From 1fc1e227b8e45fb6f2793e3358f8d05b98043798 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 21:54:21 -0500 Subject: [PATCH 1/9] Removed build step which no longer exists. --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1c098a9..2dd97c43 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,9 @@ The `au new` command now simplify wraps `npx makes aurelia/v1`. Users can direct 1. Clone the aurelia-cli: `git clone https://github.com/aurelia/cli.git` 2. Go into the cli directory: `cd cli` 3. Run `npm install` -4. Run build `npm run build` -5. Link the cli with: `npm link` -6. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project. -7. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run` +6. Link the cli with: `npm link` +7. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project. +8. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run` ## Running the Tests From 70d9011680c3f3469762be6c0b24c5964798fb65 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 21:54:50 -0500 Subject: [PATCH 2/9] Add shell flag to spawn constructor call. --- lib/package-managers/base-package-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index fc66ab19..1039ce28 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -15,7 +15,7 @@ exports.BasePackageManager = class { this.proc = spawn( this.getExecutablePath(workingDirectory), [command, ...args], - { stdio: 'inherit', cwd: workingDirectory } + { stdio: 'inherit', cwd: workingDirectory, shell: true } ) .on('close', resolve) .on('error', reject); From 3a975d75e344647e99bc69c3d2b2ee746bc52066 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 21:55:22 -0500 Subject: [PATCH 3/9] Ignore my-app project used for testing changes locally. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5d9c4dfe..c54fda6e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ dist /package-lock.json /yarn.lock .npmrc +/my-app \ No newline at end of file From 90bcbdbc9f8f15b706c261ebfaef7e173940a2c5 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 21:56:26 -0500 Subject: [PATCH 4/9] Bump up package version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fce0b14f..860bcde6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-cli", - "version": "3.0.2", + "version": "3.0.3", "description": "The command line tooling for Aurelia.", "keywords": [ "aurelia", From 567f5076b286da87aafa188171f33915a449e734 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 21:56:34 -0500 Subject: [PATCH 5/9] Update changelog document. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69280e9b..afc92759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [3.0.3](https://github.com/aurelia/cli/compare/v3.0.2...v3.0.3) (2024-04-17) + + + ## [3.0.2](https://github.com/aurelia/cli/compare/v3.0.1...v3.0.2) (2023-10-07) From 9de880b222a1befe9698f28d7cba192c7e9e65bb Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 22:03:06 -0500 Subject: [PATCH 6/9] Only apply shell property to windows users. --- lib/package-managers/base-package-manager.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index 1039ce28..379ce304 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -11,11 +11,21 @@ exports.BasePackageManager = class { } run(command, args = [], workingDirectory = process.cwd()) { + let options = { stdio: "inherit", cwd: workingDirectory }; + + const isWindows = process.platform === "win32"; + if (isWindows) { + options = { + ...options, + shell: true + } + } + return new Promise((resolve, reject) => { this.proc = spawn( this.getExecutablePath(workingDirectory), [command, ...args], - { stdio: 'inherit', cwd: workingDirectory, shell: true } + options ) .on('close', resolve) .on('error', reject); From cd0773d33b47ede28375bf81eed2edb8e04eac2a Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Wed, 17 Apr 2024 22:05:31 -0500 Subject: [PATCH 7/9] Code clean up --- lib/package-managers/base-package-manager.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index 379ce304..f7a938f0 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -12,13 +12,8 @@ exports.BasePackageManager = class { run(command, args = [], workingDirectory = process.cwd()) { let options = { stdio: "inherit", cwd: workingDirectory }; - - const isWindows = process.platform === "win32"; - if (isWindows) { - options = { - ...options, - shell: true - } + if (process.platform === "win32") { + options = { ...options, shell: true } } return new Promise((resolve, reject) => { From 4f37086e3fcd7f1343eb01934c5d30246b28db24 Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Mon, 22 Apr 2024 08:40:04 -0500 Subject: [PATCH 8/9] Add quotation around executable path. --- lib/package-managers/base-package-manager.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index f7a938f0..48b749b1 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -11,14 +11,17 @@ exports.BasePackageManager = class { } run(command, args = [], workingDirectory = process.cwd()) { + const isWindows = process.platform === "win32"; + let executable = this.getExecutablePath(workingDirectory); let options = { stdio: "inherit", cwd: workingDirectory }; - if (process.platform === "win32") { + if (isWindows) { + executable = `"${executable}"` options = { ...options, shell: true } } return new Promise((resolve, reject) => { this.proc = spawn( - this.getExecutablePath(workingDirectory), + executable, [command, ...args], options ) From baa5f10fe8680ce589008e432043c23fd9f9368f Mon Sep 17 00:00:00 2001 From: Namito Yokota Date: Tue, 23 Apr 2024 07:18:46 -0500 Subject: [PATCH 9/9] Suggested code changes. --- .gitignore | 3 +-- CHANGELOG.md | 4 ---- README.md | 6 +++--- lib/package-managers/base-package-manager.js | 8 +++----- package.json | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index c54fda6e..b0d04eb9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,4 @@ dist /coverage /package-lock.json /yarn.lock -.npmrc -/my-app \ No newline at end of file +.npmrc \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index afc92759..69280e9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ -## [3.0.3](https://github.com/aurelia/cli/compare/v3.0.2...v3.0.3) (2024-04-17) - - - ## [3.0.2](https://github.com/aurelia/cli/compare/v3.0.1...v3.0.2) (2023-10-07) diff --git a/README.md b/README.md index 2dd97c43..4597d461 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ The `au new` command now simplify wraps `npx makes aurelia/v1`. Users can direct 1. Clone the aurelia-cli: `git clone https://github.com/aurelia/cli.git` 2. Go into the cli directory: `cd cli` 3. Run `npm install` -6. Link the cli with: `npm link` -7. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project. -8. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run` +4. Link the cli with: `npm link` +5. Create a new project with `au new` or use an existing project. The linked CLI will be used to create the project. +6. In the project directory, run `npm link aurelia-cli`. The linked CLI will then be used for `au` commands such as `au run` ## Running the Tests diff --git a/lib/package-managers/base-package-manager.js b/lib/package-managers/base-package-manager.js index 48b749b1..673a9453 100644 --- a/lib/package-managers/base-package-manager.js +++ b/lib/package-managers/base-package-manager.js @@ -1,5 +1,6 @@ const {spawn} = require('child_process'); const npmWhich = require('npm-which'); +const isWindows = process.platform === "win32"; exports.BasePackageManager = class { constructor(executableName) { @@ -11,19 +12,16 @@ exports.BasePackageManager = class { } run(command, args = [], workingDirectory = process.cwd()) { - const isWindows = process.platform === "win32"; let executable = this.getExecutablePath(workingDirectory); - let options = { stdio: "inherit", cwd: workingDirectory }; if (isWindows) { - executable = `"${executable}"` - options = { ...options, shell: true } + executable = JSON.stringify(executable); // Add quotes around path } return new Promise((resolve, reject) => { this.proc = spawn( executable, [command, ...args], - options + { stdio: "inherit", cwd: workingDirectory, shell: isWindows } ) .on('close', resolve) .on('error', reject); diff --git a/package.json b/package.json index 860bcde6..fce0b14f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-cli", - "version": "3.0.3", + "version": "3.0.2", "description": "The command line tooling for Aurelia.", "keywords": [ "aurelia",