Skip to content

Commit

Permalink
feat: output pnpm version with info/version command (#3906)
Browse files Browse the repository at this point in the history
* feat: output pnpm version with `info`/`version` command

* ci: setup pnpm for tests

* chore: update comment
  • Loading branch information
snitin315 authored Aug 21, 2023
1 parent d40d4a6 commit 38f3c6f
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: "yarn"

# Setup pnpm v7 for tests which is compatible with Node.js >=14
- uses: pnpm/action-setup@v2
with:
version: 7

- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines

Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"colorette": "^2.0.14",
"commander": "^10.0.1",
"cross-spawn": "^7.0.3",
"envinfo": "^7.7.3",
"envinfo": "^7.10.0",
"fastest-levenshtein": "^1.0.12",
"import-local": "^3.0.2",
"interpret": "^3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/src/webpack-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ class WebpackCLI implements IWebpackCLI {
}

const defaultInformation: Information = {
Binaries: ["Node", "Yarn", "npm"],
Binaries: ["Node", "Yarn", "npm", "pnpm"],
Browsers: [
"Brave Browser",
"Chrome",
Expand Down
4 changes: 4 additions & 0 deletions test/info/additional-package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
});

Expand All @@ -33,6 +34,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
});

Expand All @@ -51,6 +53,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
expect(stdout).toContain("eslint");
expect(stdout).toContain("eslint-config-prettier");
Expand All @@ -72,6 +75,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
expect(stdout).toContain("eslint");
expect(stdout).toContain("eslint-config-prettier");
Expand Down
2 changes: 2 additions & 0 deletions test/info/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("basic usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

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

it("shows an appropriate warning on supplying unknown args", async () => {
Expand Down
1 change: 1 addition & 0 deletions test/info/output.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("'-o, --output <value>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

it("gets info as json", async () => {
Expand Down
4 changes: 4 additions & 0 deletions test/version/additional-package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
});

Expand All @@ -33,6 +34,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
});

Expand All @@ -51,6 +53,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
expect(stdout).toContain("eslint");
expect(stdout).toContain("eslint-config-prettier");
Expand All @@ -72,6 +75,7 @@ describe("'-a, --additional-package <value...>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
expect(stdout).toContain("typescript");
expect(stdout).toContain("eslint");
expect(stdout).toContain("eslint-config-prettier");
Expand Down
5 changes: 5 additions & 0 deletions test/version/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("basic usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

it("should work with v alias", async () => {
Expand All @@ -22,6 +23,7 @@ describe("basic usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

it("should work with --version", async () => {
Expand All @@ -33,6 +35,7 @@ describe("basic usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

it("should work with -v alias", async () => {
Expand All @@ -44,6 +47,7 @@ describe("basic usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

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

it("shows an appropriate warning on supplying unknown args", async () => {
Expand Down
1 change: 1 addition & 0 deletions test/version/output.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("'-o, --output <value>' usage", () => {
expect(stdout).toContain("Node");
expect(stdout).toContain("npm");
expect(stdout).toContain("Yarn");
expect(stdout).toContain("pnpm");
});

it("gets info as json", async () => {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5134,7 +5134,7 @@ env-paths@^2.2.0:
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==

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

0 comments on commit 38f3c6f

Please sign in to comment.