modify the example node.js package to use chalk
because left-pad is deprecated
This commit is contained in:
parent
32b3b58a6b
commit
92ab9966d5
|
|
@ -45,10 +45,11 @@ cat >package.json <<'EOF'
|
|||
}
|
||||
EOF
|
||||
cat >hello-world.js <<'EOF'
|
||||
const leftPad = require('left-pad')
|
||||
console.log(leftPad('hello world', 40))
|
||||
import chalk from 'chalk';
|
||||
|
||||
console.log(chalk.green('Hello, World!'));
|
||||
EOF
|
||||
npm install --save left-pad
|
||||
npm install --save chalk
|
||||
node hello-world.js
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -70,10 +70,11 @@ Set-Content `
|
|||
-Encoding Ascii `
|
||||
hello-world-win.js `
|
||||
@'
|
||||
const leftPad = require('left-pad')
|
||||
console.log(leftPad('hello world', 40))
|
||||
import chalk from 'chalk';
|
||||
|
||||
console.log(chalk.green('Hello, World!'));
|
||||
'@
|
||||
npm install --save left-pad
|
||||
npm install --save chalk
|
||||
node hello-world-win.js
|
||||
|
||||
#
|
||||
|
|
@ -101,7 +102,7 @@ mkdir use-hello-world-win-npm | Out-Null
|
|||
Push-Location use-hello-world-win-npm
|
||||
Set-Content `
|
||||
-Encoding Ascii `
|
||||
hello-world-win.js `
|
||||
package.json `
|
||||
@'
|
||||
{
|
||||
"name": "use-hello-world-win",
|
||||
|
|
|
|||
Loading…
Reference in New Issue