@jskit-ai/release 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/release.mjs +21 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/release",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Selective npm release preparation, publication and dependency pinning for package repositories.",
5
5
  "type": "module",
6
6
  "files": [
package/src/release.mjs CHANGED
@@ -10,10 +10,12 @@ import { createPublicationInspection, planPublication, snapshotFiles } from "./n
10
10
  // declared in the root package.json `jskitRelease` field:
11
11
  // prepare command that regenerates derived files during preparation
12
12
  // nestedManifests package subdirectories whose package.json pins follow the release
13
+ // manifests further package directories (or `*` patterns) the repository owns
14
+ // without declaring them as npm workspaces
13
15
  // and per package in its own `jskitRelease` field:
14
16
  // pack command printing a custom tarball path (see npm-publication.mjs)
15
17
  // versionFiles JSON files whose `version` must equal the package version
16
- const USAGE = "Usage: jskit-release <prepare|publish|pin> [--cwd <dir>] [--dry-run] [--registry <url>] [--from <repoDir>...]";
18
+ const USAGE = "Usage: jskit-release <prepare|publish|pin> [--cwd <dir>] [--dry-run] [--registry <url>] [--from <repoDir>...] [--no-commit]";
17
19
  const DEPENDENCY_FIELDS = Object.freeze([
18
20
  "dependencies",
19
21
  "devDependencies",
@@ -33,6 +35,7 @@ function parseArgs(argv = []) {
33
35
  intent,
34
36
  cwd: process.cwd(),
35
37
  dryRun: false,
38
+ noCommit: false,
36
39
  registry: DEFAULT_REGISTRY,
37
40
  from: []
38
41
  };
@@ -43,6 +46,10 @@ function parseArgs(argv = []) {
43
46
  options.dryRun = true;
44
47
  continue;
45
48
  }
49
+ if (argument === "--no-commit" && intent === "pin") {
50
+ options.noCommit = true;
51
+ continue;
52
+ }
46
53
  const [name, inline] = argument.startsWith("--") && argument.includes("=")
47
54
  ? [argument.slice(0, argument.indexOf("=")), argument.slice(argument.indexOf("=") + 1)] : [argument, undefined];
48
55
  if (name === "--cwd" || (name === "--from" && intent === "pin")) {
@@ -132,12 +139,15 @@ async function expandWorkspacePattern(repoRoot, pattern) {
132
139
  return directories;
133
140
  }
134
141
 
135
- // Every manifest the repository owns: the root, its workspaces and `file:`
136
- // dependency directories inside the repository (followed transitively).
142
+ // Every manifest the repository owns: the root, its workspaces, its declared
143
+ // `jskitRelease.manifests` and `file:` dependency directories inside the
144
+ // repository (followed transitively).
137
145
  async function discoverManifests(repoRoot) {
138
146
  const root = path.resolve(repoRoot);
139
147
  const rootJson = await readJsonFile(path.join(root, "package.json"));
140
- const patterns = Array.isArray(rootJson.workspaces) ? rootJson.workspaces : rootJson.workspaces?.packages || [];
148
+ const workspaces = Array.isArray(rootJson.workspaces) ? rootJson.workspaces : rootJson.workspaces?.packages || [];
149
+ const declared = Array.isArray(rootJson.jskitRelease?.manifests) ? rootJson.jskitRelease.manifests : [];
150
+ const patterns = [...workspaces, ...declared];
141
151
  const queue = [root];
142
152
  for (const pattern of patterns) {
143
153
  if (!String(pattern).startsWith("!")) queue.push(...(await expandWorkspacePattern(root, pattern)).sort());
@@ -725,7 +735,9 @@ async function installReleasedPins(repoRoot, { attempts = 20, delayMs = Number(p
725
735
  // pin: make every dependency on a package published from the given
726
736
  // repositories follow that package's current version, keeping ^/~, then
727
737
  // install, commit and push. Moved from Vibe64 Online's deploy orchestrator.
728
- async function pinCommand({ cwd: repoRoot, from, dryRun }) {
738
+ // --no-commit stops after the install, leaving the edits for the caller to
739
+ // build from and discard (a deploy rehearsal).
740
+ async function pinCommand({ cwd: repoRoot, from, dryRun, noCommit }) {
729
741
  const versions = new Map();
730
742
  for (const dir of from) {
731
743
  for (const record of await discoverReleasePackages(dir)) versions.set(record.name, record.packageJson.version);
@@ -749,6 +761,10 @@ async function pinCommand({ cwd: repoRoot, from, dryRun }) {
749
761
  return;
750
762
  }
751
763
  await installReleasedPins(repoRoot);
764
+ if (noCommit) {
765
+ process.stdout.write(`${path.basename(repoRoot)}: pins installed; not committed\n`);
766
+ return;
767
+ }
752
768
  commitAndPush(repoRoot, "Consume released packages");
753
769
  }
754
770