Skip to content

Commit 38f3c6f

Browse files
authored
feat: output pnpm version with info/version command (#3906)
* feat: output pnpm version with `info`/`version` command * ci: setup pnpm for tests * chore: update comment
1 parent d40d4a6 commit 38f3c6f

File tree

10 files changed

+25
-3
lines changed

10 files changed

+25
-3
lines changed

.github/workflows/nodejs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ jobs:
8282
node-version: ${{ matrix.node-version }}
8383
cache: "yarn"
8484

85+
# Setup pnpm v7 for tests which is compatible with Node.js >=14
86+
- uses: pnpm/action-setup@v2
87+
with:
88+
version: 7
89+
8590
- name: Install dependencies
8691
run: yarn --frozen-lockfile --ignore-engines
8792

packages/webpack-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"colorette": "^2.0.14",
4242
"commander": "^10.0.1",
4343
"cross-spawn": "^7.0.3",
44-
"envinfo": "^7.7.3",
44+
"envinfo": "^7.10.0",
4545
"fastest-levenshtein": "^1.0.12",
4646
"import-local": "^3.0.2",
4747
"interpret": "^3.1.1",

packages/webpack-cli/src/webpack-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ class WebpackCLI implements IWebpackCLI {
475475
}
476476

477477
const defaultInformation: Information = {
478-
Binaries: ["Node", "Yarn", "npm"],
478+
Binaries: ["Node", "Yarn", "npm", "pnpm"],
479479
Browsers: [
480480
"Brave Browser",
481481
"Chrome",

test/info/additional-package.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
1717
expect(stdout).toContain("Node");
1818
expect(stdout).toContain("npm");
1919
expect(stdout).toContain("Yarn");
20+
expect(stdout).toContain("pnpm");
2021
expect(stdout).toContain("typescript");
2122
});
2223

@@ -33,6 +34,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
3334
expect(stdout).toContain("Node");
3435
expect(stdout).toContain("npm");
3536
expect(stdout).toContain("Yarn");
37+
expect(stdout).toContain("pnpm");
3638
expect(stdout).toContain("typescript");
3739
});
3840

@@ -51,6 +53,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
5153
expect(stdout).toContain("Node");
5254
expect(stdout).toContain("npm");
5355
expect(stdout).toContain("Yarn");
56+
expect(stdout).toContain("pnpm");
5457
expect(stdout).toContain("typescript");
5558
expect(stdout).toContain("eslint");
5659
expect(stdout).toContain("eslint-config-prettier");
@@ -72,6 +75,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
7275
expect(stdout).toContain("Node");
7376
expect(stdout).toContain("npm");
7477
expect(stdout).toContain("Yarn");
78+
expect(stdout).toContain("pnpm");
7579
expect(stdout).toContain("typescript");
7680
expect(stdout).toContain("eslint");
7781
expect(stdout).toContain("eslint-config-prettier");

test/info/basic.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("basic usage", () => {
1111
expect(stdout).toContain("Node");
1212
expect(stdout).toContain("npm");
1313
expect(stdout).toContain("Yarn");
14+
expect(stdout).toContain("pnpm");
1415
});
1516

1617
it("should work and gets more info in project root", async () => {
@@ -24,6 +25,7 @@ describe("basic usage", () => {
2425
expect(stdout).toContain("Node");
2526
expect(stdout).toContain("npm");
2627
expect(stdout).toContain("Yarn");
28+
expect(stdout).toContain("pnpm");
2729
});
2830

2931
it("shows an appropriate warning on supplying unknown args", async () => {

test/info/output.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("'-o, --output <value>' usage", () => {
1212
expect(stdout).toContain("Node");
1313
expect(stdout).toContain("npm");
1414
expect(stdout).toContain("Yarn");
15+
expect(stdout).toContain("pnpm");
1516
});
1617

1718
it("gets info as json", async () => {

test/version/additional-package.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
1717
expect(stdout).toContain("Node");
1818
expect(stdout).toContain("npm");
1919
expect(stdout).toContain("Yarn");
20+
expect(stdout).toContain("pnpm");
2021
expect(stdout).toContain("typescript");
2122
});
2223

@@ -33,6 +34,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
3334
expect(stdout).toContain("Node");
3435
expect(stdout).toContain("npm");
3536
expect(stdout).toContain("Yarn");
37+
expect(stdout).toContain("pnpm");
3638
expect(stdout).toContain("typescript");
3739
});
3840

@@ -51,6 +53,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
5153
expect(stdout).toContain("Node");
5254
expect(stdout).toContain("npm");
5355
expect(stdout).toContain("Yarn");
56+
expect(stdout).toContain("pnpm");
5457
expect(stdout).toContain("typescript");
5558
expect(stdout).toContain("eslint");
5659
expect(stdout).toContain("eslint-config-prettier");
@@ -72,6 +75,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
7275
expect(stdout).toContain("Node");
7376
expect(stdout).toContain("npm");
7477
expect(stdout).toContain("Yarn");
78+
expect(stdout).toContain("pnpm");
7579
expect(stdout).toContain("typescript");
7680
expect(stdout).toContain("eslint");
7781
expect(stdout).toContain("eslint-config-prettier");

test/version/basic.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("basic usage", () => {
1111
expect(stdout).toContain("Node");
1212
expect(stdout).toContain("npm");
1313
expect(stdout).toContain("Yarn");
14+
expect(stdout).toContain("pnpm");
1415
});
1516

1617
it("should work with v alias", async () => {
@@ -22,6 +23,7 @@ describe("basic usage", () => {
2223
expect(stdout).toContain("Node");
2324
expect(stdout).toContain("npm");
2425
expect(stdout).toContain("Yarn");
26+
expect(stdout).toContain("pnpm");
2527
});
2628

2729
it("should work with --version", async () => {
@@ -33,6 +35,7 @@ describe("basic usage", () => {
3335
expect(stdout).toContain("Node");
3436
expect(stdout).toContain("npm");
3537
expect(stdout).toContain("Yarn");
38+
expect(stdout).toContain("pnpm");
3639
});
3740

3841
it("should work with -v alias", async () => {
@@ -44,6 +47,7 @@ describe("basic usage", () => {
4447
expect(stdout).toContain("Node");
4548
expect(stdout).toContain("npm");
4649
expect(stdout).toContain("Yarn");
50+
expect(stdout).toContain("pnpm");
4751
});
4852

4953
it("should work and gets more info in project root", async () => {
@@ -57,6 +61,7 @@ describe("basic usage", () => {
5761
expect(stdout).toContain("Node");
5862
expect(stdout).toContain("npm");
5963
expect(stdout).toContain("Yarn");
64+
expect(stdout).toContain("pnpm");
6065
});
6166

6267
it("shows an appropriate warning on supplying unknown args", async () => {

test/version/output.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("'-o, --output <value>' usage", () => {
1212
expect(stdout).toContain("Node");
1313
expect(stdout).toContain("npm");
1414
expect(stdout).toContain("Yarn");
15+
expect(stdout).toContain("pnpm");
1516
});
1617

1718
it("gets info as json", async () => {

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5134,7 +5134,7 @@ env-paths@^2.2.0:
51345134
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
51355135
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
51365136

5137-
envinfo@^7.7.3, envinfo@^7.7.4:
5137+
envinfo@^7.10.0, envinfo@^7.7.4:
51385138
version "7.10.0"
51395139
resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.10.0.tgz#55146e3909cc5fe63c22da63fb15b05aeac35b13"
51405140
integrity sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==

0 commit comments

Comments
 (0)