-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back format-js with a deprecation note
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const chalk = require( 'chalk' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
const { getNodeArgsFromCLI, spawnScript } = require( '../utils' ); | ||
|
||
const { scriptArgs, nodeArgs } = getNodeArgsFromCLI(); | ||
|
||
const keypress = async () => { | ||
process.stdin.setRawMode( true ); | ||
return new Promise( ( resolve ) => | ||
process.stdin.once( 'data', () => { | ||
process.stdin.setRawMode( false ); | ||
resolve(); | ||
} ) | ||
); | ||
}; | ||
|
||
( async () => { | ||
const message = | ||
`Please note that the ${ chalk.red( | ||
'format-js' | ||
) } script has been renamed to ${ chalk.green( 'format' ) }.\n` + | ||
"If you're calling it from any of your own scripts, please update them accordingly.\n" + | ||
'Press any key to continiue.'; | ||
|
||
// eslint-disable-next-line no-console | ||
console.log( message ); | ||
|
||
await keypress(); | ||
spawnScript( 'format', scriptArgs, nodeArgs ); | ||
} )(); |