@dokebi/cli 0.4.31 → 0.4.33

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/catalog.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by scripts/catalog/build.ts from package.json dokebiCatalog fields and packages/cli/catalog-src (D-0065). Do not edit; run node scripts/catalog/build.ts.",
3
3
  "schemaVersion": 1,
4
- "cli": "0.4.31",
4
+ "cli": "0.4.33",
5
5
  "core": {
6
6
  "package": "@dokebi/core",
7
7
  "version": "0.4.6"
@@ -567,7 +567,7 @@
567
567
  {
568
568
  "id": "dokebi-auth",
569
569
  "package": "@dokebi/auth",
570
- "version": "0.4.1",
570
+ "version": "0.4.2",
571
571
  "kind": "plugin",
572
572
  "summary": "Login on your own user table: sessions, remember-me, API tokens, route protection, authorize hook, password hashing, login throttling, realms; optional Google/Apple social login",
573
573
  "description": "Login for @dokebi/web on your own user table through an extension class: sessions, remember-me, API tokens (personal, access/refresh), route protection, authorization hook, password hashing, login throttling, realms.",
@@ -807,7 +807,7 @@
807
807
  {
808
808
  "id": null,
809
809
  "package": "@dokebi/cli",
810
- "version": "0.4.31",
810
+ "version": "0.4.33",
811
811
  "kind": "cli",
812
812
  "summary": "Commands to create a project, browse the plugin catalog, run recipes, install plugins and verify (dokebi)",
813
813
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
@@ -1866,7 +1866,7 @@
1866
1866
  {
1867
1867
  "id": "dokebi-mail",
1868
1868
  "package": "@dokebi/mail",
1869
- "version": "0.4.2",
1869
+ "version": "0.4.3",
1870
1870
  "kind": "plugin",
1871
1871
  "summary": "Mail: EJS templates per locale, SMTP with required STARTTLS (nodemailer) and Amazon SES v2, queued sending through @dokebi/job with sealed links and tokens, a development inbox and test outbox",
1872
1872
  "description": "Mail for Dokebi apps: EJS templates per locale, SMTP (nodemailer, STARTTLS required) and Amazon SES v2, queued sending through @dokebi/job with sealed data, deterministic Message-IDs, a development inbox and test helpers.",
@@ -3416,7 +3416,7 @@
3416
3416
  {
3417
3417
  "id": "dokebi-two-factor",
3418
3418
  "package": "@dokebi/two-factor",
3419
- "version": "0.1.1",
3419
+ "version": "0.1.2",
3420
3420
  "kind": "plugin",
3421
3421
  "summary": "Two-factor sign-in for @dokebi/auth: TOTP codes of authenticator apps (secrets encrypted at rest, a code good once), ten recovery codes kept as HMACs, a second step after the password, remembered devices, lockout after wrong codes, and a code confirmation for the re-authentication page",
3422
3422
  "description": "Two-factor sign-in for @dokebi/auth: TOTP codes of authenticator apps (secrets encrypted at rest), recovery codes stored as HMACs, a second step after the password, remembered devices, lockout, and a code confirmation for re-authentication.",
package/dist/output.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const CLI_VERSION = "0.4.31";
1
+ export declare const CLI_VERSION = "0.4.33";
2
2
  export declare function envelope(command: string, result: unknown, ok?: boolean): object;
3
3
  export declare function failure(command: string, error: unknown, mutationStarted: boolean): object;
package/dist/output.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CliError } from './errors.js';
2
- export const CLI_VERSION = '0.4.31';
2
+ export const CLI_VERSION = '0.4.33';
3
3
  export function envelope(command, result, ok = true) {
4
4
  return { schemaVersion: 1, cliVersion: CLI_VERSION, command, ok, result, error: null };
5
5
  }
@@ -28,6 +28,24 @@ async function observe(path) {
28
28
  return 'other';
29
29
  return `file:${await hashing.sha256File(path)}`;
30
30
  }
31
+ /**
32
+ * What the plan saw at `path` (checked again by the commit): `fingerprint`, except for the
33
+ * project's node_modules folder, whose time changes without any package changing: a running
34
+ * `dokebi dev` writes Vite's dependency cache (`node_modules/.vite`, `.vite-temp`) there, and an
35
+ * upgrade right after another then failed with CONCURRENT_CHANGE. npm rewrites its hidden lockfile
36
+ * `node_modules/.package-lock.json` on every install, so the folder is its identity and that
37
+ * file; without the file (another package manager) the folder's time as before.
38
+ */
39
+ async function planFingerprint(root, path) {
40
+ const full = await securePath(root, path);
41
+ const seen = await fingerprint(full);
42
+ if (path !== 'node_modules' || !seen?.startsWith('directory:'))
43
+ return seen;
44
+ const installed = await fingerprint(join(full, '.package-lock.json'));
45
+ if (installed === null)
46
+ return seen;
47
+ return `directory:${(await lstat(full)).ino}:npm:${installed}`;
48
+ }
31
49
  const LINK_UNSUPPORTED = new Set(['EPERM', 'ENOTSUP', 'EOPNOTSUPP', 'EMLINK', 'EXDEV']);
32
50
  /** Why `now` is not the `installed` fingerprint (both as `observe` writes them). */
33
51
  function differs(installed, now) {
@@ -240,7 +258,7 @@ export class Transaction {
240
258
  }
241
259
  async capture(path) {
242
260
  if (!this.#snapshots.has(path))
243
- this.#snapshots.set(path, await fingerprint(await securePath(this.root, path)));
261
+ this.#snapshots.set(path, await planFingerprint(this.root, path));
244
262
  }
245
263
  async ensureDirectory(path) {
246
264
  const parts = path.split('/');
@@ -343,8 +361,13 @@ export class Transaction {
343
361
  throw interruptedError(this.#interrupted);
344
362
  this.#committing = true;
345
363
  for (const [path, expected] of this.#snapshots) {
346
- if ((await fingerprint(await securePath(this.root, path))) !== expected) {
347
- throw new CliError('CONCURRENT_CHANGE', `File changed while planning: ${path}`);
364
+ if ((await planFingerprint(this.root, path)) !== expected) {
365
+ throw new CliError('CONCURRENT_CHANGE', `File changed while planning: ${path}`, {
366
+ details: {
367
+ path,
368
+ fix: `something else changed ${path} while this command ran (another dokebi or npm command, an editor); nothing was written: run the same command again`,
369
+ },
370
+ });
348
371
  }
349
372
  }
350
373
  // A staged folder is recognised by its dev:ino, and a file system hands a freed inode number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dokebi/cli",
3
- "version": "0.4.31",
3
+ "version": "0.4.33",
4
4
  "description": "Project scaffolding, plugin catalog, recipes, install and verification CLI for Dokebi.",
5
5
  "keywords": [
6
6
  "dokebi",