@dokebi/cli 0.4.32 → 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 +2 -2
- package/dist/output.d.ts +1 -1
- package/dist/output.js +1 -1
- package/dist/transaction.js +26 -3
- package/package.json +1 -1
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.
|
|
4
|
+
"cli": "0.4.33",
|
|
5
5
|
"core": {
|
|
6
6
|
"package": "@dokebi/core",
|
|
7
7
|
"version": "0.4.6"
|
|
@@ -807,7 +807,7 @@
|
|
|
807
807
|
{
|
|
808
808
|
"id": null,
|
|
809
809
|
"package": "@dokebi/cli",
|
|
810
|
-
"version": "0.4.
|
|
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.",
|
package/dist/output.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.4.
|
|
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
package/dist/transaction.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|