zyrk 0.3.8 → 0.3.9

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 (189) hide show
  1. package/VERSION +1 -1
  2. package/bin/zyrk.js +1 -1
  3. package/dist/cli/main.d.ts +54 -0
  4. package/dist/cli/main.d.ts.map +1 -0
  5. package/dist/cli/main.js +473 -0
  6. package/dist/cli/npm-delegate.d.ts +38 -0
  7. package/dist/cli/npm-delegate.d.ts.map +1 -0
  8. package/{src/cli/npm-delegate.ts → dist/cli/npm-delegate.js} +26 -55
  9. package/dist/cli/parse.d.ts +40 -0
  10. package/dist/cli/parse.d.ts.map +1 -0
  11. package/dist/cli/parse.js +78 -0
  12. package/dist/commands/dependencies.d.ts +12 -0
  13. package/dist/commands/dependencies.d.ts.map +1 -0
  14. package/dist/commands/dependencies.js +118 -0
  15. package/dist/commands/deploy.d.ts +15 -0
  16. package/dist/commands/deploy.d.ts.map +1 -0
  17. package/dist/commands/deploy.js +506 -0
  18. package/dist/commands/maintenance.d.ts +27 -0
  19. package/dist/commands/maintenance.d.ts.map +1 -0
  20. package/dist/commands/maintenance.js +198 -0
  21. package/dist/commands/patch.d.ts +38 -0
  22. package/dist/commands/patch.d.ts.map +1 -0
  23. package/dist/commands/patch.js +336 -0
  24. package/dist/commands/project.d.ts +15 -0
  25. package/dist/commands/project.d.ts.map +1 -0
  26. package/dist/commands/project.js +396 -0
  27. package/dist/commands/store.d.ts +10 -0
  28. package/dist/commands/store.d.ts.map +1 -0
  29. package/dist/commands/store.js +551 -0
  30. package/dist/config/paths.d.ts +37 -0
  31. package/dist/config/paths.d.ts.map +1 -0
  32. package/dist/config/paths.js +66 -0
  33. package/dist/dlx/create.d.ts +23 -0
  34. package/dist/dlx/create.d.ts.map +1 -0
  35. package/dist/dlx/create.js +59 -0
  36. package/dist/dlx/run.d.ts +54 -0
  37. package/dist/dlx/run.d.ts.map +1 -0
  38. package/dist/dlx/run.js +274 -0
  39. package/dist/errors.d.ts +68 -0
  40. package/dist/errors.d.ts.map +1 -0
  41. package/dist/errors.js +111 -0
  42. package/dist/extract/tarball.d.ts +82 -0
  43. package/dist/extract/tarball.d.ts.map +1 -0
  44. package/dist/extract/tarball.js +645 -0
  45. package/dist/fetch/all.d.ts +48 -0
  46. package/dist/fetch/all.d.ts.map +1 -0
  47. package/dist/fetch/all.js +127 -0
  48. package/dist/fetch/package.d.ts +45 -0
  49. package/dist/fetch/package.d.ts.map +1 -0
  50. package/dist/fetch/package.js +124 -0
  51. package/dist/fetch/registry.d.ts +109 -0
  52. package/dist/fetch/registry.d.ts.map +1 -0
  53. package/dist/fetch/registry.js +418 -0
  54. package/dist/install/import-npm.d.ts +4 -0
  55. package/dist/install/import-npm.d.ts.map +1 -0
  56. package/dist/install/import-npm.js +147 -0
  57. package/dist/install/lock.d.ts +8 -0
  58. package/dist/install/lock.d.ts.map +1 -0
  59. package/dist/install/lock.js +146 -0
  60. package/dist/install/metadata.d.ts +19 -0
  61. package/dist/install/metadata.d.ts.map +1 -0
  62. package/dist/install/metadata.js +79 -0
  63. package/dist/install/registry.d.ts +8 -0
  64. package/dist/install/registry.d.ts.map +1 -0
  65. package/dist/install/registry.js +59 -0
  66. package/dist/install/run.d.ts +32 -0
  67. package/dist/install/run.d.ts.map +1 -0
  68. package/dist/install/run.js +545 -0
  69. package/dist/lockfile/fingerprints.d.ts +35 -0
  70. package/dist/lockfile/fingerprints.d.ts.map +1 -0
  71. package/dist/lockfile/fingerprints.js +56 -0
  72. package/dist/lockfile/read.d.ts +27 -0
  73. package/dist/lockfile/read.d.ts.map +1 -0
  74. package/dist/lockfile/read.js +126 -0
  75. package/dist/lockfile/types.d.ts +74 -0
  76. package/dist/lockfile/types.d.ts.map +1 -0
  77. package/dist/lockfile/types.js +17 -0
  78. package/dist/lockfile/write.d.ts +39 -0
  79. package/dist/lockfile/write.d.ts.map +1 -0
  80. package/dist/lockfile/write.js +180 -0
  81. package/dist/log.d.ts +21 -0
  82. package/dist/log.d.ts.map +1 -0
  83. package/dist/log.js +79 -0
  84. package/dist/project/projection.d.ts +50 -0
  85. package/dist/project/projection.d.ts.map +1 -0
  86. package/dist/project/projection.js +276 -0
  87. package/dist/resolve/resolver.d.ts +75 -0
  88. package/dist/resolve/resolver.d.ts.map +1 -0
  89. package/dist/resolve/resolver.js +533 -0
  90. package/dist/resolve/spec.d.ts +26 -0
  91. package/dist/resolve/spec.d.ts.map +1 -0
  92. package/dist/resolve/spec.js +87 -0
  93. package/dist/store/db.d.ts +49 -0
  94. package/dist/store/db.d.ts.map +1 -0
  95. package/{src/store/db.ts → dist/store/db.js} +106 -206
  96. package/dist/store/graph.d.ts +60 -0
  97. package/dist/store/graph.d.ts.map +1 -0
  98. package/dist/store/graph.js +115 -0
  99. package/dist/store/layout.d.ts +71 -0
  100. package/dist/store/layout.d.ts.map +1 -0
  101. package/dist/store/layout.js +282 -0
  102. package/dist/store/manifests.d.ts +78 -0
  103. package/dist/store/manifests.d.ts.map +1 -0
  104. package/dist/store/manifests.js +238 -0
  105. package/dist/store/objects.d.ts +56 -0
  106. package/dist/store/objects.d.ts.map +1 -0
  107. package/dist/store/objects.js +157 -0
  108. package/dist/store/realize.d.ts +38 -0
  109. package/dist/store/realize.d.ts.map +1 -0
  110. package/dist/store/realize.js +227 -0
  111. package/dist/store/source.d.ts +42 -0
  112. package/dist/store/source.d.ts.map +1 -0
  113. package/dist/store/source.js +169 -0
  114. package/dist/store/txn.d.ts +37 -0
  115. package/dist/store/txn.d.ts.map +1 -0
  116. package/dist/store/txn.js +97 -0
  117. package/dist/store/verify.d.ts +40 -0
  118. package/dist/store/verify.d.ts.map +1 -0
  119. package/dist/store/verify.js +396 -0
  120. package/dist/util/fsx.d.ts +54 -0
  121. package/dist/util/fsx.d.ts.map +1 -0
  122. package/dist/util/fsx.js +259 -0
  123. package/dist/util/hash.d.ts +48 -0
  124. package/dist/util/hash.d.ts.map +1 -0
  125. package/dist/util/hash.js +80 -0
  126. package/dist/util/ids.d.ts +19 -0
  127. package/dist/util/ids.d.ts.map +1 -0
  128. package/dist/util/ids.js +38 -0
  129. package/dist/util/integrity.d.ts +97 -0
  130. package/dist/util/integrity.d.ts.map +1 -0
  131. package/dist/util/integrity.js +192 -0
  132. package/dist/util/json.d.ts +14 -0
  133. package/dist/util/json.d.ts.map +1 -0
  134. package/dist/util/json.js +78 -0
  135. package/dist/util/locks.d.ts +40 -0
  136. package/dist/util/locks.d.ts.map +1 -0
  137. package/dist/util/locks.js +186 -0
  138. package/dist/util/proc.d.ts +32 -0
  139. package/dist/util/proc.d.ts.map +1 -0
  140. package/dist/util/proc.js +84 -0
  141. package/dist/version.d.ts +27 -0
  142. package/dist/version.d.ts.map +1 -0
  143. package/{src/version.ts → dist/version.js} +0 -8
  144. package/package.json +5 -3
  145. package/src/cli/main.ts +0 -602
  146. package/src/cli/parse.ts +0 -106
  147. package/src/commands/dependencies.ts +0 -154
  148. package/src/commands/deploy.ts +0 -777
  149. package/src/commands/maintenance.ts +0 -260
  150. package/src/commands/patch.ts +0 -408
  151. package/src/commands/project.ts +0 -598
  152. package/src/commands/store.ts +0 -689
  153. package/src/config/paths.ts +0 -119
  154. package/src/dlx/create.ts +0 -69
  155. package/src/dlx/run.ts +0 -389
  156. package/src/errors.ts +0 -142
  157. package/src/extract/tarball.ts +0 -868
  158. package/src/fetch/all.ts +0 -206
  159. package/src/fetch/package.ts +0 -181
  160. package/src/fetch/registry.ts +0 -615
  161. package/src/install/import-npm.ts +0 -177
  162. package/src/install/lock.ts +0 -176
  163. package/src/install/metadata.ts +0 -122
  164. package/src/install/registry.ts +0 -88
  165. package/src/install/run.ts +0 -760
  166. package/src/lockfile/fingerprints.ts +0 -74
  167. package/src/lockfile/read.ts +0 -198
  168. package/src/lockfile/types.ts +0 -75
  169. package/src/lockfile/write.ts +0 -257
  170. package/src/log.ts +0 -100
  171. package/src/project/projection.ts +0 -390
  172. package/src/resolve/resolver.ts +0 -757
  173. package/src/resolve/spec.ts +0 -131
  174. package/src/store/graph.ts +0 -175
  175. package/src/store/layout.ts +0 -431
  176. package/src/store/manifests.ts +0 -347
  177. package/src/store/objects.ts +0 -229
  178. package/src/store/realize.ts +0 -322
  179. package/src/store/source.ts +0 -249
  180. package/src/store/txn.ts +0 -118
  181. package/src/store/verify.ts +0 -433
  182. package/src/types/vendor.d.ts +0 -120
  183. package/src/util/fsx.ts +0 -289
  184. package/src/util/hash.ts +0 -117
  185. package/src/util/ids.ts +0 -42
  186. package/src/util/integrity.ts +0 -269
  187. package/src/util/json.ts +0 -89
  188. package/src/util/locks.ts +0 -266
  189. package/src/util/proc.ts +0 -108
@@ -16,14 +16,11 @@
16
16
  * operate outside zyrk's dependency management. Global installs are never
17
17
  * delegated (F-018); see parse.ts.
18
18
  */
19
-
20
19
  import { spawn } from "node:child_process";
21
- import { ZyrkError } from "../errors.ts";
22
- import { closeCode } from "../util/proc.ts";
23
-
20
+ import { ZyrkError } from "../errors.js";
21
+ import { closeCode } from "../util/proc.js";
24
22
  /** Delegated command, its aliases collapsed, plus help text. */
25
- const DELEGATED_COMMANDS: ReadonlyArray<readonly [readonly string[], string]> =
26
- [
23
+ const DELEGATED_COMMANDS = [
27
24
  [["publish"], "Publish the current package to the registry (via npm)."],
28
25
  [["unpublish"], "Remove a published version from the registry (via npm)."],
29
26
  [["access"], "Manage package access and visibility (via npm)."],
@@ -36,62 +33,36 @@ const DELEGATED_COMMANDS: ReadonlyArray<readonly [readonly string[], string]> =
36
33
  [["whoami"], "Show the authenticated registry username (via npm)."],
37
34
  [["ping"], "Check registry authentication and reachability (via npm)."],
38
35
  [["pack"], "Create a tarball from the current package (via npm)."],
39
- ];
40
-
41
- export const DELEGATED_COMMAND_NAMES: ReadonlySet<string> = new Set(
42
- DELEGATED_COMMANDS.flatMap(([names]) => names),
43
- );
44
-
45
- export function isDelegatedCommand(command: string): boolean {
46
- return DELEGATED_COMMAND_NAMES.has(command);
36
+ ];
37
+ export const DELEGATED_COMMAND_NAMES = new Set(DELEGATED_COMMANDS.flatMap(([names]) => names));
38
+ export function isDelegatedCommand(command) {
39
+ return DELEGATED_COMMAND_NAMES.has(command);
47
40
  }
48
-
49
- export function delegatedHelpLines(): string[] {
50
- return DELEGATED_COMMANDS.map(
51
- ([names, description]) =>
52
- ` ${names.join(", ").padEnd(22, " ")}${description}`,
53
- );
41
+ export function delegatedHelpLines() {
42
+ return DELEGATED_COMMANDS.map(([names, description]) => ` ${names.join(", ").padEnd(22, " ")}${description}`);
54
43
  }
55
-
56
- export type DelegateOptions = {
57
- command: string;
58
- /** Raw tokens after the command, verbatim (may include --json, --, -g). */
59
- args: readonly string[];
60
- env: NodeJS.ProcessEnv;
61
- stderr: { write(chunk: string): unknown };
62
- };
63
-
64
44
  /**
65
45
  * Exec `npm <command> <args...>` with inherited stdio. Resolves with the
66
46
  * child exit code, or 128 plus the signal number when signaled (the shell
67
47
  * convention), so callers observe the same termination. Rejects with
68
48
  * ZYRK_NPM_UNAVAILABLE when npm cannot be launched.
69
49
  */
70
- export async function delegateToNpm(options: DelegateOptions): Promise<number> {
71
- options.stderr.write(
72
- `zyrk: delegating \`zyrk ${options.command}\` to npm; zyrk does not implement publishing or registry authentication.\n`,
73
- );
74
- return new Promise((resolve, reject) => {
75
- const child = spawn("npm", [options.command, ...options.args], {
76
- env: options.env,
77
- stdio: "inherit",
50
+ export async function delegateToNpm(options) {
51
+ options.stderr.write(`zyrk: delegating \`zyrk ${options.command}\` to npm; zyrk does not implement publishing or registry authentication.\n`);
52
+ return new Promise((resolve, reject) => {
53
+ const child = spawn("npm", [options.command, ...options.args], {
54
+ env: options.env,
55
+ stdio: "inherit",
56
+ });
57
+ child.on("error", (error) => {
58
+ reject(new ZyrkError("ZYRK_NPM_UNAVAILABLE", "zyrk could not launch npm for an explicitly delegated command.", {
59
+ detail: { command: options.command },
60
+ remedy: "Install Node.js with npm on PATH, or run the npm command directly.",
61
+ cause: error,
62
+ }));
63
+ });
64
+ child.on("close", (code, signal) => {
65
+ resolve(closeCode(code, signal));
66
+ });
78
67
  });
79
- child.on("error", (error) => {
80
- reject(
81
- new ZyrkError(
82
- "ZYRK_NPM_UNAVAILABLE",
83
- "zyrk could not launch npm for an explicitly delegated command.",
84
- {
85
- detail: { command: options.command },
86
- remedy:
87
- "Install Node.js with npm on PATH, or run the npm command directly.",
88
- cause: error,
89
- },
90
- ),
91
- );
92
- });
93
- child.on("close", (code, signal) => {
94
- resolve(closeCode(code, signal));
95
- });
96
- });
97
68
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Minimal argv parsing for the zyrk CLI (SPEC 15).
3
+ *
4
+ * zyrk takes no global configuration file of its own here: flags are parsed
5
+ * per invocation. `--json` anywhere before the `--` separator selects the
6
+ * machine-readable envelope. Everything after `--` belongs to the requested
7
+ * user command (SPEC 15.3.1: flags following the separator for `run`/`exec`
8
+ * remain user arguments, never zyrk options).
9
+ */
10
+ export type ParsedArgs = {
11
+ help: boolean;
12
+ version: boolean;
13
+ /** The requested command, or undefined when none was given. */
14
+ command: string | undefined;
15
+ /** Everything that is not the command, `--json`, or `--help`/`--version`. */
16
+ commandArgs: string[];
17
+ /** Raw tokens after the command token, verbatim, for npm delegation. */
18
+ argsAfterCommand: string[];
19
+ /**
20
+ * Non-zyrk tokens placed before the command token, in order. Delegation
21
+ * forwards these too: a leading protective flag such as `--dry-run`
22
+ * belongs to npm, and dropping it would silently change what runs (S05).
23
+ */
24
+ argsBeforeCommand: string[];
25
+ json: boolean;
26
+ };
27
+ export declare function parseArgs(argv: readonly string[]): ParsedArgs;
28
+ /**
29
+ * Detect global-install mode before any work happens.
30
+ *
31
+ * Exact tokens `-g` and `--global` in any position, plus the `--global=true`
32
+ * spelling, select global mode; `install`/`add` take no `--` payload, so
33
+ * tokens after a separator are still zyrk's. Explicit local selections
34
+ * (`--no-global`, `--global=false`) do not trigger. zyrk defines no
35
+ * configuration that selects global-install mode, so the only remaining
36
+ * channel is the environment npm itself documents: `npm_config_global=true`
37
+ * is honored as a fail-safe, never as a silent conversion.
38
+ */
39
+ export declare function isGlobalInstallRequest(command: string, commandArgs: readonly string[], env: NodeJS.ProcessEnv): boolean;
40
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/cli/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,6EAA6E;IAC7E,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,wEAAwE;IACxE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAkD7D;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,OAAO,CAOT"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Minimal argv parsing for the zyrk CLI (SPEC 15).
3
+ *
4
+ * zyrk takes no global configuration file of its own here: flags are parsed
5
+ * per invocation. `--json` anywhere before the `--` separator selects the
6
+ * machine-readable envelope. Everything after `--` belongs to the requested
7
+ * user command (SPEC 15.3.1: flags following the separator for `run`/`exec`
8
+ * remain user arguments, never zyrk options).
9
+ */
10
+ export function parseArgs(argv) {
11
+ const parsed = {
12
+ help: false,
13
+ version: false,
14
+ command: undefined,
15
+ commandArgs: [],
16
+ argsAfterCommand: [],
17
+ argsBeforeCommand: [],
18
+ json: false,
19
+ };
20
+ let separator = false;
21
+ let commandIndex = -1;
22
+ argv.forEach((token, index) => {
23
+ if (separator) {
24
+ parsed.commandArgs.push(token);
25
+ return;
26
+ }
27
+ if (token === "--") {
28
+ separator = true;
29
+ parsed.commandArgs.push(token);
30
+ return;
31
+ }
32
+ if (token === "--json") {
33
+ parsed.json = true;
34
+ return;
35
+ }
36
+ if (parsed.command === undefined &&
37
+ (token === "--help" || token === "-h")) {
38
+ parsed.help = true;
39
+ return;
40
+ }
41
+ if (parsed.command === undefined &&
42
+ (token === "--version" || token === "-v")) {
43
+ parsed.version = true;
44
+ return;
45
+ }
46
+ if (parsed.command === undefined && !token.startsWith("-")) {
47
+ parsed.command = token;
48
+ commandIndex = index;
49
+ return;
50
+ }
51
+ if (parsed.command === undefined)
52
+ parsed.argsBeforeCommand.push(token);
53
+ parsed.commandArgs.push(token);
54
+ });
55
+ if (commandIndex >= 0)
56
+ parsed.argsAfterCommand = argv.slice(commandIndex + 1);
57
+ return parsed;
58
+ }
59
+ /** Commands whose global-install mode zyrk rejects (SPEC 15.3.1, 22.3). */
60
+ const GLOBAL_INSTALL_COMMANDS = new Set(["install", "i", "add"]);
61
+ /**
62
+ * Detect global-install mode before any work happens.
63
+ *
64
+ * Exact tokens `-g` and `--global` in any position, plus the `--global=true`
65
+ * spelling, select global mode; `install`/`add` take no `--` payload, so
66
+ * tokens after a separator are still zyrk's. Explicit local selections
67
+ * (`--no-global`, `--global=false`) do not trigger. zyrk defines no
68
+ * configuration that selects global-install mode, so the only remaining
69
+ * channel is the environment npm itself documents: `npm_config_global=true`
70
+ * is honored as a fail-safe, never as a silent conversion.
71
+ */
72
+ export function isGlobalInstallRequest(command, commandArgs, env) {
73
+ if (!GLOBAL_INSTALL_COMMANDS.has(command))
74
+ return false;
75
+ if (env.npm_config_global === "true")
76
+ return true;
77
+ return commandArgs.some((token) => token === "-g" || token === "--global" || token === "--global=true");
78
+ }
@@ -0,0 +1,12 @@
1
+ import type { RegistryClient } from "../fetch/registry.ts";
2
+ import type { Store } from "../store/layout.ts";
3
+ import { type InstallResult } from "../install/run.ts";
4
+ export type DependencyCommand = "add" | "remove" | "update" | "import";
5
+ export declare function runDependencyCommand(options: {
6
+ command: DependencyCommand;
7
+ args: readonly string[];
8
+ projectDir: string;
9
+ store: Store;
10
+ registry: RegistryClient;
11
+ }): Promise<InstallResult>;
12
+ //# sourceMappingURL=dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/commands/dependencies.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAavE,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;CAC1B,GAAG,OAAO,CAAC,aAAa,CAAC,CA0HzB"}
@@ -0,0 +1,118 @@
1
+ /** Parse dependency edits; the installer owns resolution and atomic publication. */
2
+ import npa from "npm-package-arg";
3
+ import { ZyrkError } from "../errors.js";
4
+ import { packageName } from "../install/lock.js";
5
+ import { installProject, } from "../install/run.js";
6
+ function usage(command, reason) {
7
+ return new ZyrkError("ZYRK_USAGE", `Cannot ${command} dependencies: ${reason}.`, {
8
+ remedy: "Use add <spec...>, remove <name...>, update [--latest] [name...], or import --from npm; review zyrk --help for supported options.",
9
+ });
10
+ }
11
+ export async function runDependencyCommand(options) {
12
+ const { command } = options;
13
+ const install = {
14
+ projectDir: options.projectDir,
15
+ store: options.store,
16
+ registry: options.registry,
17
+ };
18
+ const names = [];
19
+ let from;
20
+ let latest = false;
21
+ let positional = false;
22
+ for (let i = 0; i < options.args.length; i++) {
23
+ const arg = options.args[i];
24
+ if (!positional && arg === "--") {
25
+ positional = true;
26
+ continue;
27
+ }
28
+ if (!positional && arg.startsWith("-")) {
29
+ switch (arg) {
30
+ case "-D":
31
+ case "--save-dev":
32
+ if (command !== "add")
33
+ throw usage(command, "--save-dev is only valid for add");
34
+ install.saveDev = true;
35
+ break;
36
+ case "-O":
37
+ case "--save-optional":
38
+ if (command !== "add")
39
+ throw usage(command, "--save-optional is only valid for add");
40
+ install.saveOptional = true;
41
+ break;
42
+ case "-E":
43
+ case "--save-exact":
44
+ if (command !== "add" && command !== "update")
45
+ throw usage(command, "--save-exact is only valid for add or update");
46
+ install.saveExact = true;
47
+ break;
48
+ case "--latest":
49
+ if (command !== "update")
50
+ throw usage(command, "--latest is only valid for update");
51
+ latest = true;
52
+ break;
53
+ case "--ignore-scripts":
54
+ install.ignoreScripts = true;
55
+ break;
56
+ case "--lockfile-only":
57
+ install.lockfileOnly = true;
58
+ break;
59
+ case "--from":
60
+ if (command !== "import" || from !== undefined)
61
+ throw usage(command, "unexpected --from option");
62
+ from = options.args[++i];
63
+ if (from === undefined)
64
+ throw usage(command, "--from requires npm");
65
+ break;
66
+ default:
67
+ if (arg.startsWith("--from=") &&
68
+ command === "import" &&
69
+ from === undefined) {
70
+ from = arg.slice(7);
71
+ break;
72
+ }
73
+ if (command === "add" &&
74
+ ["-g", "--global", "--global=true"].includes(arg))
75
+ throw new ZyrkError("ZYRK_GLOBAL_INSTALL_UNSUPPORTED", "Cannot install global dependencies through zyrk.", { remedy: "Run npm install --global directly instead." });
76
+ throw usage(command, "an unsupported option was supplied");
77
+ }
78
+ }
79
+ else
80
+ names.push(arg);
81
+ }
82
+ if (install.saveDev && install.saveOptional)
83
+ throw usage(command, "development and optional dependency groups conflict");
84
+ switch (command) {
85
+ case "add":
86
+ if (!names.length)
87
+ throw usage(command, "at least one package specification is required");
88
+ for (const name of names) {
89
+ try {
90
+ const parsed = npa(name);
91
+ if (!parsed.name ||
92
+ !packageName(parsed.name) ||
93
+ !["version", "range", "tag", "alias"].includes(parsed.type))
94
+ throw new Error("unsupported");
95
+ }
96
+ catch {
97
+ throw usage(command, "a registry package specification is invalid");
98
+ }
99
+ }
100
+ install.specs = names;
101
+ break;
102
+ case "remove":
103
+ case "update":
104
+ if (command === "remove" && !names.length)
105
+ throw usage(command, "at least one direct dependency name is required");
106
+ if (names.some((name) => !packageName(name)))
107
+ throw usage(command, "expected direct dependency names without versions");
108
+ install.mutation =
109
+ command === "remove" ? { remove: names } : { update: names, latest };
110
+ break;
111
+ case "import":
112
+ if (from !== "npm" || names.length)
113
+ throw usage(command, "import requires --from npm and no package arguments");
114
+ install.importNpm = true;
115
+ break;
116
+ }
117
+ return installProject(install);
118
+ }
@@ -0,0 +1,15 @@
1
+ export type DeployCommandOptions = {
2
+ command: "deploy" | "docker";
3
+ args: readonly string[];
4
+ cwd: string;
5
+ env: NodeJS.ProcessEnv;
6
+ stdout: {
7
+ write(chunk: string): unknown;
8
+ };
9
+ stderr: {
10
+ write(chunk: string): unknown;
11
+ };
12
+ json?: boolean;
13
+ };
14
+ export declare function runDeployCommand(options: DeployCommandOptions): Promise<number>;
15
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA8CA,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,MAAM,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,MAAM,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAwEF,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAmUjB"}