zyrk 0.6.4 → 0.6.5

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
@@ -178,7 +178,14 @@ For `create next-app`, the native adapter accepts resolved create-next-app
178
178
  scaffold check covers 16.4.2. Other versions fail before execution. zyrk passes the official `--skip-install` flag to
179
179
  create-next-app, validates the generated project manifest, then installs its
180
180
  dependencies through zyrk using the same store and registry configuration. An
181
- explicit `--skip-install` leaves the generated project uninstalled. The official
181
+ explicit `--skip-install` leaves the generated project uninstalled.
182
+ The private initializer displays `Using zyrk.` for native installation, or
183
+ `Scaffolding only; dependency installation skipped.` for an explicit skip. This
184
+ adapts verified upstream display statements without changing shared source
185
+ files, installer execution, generated metadata, or unrelated npm text. An
186
+ unrecognized display contract fails before the initializer runs. Conflicting
187
+ `--use-npm`, `--use-pnpm`, `--use-yarn`, and `--use-bun` selections require an
188
+ explicit `--skip-install`; remove them to install with zyrk. The official
182
189
  flag can select create-next-app's configuration defaults instead of prompting
183
190
  for each choice; pass its explicit configuration flags to customize them. Its
184
191
  interactive project-name prompt remains available. Supply an explicit target
package/VERSION CHANGED
@@ -1 +1 @@
1
- v0.6.4
1
+ v0.6.5
package/dist/cli/main.js CHANGED
@@ -621,7 +621,7 @@ async function runToolCommand(command, parsed, options, version) {
621
621
  options.stderr.write(isNext
622
622
  ? tail.includes("--skip-install")
623
623
  ? "zyrk: Next scaffolding only; dependency installation was explicitly skipped.\n"
624
- : "zyrk: Next scaffolder runs with --skip-install; zyrk will install dependencies.\n"
624
+ : "zyrk: Creating Next.js application; dependencies will install with zyrk.\n"
625
625
  : "zyrk: This initializer controls its own dependency installation.\n");
626
626
  const progress = createInstallProgress(options.stderr, false);
627
627
  try {
@@ -0,0 +1,2 @@
1
+ export declare function adaptNextDisplay(script: string, version: string, skipInstall: boolean): Promise<void>;
2
+ //# sourceMappingURL=next-display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-display.d.ts","sourceRoot":"","sources":["../../src/dlx/next-display.ts"],"names":[],"mappings":"AAQA,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,IAAI,CAAC,CA8Cf"}
@@ -0,0 +1,36 @@
1
+ /** A display-only adaptation of verified create-next-app statement shapes.
2
+ * Official source: v16.4.2 create-app.ts and templates/index.ts. Installer
3
+ * selection and executable logic stay upstream; --skip-install keeps the
4
+ * native zyrk installation separate. Only the private initializer is edited.
5
+ */
6
+ import { lstat, readFile, writeFile } from "node:fs/promises";
7
+ import { ZyrkError } from "../errors.js";
8
+ export async function adaptNextDisplay(script, version, skipInstall) {
9
+ const file = await lstat(script);
10
+ if (!file.isFile() || file.nlink !== 1 || (file.mode & 0o200) === 0)
11
+ throw new ZyrkError("ZYRK_INTERNAL", "Cannot adapt the Next initializer without an independent writable script.", {
12
+ remedy: "Retry with a private initializer generation; never make shared store files writable.",
13
+ });
14
+ const original = await readFile(script, "utf8");
15
+ // Match complete neighboring statements, not arbitrary output strings. Minifier
16
+ // variable names can vary; the verified statement structure must match once.
17
+ const header = /console\.log\(`Creating a new Next\.js app in \$\{\(0,([A-Za-z_$][\w$]*)\.green\)\(([A-Za-z_$][\w$]*)\)\}\.`\);console\.log\(\);process\.chdir\(\2\);/g;
18
+ const label = /console\.log\(\(0,([A-Za-z_$][\w$]*)\.bold\)\(`Using \$\{[A-Za-z_$][\w$]*\}\.`\)\);(?=console\.log\("\\nInitializing project with template:",[A-Za-z_$][\w$]*,"\\n"\);)/g;
19
+ const headers = [...original.matchAll(header)];
20
+ const labels = [...original.matchAll(label)];
21
+ if (headers.length !== 1 ||
22
+ labels.length !== 1 ||
23
+ headers[0][1] !== labels[0][1])
24
+ throw new ZyrkError("ZYRK_RESOLUTION_FAILED", "Cannot adapt the selected Next initializer: its display contract is unsupported.", {
25
+ detail: { package: "create-next-app", version },
26
+ remedy: "Select create-next-app@16.4.2 or report this version so its upstream display contract can be verified.",
27
+ });
28
+ const message = skipInstall
29
+ ? "Scaffolding only; dependency installation skipped."
30
+ : "Using zyrk.";
31
+ const adapted = original
32
+ .replace(label, "")
33
+ .replace(header, (statement, color, target) => statement.slice(0, -`process.chdir(${target});`.length) +
34
+ `console.log((0,${color}.bold)(${JSON.stringify(message)}));console.log();process.chdir(${target});`);
35
+ await writeFile(script, adapted);
36
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/dlx/next.ts"],"names":[],"mappings":"AAQA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAuC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAEtE;AA4CD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,UAAU,GAAG;IAAE,iBAAiB,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CAAE,GACzE,OAAO,CAAC,SAAS,CAAC,CAkGpB"}
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../src/dlx/next.ts"],"names":[],"mappings":"AASA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAuC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAEtE;AA4CD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,UAAU,GAAG;IAAE,iBAAiB,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CAAE,GACzE,OAAO,CAAC,SAAS,CAAC,CAoHpB"}
package/dist/dlx/next.js CHANGED
@@ -5,6 +5,7 @@
5
5
  import { lstat, readFile, readdir } from "node:fs/promises";
6
6
  import * as path from "node:path";
7
7
  import { satisfies } from "semver";
8
+ import { adaptNextDisplay } from "./next-display.js";
8
9
  import { ZyrkError } from "../errors.js";
9
10
  import { installProject } from "../install/run.js";
10
11
  import { isErrno } from "../util/fsx.js";
@@ -106,6 +107,11 @@ export async function runNextInitializer(options) {
106
107
  throw failed("Next initializer target already has a project manifest.");
107
108
  const entries = explicit === undefined ? new Set(await readdir(cwd)) : undefined;
108
109
  const skipInstall = flags.has("--skip-install");
110
+ if (!skipInstall &&
111
+ [...flags].some((flag) => ["--use-npm", "--use-pnpm", "--use-yarn", "--use-bun"].includes(flag)))
112
+ throw new ZyrkError("ZYRK_USAGE", "Cannot select another dependency installer for zyrk create next-app.", {
113
+ remedy: "Remove --use-npm/--use-pnpm/--use-yarn/--use-bun to install with zyrk, or pass --skip-install to scaffold only.",
114
+ });
109
115
  // Insert before -- so it remains an option when the user supplies a literal target.
110
116
  const forwarded = [...args];
111
117
  if (!skipInstall) {
@@ -123,7 +129,7 @@ export async function runNextInitializer(options) {
123
129
  remedy: "Select create-next-app 15.x or 16.x; the native create adapter requires the verified --skip-install contract.",
124
130
  });
125
131
  },
126
- });
132
+ }, async ({ script, version }) => adaptNextDisplay(script, version, skipInstall));
127
133
  if (result.exitCode !== 0)
128
134
  return result;
129
135
  let directory = explicit;
package/dist/dlx/run.d.ts CHANGED
@@ -57,5 +57,9 @@ export declare function splitDlxSpec(spec: string): {
57
57
  export declare function runDlx(options: DlxOptions): Promise<DlxResult>;
58
58
  /** Initializers copy and rewrite their shipped templates, so their full
59
59
  * closure must use independent writable files (I-001, I-002, F-017). */
60
- export declare function runInitializer(options: DlxOptions): Promise<DlxResult>;
60
+ export declare function runInitializer(options: DlxOptions, prepare?: (tool: {
61
+ script: string;
62
+ name: string;
63
+ version: string;
64
+ }) => Promise<void>): Promise<DlxResult>;
61
65
  //# sourceMappingURL=run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"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MAAM,CAAC;IAChB,iEAAiE;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAqBA;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpE;AAED;wEACwE;AACxE,wBAAsB,cAAc,CAClC,OAAO,EAAE,UAAU,EACnB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,KAAK,OAAO,CAAC,IAAI,CAAC,GAClB,OAAO,CAAC,SAAS,CAAC,CAEpB"}
package/dist/dlx/run.js CHANGED
@@ -59,10 +59,10 @@ export async function runDlx(options) {
59
59
  }
60
60
  /** Initializers copy and rewrite their shipped templates, so their full
61
61
  * closure must use independent writable files (I-001, I-002, F-017). */
62
- export async function runInitializer(options) {
63
- return runTemporaryTool(options, true);
62
+ export async function runInitializer(options, prepare) {
63
+ return runTemporaryTool(options, true, prepare);
64
64
  }
65
- async function runTemporaryTool(options, writable) {
65
+ async function runTemporaryTool(options, writable, prepare) {
66
66
  const { store, registry } = options;
67
67
  const args = options.args ?? [];
68
68
  const cwd = options.cwd ?? process.cwd();
@@ -148,6 +148,7 @@ async function runTemporaryTool(options, writable) {
148
148
  if (binTarget === undefined)
149
149
  throw internal(`selected bin ${binKey} vanished`);
150
150
  const script = await resolveBinScript(toolPkgDir, tool, binKey, binTarget);
151
+ await prepare?.({ script, name: tool.name, version: tool.version });
151
152
  const bins = {};
152
153
  for (const [name, target] of Object.entries(tool.bin)) {
153
154
  bins[name] = await resolveBinScript(toolPkgDir, tool, name, target);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyrk",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Storage-efficient Node package manager: one verified store per user, shared across projects through links.",
5
5
  "license": "MIT",
6
6
  "type": "module",