Skip to content

Commit 0766a3d

Browse files
committed
Merge remote-tracking branch 'origin/main' into drop-bolt
2 parents 407ff87 + 3cf8c4e commit 0766a3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+927
-11952
lines changed

.changeset/curly-mirrors-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@manypkg/cli": minor
3+
---
4+
5+
Change the default value of the `defaultBranch` config from `"master"` to `"main"`

.changeset/large-plants-sit.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@manypkg/get-packages": major
3+
"@manypkg/find-root": major
4+
"@manypkg/tools": major
5+
---
6+
7+
Fixed an issue with projects using npm workspaces being recognized as yarn projects

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ Manypkg supports a number of options. Options can be provided using the `manypkg
9494

9595
### `defaultBranch`
9696

97-
Used by the [Incorrect `repository` field](#incorrect-repository-field) rule to determine the correct name for repositories. The default value is `master`.
97+
Used by the [Incorrect `repository` field](#incorrect-repository-field) rule to determine the correct name for repositories. The default value is `main`.
9898

9999
```json
100100
{
101101
"manypkg": {
102-
"defaultBranch": "master"
102+
"defaultBranch": "main"
103103
}
104104
}
105105
```

__fixtures__/basic-npm/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@manypkg/basic-npm-fixture",
3+
"version": "1.0.0",
4+
"workspaces": [
5+
"packages/*"
6+
]
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "@manypkg/basic-fixture-pkg-one",
3+
"version": "1.0.0"
4+
}

__fixtures__/basic-npm/packages/package-one/src/index.js

Whitespace-only changes.

__fixtures__/basic-with-scripts/yarn.lock

Whitespace-only changes.

__fixtures__/basic/yarn.lock

Whitespace-only changes.

__fixtures__/local-deps-cycle/yarn.lock

Whitespace-only changes.

__fixtures__/no-name-field/yarn.lock

Whitespace-only changes.

__fixtures__/npm-workspace-base/package-lock.json

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"private": true,
3+
"name": "npm-workspace-base",
4+
"description": "Base npm workspace work",
5+
"version": "1.0.0",
6+
"workspaces": [
7+
"packages/*"
8+
]
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "npm-workspace-base-pkg-a",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"npm-workspace-base-pkg-b": "1.0.0"
6+
}
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "npm-workspace-base-pkg-b",
3+
"version": "1.0.0"
4+
}

__fixtures__/yarn-workspace-base/yarn.lock

Whitespace-only changes.

knip.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
22
"$schema": "https://unpkg.com/knip@5/schema.json",
3-
"ignoreWorkspaces": ["test-gatsby", "packages/gatsby-source-workspace"],
43
"workspaces": {
54
".": {
6-
"ignoreBinaries": ["gatsby", "packages/cli/bin.js"]
5+
"ignoreBinaries": ["packages/cli/bin.js"]
76
}
87
},
98
"ignore": ["__fixtures__/**"]

package.json

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,15 @@
44
"private": true,
55
"license": "MIT",
66
"workspaces": [
7-
"packages/*",
8-
"test-gatsby"
7+
"packages/*"
98
],
109
"scripts": {
1110
"format": "prettier --write .",
1211
"format:check": "prettier --check .",
1312
"postinstall": "preconstruct dev && NODE_OPTIONS=--experimental-strip-types packages/cli/bin.js check",
1413
"knip": "knip",
1514
"release": "preconstruct build && changeset publish",
16-
"test": "jest",
17-
"test-gatsby": "cd test-gatsby && gatsby develop"
18-
},
19-
"jest": {
20-
"watchPlugins": [
21-
"jest-watch-typeahead/filename",
22-
"jest-watch-typeahead/testname"
23-
]
15+
"test": "vitest"
2416
},
2517
"devDependencies": {
2618
"@babel/core": "^7.20.5",
@@ -30,21 +22,19 @@
3022
"@changesets/changelog-github": "^0.4.8",
3123
"@changesets/cli": "^2.26.0",
3224
"@preconstruct/cli": "^2.8.12",
33-
"@types/jest": "^29.2.4",
3425
"@types/normalize-path": "^3.0.0",
3526
"@types/parse-github-url": "^1.0.0",
3627
"@types/semver": "^6.0.1",
37-
"jest": "^29.3.1",
38-
"jest-watch-typeahead": "^2.2.1",
3928
"knip": "^5.33.3",
4029
"prettier": "^3.5.3",
4130
"prettier-plugin-packagejson": "^2.5.10",
42-
"typescript": "^5.3.2"
31+
"typescript": "^5.3.2",
32+
"vitest": "^3.1.2"
4333
},
4434
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
4535
"preconstruct": {
4636
"packages": [
47-
"packages/!(gatsby)*"
37+
"packages/*"
4838
],
4939
"exports": {
5040
"importConditionDefaultExport": "default"

packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"@changesets/types": "^5.2.1",
3333
"@types/validate-npm-package-name": "^4.0.2",
3434
"fixturez": "^1.1.0",
35-
"strip-ansi": "^6.0.0"
35+
"strip-ansi": "^6.0.0",
36+
"vitest": "^3.1.2"
3637
},
3738
"engines": {
3839
"node": ">=18.0.0"

packages/cli/src/__snapshots__/run.test.ts.snap

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`Run command should execute "@manypkg/basic-fixture-pkg-two start" and exit with 0: stderr 1`] = `
3+
exports[`Run command > should execute "@manypkg/basic-fixture-pkg-two start" and exit with 0 > stderr 1`] = `
44
"warning package.json: No license field
55
warning ../../package.json: No license field
66
"
77
`;
88

9-
exports[`Run command should execute "@manypkg/basic-fixture-pkg-two start" and exit with 0: stdout 1`] = `
9+
exports[`Run command > should execute "@manypkg/basic-fixture-pkg-two start" and exit with 0 > stdout 1`] = `
1010
"$ echo hello start
1111
hello start
1212
"
1313
`;
1414

15-
exports[`Run command should execute "package start" and exit with 1: stderr 1`] = `
15+
exports[`Run command > should execute "package start" and exit with 1 > stderr 1`] = `
1616
"☔️ error an identifier must only match a single package but "package" matches the following packages:
1717
☔️ error @manypkg/basic-fixture-pkg-one
1818
☔️ error @manypkg/basic-fixture-pkg-two
1919
☔️ error @manypkg/basic-fixture-pkg-two-one
2020
"
2121
`;
2222

23-
exports[`Run command should execute "package start" and exit with 1: stdout 1`] = `""`;
23+
exports[`Run command > should execute "package start" and exit with 1 > stdout 1`] = `""`;
2424

25-
exports[`Run command should execute "package-one start" and exit with 0: stderr 1`] = `
25+
exports[`Run command > should execute "package-one start" and exit with 0 > stderr 1`] = `
2626
"warning package.json: No license field
2727
warning ../../package.json: No license field
2828
"
2929
`;
3030

31-
exports[`Run command should execute "package-one start" and exit with 0: stdout 1`] = `
31+
exports[`Run command > should execute "package-one start" and exit with 0 > stdout 1`] = `
3232
"$ echo hello start
3333
hello start
3434
"
3535
`;
3636

37-
exports[`Run command should execute "package-one test" and exit with 0: stderr 1`] = `
37+
exports[`Run command > should execute "package-one test" and exit with 0 > stderr 1`] = `
3838
"warning package.json: No license field
3939
warning ../../package.json: No license field
4040
"
4141
`;
4242

43-
exports[`Run command should execute "package-one test" and exit with 0: stdout 1`] = `
43+
exports[`Run command > should execute "package-one test" and exit with 0 > stdout 1`] = `
4444
"$ echo testing
4545
testing
4646
"
4747
`;
4848

49-
exports[`Run command should execute "package-three start" and exit with 1: stderr 1`] = `
49+
exports[`Run command > should execute "package-three start" and exit with 1 > stderr 1`] = `
5050
"☔️ error No matching packages found
5151
"
5252
`;
5353

54-
exports[`Run command should execute "package-three start" and exit with 1: stdout 1`] = `""`;
54+
exports[`Run command > should execute "package-three start" and exit with 1 > stdout 1`] = `""`;
5555

56-
exports[`Run command should execute "package-two start" and exit with 1: stderr 1`] = `
56+
exports[`Run command > should execute "package-two start" and exit with 1 > stderr 1`] = `
5757
"☔️ error an identifier must only match a single package but "package-two" matches the following packages:
5858
☔️ error @manypkg/basic-fixture-pkg-two
5959
☔️ error @manypkg/basic-fixture-pkg-two-one
6060
"
6161
`;
6262

63-
exports[`Run command should execute "package-two start" and exit with 1: stdout 1`] = `""`;
63+
exports[`Run command > should execute "package-two start" and exit with 1 > stdout 1`] = `""`;
6464

65-
exports[`Run command should execute "package-two-one something" and exit with 1: stderr 1`] = `
65+
exports[`Run command > should execute "package-two-one something" and exit with 1 > stderr 1`] = `
6666
"warning package.json: No license field
6767
warning ../../package.json: No license field
6868
error Command "something" not found.
6969
"
7070
`;
7171

72-
exports[`Run command should execute "package-two-one something" and exit with 1: stdout 1`] = `
72+
exports[`Run command > should execute "package-two-one something" and exit with 1 > stdout 1`] = `
7373
"info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
7474
"
7575
`;
7676

77-
exports[`Run command should execute "package-two-one start" and exit with 0: stderr 1`] = `
77+
exports[`Run command > should execute "package-two-one start" and exit with 0 > stderr 1`] = `
7878
"warning package.json: No license field
7979
warning ../../package.json: No license field
8080
"
8181
`;
8282

83-
exports[`Run command should execute "package-two-one start" and exit with 0: stdout 1`] = `
83+
exports[`Run command > should execute "package-two-one start" and exit with 0 > stdout 1`] = `
8484
"$ echo hello start
8585
hello start
8686
"
8787
`;
8888

89-
exports[`Run command should execute "packages/package-two start" and exit with 0: stderr 1`] = `
89+
exports[`Run command > should execute "packages/package-two start" and exit with 0 > stderr 1`] = `
9090
"warning package.json: No license field
9191
warning ../../package.json: No license field
9292
"
9393
`;
9494

95-
exports[`Run command should execute "packages/package-two start" and exit with 0: stdout 1`] = `
95+
exports[`Run command > should execute "packages/package-two start" and exit with 0 > stdout 1`] = `
9696
"$ echo hello start
9797
hello start
9898
"
9999
`;
100100

101-
exports[`Run command should execute "pkg-one start" and exit with 0: stderr 1`] = `
101+
exports[`Run command > should execute "pkg-one start" and exit with 0 > stderr 1`] = `
102102
"warning package.json: No license field
103103
warning ../../package.json: No license field
104104
"
105105
`;
106106

107-
exports[`Run command should execute "pkg-one start" and exit with 0: stdout 1`] = `
107+
exports[`Run command > should execute "pkg-one start" and exit with 0 > stdout 1`] = `
108108
"$ echo hello start
109109
hello start
110110
"
111111
`;
112112

113-
exports[`Run command should execute "pkg-two start" and exit with 1: stderr 1`] = `
113+
exports[`Run command > should execute "pkg-two start" and exit with 1 > stderr 1`] = `
114114
"☔️ error an identifier must only match a single package but "pkg-two" matches the following packages:
115115
☔️ error @manypkg/basic-fixture-pkg-two
116116
☔️ error @manypkg/basic-fixture-pkg-two-one
117117
"
118118
`;
119119

120-
exports[`Run command should execute "pkg-two start" and exit with 1: stdout 1`] = `""`;
120+
exports[`Run command > should execute "pkg-two start" and exit with 1 > stdout 1`] = `""`;
121121

122-
exports[`Run command should execute "pkg-two-one start" and exit with 0: stderr 1`] = `
122+
exports[`Run command > should execute "pkg-two-one start" and exit with 0 > stderr 1`] = `
123123
"warning package.json: No license field
124124
warning ../../package.json: No license field
125125
"
126126
`;
127127

128-
exports[`Run command should execute "pkg-two-one start" and exit with 0: stdout 1`] = `
128+
exports[`Run command > should execute "pkg-two-one start" and exit with 0 > stdout 1`] = `
129129
"$ echo hello start
130130
hello start
131131
"

packages/cli/src/checks/__tests__/EXTERNAL_MISMATCH.ts renamed to packages/cli/src/checks/__tests__/EXTERNAL_MISMATCH.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { expect, it } from "vitest";
12
import internalMismatch from "../EXTERNAL_MISMATCH.ts";
2-
import { getWS, getFakeWS, getRootWS } from "../../test-helpers.ts";
3+
import { getWS, getFakeWS, getRootWS } from "./test-helpers.ts";
34

45
let rootWorkspace = getRootWS();
56

packages/cli/src/checks/__tests__/INCORRECT_REPOSITORY_FIELD.ts renamed to packages/cli/src/checks/__tests__/INCORRECT_REPOSITORY_FIELD.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import {
2-
getFakeString,
3-
getFakeWS,
4-
getRootWS,
5-
getWS,
6-
} from "../../test-helpers.ts";
1+
import { describe, expect, it } from "vitest";
2+
import { getFakeString, getFakeWS, getRootWS, getWS } from "./test-helpers.ts";
73
import check from "../INCORRECT_REPOSITORY_FIELD.ts";
84

95
describe("incorrect repository field", () => {

packages/cli/src/checks/__tests__/INTERNAL_MISMATCH.ts renamed to packages/cli/src/checks/__tests__/INTERNAL_MISMATCH.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getFakeWS, getRootWS, getWS } from "../../test-helpers.ts";
1+
import { describe, expect, it } from "vitest";
2+
import { getFakeWS, getRootWS, getWS } from "./test-helpers.ts";
23
import makeCheck, { ErrorType } from "../INTERNAL_MISMATCH.ts";
34

45
let rootWorkspace = getRootWS();

packages/cli/src/checks/__tests__/INVALID_DEV_AND_PEER_DEPENDENCY.ts renamed to packages/cli/src/checks/__tests__/INVALID_DEV_AND_PEER_DEPENDENCY.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getFakeWS, getRootWS, getWS } from "../../test-helpers.ts";
1+
import { describe, expect, it } from "vitest";
2+
import { getFakeWS, getRootWS, getWS } from "./test-helpers.ts";
23
import makeCheck from "../INVALID_DEV_AND_PEER_DEPENDENCY_RELATIONSHIP.ts";
34

45
let rootWorkspace = getRootWS();

packages/cli/src/checks/__tests__/WORKSPACE_REQUIRED.ts renamed to packages/cli/src/checks/__tests__/WORKSPACE_REQUIRED.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getFakeWS, getRootWS, getWS } from "../../test-helpers.ts";
1+
import { expect, test } from "vitest";
2+
import { getFakeWS, getRootWS, getWS } from "./test-helpers.ts";
23
import makeCheck from "../WORKSPACE_REQUIRED.ts";
34
let rootWorkspace = getRootWS();
45

packages/cli/src/test-helpers.ts renamed to packages/cli/src/checks/__tests__/test-helpers.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// These are utils for testing.
2-
// I wanted to put this in the test folder but then jest tested it
3-
// Easier to put it here than add to jest ignore but maybe wrong.
4-
//
5-
// Who can say? ¯\_(ツ)_/¯
6-
71
import { Package } from "@manypkg/get-packages";
82
import crypto from "node:crypto";
93

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type PackagesWithConfig = Packages & {
2525
};
2626

2727
let defaultOptions = {
28-
defaultBranch: "master",
28+
defaultBranch: "main",
2929
};
3030

3131
let runChecks = (

packages/cli/src/run.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, it } from "vitest";
12
import fixturez from "fixturez";
23
import stripAnsi from "strip-ansi";
34
import { exec } from "tinyexec";

packages/cli/src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export async function writePackage(pkg: Package) {
1717
export async function install(toolType: string, cwd: string) {
1818
const cliRunners: Record<string, string> = {
1919
lerna: "lerna",
20+
npm: "npm",
2021
pnpm: "pnpm",
2122
root: "yarn",
2223
rush: "rushx",
@@ -25,7 +26,7 @@ export async function install(toolType: string, cwd: string) {
2526

2627
await exec(
2728
cliRunners[toolType],
28-
toolType === "pnpm"
29+
toolType === "npm" || toolType === "pnpm"
2930
? ["install"]
3031
: toolType === "lerna"
3132
? ["bootstrap", "--since", "HEAD"]

packages/find-root/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
},
1818
"devDependencies": {
1919
"@types/node": "^16.11.7",
20-
"fixturez": "^1.1.0"
20+
"fixturez": "^1.1.0",
21+
"vitest": "^3.1.2"
2122
},
2223
"engines": {
2324
"node": ">=14.18.0"

0 commit comments

Comments
 (0)