@dokebi/cli 0.2.2 → 0.2.4
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/AI.md +25 -5
- package/README.md +3 -1
- package/dist/bin.js +110 -1
- package/dist/configuration-scaffold.js +3 -0
- package/dist/configuration.d.ts +2 -2
- package/dist/configuration.js +11 -2
- package/dist/dev-guard.d.ts +1 -0
- package/dist/dev-guard.js +9 -0
- package/dist/diagnostics.d.ts +21 -0
- package/dist/diagnostics.js +87 -0
- package/dist/install-module.js +13 -2
- package/dist/log-writer.d.ts +1 -0
- package/dist/log-writer.js +133 -0
- package/dist/logging-config.d.ts +14 -0
- package/dist/logging-config.js +48 -0
- package/dist/npm-client.js +9 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.js +1 -1
- package/dist/project-inspector.js +9 -0
- package/dist/project.js +9 -5
- package/dist/rotating-log.d.ts +27 -0
- package/dist/rotating-log.js +166 -0
- package/dist/server.d.ts +99 -0
- package/dist/server.js +857 -0
- package/dist/transaction.js +10 -1
- package/dist/vite-watch.d.ts +1 -0
- package/dist/vite-watch.js +23 -0
- package/dist/workspace.js +6 -2
- package/package.json +3 -3
package/dist/transaction.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lstat, mkdir, mkdtemp, open, readdir, readFile, rename, rm, rmdir, writeFile, } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
+
import { debug, debugEnabled, describeError, reportError } from './diagnostics.js';
|
|
3
4
|
import { CliError } from './errors.js';
|
|
4
5
|
import { exists, fingerprint, json, securePath } from './filesystem.js';
|
|
5
6
|
export class Transaction {
|
|
@@ -32,7 +33,10 @@ export class Transaction {
|
|
|
32
33
|
return new Transaction(root, await mkdtemp(join(control, 'transaction-')));
|
|
33
34
|
}
|
|
34
35
|
catch (cause) {
|
|
35
|
-
await handle.close().catch(() => {
|
|
36
|
+
await handle.close().catch((error) => {
|
|
37
|
+
// The lock is removed below either way; the original failure is what the caller gets.
|
|
38
|
+
reportError('LOCK_CLOSE_FAILED', 'Unable to close .dokebi/lock', error);
|
|
39
|
+
});
|
|
36
40
|
await rm(lock, { force: true });
|
|
37
41
|
throw cause;
|
|
38
42
|
}
|
|
@@ -125,6 +129,11 @@ export class Transaction {
|
|
|
125
129
|
await afterApply?.();
|
|
126
130
|
}
|
|
127
131
|
catch (cause) {
|
|
132
|
+
if (debugEnabled())
|
|
133
|
+
debug('Commit failed; rolling back', {
|
|
134
|
+
changes: journal.length,
|
|
135
|
+
error: describeError(cause),
|
|
136
|
+
});
|
|
128
137
|
const failures = [];
|
|
129
138
|
for (const change of [...journal].reverse()) {
|
|
130
139
|
try {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Run by `dokebi dev` (D-0044) for one Vite config: a watch build that never empties its outDir.
|
|
2
|
+
// The browser build's `emptyOutDir: true` would otherwise delete dist/ssr/ on every rebuild,
|
|
3
|
+
// which is fine for `npm run build` (one build after the other) but not for two watchers.
|
|
4
|
+
// Every finished build is reported to dev over the IPC channel ({ built: true } or
|
|
5
|
+
// { failed: true }); output goes to the terminal as usual.
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
const configFile = process.argv[2];
|
|
9
|
+
if (!configFile)
|
|
10
|
+
throw new Error('usage: vite-watch <config>');
|
|
11
|
+
const vite = (await import(pathToFileURL(join(process.cwd(), 'node_modules/vite/dist/node/index.js')).href));
|
|
12
|
+
const watcher = (await vite.build({
|
|
13
|
+
configFile,
|
|
14
|
+
build: { watch: {}, emptyOutDir: false },
|
|
15
|
+
}));
|
|
16
|
+
watcher.on('event', (event) => {
|
|
17
|
+
if (event.code === 'BUNDLE_END')
|
|
18
|
+
void event.result?.close();
|
|
19
|
+
if (event.code === 'END')
|
|
20
|
+
process.send?.({ built: true });
|
|
21
|
+
if (event.code === 'ERROR')
|
|
22
|
+
process.send?.({ failed: true });
|
|
23
|
+
});
|
package/dist/workspace.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { glob, readFile, realpath } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join, relative, sep } from 'node:path';
|
|
3
|
+
import { isMissing, reportError } from './diagnostics.js';
|
|
3
4
|
import { CliError } from './errors.js';
|
|
4
5
|
import { exists, relativePath, securePath } from './filesystem.js';
|
|
5
6
|
/** `*` matches one path segment, `**` any number; patterns are npm `workspaces` entries. */
|
|
@@ -33,8 +34,11 @@ export async function workspaceRootOf(project) {
|
|
|
33
34
|
if (!hidden && patternsOf(pkg).some((item) => matches(item, member)))
|
|
34
35
|
return directory;
|
|
35
36
|
}
|
|
36
|
-
catch {
|
|
37
|
-
|
|
37
|
+
catch (error) {
|
|
38
|
+
// No package.json here: keep walking up. An unreadable or invalid one is reported and
|
|
39
|
+
// skipped the same way, so a broken parent folder does not block the command.
|
|
40
|
+
if (!isMissing(error))
|
|
41
|
+
reportError('WORKSPACE_PACKAGE_INVALID', 'Skipping an unreadable package.json', error);
|
|
38
42
|
}
|
|
39
43
|
if (dirname(directory) === directory)
|
|
40
44
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dokebi/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"semver": "7.8.5",
|
|
27
|
-
"@dokebi/core": "0.2.2",
|
|
28
|
-
"@dokebi/config": "0.2.2",
|
|
27
|
+
"@dokebi/core": "^0.2.2",
|
|
28
|
+
"@dokebi/config": "^0.2.2",
|
|
29
29
|
"yaml": "2.9.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|