@wtf/release-npm 1.1.1 → 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 CHANGED
@@ -1,55 +1,78 @@
1
1
  # @wtf/release-npm
2
2
 
3
- The npm packages of a monorepo released in trains, with no release tool. Its default export is the
4
- ecosystem of npm, which a config of the trains names in `ecosystems` as `'@wtf/release-npm'`: the
5
- trains read the packages of each `package.json` by it, each `dependencies` and
6
- `optionalDependencies` what a package runs with, each `peerDependencies` its users' peers, and each
7
- `devDependencies` what its own tests and tools run with, which orders no train. And every package of
8
- a release train published, in the order of their dependencies, by a publisher of your choice, npm's
9
- by default. It writes no file of the repo: the
10
- version of a release is given, each manifest is resolved as it publishes, and each package is
11
- packed from a copy in the system's temporary files. The library of
3
+ The npm packages of a monorepo released, with no release tool and no train. Its default export is
4
+ the ecosystem of npm, of the contract of [`@wtf/release`](../release/README.md). Its read side is
5
+ what a config names in `ecosystems` as `'@wtf/release-npm'`: the trains read the packages of each
6
+ `package.json` by it, each `dependencies` and `optionalDependencies` what a package runs with, each
7
+ `peerDependencies` its users' peers, and each `devDependencies` what its own tests and tools run
8
+ with, which orders no train. Its steps release the packages of the plan a driver gives it, in the
9
+ order of the plan, by a publisher of your choice, npm's by default. It writes no file of the repo:
10
+ the version of a release is given, each manifest is resolved as it publishes, and each package is
11
+ packed from a copy in a temporary folder of the platform. The library of
12
12
  `@wtf/semantic-release-npm`, with no dependency on semantic-release.
13
13
 
14
- ## As a library
14
+ ## The steps of a release
15
15
 
16
- Each function takes the `system` it runs by, which it requires, as a CLI passes its own, adapted to
17
- the interface:
16
+ Each step takes the release, `{ version, root, platform, dryRun, log }`, the plan, `{ own, versions
17
+ }`, the packages that publish in the order to publish them in and the version of each package of
18
+ the repo a range resolves to, and the options, `NpmOptions`:
19
+
20
+ | Step | What it does |
21
+ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22
+ | `verify` | Checks the version, one of semver (`EPUBLISHVERSION`), the options (`EOPTIONS`, `EPUBLISHER`), and the packages as they are in the repo (`EPUBLISHCHECK`) |
23
+ | `prepare` | Resolves each manifest as it publishes and checks it (`EPUBLISHCHECK`), packs each package, and asks the registry (`EPUBLISHBEHIND`). None of npm is committed, so it gives no file |
24
+ | `smoke` | Installs each package packed, and each private package of `pack`, of the tarballs, and imports each entry, as a consumer does (`EPUBLISHSMOKE`) |
25
+ | `publish` | Publishes each package in order, under the first dist-tag of `moving`, each other pointed at it, each version the registry has skipped; gives each package published, or found published, for the links |
26
+ | `move` | Points each dist-tag of `moving` at the version, of each package the registry has at it, and gives each package it moved |
27
+
28
+ The options are its own, the same for each step: `moving`, the dist-tags a publish puts the version
29
+ under, non-empty, as npm publishes under one always; `publisher`; `access`; `provenance`;
30
+ `registry`; `conditions`; `check`; `aside`, the packages that publish under other dist-tags where a
31
+ dist-tag of `moving` points above the release, and those dist-tags; `tarballDir`; `pack`, the
32
+ private packages packed beside the others and never published, of the plan's `packages` where it
33
+ has them; and `forbid`, the globs of the files no tarball may hold, of `smoke`. The library names no
34
+ dist-tag of its own: the caller gives `moving`, as the plugin derives it of the channel of a
35
+ release.
36
+
37
+ A driver runs each step over the plan it works out, by `runStep` of `@wtf/release/driver`; the
38
+ plugin works it out by the trains, and a CLI of its own may give the packages by hand:
18
39
 
19
40
  ```ts
20
- import type { System } from '@wtf/release-system/system'
21
- import { packTrain, publishTrain, resolveManifests } from '@wtf/release-npm/release'
22
-
23
- export async function release(system: System, version: string) {
24
- // Each manifest as it publishes: the version, and each range resolved. It writes nothing.
25
- const resolved = await resolveManifests({
26
- trains: { trains: { paths: ['packages/release-trains', 'packages/release-trains-*'] } },
27
- train: 'trains',
28
- version,
29
- system
30
- })
31
- // Each package packed, from a copy in the system's temporary files.
32
- const packed = await packTrain(resolved, { system })
33
- try {
34
- return await publishTrain(packed, { system })
35
- } finally {
36
- await packed.cleanup()
37
- }
41
+ import type { Release } from '@wtf/release/contract'
42
+ import { runStep } from '@wtf/release/driver'
43
+ import npm from '@wtf/release-npm'
44
+
45
+ export async function release(at: Release) {
46
+ // Every package of the repo that publishes, as the ecosystem reads it, at the version.
47
+ const own = (await npm.packages(at)).filter(({ published }) => published)
48
+ const versions = new Map(own.map(({ name }) => [name, at.version]))
49
+ const plans = new Map([['npm', { own, versions }]])
50
+ const ecosystems = [[npm, { moving: ['latest'] }]] as const
51
+ for (const step of ['verify', 'prepare', 'smoke'] as const)
52
+ await runStep(at, plans, ecosystems, step)
53
+ const { released } = await runStep(at, plans, ecosystems, 'publish')
54
+ return released
38
55
  }
39
56
  ```
40
57
 
41
- | Export | What it is |
42
- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
- | `@wtf/release-npm` | The ecosystem of npm, its default export, and the types: `Publisher`, `Lookup`, `PublishPackage`, `PublishOptions`, `PublisherContext` |
44
- | `@wtf/release-npm/ecosystem` | `npmEcosystem`, the ecosystem of npm, as the trains read it |
45
- | `@wtf/release-npm/manifests` | The package.json files of a repo (`readManifests`, `manifestsAt`), their fields, the range a `workspace:` range publishes (`resolveSpecifier`), and each a package of the trains |
46
- | `@wtf/release-npm/workspace` | The packages of a workspace, by the globs of pnpm, npm or yarn |
47
- | `@wtf/release-npm/release` | `resolveManifests`, `packTrain`, `publishedOf`, `publishedOfResolved`, `publishTrain`, `publishPacked`, `releaseTrain`, `tagTrain`, `checkTrain`, and `distTagOf` |
48
- | `@wtf/release-npm/smoke` | `smokePacked`: each package packed, and each of `pack`, checked, installed by npm of the tarballs packed, and each entry imported, before a publish; `tarballFaults`, `entrySpecifiers` |
49
- | `@wtf/release-npm/publishers` | `npmPublisher`, `pnpmPublisher`, `PUBLISHERS`, `isPublisher` and `builtInPublisher` |
50
- | `@wtf/release-npm/prepare` | What a manifest is made before it publishes, each function pure |
51
- | `@wtf/release-npm/check` | The guard of a release, of each package as it publishes |
52
- | `@wtf/release-npm/errors` | `NPM_ERRORS` |
58
+ What `prepare` packed, `smoke` and `publish` take in the same process; a step that finds nothing
59
+ packed packs again, and `discardPacked` of `./release` removes what is packed of a release that goes
60
+ no further. Each function a step builds on is of `./release` too, of the folder of the repo and the
61
+ platform its caller gives it: `resolvePlan`, `packRelease`, `publishedOf`, `publishPacked` and
62
+ `moveRelease`.
63
+
64
+ | Export | What it is |
65
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
66
+ | `@wtf/release-npm` | The ecosystem of npm, its default export, and the types: `NpmOptions`, `NpmAside`, `Publisher`, `Lookup`, `PublishPackage`, `PublishOptions`, `PublisherContext` |
67
+ | `@wtf/release-npm/ecosystem` | `npmEcosystem`, the ecosystem of npm, its read side and its steps |
68
+ | `@wtf/release-npm/manifests` | The package.json files of a repo (`readManifests`, `manifestsAt`), their fields, the range a `workspace:` range publishes (`resolveSpecifier`), and each a package of an ecosystem |
69
+ | `@wtf/release-npm/workspace` | The packages of a workspace, by the globs of pnpm, npm or yarn |
70
+ | `@wtf/release-npm/release` | Each step (`verifyRelease`, `prepareRelease`, `smokeRelease`, `publishRelease`, `moveRelease`), `checkPlan`, `resolvePlan`, `packRelease`, `publishedOf`, `publishPacked`, `discardPacked`, and `npmOptionsSchema` |
71
+ | `@wtf/release-npm/smoke` | `smokePacked`: each package packed, and each of `pack`, checked, installed by npm of the tarballs packed, and each entry imported, before a publish; `tarballFaults`, `entrySpecifiers` |
72
+ | `@wtf/release-npm/publishers` | `npmPublisher`, `pnpmPublisher`, `PUBLISHERS`, `isPublisher`, `builtInPublisher`, and `registryOf`, the registry a package is published to |
73
+ | `@wtf/release-npm/prepare` | What a manifest is made before it publishes, each function pure |
74
+ | `@wtf/release-npm/check` | The guard of a release, of each package as it publishes |
75
+ | `@wtf/release-npm/errors` | `NpmError`, and `NPM_ERRORS` |
53
76
 
54
77
  See [Publishing](../docs/guides/publishing.md).
55
78
 
package/dist/check.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The guard of the publishing of a train ({@link checkPackages}): each fault that would fail its
2
+ * The guard of the publishing of a release ({@link checkPackages}): each fault that would fail its
3
3
  * release part way, or publish a package no consumer can install, as an {@link Issue}, and none
4
4
  * where it publishes as it should. It reads nothing: it checks what it is given.
5
5
  *
@@ -14,7 +14,7 @@
14
14
  * @packageDocumentation
15
15
  * @module @wtf/release-npm/check
16
16
  */
17
- import type { OrderFault } from '@wtf/release-trains/packages';
17
+ import type { OrderFault } from '@wtf/release/order';
18
18
  import { type Manifest } from './manifests.ts';
19
19
  /** A package as the guard reads it: its folder, its name, and what its package.json holds. */
20
20
  export type CheckedPackage = Pick<Manifest, 'dir' | 'name' | 'json'>;
@@ -36,7 +36,7 @@ export type IssueCode =
36
36
  | 'TYPESCRIPT_EXPORT'
37
37
  /** The order of publishing cannot hold, of a pin or a cycle. */
38
38
  | OrderFault['code'];
39
- /** A fault of a package, or of the train, whose `dir` is then `.`. */
39
+ /** A fault of a package, or of the release, whose `dir` is then `.`. */
40
40
  export interface Issue {
41
41
  readonly code: IssueCode;
42
42
  /** The folder of the package, from the root of the repo. */
@@ -66,11 +66,11 @@ export interface CheckOptions {
66
66
  */
67
67
  export declare const formatIssue: ({ dir, name, message }: Issue) => string;
68
68
  /**
69
- * The faults of `packages`, the packages of a train that publish, as each would publish: those of
69
+ * The faults of `packages`, the packages of a release that publish, as each would publish: those of
70
70
  * each alone, a dependency of one on a private package of `workspace`, and those of the order of
71
71
  * publishing. None, where they publish as they should.
72
72
  *
73
- * @param packages - The packages of the train that publish, as each would publish.
73
+ * @param packages - The packages of the release that publish, as each would publish.
74
74
  * @param options - Whether they are prepared, the faults of the order, the workspace, the access
75
75
  * and the conditions of the source.
76
76
  * @returns The faults found, empty of none.
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAE9D,O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,EAAE,GAAG,SAAS,CAAA;IACnD,6FAA6F;IAC7F,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,CAAA;IAC1D,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAA;IACrD,yDAAyD;IACzD,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CACpD;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,wBAAwB,KAAK,KAAG,MACG,CAAA;AA8D/D;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,OAAO,GAAE,YAAiB,GACzB,KAAK,EAAE,CAeT"}
package/dist/check.js CHANGED
@@ -49,11 +49,11 @@ function checkOne(pkg, options) {
49
49
  return issues;
50
50
  }
51
51
  /**
52
- * The faults of `packages`, the packages of a train that publish, as each would publish: those of
52
+ * The faults of `packages`, the packages of a release that publish, as each would publish: those of
53
53
  * each alone, a dependency of one on a private package of `workspace`, and those of the order of
54
54
  * publishing. None, where they publish as they should.
55
55
  *
56
- * @param packages - The packages of the train that publish, as each would publish.
56
+ * @param packages - The packages of the release that publish, as each would publish.
57
57
  * @param options - Whether they are prepared, the faults of the order, the workspace, the access
58
58
  * and the conditions of the source.
59
59
  * @returns The faults found, empty of none.
@@ -1,11 +1,50 @@
1
- import type { Ecosystem } from '@wtf/release-trains/ecosystem';
1
+ /**
2
+ * The ecosystem of npm ({@link npmEcosystem}), the default export of the package, which a config
3
+ * names in `ecosystems` as `'@wtf/release-npm'`: the read side, the packages of the repo, each
4
+ * package.json git tracks, of a name, a range of the workspace protocol published as pnpm resolves
5
+ * it, and the rules of semver; and the steps of a release of the contract of
6
+ * `@wtf/release/contract`, each over the plan its driver gives it, of the options of
7
+ * {@link NpmOptions}, as `./release` has them.
8
+ *
9
+ * ```ts
10
+ * import type { Release } from '@wtf/release/contract'
11
+ * import { runStep } from '@wtf/release/driver'
12
+ * import npm from '@wtf/release-npm'
13
+ *
14
+ * declare const release: Release
15
+ *
16
+ * const own = (await npm.packages(release)).filter(({ published }) => published)
17
+ * const versions = new Map(own.map(({ name }) => [name, release.version]))
18
+ * const plans = new Map([['npm', { own, versions }]])
19
+ * const ecosystems = [[npm, { moving: ['latest'] }]] as const
20
+ * await runStep(release, plans, ecosystems, 'verify')
21
+ * await runStep(release, plans, ecosystems, 'prepare')
22
+ * const { released } = await runStep(release, plans, ecosystems, 'publish')
23
+ * ```
24
+ *
25
+ * @packageDocumentation
26
+ * @module @wtf/release-npm/ecosystem
27
+ */
28
+ import type { ReleasingEcosystem } from '@wtf/release/contract';
29
+ import { type NpmPackage } from './manifests.ts';
30
+ import type { NpmOptions } from './types.ts';
2
31
  /**
3
32
  * The ecosystem of npm: its packages, each package.json of the repo of a name, of the files git
4
- * tracks of the working tree, or at a commit by git (`packagesOfManifests` of `./manifests`),
5
- * published unless private, each dependency on another of the kind of its field; a range published
6
- * by pnpm's rules of the workspace protocol (`resolveSpecifier`); and a range of semver, a
7
- * prerelease within its bounds too, and any range that names no version taking any
8
- * (`satisfiesRange`).
33
+ * tracks of the working tree, read from the folder of the repo, or at a commit by git
34
+ * (`packagesOfManifests` of `./manifests`), published unless private, each dependency on another of
35
+ * the kind of its field; a range published by pnpm's rules of the workspace protocol
36
+ * (`resolveSpecifier`); and a range of semver, a prerelease within its bounds too, and any range
37
+ * that names no version taking any (`satisfiesRange`). Its steps, each of `./release`:
38
+ *
39
+ * - `verify`: the version, one of semver, the options, and the packages as they are
40
+ * (`verifyRelease`);
41
+ * - `prepare`: each manifest resolved as it publishes and checked, each package packed, and the
42
+ * registry asked (`prepareRelease`); none of npm is committed, so it gives no file;
43
+ * - `smoke`: each package packed, installed and imported as a consumer does (`smokeRelease`);
44
+ * - `publish`: each package of the plan published in order, each npm has skipped, by the pluggable
45
+ * publisher (`publishRelease`);
46
+ * - `move`: each dist-tag of `moving` pointed at the version (`moveRelease`), and each package
47
+ * moved, or found moved, given once, of its page.
9
48
  */
10
- export declare const npmEcosystem: Ecosystem;
49
+ export declare const npmEcosystem: ReleasingEcosystem<NpmOptions, NpmPackage, 'verify' | 'prepare' | 'smoke' | 'move'>;
11
50
  //# sourceMappingURL=ecosystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ecosystem.d.ts","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAU9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,SAU1B,CAAA"}
1
+ {"version":3,"file":"ecosystem.d.ts","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAY,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAEL,KAAK,UAAU,EAKhB,MAAM,gBAAgB,CAAA;AAQvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAC3C,UAAU,EACV,UAAU,EACV,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CA4BxC,CAAA"}
package/dist/ecosystem.js CHANGED
@@ -1,36 +1,44 @@
1
- /**
2
- * The ecosystem of npm ({@link npmEcosystem}), as the trains read it, and the default export of
3
- * the package, which a config names in `ecosystems` as `'@wtf/release-npm'`: the packages of the
4
- * repo, each package.json git tracks, of a name; a range of the workspace protocol published as
5
- * pnpm resolves it; and the rules of semver.
6
- *
7
- * ```js
8
- * // release.config.mjs
9
- * export default {
10
- * trains: { core: { paths: ['packages/core'] } },
11
- * ecosystems: ['@wtf/release-npm']
12
- * }
13
- * ```
14
- *
15
- * @packageDocumentation
16
- * @module @wtf/release-npm/ecosystem
17
- */
18
- import { trackedFiles } from '@wtf/release-system/git';
1
+ import { trackedFiles } from '@wtf/release/git';
19
2
  import { manifestsAt, packagesOfManifests, readManifests, resolveSpecifier, satisfiesRange } from "./manifests.js";
3
+ import { moveRelease, prepareRelease, publishRelease, smokeRelease, verifyRelease } from "./release.js";
20
4
  /**
21
5
  * The ecosystem of npm: its packages, each package.json of the repo of a name, of the files git
22
- * tracks of the working tree, or at a commit by git (`packagesOfManifests` of `./manifests`),
23
- * published unless private, each dependency on another of the kind of its field; a range published
24
- * by pnpm's rules of the workspace protocol (`resolveSpecifier`); and a range of semver, a
25
- * prerelease within its bounds too, and any range that names no version taking any
26
- * (`satisfiesRange`).
6
+ * tracks of the working tree, read from the folder of the repo, or at a commit by git
7
+ * (`packagesOfManifests` of `./manifests`), published unless private, each dependency on another of
8
+ * the kind of its field; a range published by pnpm's rules of the workspace protocol
9
+ * (`resolveSpecifier`); and a range of semver, a prerelease within its bounds too, and any range
10
+ * that names no version taking any (`satisfiesRange`). Its steps, each of `./release`:
11
+ *
12
+ * - `verify`: the version, one of semver, the options, and the packages as they are
13
+ * (`verifyRelease`);
14
+ * - `prepare`: each manifest resolved as it publishes and checked, each package packed, and the
15
+ * registry asked (`prepareRelease`); none of npm is committed, so it gives no file;
16
+ * - `smoke`: each package packed, installed and imported as a consumer does (`smokeRelease`);
17
+ * - `publish`: each package of the plan published in order, each npm has skipped, by the pluggable
18
+ * publisher (`publishRelease`);
19
+ * - `move`: each dist-tag of `moving` pointed at the version (`moveRelease`), and each package
20
+ * moved, or found moved, given once, of its page.
27
21
  */
28
22
  export const npmEcosystem = {
29
23
  name: 'npm',
30
24
  packages: async (context) => packagesOfManifests(context.ref === undefined
31
- ? await readManifests(await trackedFiles(context), context)
25
+ ? await readManifests(await trackedFiles(context), context.root)
32
26
  : await manifestsAt(context.ref, context)),
33
27
  resolve: resolveSpecifier,
34
- satisfies: satisfiesRange
28
+ satisfies: satisfiesRange,
29
+ verify: verifyRelease,
30
+ prepare: prepareRelease,
31
+ smoke: smokeRelease,
32
+ publish: publishRelease,
33
+ async move(release, plan, options) {
34
+ const { packages } = await moveRelease(release, plan, options);
35
+ const moved = new Map();
36
+ for (const { name, version, page, status } of packages)
37
+ if (status === 'tagged' && !moved.has(name))
38
+ moved.set(name, page === undefined
39
+ ? { ecosystem: 'npm', name, version }
40
+ : { ecosystem: 'npm', name, version, page });
41
+ return [...moved.values()];
42
+ }
35
43
  };
36
44
  //# sourceMappingURL=ecosystem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ecosystem.js","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAGtD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAA;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAC1B,mBAAmB,CACjB,OAAO,CAAC,GAAG,KAAK,SAAS;QACvB,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAC3D,CAAC,CAAC,MAAM,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAC5C;IACH,OAAO,EAAE,gBAAgB;IACzB,SAAS,EAAE,cAAc;CAC1B,CAAA"}
1
+ {"version":3,"file":"ecosystem.js","sourceRoot":"","sources":["../src/ecosystem.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,OAAO,EACL,WAAW,EAEX,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAA;AACvB,OAA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AC,MAAM,EAAE,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA"}
package/dist/errors.d.ts CHANGED
@@ -1,21 +1,30 @@
1
1
  /**
2
- * The codes of the errors of the npm packages of a train, read and published, each with what it
3
- * means: `TrainsError` of `@wtf/release-trains/errors` of these codes, each with its details of how
4
- * to fix it. A dependency on a package of no train, or of a train with no release, is the trains'
5
- * own, `EDEPENDENCYNOTRAIN` and `EDEPENDENCYNORELEASE` of their `TRAINS_ERRORS`.
2
+ * What the release of npm packages throws: {@link NpmError}, a `ReleaseError` of
3
+ * `@wtf/release/errors` of the codes of {@link NPM_ERRORS}, beside the codes of the options, its
4
+ * `RELEASE_ERRORS` (`EOPTIONS`). A range of a package of another part of the repo that no release
5
+ * satisfies is the caller's to find, as the trains find it as they work out a plan.
6
6
  *
7
7
  * @packageDocumentation
8
8
  * @module @wtf/release-npm/errors
9
9
  */
10
- /** The codes of the errors of the npm packages of a train, each with what it means. */
10
+ import { ReleaseError } from '@wtf/release/errors';
11
+ /** The codes of the errors of the npm packages of a release, each with what it means. */
11
12
  export declare const NPM_ERRORS: {
12
13
  readonly EWORKSPACE: "The workspace of the repo cannot be read.";
13
14
  readonly EPUBLISHER: "The publisher cannot be loaded, or is no publisher.";
14
- readonly EPUBLISHCHECK: "A package of the train would not publish as it should.";
15
+ readonly EPUBLISHVERSION: "The version of a release is no version of semver, which npm publishes.";
16
+ readonly EPUBLISHCHECK: "A package of the release would not publish as it should.";
15
17
  readonly EPUBLISHBEHIND: "A release is below the version its dist-tag points at on the registry.";
16
18
  readonly EPUBLISH: "A package could not be published, or the registry could not be asked.";
17
19
  readonly EPUBLISHSMOKE: "A package packed does not install, or import, as a consumer installs it.";
18
20
  };
19
21
  /** A code of {@link NPM_ERRORS}. */
20
22
  export type NpmErrorCode = keyof typeof NPM_ERRORS;
23
+ /**
24
+ * An error of the npm packages of a release, or of its options: a stable `code`, of
25
+ * {@link NPM_ERRORS} or of `RELEASE_ERRORS` of `@wtf/release/errors`, its `message` what is wrong,
26
+ * and its `details` how to fix it.
27
+ */
28
+ export declare class NpmError extends ReleaseError {
29
+ }
21
30
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAA"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,yFAAyF;AACzF,eAAO,MAAM,UAAU;;;;;;;;CAQb,CAAA;AAEV,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,UAAU,CAAA;AAElD;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,YAAY;CAAG"}
package/dist/errors.js CHANGED
@@ -1,19 +1,28 @@
1
1
  /**
2
- * The codes of the errors of the npm packages of a train, read and published, each with what it
3
- * means: `TrainsError` of `@wtf/release-trains/errors` of these codes, each with its details of how
4
- * to fix it. A dependency on a package of no train, or of a train with no release, is the trains'
5
- * own, `EDEPENDENCYNOTRAIN` and `EDEPENDENCYNORELEASE` of their `TRAINS_ERRORS`.
2
+ * What the release of npm packages throws: {@link NpmError}, a `ReleaseError` of
3
+ * `@wtf/release/errors` of the codes of {@link NPM_ERRORS}, beside the codes of the options, its
4
+ * `RELEASE_ERRORS` (`EOPTIONS`). A range of a package of another part of the repo that no release
5
+ * satisfies is the caller's to find, as the trains find it as they work out a plan.
6
6
  *
7
7
  * @packageDocumentation
8
8
  * @module @wtf/release-npm/errors
9
9
  */
10
- /** The codes of the errors of the npm packages of a train, each with what it means. */
10
+ import { ReleaseError } from '@wtf/release/errors';
11
+ /** The codes of the errors of the npm packages of a release, each with what it means. */
11
12
  export const NPM_ERRORS = {
12
13
  EWORKSPACE: 'The workspace of the repo cannot be read.',
13
14
  EPUBLISHER: 'The publisher cannot be loaded, or is no publisher.',
14
- EPUBLISHCHECK: 'A package of the train would not publish as it should.',
15
+ EPUBLISHVERSION: 'The version of a release is no version of semver, which npm publishes.',
16
+ EPUBLISHCHECK: 'A package of the release would not publish as it should.',
15
17
  EPUBLISHBEHIND: 'A release is below the version its dist-tag points at on the registry.',
16
18
  EPUBLISH: 'A package could not be published, or the registry could not be asked.',
17
19
  EPUBLISHSMOKE: 'A package packed does not install, or import, as a consumer installs it.'
18
20
  };
21
+ /**
22
+ * An error of the npm packages of a release, or of its options: a stable `code`, of
23
+ * {@link NPM_ERRORS} or of `RELEASE_ERRORS` of `@wtf/release/errors`, its `message` what is wrong,
24
+ * and its `details` how to fix it.
25
+ */
26
+ export class NpmError extends ReleaseError {
27
+ }
19
28
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,2CAA2C;IACvD,UAAU,EAAE,qDAAqD;IACjE,aAAa,EAAE,wDAAwD;IACvE,cAAc,EAAE,wEAAwE;IACxF,QAAQ,EAAE,uEAAuE;IACjF,aAAa,EAAE,0EAA0E;CACjF,CAAA"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,yFAAyF;AACzF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,2CAA2C;IACvD,UAAU,EAAE,qDAAqD;IACjE,eAAe,EAAE,wEAAwE;IACzF,aAAa,EAAE,0DAA0D;IACzE,cAAc,EAAE,wEAAwE;IACxF,QAAQ,EAAE,uEAAuE;IACjF,aAAa,EAAE,0EAA0E;CACjF,CAAA;AAKV;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG"}
package/dist/index.d.ts CHANGED
@@ -1,24 +1,28 @@
1
1
  /**
2
- * The npm packages of a monorepo released in trains, of no release tool, by the `system` its
3
- * caller gives it. Its default export is the ecosystem of npm, `npmEcosystem` of `./ecosystem`,
4
- * which a config of the trains names in `ecosystems` as `'@wtf/release-npm'`, so the trains read
5
- * the packages of the repo by it; and every package of a release train published: in the order of
6
- * their dependencies, by a {@link Publisher} of your choice, npm's by default, each at the version
7
- * of the release, its `workspace:` ranges resolved, checked and packed before the first publish,
8
- * each already on the registry skipped, under the dist-tag of its channel. This module declares
9
- * what a publisher is; the code is at the subpaths:
2
+ * The npm packages of a monorepo released, of no release tool and no train, by the folder of the
3
+ * repo and the platform its caller gives it. Its default export is the ecosystem of npm,
4
+ * `npmEcosystem` of `./ecosystem`, of the contract of `@wtf/release/contract`: the read side, which a
5
+ * config names in `ecosystems` as `'@wtf/release-npm'`, so the trains read the packages of the repo
6
+ * by it; and the steps of a release, each over the plan its driver gives it, the packages that
7
+ * publish in order and the versions of the repo, of the options of {@link NpmOptions}: `verify`,
8
+ * `prepare`, `smoke`, `publish` and `move`. Each package is published in the order of the plan, by
9
+ * a {@link Publisher} of your choice, npm's by default, at the version of the release, its
10
+ * `workspace:` ranges resolved, checked and packed before the first publish, each already on the
11
+ * registry skipped, under the dist-tags of `moving`. This module declares what a publisher is, and
12
+ * the options; the code is at the subpaths:
10
13
  *
11
- * - `./ecosystem`: the ecosystem of npm, as the trains read it;
14
+ * - `./ecosystem`: the ecosystem of npm, and its steps;
12
15
  * - `./manifests`: the package.json files of the repo, their fields and ranges, and each a package
13
- * of the trains;
16
+ * of an ecosystem;
14
17
  * - `./workspace`: the packages of a workspace, by its globs;
15
18
  * - `./publishers`: the publishers built in, `npm` and `pnpm`;
16
- * - `./release`: the manifests of a release resolved (`resolveManifests`), its packages packed
17
- * (`packTrain`) and published (`publishTrain`), none of which writes a file of the repo;
19
+ * - `./release`: each step of a release, and what each builds on: the manifests of a plan resolved
20
+ * (`resolvePlan`), its packages packed (`packRelease`) and published (`publishPacked`), and its
21
+ * dist-tags moved (`moveRelease`), none of which writes a file of the repo;
18
22
  * - `./prepare`: what a package is made before it publishes;
19
23
  * - `./check`: the guard of a release, of each package as it publishes;
20
24
  * - `./smoke`: the packages packed tried as a consumer installs them;
21
- * - `./errors`: the codes of its errors.
25
+ * - `./errors`: `NpmError`, and the codes of its errors.
22
26
  *
23
27
  * ```js
24
28
  * // release.config.mjs
@@ -32,7 +36,7 @@
32
36
  * @module @wtf/release-npm
33
37
  */
34
38
  import { npmEcosystem } from './ecosystem.ts';
35
- export type { Lookup, PublishOptions, Publisher, PublisherContext, PublishPackage, PublishTrainOptions } from './types.ts';
36
- /** The ecosystem of npm, which a config of the trains names as `'@wtf/release-npm'`. */
39
+ export type { Lookup, NpmAside, NpmOptions, PublishOptions, Publisher, PublisherContext, PublishPackage } from './types.ts';
40
+ /** The ecosystem of npm, and its steps of a release: a config names it `'@wtf/release-npm'`. */
37
41
  export default npmEcosystem;
38
42
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,YAAY,EACV,MAAM,EACN,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACpB,MAAM,YAAY,CAAA;AAEnB,wFAAwF;AACxF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,YAAY,EACV,MAAM,EACN,QAAQ,EACR,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAA;AAEnB,gGAAgG;AAChG,eAAe,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,24 +1,28 @@
1
1
  /**
2
- * The npm packages of a monorepo released in trains, of no release tool, by the `system` its
3
- * caller gives it. Its default export is the ecosystem of npm, `npmEcosystem` of `./ecosystem`,
4
- * which a config of the trains names in `ecosystems` as `'@wtf/release-npm'`, so the trains read
5
- * the packages of the repo by it; and every package of a release train published: in the order of
6
- * their dependencies, by a {@link Publisher} of your choice, npm's by default, each at the version
7
- * of the release, its `workspace:` ranges resolved, checked and packed before the first publish,
8
- * each already on the registry skipped, under the dist-tag of its channel. This module declares
9
- * what a publisher is; the code is at the subpaths:
2
+ * The npm packages of a monorepo released, of no release tool and no train, by the folder of the
3
+ * repo and the platform its caller gives it. Its default export is the ecosystem of npm,
4
+ * `npmEcosystem` of `./ecosystem`, of the contract of `@wtf/release/contract`: the read side, which a
5
+ * config names in `ecosystems` as `'@wtf/release-npm'`, so the trains read the packages of the repo
6
+ * by it; and the steps of a release, each over the plan its driver gives it, the packages that
7
+ * publish in order and the versions of the repo, of the options of {@link NpmOptions}: `verify`,
8
+ * `prepare`, `smoke`, `publish` and `move`. Each package is published in the order of the plan, by
9
+ * a {@link Publisher} of your choice, npm's by default, at the version of the release, its
10
+ * `workspace:` ranges resolved, checked and packed before the first publish, each already on the
11
+ * registry skipped, under the dist-tags of `moving`. This module declares what a publisher is, and
12
+ * the options; the code is at the subpaths:
10
13
  *
11
- * - `./ecosystem`: the ecosystem of npm, as the trains read it;
14
+ * - `./ecosystem`: the ecosystem of npm, and its steps;
12
15
  * - `./manifests`: the package.json files of the repo, their fields and ranges, and each a package
13
- * of the trains;
16
+ * of an ecosystem;
14
17
  * - `./workspace`: the packages of a workspace, by its globs;
15
18
  * - `./publishers`: the publishers built in, `npm` and `pnpm`;
16
- * - `./release`: the manifests of a release resolved (`resolveManifests`), its packages packed
17
- * (`packTrain`) and published (`publishTrain`), none of which writes a file of the repo;
19
+ * - `./release`: each step of a release, and what each builds on: the manifests of a plan resolved
20
+ * (`resolvePlan`), its packages packed (`packRelease`) and published (`publishPacked`), and its
21
+ * dist-tags moved (`moveRelease`), none of which writes a file of the repo;
18
22
  * - `./prepare`: what a package is made before it publishes;
19
23
  * - `./check`: the guard of a release, of each package as it publishes;
20
24
  * - `./smoke`: the packages packed tried as a consumer installs them;
21
- * - `./errors`: the codes of its errors.
25
+ * - `./errors`: `NpmError`, and the codes of its errors.
22
26
  *
23
27
  * ```js
24
28
  * // release.config.mjs
@@ -32,6 +36,6 @@
32
36
  * @module @wtf/release-npm
33
37
  */
34
38
  import { npmEcosystem } from "./ecosystem.js";
35
- /** The ecosystem of npm, which a config of the trains names as `'@wtf/release-npm'`. */
39
+ /** The ecosystem of npm, and its steps of a release: a config names it `'@wtf/release-npm'`. */
36
40
  export default npmEcosystem;
37
41
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAW7C,wFAAwF;AACxF,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAY7C,gGAAgG;AAChG,eAAe,YAAY,CAAA"}
@@ -7,13 +7,13 @@
7
7
  * manifest as a package of the trains reads it ({@link packageOf}), each dependency of its kind.
8
8
  *
9
9
  * ```ts
10
- * import { trackedFiles } from '@wtf/release-system/git'
11
- * import type { System } from '@wtf/release-system/system'
10
+ * import type { RepoContext } from '@wtf/release'
11
+ * import { trackedFiles } from '@wtf/release/git'
12
12
  * import { packageOf, readManifests, resolveSpecifier } from '@wtf/release-npm/manifests'
13
13
  *
14
- * // The system of the caller: Node's of a plugin, its own of a CLI.
15
- * declare const system: System
16
- * const manifests = await readManifests(await trackedFiles({ system }), { system })
14
+ * // The folder of the repo and the platform of the caller: Node's of a plugin, its own of a CLI.
15
+ * declare const repo: RepoContext
16
+ * const manifests = await readManifests(await trackedFiles(repo), repo.root)
17
17
  * const names = new Set(manifests.flatMap(({ name }) => (name === undefined ? [] : [name])))
18
18
  *
19
19
  * manifests.map((manifest) => packageOf(manifest, names)) // each of its dependencies of the repo
@@ -23,8 +23,9 @@
23
23
  * @packageDocumentation
24
24
  * @module @wtf/release-npm/manifests
25
25
  */
26
- import { type GitContext } from '@wtf/release-system/git';
27
- import type { DependencyKind, Package } from '@wtf/release-trains/ecosystem';
26
+ import type { FileSystemDirectoryHandle } from '@wtf/platform/fs';
27
+ import { type GitContext } from '@wtf/release/git';
28
+ import type { DependencyKind, Package } from '@wtf/release/ecosystem';
28
29
  /** The fields of a package.json that list the packages it depends on. */
29
30
  export declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
30
31
  /** A field of {@link DEPENDENCY_FIELDS}. */
@@ -47,20 +48,19 @@ export interface Manifest {
47
48
  readonly json: Readonly<Record<string, unknown>>;
48
49
  }
49
50
  /**
50
- * Each package.json of `files`, the files of a repo, read from its folder by its system: each but
51
- * those in a `node_modules`.
51
+ * Each package.json of `files`, the files of a repo, read from its folder, `root`: each but those
52
+ * in a `node_modules`.
52
53
  *
53
54
  * @param files - The files of the repo, from its root, as git tracks them.
54
- * @param context - Where the files are: the folder of the repo, and the system they are read by.
55
+ * @param root - The folder of the repo, a handle of the File System standard.
55
56
  * @returns The manifests, in the order of `files`.
56
57
  */
57
- export declare function readManifests(files: readonly string[], context: GitContext): Promise<Manifest[]>;
58
+ export declare function readManifests(files: readonly string[], root: FileSystemDirectoryHandle): Promise<Manifest[]>;
58
59
  /**
59
60
  * Each package.json of the repo at `ref`, read by git: each but those in a `node_modules`.
60
61
  *
61
62
  * @param ref - The commit to read them at, as `HEAD` or the tag of a release.
62
- * @param context - Where git runs: the folder of the repo, its environment, and the system it runs
63
- * by.
63
+ * @param context - Where git runs: the platform, whose working folder is the folder of the repo.
64
64
  * @returns The manifests, each of its file and its folder from the root of the repo.
65
65
  */
66
66
  export declare function manifestsAt(ref: string, context: GitContext): Promise<Manifest[]>;