@verentis/cli 0.2.13 → 0.2.15

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
@@ -164,7 +164,26 @@ At runtime this is still an iframe launch: the SDK receives
164
164
 
165
165
  ## Marketplace publishing
166
166
 
167
+ ```
168
+
169
+ ## Create projects from npm templates
170
+
171
+ Create commands use published npm template packages rather than GitHub template
172
+ repositories:
173
+
167
174
  ```bash
175
+ verentis create application my-app
176
+ verentis create engine my-python-engine
177
+ verentis create bundle sample-data
178
+ verentis create canvas-component starter-widgets
179
+ ```
180
+
181
+ The initial mappings are `@verentis/template-application`,
182
+ `@verentis/template-engine`, `@verentis/template-bundle`, and
183
+ `@verentis/template-canvas-component`. Use `--package` for a compatible
184
+ third-party template, `--version` to pin it, and `--registry` for a private
185
+ npm registry. Templates are installed with `npm pack --ignore-scripts` and
186
+ support `{{name}}` and `{{type}}` substitutions.bash
168
187
  verentis publisher create --name acme --display-name "Acme Inc."
169
188
  verentis publisher create --name acme --display-name "Acme Inc." --logo ./brand/logo.png
170
189
  verentis publisher update --description "Tools for data teams" --website https://acme.example
@@ -173,7 +192,9 @@ verentis publisher logo remove
173
192
  verentis keygen # Ed25519 signing key + register public half
174
193
  verentis init my-app --kind application
175
194
  verentis pack # signed .vpkg (--encrypt seals the payload)
176
- verentis publish my-app-0.1.0.vpkg
195
+ verentis pack . --env production # writes my-app-production-<version>.vpkg
196
+ verentis pack . --bump-version # increments metadata.version.patch in the manifest
197
+ verentis publish # publishes the highest-version .vpkg in the current directory
177
198
  verentis package list # your packages
178
199
  verentis package versions acme/my-app
179
200
  verentis package deprecate my-app --message "use my-app-2"
@@ -225,8 +246,10 @@ node after installation. See the platform docs (`marketplace/packaging`) for the
225
246
 
226
247
  Packing behaviour:
227
248
  - `packaging.files` globs select the payload; without them, applications automatically include every `./…` schema `source` referenced by the manifest.
228
- - `pack --env production` merges `environments/production.yaml`; `--overlay <path>` selects an
229
- explicit overlay, and `--version <version>` overrides the packed manifest version. `validate`
249
+ - `pack --env production` merges `environments/production.yaml` and includes `production` in the
250
+ output filename; `--overlay <path>` selects an explicit overlay, `--set-version <version>`
251
+ overrides the packed manifest version, and `--bump-version` increments the authored patch version.
252
+ `publish` without a file selects the highest-version `.vpkg` in the current directory. `validate`
230
253
  accepts the same overlay selectors.
231
254
  - Marketplace files are selected independently of `packaging.files` and written to deterministic,
232
255
  content-addressed `catalog/assets/**` and `catalog/docs/**` entries described by
package/dist/index.js CHANGED
@@ -3,13 +3,15 @@ import { Command, Option } from 'commander';
3
3
  import { mkdir, stat, writeFile, readFile, readdir, realpath, mkdtemp, rm, glob } from 'fs/promises';
4
4
  import { tmpdir, homedir } from 'os';
5
5
  import { resolve, basename, dirname, posix, join, isAbsolute, extname, relative, sep } from 'path';
6
- import { spawn, spawnSync } from 'child_process';
6
+ import { execFile, spawn, spawnSync } from 'child_process';
7
+ import { promisify } from 'util';
8
+ import * as tar from 'tar';
9
+ import { extract } from 'tar';
7
10
  import { generateKeyPairSync, createHash, randomUUID, randomBytes, createCipheriv, createPublicKey, verify, diffieHellman, hkdfSync, sign, createPrivateKey } from 'crypto';
8
- import { parse, stringify } from 'yaml';
11
+ import { parse, stringify, parseDocument } from 'yaml';
9
12
  import { createWriteStream, readFileSync, createReadStream } from 'fs';
10
13
  import { Readable } from 'stream';
11
14
  import { pipeline } from 'stream/promises';
12
- import * as tar from 'tar';
13
15
  import { fileURLToPath } from 'url';
14
16
 
15
17
  function insecureFetchOptions(insecure) {
@@ -137,7 +139,7 @@ async function refreshIdentityToken(apiUrl, refreshToken, insecure) {
137
139
  `Session could not be renewed${payload?.error ? ` (${payload.error})` : ` (${res.status})`}. Run \`verentis login\` again.`
138
140
  );
139
141
  }
140
- var sleep = (ms) => new Promise((resolve11) => setTimeout(resolve11, ms));
142
+ var sleep = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
141
143
 
142
144
  // src/http.ts
143
145
  var ApiError = class extends Error {
@@ -810,6 +812,105 @@ function registerApiKey(program2) {
810
812
  console.log(`Removed ${scopeName} from API key ${apiKeyId}.`);
811
813
  });
812
814
  }
815
+ var execFileAsync = promisify(execFile);
816
+ var TEMPLATE_PACKAGES = {
817
+ application: "@verentis/template-application",
818
+ engine: "@verentis/template-engine",
819
+ bundle: "@verentis/template-bundle",
820
+ "canvas-component": "@verentis/template-canvas-component"
821
+ };
822
+ function normalizeTemplateType(value) {
823
+ const normalized = value.trim().toLowerCase().replace(/[_\s]+/g, "-");
824
+ if (normalized === "canvas" || normalized === "component" || normalized === "canvas-pack") {
825
+ return "canvas-component";
826
+ }
827
+ if (normalized === "app") return "application";
828
+ if (normalized === "execution-engine") return "engine";
829
+ if (normalized === "bundle") return "bundle";
830
+ if (normalized === "application" || normalized === "engine" || normalized === "canvas-component") {
831
+ return normalized;
832
+ }
833
+ throw new Error(`Unknown template type '${value}' \u2014 use application, engine, bundle or canvas-component.`);
834
+ }
835
+ async function createFromTemplate(typeValue, name, destination, options = {}) {
836
+ const type = normalizeTemplateType(typeValue);
837
+ validateProjectName(name);
838
+ const target = resolve(destination ?? name);
839
+ if (await exists(target)) {
840
+ if (!options.force) throw new Error(`${target} already exists. Choose another directory or pass --force.`);
841
+ if (!(await stat(target)).isDirectory()) throw new Error(`${target} exists and is not a directory.`);
842
+ if ((await readdir(target)).length > 0) throw new Error(`${target} is not empty. --force only allows an existing empty directory.`);
843
+ } else {
844
+ await mkdir(target, { recursive: true });
845
+ }
846
+ const packageName = options.packageName ?? TEMPLATE_PACKAGES[type];
847
+ const spec = options.version ? `${packageName}@${options.version}` : packageName;
848
+ const tempDir = await mkdtemp(join(tmpdir(), "verentis-template-"));
849
+ try {
850
+ const { stdout } = await execFileAsync("npm", [
851
+ "pack",
852
+ spec,
853
+ "--json",
854
+ "--ignore-scripts",
855
+ ...options.registry ? ["--registry", options.registry] : []
856
+ ], { cwd: tempDir, maxBuffer: 1024 * 1024 });
857
+ const result = JSON.parse(stdout);
858
+ const archive = result[0]?.filename;
859
+ if (!archive) throw new Error(`npm pack did not return an archive for ${spec}.`);
860
+ await extractTemplateArchive(join(tempDir, archive), target);
861
+ await substituteTemplateValues(target, { name, type });
862
+ } finally {
863
+ await rm(tempDir, { recursive: true, force: true });
864
+ }
865
+ return { type, packageName, directory: target };
866
+ }
867
+ async function extractTemplateArchive(archive, target) {
868
+ await extract({ file: archive, cwd: target, strip: 1 });
869
+ }
870
+ async function substituteTemplateValues(root, values) {
871
+ const entries = await readdir(root, { withFileTypes: true });
872
+ for (const entry of entries) {
873
+ const path = join(root, entry.name);
874
+ if (entry.isDirectory()) {
875
+ await substituteTemplateValues(path, values);
876
+ continue;
877
+ }
878
+ if (!entry.isFile() || entry.name === "node_modules") continue;
879
+ const content = await readFile(path);
880
+ if (content.includes(0)) continue;
881
+ const text = content.toString("utf8");
882
+ const substituted = text.replace(/\{\{(name|type)\}\}/g, (_, key) => values[key] ?? "");
883
+ if (substituted !== text) await writeFile(path, substituted);
884
+ }
885
+ }
886
+ function validateProjectName(name) {
887
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) {
888
+ throw new Error(`Invalid project name '${name}' \u2014 use lowercase letters, digits and hyphens.`);
889
+ }
890
+ }
891
+ async function exists(path) {
892
+ try {
893
+ await stat(path);
894
+ return true;
895
+ } catch {
896
+ return false;
897
+ }
898
+ }
899
+
900
+ // src/commands/create.ts
901
+ function registerCreate(program2) {
902
+ program2.command("create <type> <name> [directory]").description("Create a project from an npm-backed Verentis template").option("--package <name>", "override the npm template package").option("--version <version>", "use a specific template package version").option("--registry <url>", "use an npm registry other than the default").option("--force", "create in an existing empty directory").action(async (type, name, directory, options) => {
903
+ const result = await createFromTemplate(type, name, directory, {
904
+ packageName: options.package,
905
+ version: options.version,
906
+ registry: options.registry,
907
+ force: options.force
908
+ });
909
+ console.log(`Created ${result.type} project in ${result.directory}`);
910
+ console.log(` template: ${result.packageName}`);
911
+ console.log("Next steps: install dependencies, then run `verentis validate` and `verentis pack`.");
912
+ });
913
+ }
813
914
  function buildLocalContext(input) {
814
915
  const payload = decodeJwtPayload(input.accessToken);
815
916
  const expiresAt = payload?.exp ? new Date(payload.exp * 1e3).toISOString() : void 0;
@@ -895,6 +996,24 @@ async function loadManifest(path) {
895
996
  }
896
997
  return manifest;
897
998
  }
999
+ function bumpPatchVersion(version) {
1000
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version.trim());
1001
+ if (!match) {
1002
+ throw new Error(`Cannot bump version '${version}' \u2014 expected a semantic version like 1.2.3.`);
1003
+ }
1004
+ return `${match[1]}.${match[2]}.${Number(match[3]) + 1}`;
1005
+ }
1006
+ async function bumpManifestPatchVersion(path, currentVersion) {
1007
+ const text = await readFile(path, "utf8");
1008
+ const nextVersion = bumpPatchVersion(currentVersion);
1009
+ const document = parseDocument(text);
1010
+ if (document.errors.length > 0) {
1011
+ throw new Error(`Failed to parse manifest at ${path}: ${document.errors.map((error) => error.message).join(" ")}`);
1012
+ }
1013
+ document.setIn(["metadata", "version"], nextVersion);
1014
+ await writeFile(path, document.toString());
1015
+ return nextVersion;
1016
+ }
898
1017
  function validateApplicationSplashSection(kind, spec) {
899
1018
  if (kind !== "Application" || !spec || typeof spec !== "object" || Array.isArray(spec)) return [];
900
1019
  const applicationSpec = spec;
@@ -1029,6 +1148,7 @@ function validateManifest(manifest) {
1029
1148
  if (!meta[field]) error(`metadata.${field} is required`);
1030
1149
  }
1031
1150
  const spec = manifest.spec ?? {};
1151
+ validateManifestIcons(meta, spec, issues);
1032
1152
  const launchKindError = validateLaunchManifestKind(kind, spec);
1033
1153
  if (launchKindError) error(launchKindError);
1034
1154
  if (kind === "ExecutionEngine") {
@@ -1069,6 +1189,29 @@ function validateManifest(manifest) {
1069
1189
  if (!packaging.publisher) warning("packaging.publisher is not set \u2014 `verentis pack`/`publish` will refuse the package");
1070
1190
  return issues;
1071
1191
  }
1192
+ function validateManifestIcons(metadata, spec, issues) {
1193
+ validateOptionalIcon(metadata.icon, "metadata.icon", issues);
1194
+ validateBindingIcons(spec["mime-types"], "spec.mime-types", issues);
1195
+ validateBindingIcons(spec["file-types"], "spec.file-types", issues);
1196
+ if (!Array.isArray(spec["entry-points"])) return;
1197
+ spec["entry-points"].forEach((value, index) => {
1198
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
1199
+ validateOptionalIcon(value.icon, `spec.entry-points[${index}].icon`, issues);
1200
+ validateBindingIcons(value["mime-types"], `spec.entry-points[${index}].mime-types`, issues);
1201
+ });
1202
+ }
1203
+ function validateBindingIcons(bindings, path, issues) {
1204
+ if (!Array.isArray(bindings)) return;
1205
+ bindings.forEach((value, index) => {
1206
+ if (!value || typeof value !== "object" || Array.isArray(value)) return;
1207
+ validateOptionalIcon(value.icon, `${path}[${index}].icon`, issues);
1208
+ });
1209
+ }
1210
+ function validateOptionalIcon(value, path, issues) {
1211
+ if (value !== void 0 && !isNonEmptyString(value)) {
1212
+ issues.push({ level: "error", message: `${path} must be a non-empty string` });
1213
+ }
1214
+ }
1072
1215
  function validateApplicationLaunch(spec, issues) {
1073
1216
  const launch = spec.launch;
1074
1217
  if (launch === void 0) return;
@@ -1564,7 +1707,7 @@ async function followExecution(api, workspaceId, executionId, json) {
1564
1707
  if (exec.status !== "Completed") process.exitCode = 1;
1565
1708
  return;
1566
1709
  }
1567
- await new Promise((resolve11) => setTimeout(resolve11, 1e3));
1710
+ await new Promise((resolve12) => setTimeout(resolve12, 1e3));
1568
1711
  }
1569
1712
  console.error("Timed out waiting for a terminal status \u2014 check `verentis exec get`.");
1570
1713
  process.exitCode = 1;
@@ -1834,13 +1977,13 @@ function registerInit(program2) {
1834
1977
  await mkdir(targetDir, { recursive: true });
1835
1978
  const name = (options.name ?? targetDir.split("/").pop() ?? "my-package").toLowerCase().replace(/[^a-z0-9-]/g, "-");
1836
1979
  const manifestPath = join(targetDir, "manifest.yaml");
1837
- if (await exists(manifestPath)) throw new Error(`${manifestPath} already exists.`);
1980
+ if (await exists2(manifestPath)) throw new Error(`${manifestPath} already exists.`);
1838
1981
  await writeFile(manifestPath, template(name));
1839
1982
  console.log(`Created ${manifestPath} (kind: ${options.kind}).`);
1840
1983
  console.log("Fill in packaging.publisher and packaging.files, then run `verentis pack`.");
1841
1984
  });
1842
1985
  }
1843
- async function exists(path) {
1986
+ async function exists2(path) {
1844
1987
  try {
1845
1988
  await stat(path);
1846
1989
  return true;
@@ -2427,9 +2570,17 @@ async function pack(options) {
2427
2570
  const manifestPath = resolve(options.manifestPath);
2428
2571
  const projectDir = dirname(manifestPath);
2429
2572
  const base = await loadManifest(manifestPath);
2573
+ if (options.version !== void 0 && options.bumpVersion) {
2574
+ throw new Error("Use either --set-version or --bump-version, not both.");
2575
+ }
2430
2576
  const overlayPath = resolveOverlayPath(projectDir, { env: options.env, overlay: options.overlay });
2431
- let manifest = overlayPath ? applyOverlay(base, await loadOverlay(overlayPath)) : base;
2432
- let overrideApplied = overlayPath !== void 0;
2577
+ const overlay = overlayPath ? await loadOverlay(overlayPath) : void 0;
2578
+ if (options.bumpVersion) {
2579
+ const nextVersion = await bumpManifestPatchVersion(manifestPath, base.metadata.version);
2580
+ base.metadata.version = nextVersion;
2581
+ }
2582
+ let manifest = overlay ? applyOverlay(base, overlay) : base;
2583
+ let overrideApplied = overlayPath !== void 0 || options.bumpVersion === true;
2433
2584
  if (options.version !== void 0) {
2434
2585
  manifest = { ...manifest, metadata: { ...manifest.metadata, version: options.version } };
2435
2586
  overrideApplied = true;
@@ -2503,7 +2654,8 @@ async function pack(options) {
2503
2654
  }
2504
2655
  const outDir = resolve(options.outDir ?? projectDir);
2505
2656
  await mkdir(outDir, { recursive: true });
2506
- const outFile = join(outDir, `${name}-${version}.vpkg`);
2657
+ const environmentSuffix = options.env ? `-${options.env}` : "";
2658
+ const outFile = join(outDir, `${name}${environmentSuffix}-${version}.vpkg`);
2507
2659
  const entries = [
2508
2660
  "manifest.yaml",
2509
2661
  ".verentis/package.yaml",
@@ -2676,7 +2828,7 @@ async function readJsonIfExists(path) {
2676
2828
 
2677
2829
  // src/commands/pack.ts
2678
2830
  function registerPack(program2) {
2679
- program2.command("pack [dir]").description("Build a signed .vpkg from a project directory").option("--manifest <path>", "manifest path (default: auto-detected in the project directory)").option("--publisher <name>", "publisher name (default: packaging.publisher in the manifest)").option("--name <name>", "override the package name").option("--env <name>", "merge a per-environment overlay (environments/<name>.yaml) before packing").option("--overlay <path>", "merge an explicit overlay file before packing (wins over --env)").option("--set-version <version>", "override metadata.version (e.g. a CI-derived build number)").option("--out <dir>", "output directory (default: the project directory)").option("--key <name>", "signing key name (default: the configured default key)").option("--no-sign", "produce an unsigned package").option("--encrypt", "seal the payload (AES-256-GCM); requires at least one recipient").option("--recipient <id=base64key...>", "additional X25519 recipient (repeatable)", collectRecipients, []).action(async (dir, options) => {
2831
+ program2.command("pack [dir]").description("Build a signed .vpkg from a project directory").option("--manifest <path>", "manifest path (default: auto-detected in the project directory)").option("--publisher <name>", "publisher name (default: packaging.publisher in the manifest)").option("--name <name>", "override the package name").option("--env <name>", "merge a per-environment overlay (environments/<name>.yaml) before packing").option("--overlay <path>", "merge an explicit overlay file before packing (wins over --env)").option("--set-version <version>", "override metadata.version (e.g. a CI-derived build number)").option("--bump-version", "increment metadata.version.patch and update the manifest").option("--bump", "alias for --bump-version").option("--out <dir>", "output directory (default: the project directory)").option("--key <name>", "signing key name (default: the configured default key)").option("--no-sign", "produce an unsigned package").option("--encrypt", "seal the payload (AES-256-GCM); requires at least one recipient").option("--recipient <id=base64key...>", "additional X25519 recipient (repeatable)", collectRecipients, []).action(async (dir, options) => {
2680
2832
  const projectDir = resolve(dir ?? ".");
2681
2833
  const manifestPath = options.manifest ? resolve(options.manifest) : await findManifest(projectDir);
2682
2834
  const manifest = await loadManifest(manifestPath);
@@ -2714,6 +2866,7 @@ function registerPack(program2) {
2714
2866
  env: options.env,
2715
2867
  overlay: options.overlay,
2716
2868
  version: options.setVersion,
2869
+ bumpVersion: options.bumpVersion || options.bump,
2717
2870
  outDir: options.out,
2718
2871
  signingKey,
2719
2872
  encryptFor
@@ -2988,9 +3141,71 @@ async function uploadPublisherLogo(api, publisherId, path) {
2988
3141
  contentType: logo.contentType
2989
3142
  });
2990
3143
  }
3144
+
3145
+ // src/update/semver.ts
3146
+ function isNewerVersion(candidate, base) {
3147
+ return compareVersions(candidate, base) > 0;
3148
+ }
3149
+ function compareVersions(a, b) {
3150
+ const pa = parse5(a);
3151
+ const pb = parse5(b);
3152
+ for (let i = 0; i < 3; i++) {
3153
+ if (pa.main[i] !== pb.main[i]) return pa.main[i] < pb.main[i] ? -1 : 1;
3154
+ }
3155
+ if (pa.pre.length === 0 && pb.pre.length === 0) return 0;
3156
+ if (pa.pre.length === 0) return 1;
3157
+ if (pb.pre.length === 0) return -1;
3158
+ const len = Math.max(pa.pre.length, pb.pre.length);
3159
+ for (let i = 0; i < len; i++) {
3160
+ if (i >= pa.pre.length) return -1;
3161
+ if (i >= pb.pre.length) return 1;
3162
+ const x = pa.pre[i];
3163
+ const y = pb.pre[i];
3164
+ const xNum = /^\d+$/.test(x);
3165
+ const yNum = /^\d+$/.test(y);
3166
+ if (xNum && yNum) {
3167
+ const nx = Number(x);
3168
+ const ny = Number(y);
3169
+ if (nx !== ny) return nx < ny ? -1 : 1;
3170
+ } else if (xNum !== yNum) {
3171
+ return xNum ? -1 : 1;
3172
+ } else if (x !== y) {
3173
+ return x < y ? -1 : 1;
3174
+ }
3175
+ }
3176
+ return 0;
3177
+ }
3178
+ function parse5(version) {
3179
+ const cleaned = version.trim().replace(/^v/i, "").split("+", 1)[0];
3180
+ const dash = cleaned.indexOf("-");
3181
+ const core = dash === -1 ? cleaned : cleaned.slice(0, dash);
3182
+ const pre = dash === -1 ? "" : cleaned.slice(dash + 1);
3183
+ const parts = core.split(".").map((n) => Number.parseInt(n, 10) || 0);
3184
+ return { main: [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0], pre: pre ? pre.split(".") : [] };
3185
+ }
3186
+
3187
+ // src/commands/registry.ts
3188
+ async function findLatestLocalVpkg(directory) {
3189
+ const entries = await readdir(directory, { withFileTypes: true });
3190
+ const candidates = entries.filter((entry) => entry.isFile() && entry.name.endsWith(".vpkg")).map((entry) => resolve(directory, entry.name));
3191
+ if (candidates.length === 0) {
3192
+ throw new Error(`No .vpkg files found in ${directory}. Pack a package first.`);
3193
+ }
3194
+ let latest;
3195
+ for (const path of candidates) {
3196
+ const contents = await readVpkg(path);
3197
+ const comparison = latest ? compareVersions(contents.metadata.version, latest.version) : 1;
3198
+ if (!latest || comparison > 0 || comparison === 0 && path > latest.path) {
3199
+ latest = { path, version: contents.metadata.version };
3200
+ }
3201
+ }
3202
+ if (!latest) throw new Error(`No readable .vpkg files found in ${directory}.`);
3203
+ return latest.path;
3204
+ }
2991
3205
  function registerRegistry(program2) {
2992
- program2.command("publish <vpkg>").description("Upload a packed .vpkg to the marketplace registry (creates the package on first publish)").option("--visibility <visibility>", "catalog visibility for a newly created package: Public | Private", "Private").action(async (vpkgPath, options) => {
2993
- const contents = await readVpkg(resolve(vpkgPath));
3206
+ program2.command("publish [vpkg]").description("Upload a packed .vpkg to the marketplace registry (creates the package on first publish)").option("--visibility <visibility>", "catalog visibility for a newly created package: Public | Private", "Private").action(async (vpkgPath, options) => {
3207
+ const selectedPath = vpkgPath ? resolve(vpkgPath) : await findLatestLocalVpkg(process.cwd());
3208
+ const contents = await readVpkg(selectedPath);
2994
3209
  if (contents.digestErrors.length > 0) {
2995
3210
  throw new Error(`Refusing to publish: package failed digest verification:
2996
3211
  ${contents.digestErrors.join("\n ")}`);
@@ -3013,7 +3228,7 @@ function registerRegistry(program2) {
3013
3228
  console.log(`Created package ${publisher.name}/${contents.metadata.name} (${visibility.toLowerCase()}).`);
3014
3229
  pkg = { id };
3015
3230
  }
3016
- const version = await uploadVersion(api, pkg.id, resolve(vpkgPath));
3231
+ const version = await uploadVersion(api, pkg.id, selectedPath);
3017
3232
  console.log(`Published ${publisher.name}/${contents.metadata.name}@${version.version} \u2192 ${version.status}`);
3018
3233
  if (version.status === "Submitted") {
3019
3234
  console.log("The version is queued for moderation; it becomes installable once approved and published.");
@@ -3181,48 +3396,6 @@ async function fetchLatestVersion(options = {}) {
3181
3396
  clearTimeout(timer);
3182
3397
  }
3183
3398
  }
3184
-
3185
- // src/update/semver.ts
3186
- function isNewerVersion(candidate, base) {
3187
- return compareVersions(candidate, base) > 0;
3188
- }
3189
- function compareVersions(a, b) {
3190
- const pa = parse5(a);
3191
- const pb = parse5(b);
3192
- for (let i = 0; i < 3; i++) {
3193
- if (pa.main[i] !== pb.main[i]) return pa.main[i] < pb.main[i] ? -1 : 1;
3194
- }
3195
- if (pa.pre.length === 0 && pb.pre.length === 0) return 0;
3196
- if (pa.pre.length === 0) return 1;
3197
- if (pb.pre.length === 0) return -1;
3198
- const len = Math.max(pa.pre.length, pb.pre.length);
3199
- for (let i = 0; i < len; i++) {
3200
- if (i >= pa.pre.length) return -1;
3201
- if (i >= pb.pre.length) return 1;
3202
- const x = pa.pre[i];
3203
- const y = pb.pre[i];
3204
- const xNum = /^\d+$/.test(x);
3205
- const yNum = /^\d+$/.test(y);
3206
- if (xNum && yNum) {
3207
- const nx = Number(x);
3208
- const ny = Number(y);
3209
- if (nx !== ny) return nx < ny ? -1 : 1;
3210
- } else if (xNum !== yNum) {
3211
- return xNum ? -1 : 1;
3212
- } else if (x !== y) {
3213
- return x < y ? -1 : 1;
3214
- }
3215
- }
3216
- return 0;
3217
- }
3218
- function parse5(version) {
3219
- const cleaned = version.trim().replace(/^v/i, "").split("+", 1)[0];
3220
- const dash = cleaned.indexOf("-");
3221
- const core = dash === -1 ? cleaned : cleaned.slice(0, dash);
3222
- const pre = dash === -1 ? "" : cleaned.slice(dash + 1);
3223
- const parts = core.split(".").map((n) => Number.parseInt(n, 10) || 0);
3224
- return { main: [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0], pre: pre ? pre.split(".") : [] };
3225
- }
3226
3399
  var DEFAULT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
3227
3400
  var statePath = () => join(configDir(), "update-check.json");
3228
3401
  async function readUpdateState() {
@@ -3618,6 +3791,7 @@ registerFiles(program);
3618
3791
  registerExec(program);
3619
3792
  registerDev(program);
3620
3793
  registerValidate(program);
3794
+ registerCreate(program);
3621
3795
  registerPublisher(program);
3622
3796
  registerKeygen(program);
3623
3797
  registerInit(program);