@vltpkg/workspaces 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/index.d.ts +15 -1
- package/dist/index.js +22 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -81,9 +81,8 @@ type VltProject = {
|
|
|
81
81
|
|
|
82
82
|
If `vlt.json` has no `workspaces` field, the npm/yarn-style
|
|
83
83
|
`workspaces` field of the project root's `package.json` is used
|
|
84
|
-
instead
|
|
85
|
-
|
|
86
|
-
-- a glob string, an array of them, or `{packages: [...]}` (plus
|
|
84
|
+
instead. Only the shapes npm and yarn understand are accepted there --
|
|
85
|
+
a glob string, an array of them, or `{packages: [...]}` (plus
|
|
87
86
|
yarn-classic's `nohoist`, which is parsed and ignored). Named groups
|
|
88
87
|
are rejected in `package.json`, because a `package.json` using them
|
|
89
88
|
would be meaningless to every other package manager.
|
|
@@ -96,6 +95,10 @@ If neither declares workspaces, the `packages` list of a root
|
|
|
96
95
|
`pnpm-workspace.yaml` is used (plain string lists only; other keys and
|
|
97
96
|
unsupported YAML are ignored).
|
|
98
97
|
|
|
98
|
+
`vlt install` copies these globs to `vlt.json` (see
|
|
99
|
+
`migratableWSConfig`; opt out with `--no-migrate-workspaces`), and
|
|
100
|
+
`vlt ci` reads `vlt.json` only (`setVltJsonOnly`).
|
|
101
|
+
|
|
99
102
|
In any of these files, a pattern beginning with `!` excludes the paths
|
|
100
103
|
it matches, following npm's semantics: `!a/b` excludes only that
|
|
101
104
|
directory, `!a/b/**` excludes the subtree, and a later positive
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ export type ResolvedWorkspaceConfig = {
|
|
|
65
65
|
*/
|
|
66
66
|
source?: WorkspaceConfigSource;
|
|
67
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Process-wide: when true, {@link resolveWSConfig} reads `vlt.json`
|
|
70
|
+
* only, ignoring `package.json` and `pnpm-workspace.yaml`. Set by
|
|
71
|
+
* `vlt ci`.
|
|
72
|
+
*/
|
|
73
|
+
export declare const setVltJsonOnly: (value: boolean) => void;
|
|
68
74
|
/**
|
|
69
75
|
* Resolve the effective workspace definitions for a project.
|
|
70
76
|
*
|
|
@@ -74,8 +80,16 @@ export type ResolvedWorkspaceConfig = {
|
|
|
74
80
|
* `pnpm-workspace.yaml`. Note the precedence is keyed on the *field*,
|
|
75
81
|
* not the file: a `vlt.json` that exists but says nothing about
|
|
76
82
|
* workspaces still falls through to `package.json`.
|
|
83
|
+
*
|
|
84
|
+
* `vltJsonOnlyArg` skips both fallbacks (default: {@link setVltJsonOnly}).
|
|
85
|
+
*/
|
|
86
|
+
export declare const resolveWSConfig: (projectRoot: string, packageJson?: PackageJson, vltJsonOnlyArg?: boolean) => ResolvedWorkspaceConfig;
|
|
87
|
+
/**
|
|
88
|
+
* Globs to save to `vlt.json` for workspaces declared in `package.json`
|
|
89
|
+
* or `pnpm-workspace.yaml`: plain array, in order, `!` kept (yarn
|
|
90
|
+
* `nohoist` already dropped). `undefined` if from `vlt.json` or none.
|
|
77
91
|
*/
|
|
78
|
-
export declare const
|
|
92
|
+
export declare const migratableWSConfig: ({ config, source, }: ResolvedWorkspaceConfig) => string[] | undefined;
|
|
79
93
|
/**
|
|
80
94
|
* Split a list of glob patterns into the positive patterns and the
|
|
81
95
|
* npm-compatible `!`-negated ones, which become ignore patterns.
|
package/dist/index.js
CHANGED
|
@@ -125,6 +125,15 @@ export const asManifestWSConfig = (conf, path) => {
|
|
|
125
125
|
}
|
|
126
126
|
return asWSConfig(conf, path);
|
|
127
127
|
};
|
|
128
|
+
let vltJsonOnly = false;
|
|
129
|
+
/**
|
|
130
|
+
* Process-wide: when true, {@link resolveWSConfig} reads `vlt.json`
|
|
131
|
+
* only, ignoring `package.json` and `pnpm-workspace.yaml`. Set by
|
|
132
|
+
* `vlt ci`.
|
|
133
|
+
*/
|
|
134
|
+
export const setVltJsonOnly = (value) => {
|
|
135
|
+
vltJsonOnly = value;
|
|
136
|
+
};
|
|
128
137
|
/**
|
|
129
138
|
* Resolve the effective workspace definitions for a project.
|
|
130
139
|
*
|
|
@@ -134,12 +143,16 @@ export const asManifestWSConfig = (conf, path) => {
|
|
|
134
143
|
* `pnpm-workspace.yaml`. Note the precedence is keyed on the *field*,
|
|
135
144
|
* not the file: a `vlt.json` that exists but says nothing about
|
|
136
145
|
* workspaces still falls through to `package.json`.
|
|
146
|
+
*
|
|
147
|
+
* `vltJsonOnlyArg` skips both fallbacks (default: {@link setVltJsonOnly}).
|
|
137
148
|
*/
|
|
138
|
-
export const resolveWSConfig = (projectRoot, packageJson = new PackageJson()) => {
|
|
149
|
+
export const resolveWSConfig = (projectRoot, packageJson = new PackageJson(), vltJsonOnlyArg = vltJsonOnly) => {
|
|
139
150
|
const fromVltJson = load('workspaces', assertWSConfig);
|
|
140
151
|
if (fromVltJson !== undefined) {
|
|
141
152
|
return { config: asWSConfig(fromVltJson), source: 'vlt.json' };
|
|
142
153
|
}
|
|
154
|
+
if (vltJsonOnlyArg)
|
|
155
|
+
return { config: {} };
|
|
143
156
|
// maybeRead, because a project root need not have a package.json at
|
|
144
157
|
// all, and an unreadable one is not this module's error to report.
|
|
145
158
|
const workspaces = packageJson.maybeRead(projectRoot)?.workspaces;
|
|
@@ -154,6 +167,14 @@ export const resolveWSConfig = (projectRoot, packageJson = new PackageJson()) =>
|
|
|
154
167
|
source: 'package.json',
|
|
155
168
|
};
|
|
156
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* Globs to save to `vlt.json` for workspaces declared in `package.json`
|
|
172
|
+
* or `pnpm-workspace.yaml`: plain array, in order, `!` kept (yarn
|
|
173
|
+
* `nohoist` already dropped). `undefined` if from `vlt.json` or none.
|
|
174
|
+
*/
|
|
175
|
+
export const migratableWSConfig = ({ config, source, }) => source && source !== 'vlt.json' ?
|
|
176
|
+
Object.values(config).flat()
|
|
177
|
+
: undefined;
|
|
157
178
|
/**
|
|
158
179
|
* Split a list of glob patterns into the positive patterns and the
|
|
159
180
|
* npm-compatible `!`-negated ones, which become ignore patterns.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/workspaces",
|
|
3
3
|
"description": "Utility for working with vlt workspaces",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"url": "http://vlt.sh"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@vltpkg/dep-id": "1.
|
|
17
|
-
"@vltpkg/error-cause": "1.
|
|
18
|
-
"@vltpkg/graph-run": "1.
|
|
19
|
-
"@vltpkg/package-json": "1.
|
|
20
|
-
"@vltpkg/semver": "1.
|
|
21
|
-
"@vltpkg/types": "1.
|
|
22
|
-
"@vltpkg/vlt-json": "1.
|
|
16
|
+
"@vltpkg/dep-id": "1.5.0",
|
|
17
|
+
"@vltpkg/error-cause": "1.5.0",
|
|
18
|
+
"@vltpkg/graph-run": "1.5.0",
|
|
19
|
+
"@vltpkg/package-json": "1.5.0",
|
|
20
|
+
"@vltpkg/semver": "1.5.0",
|
|
21
|
+
"@vltpkg/types": "1.5.0",
|
|
22
|
+
"@vltpkg/vlt-json": "1.5.0",
|
|
23
23
|
"glob": "^13.0.0",
|
|
24
24
|
"minimatch": "^10.1.1",
|
|
25
25
|
"path-scurry": "^2.0.1"
|