From 92ab9966d52a58e98486c80b60ea3026124a37b9 Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Fri, 5 Sep 2025 07:23:12 +0000 Subject: [PATCH] modify the example node.js package to use chalk because left-pad is deprecated --- provision/use-npm-repository.sh | 7 ++++--- provision/windows/use-npm-repository.ps1 | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/provision/use-npm-repository.sh b/provision/use-npm-repository.sh index 261f5ef..b847ba5 100644 --- a/provision/use-npm-repository.sh +++ b/provision/use-npm-repository.sh @@ -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 # diff --git a/provision/windows/use-npm-repository.ps1 b/provision/windows/use-npm-repository.ps1 index 4674eb9..da93af7 100644 --- a/provision/windows/use-npm-repository.ps1 +++ b/provision/windows/use-npm-repository.ps1 @@ -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",