@wtf/release-npm 1.2.0 → 2.0.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 +65 -42
- package/dist/check.d.ts +5 -5
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +2 -2
- package/dist/ecosystem.d.ts +46 -7
- package/dist/ecosystem.d.ts.map +1 -1
- package/dist/ecosystem.js +33 -25
- package/dist/ecosystem.js.map +1 -1
- package/dist/errors.d.ts +15 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -6
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +19 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/manifests.d.ts +13 -13
- package/dist/manifests.d.ts.map +1 -1
- package/dist/manifests.js +9 -37
- package/dist/manifests.js.map +1 -1
- package/dist/prepare.d.ts +1 -1
- package/dist/publishers.d.ts.map +1 -1
- package/dist/publishers.js +22 -17
- package/dist/publishers.js.map +1 -1
- package/dist/release.d.ts +219 -222
- package/dist/release.d.ts.map +1 -1
- package/dist/release.js +501 -378
- package/dist/release.js.map +1 -1
- package/dist/smoke.d.ts +16 -12
- package/dist/smoke.d.ts.map +1 -1
- package/dist/smoke.js +31 -25
- package/dist/smoke.js.map +1 -1
- package/dist/types.d.ts +49 -35
- package/dist/types.d.ts.map +1 -1
- package/dist/workspace.d.ts +29 -11
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +18 -43
- package/dist/workspace.js.map +1 -1
- package/package.json +5 -3
package/dist/workspace.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* pnpm-workspace.yaml, with their `!` exclusions, or by the `workspaces` of its package.json, as
|
|
4
|
-
* npm and yarn read them ({@link workspaceGlobs}); each folder they match that holds a package.json
|
|
5
|
-
* ({@link workspaceFolders}); each of its packages, read ({@link readWorkspace}); and those that
|
|
6
|
-
* publish, every one that is not private ({@link publishableOf}).
|
|
7
|
-
*
|
|
8
|
-
* Packages are found and not listed: a list kept by hand stops covering a package the day it is
|
|
9
|
-
* added. A folder the workspace does not name, as a git submodule of a repo of its own, is none of
|
|
10
|
-
* its packages.
|
|
11
|
-
*
|
|
12
|
-
* ```ts
|
|
13
|
-
* import { publishableOf, readWorkspace } from '@wtf/release-npm/workspace'
|
|
14
|
-
*
|
|
15
|
-
* const packages = publishableOf(await readWorkspace(system.cwd, { system }))
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @packageDocumentation
|
|
19
|
-
* @module @wtf/release-npm/workspace
|
|
20
|
-
*/
|
|
21
|
-
import { joinPath } from '@wtf/release-system/posix';
|
|
1
|
+
import { exists, readDir, readFile } from '@wtf/release/files';
|
|
2
|
+
import { joinPath } from '@wtf/release/posix';
|
|
22
3
|
import picomatch from 'picomatch';
|
|
23
|
-
import {
|
|
4
|
+
import { NpmError } from "./errors.js";
|
|
24
5
|
const unquote = (value) => value.trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
25
6
|
/**
|
|
26
7
|
* The `packages` globs of the text of a pnpm-workspace.yaml, as a list or inline.
|
|
@@ -56,23 +37,21 @@ export function pnpmWorkspaceGlobs(yaml) {
|
|
|
56
37
|
* package.json, a list or `{ packages }`; `undefined` of a repo that declares no workspace.
|
|
57
38
|
*
|
|
58
39
|
* @param root - The folder of the root of the workspace.
|
|
59
|
-
* @param options - The system the files are read by.
|
|
60
40
|
* @returns The globs, those of a `!` apart, of no `!`; `undefined` of no workspace.
|
|
61
41
|
*/
|
|
62
|
-
export async function workspaceGlobs(root
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!(await fs.exists(manifest)))
|
|
42
|
+
export async function workspaceGlobs(root) {
|
|
43
|
+
const yaml = 'pnpm-workspace.yaml';
|
|
44
|
+
if (await exists(root, yaml))
|
|
45
|
+
return split(pnpmWorkspaceGlobs(await readFile(root, yaml)));
|
|
46
|
+
const manifest = 'package.json';
|
|
47
|
+
if (!(await exists(root, manifest)))
|
|
69
48
|
return undefined;
|
|
70
49
|
let json;
|
|
71
50
|
try {
|
|
72
|
-
json = JSON.parse(await
|
|
51
|
+
json = JSON.parse(await readFile(root, manifest));
|
|
73
52
|
}
|
|
74
53
|
catch (error) {
|
|
75
|
-
throw new
|
|
54
|
+
throw new NpmError('EWORKSPACE', `${manifest} is no JSON: ${error.message}`, 'Fix the package.json of the root of the repo.');
|
|
76
55
|
}
|
|
77
56
|
const workspaces = json.workspaces;
|
|
78
57
|
const globs = Array.isArray(workspaces)
|
|
@@ -95,12 +74,10 @@ const SKIPPED = new Set(['node_modules', '.git']);
|
|
|
95
74
|
* folder below the root that holds one, but those of `node_modules`.
|
|
96
75
|
*
|
|
97
76
|
* @param root - The folder of the root of the workspace.
|
|
98
|
-
* @param options - The system the files are read by.
|
|
99
77
|
* @returns The folders, relative to `root`, in order; `.` of a workspace that names its root.
|
|
100
78
|
*/
|
|
101
|
-
export async function workspaceFolders(root
|
|
102
|
-
const
|
|
103
|
-
const globs = await workspaceGlobs(root, options);
|
|
79
|
+
export async function workspaceFolders(root) {
|
|
80
|
+
const globs = await workspaceGlobs(root);
|
|
104
81
|
const include = globs === undefined ? () => true : picomatch([...globs.include]);
|
|
105
82
|
const exclude = globs === undefined || globs.exclude.length === 0 ? () => false : picomatch([...globs.exclude]);
|
|
106
83
|
const deep = globs === undefined || globs.include.some((glob) => glob.includes('**'));
|
|
@@ -111,7 +88,7 @@ export async function workspaceFolders(root, options) {
|
|
|
111
88
|
const walk = async (dir, level) => {
|
|
112
89
|
if (level > depth)
|
|
113
90
|
return;
|
|
114
|
-
const entries = await
|
|
91
|
+
const entries = await readDir(root, dir);
|
|
115
92
|
if (dir !== '.' &&
|
|
116
93
|
include(dir) &&
|
|
117
94
|
!exclude(dir) &&
|
|
@@ -130,21 +107,19 @@ export async function workspaceFolders(root, options) {
|
|
|
130
107
|
* Each package of the workspace at `root`, read, by the folders of {@link workspaceFolders}.
|
|
131
108
|
*
|
|
132
109
|
* @param root - The folder of the root of the workspace.
|
|
133
|
-
* @param options - The system the files are read by.
|
|
134
110
|
* @returns The manifests, each of its file and its folder relative to `root`, in the order of the
|
|
135
111
|
* folders.
|
|
136
112
|
*/
|
|
137
|
-
export async function readWorkspace(root
|
|
138
|
-
const
|
|
139
|
-
const dirs = await workspaceFolders(root, options);
|
|
113
|
+
export async function readWorkspace(root) {
|
|
114
|
+
const dirs = await workspaceFolders(root);
|
|
140
115
|
return Promise.all(dirs.map(async (dir) => {
|
|
141
116
|
const file = dir === '.' ? 'package.json' : `${dir}/package.json`;
|
|
142
117
|
let json;
|
|
143
118
|
try {
|
|
144
|
-
json = JSON.parse(await
|
|
119
|
+
json = JSON.parse(await readFile(root, file));
|
|
145
120
|
}
|
|
146
121
|
catch (error) {
|
|
147
|
-
throw new
|
|
122
|
+
throw new NpmError('EWORKSPACE', `${file} is no JSON: ${error.message}`, `Fix ${file}, or leave its folder out of the workspace.`);
|
|
148
123
|
}
|
|
149
124
|
return { file, dir, name: typeof json['name'] === 'string' ? json['name'] : undefined, json };
|
|
150
125
|
}));
|
package/dist/workspace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAUtC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAA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,CAAC,KAAK,UAAU,aAAa,CAAC,IAA+B;IACjE,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,GAAG,CAChB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAA;QACjE,IAAI,IAA6B,CAAA;QACjC,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAA4B,CAAA;QAC1E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,QAAQ,CAChB,YAAY,EACZ,GAAG,IAAI,gBAAiB,KAAe,CAAC,OAAO,EAAE,EACjD,OAAO,IAAI,6CAA6C,CACzD,CAAA;QACH,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAA;IAC/F,CAAC,CAAC,CACH,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAA6B,EAAc,EAAE,CACzE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wtf/release-npm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "The npm packages of a monorepo released in trains, of no release tool: the ecosystem of npm, as the trains read it, its default export (., ./ecosystem); the package.json files of the repo, their fields and ranges (./manifests); the packages of a workspace by its globs (./workspace); and every package of a release train published, in the order of their dependencies, by a Publisher of your choice, npm's by default, each made ready at its version, its workspace: ranges resolved, checked and packed before the first publish, each already on the registry skipped, under the dist-tag of its channel, with provenance by an ID token: what a publisher is (.), the publishers (./publishers), what a package is made before it publishes (./prepare), the guard of a release (./check), the manifests of a release resolved, its packages packed and published (./release), the packages packed tried as a consumer installs them (./smoke), and the codes of its errors (./errors).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecosystem",
|
|
@@ -79,8 +79,9 @@
|
|
|
79
79
|
"build": "tsc -b"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@wtf/
|
|
83
|
-
"@wtf/
|
|
82
|
+
"@wtf/platform": "^1.0.0",
|
|
83
|
+
"@wtf/platform-fs": "^1.0.0",
|
|
84
|
+
"@wtf/release": "^1.0.0",
|
|
84
85
|
"picomatch": "^4.0.3",
|
|
85
86
|
"semver": "^7.7.0"
|
|
86
87
|
},
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"@types/node": "^24.10.0",
|
|
89
90
|
"@types/picomatch": "^4.0.3",
|
|
90
91
|
"@types/semver": "^7.7.0",
|
|
92
|
+
"@wtf/release-trains": "^9.0.0",
|
|
91
93
|
"vitest": "^5.0.5"
|
|
92
94
|
},
|
|
93
95
|
"engines": {
|