create-nx-archweave 0.3.0 → 0.3.2
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/dist/bin.js +13 -4
- package/dist/cli/execute.d.ts +9 -1
- package/dist/index.js +12 -4
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -948,7 +948,7 @@ function createStepContext(workspacePath) {
|
|
|
948
948
|
}
|
|
949
949
|
};
|
|
950
950
|
}
|
|
951
|
-
function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext) {
|
|
951
|
+
function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext, now = Date.now) {
|
|
952
952
|
const completed = [];
|
|
953
953
|
for (const step of plan.steps) {
|
|
954
954
|
const cwd = step.cwd === null ? invokedFromDir : join2(invokedFromDir, step.cwd);
|
|
@@ -968,16 +968,18 @@ function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext)
|
|
|
968
968
|
}
|
|
969
969
|
args = finalized;
|
|
970
970
|
}
|
|
971
|
+
const startedAt = now();
|
|
971
972
|
const result = exec(step.command, args, plan.env ? { cwd, env: plan.env } : { cwd });
|
|
973
|
+
const durationMs = now() - startedAt;
|
|
972
974
|
if (result.status !== 0) {
|
|
973
975
|
if (step.optional) {
|
|
974
976
|
const optionalFailure = result.status === null ? "it did not start or was stopped (no exit code)" : `exit code: ${result.status} (its own error output is printed above)`;
|
|
975
|
-
completed.push({ step, result, args, optionalFailure });
|
|
977
|
+
completed.push({ step, result, args, optionalFailure, durationMs });
|
|
976
978
|
continue;
|
|
977
979
|
}
|
|
978
|
-
return { ok: false, completed, failedStep: step, failedResult: result, failedArgs: args };
|
|
980
|
+
return { ok: false, completed, failedStep: step, failedResult: result, failedArgs: args, failedDurationMs: durationMs };
|
|
979
981
|
}
|
|
980
|
-
completed.push({ step, result, args });
|
|
982
|
+
completed.push({ step, result, args, durationMs });
|
|
981
983
|
}
|
|
982
984
|
return { ok: true, completed };
|
|
983
985
|
}
|
|
@@ -1018,6 +1020,11 @@ function renderExecuteReport(report, plan, workspaceName) {
|
|
|
1018
1020
|
...renderRemainingSteps(report, plan, workspaceName)
|
|
1019
1021
|
].join("\n");
|
|
1020
1022
|
}
|
|
1023
|
+
function renderStepTimings(report) {
|
|
1024
|
+
const rows = report.completed.filter((c) => c.durationMs !== void 0).map((c) => [c.step.id, c.durationMs]);
|
|
1025
|
+
if (!report.ok && report.failedDurationMs !== void 0) rows.push([`${report.failedStep.id} (failed)`, report.failedDurationMs]);
|
|
1026
|
+
return ["Step timings:", ...rows.map(([id, ms]) => ` ${(ms / 1e3).toFixed(1).padStart(7)}s ${id}`)].join("\n");
|
|
1027
|
+
}
|
|
1021
1028
|
function renderRemainingSteps(report, plan, workspaceName) {
|
|
1022
1029
|
const start = plan.steps.indexOf(report.failedStep);
|
|
1023
1030
|
const remaining = start === -1 ? [report.failedStep] : plan.steps.slice(start);
|
|
@@ -1185,6 +1192,8 @@ async function main(argv) {
|
|
|
1185
1192
|
}
|
|
1186
1193
|
const report = executePlan(plan, createProcessExec(), process.cwd());
|
|
1187
1194
|
console.log(renderExecuteReport(report, plan, name));
|
|
1195
|
+
if (process.env["CREATE_NX_ARCHWEAVE_TIMINGS"] === "1") console.log(`
|
|
1196
|
+
${renderStepTimings(report)}`);
|
|
1188
1197
|
return report.ok ? 0 : 1;
|
|
1189
1198
|
}
|
|
1190
1199
|
function readVersion(manager) {
|
package/dist/cli/execute.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface CompletedStep {
|
|
|
26
26
|
skipped?: string;
|
|
27
27
|
/** An optional step that failed (the run went on): the exit status, or why it never ran. */
|
|
28
28
|
optionalFailure?: string;
|
|
29
|
+
/** How long the step's command ran; absent when it never ran. */
|
|
30
|
+
durationMs?: number;
|
|
29
31
|
}
|
|
30
32
|
export type ExecuteReport = {
|
|
31
33
|
ok: true;
|
|
@@ -39,6 +41,8 @@ export type ExecuteReport = {
|
|
|
39
41
|
failedArgs?: string[];
|
|
40
42
|
/** Set when finalizeArgs refused — the step never executed. */
|
|
41
43
|
finalizeError?: string;
|
|
44
|
+
/** How long the failed step's command ran; absent when it never ran. */
|
|
45
|
+
failedDurationMs?: number;
|
|
42
46
|
};
|
|
43
47
|
/** Real StepContext over the created workspace (tests inject their own). */
|
|
44
48
|
export declare function createStepContext(workspacePath: string): StepContext;
|
|
@@ -49,9 +53,13 @@ export declare function createStepContext(workspacePath: string): StepContext;
|
|
|
49
53
|
* `optional` step is the exception: its failure is recorded and the run goes on. This function itself never deletes anything;
|
|
50
54
|
* it only reports.
|
|
51
55
|
*/
|
|
52
|
-
export declare function executePlan(plan: CreatePlan, exec: PlanExec, invokedFromDir: string, ctxFactory?: (workspacePath: string) => StepContext): ExecuteReport;
|
|
56
|
+
export declare function executePlan(plan: CreatePlan, exec: PlanExec, invokedFromDir: string, ctxFactory?: (workspacePath: string) => StepContext, now?: () => number): ExecuteReport;
|
|
53
57
|
/** Renders the final message printed after `executePlan` returns — success prints the
|
|
54
58
|
* plan's next-steps guidance; failure explains which step failed and how to recover,
|
|
55
59
|
* explicitly noting the created directory is left in place (never auto-deleted). */
|
|
56
60
|
export declare function renderExecuteReport(report: ExecuteReport, plan: CreatePlan, workspaceName: string): string;
|
|
61
|
+
/** How long each step that ran took, slowest work first in plan order: printed when
|
|
62
|
+
* CREATE_NX_ARCHWEAVE_TIMINGS=1 (the e2e scripts set it to see where a slow run spends its
|
|
63
|
+
* time). */
|
|
64
|
+
export declare function renderStepTimings(report: ExecuteReport): string;
|
|
57
65
|
//# sourceMappingURL=execute.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -778,7 +778,7 @@ function createStepContext(workspacePath) {
|
|
|
778
778
|
}
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
|
-
function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext) {
|
|
781
|
+
function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext, now = Date.now) {
|
|
782
782
|
const completed = [];
|
|
783
783
|
for (const step of plan.steps) {
|
|
784
784
|
const cwd = step.cwd === null ? invokedFromDir : join2(invokedFromDir, step.cwd);
|
|
@@ -798,16 +798,18 @@ function executePlan(plan, exec, invokedFromDir, ctxFactory = createStepContext)
|
|
|
798
798
|
}
|
|
799
799
|
args = finalized;
|
|
800
800
|
}
|
|
801
|
+
const startedAt = now();
|
|
801
802
|
const result = exec(step.command, args, plan.env ? { cwd, env: plan.env } : { cwd });
|
|
803
|
+
const durationMs = now() - startedAt;
|
|
802
804
|
if (result.status !== 0) {
|
|
803
805
|
if (step.optional) {
|
|
804
806
|
const optionalFailure = result.status === null ? "it did not start or was stopped (no exit code)" : `exit code: ${result.status} (its own error output is printed above)`;
|
|
805
|
-
completed.push({ step, result, args, optionalFailure });
|
|
807
|
+
completed.push({ step, result, args, optionalFailure, durationMs });
|
|
806
808
|
continue;
|
|
807
809
|
}
|
|
808
|
-
return { ok: false, completed, failedStep: step, failedResult: result, failedArgs: args };
|
|
810
|
+
return { ok: false, completed, failedStep: step, failedResult: result, failedArgs: args, failedDurationMs: durationMs };
|
|
809
811
|
}
|
|
810
|
-
completed.push({ step, result, args });
|
|
812
|
+
completed.push({ step, result, args, durationMs });
|
|
811
813
|
}
|
|
812
814
|
return { ok: true, completed };
|
|
813
815
|
}
|
|
@@ -848,6 +850,11 @@ function renderExecuteReport(report, plan, workspaceName) {
|
|
|
848
850
|
...renderRemainingSteps(report, plan, workspaceName)
|
|
849
851
|
].join("\n");
|
|
850
852
|
}
|
|
853
|
+
function renderStepTimings(report) {
|
|
854
|
+
const rows = report.completed.filter((c) => c.durationMs !== void 0).map((c) => [c.step.id, c.durationMs]);
|
|
855
|
+
if (!report.ok && report.failedDurationMs !== void 0) rows.push([`${report.failedStep.id} (failed)`, report.failedDurationMs]);
|
|
856
|
+
return ["Step timings:", ...rows.map(([id, ms]) => ` ${(ms / 1e3).toFixed(1).padStart(7)}s ${id}`)].join("\n");
|
|
857
|
+
}
|
|
851
858
|
function renderRemainingSteps(report, plan, workspaceName) {
|
|
852
859
|
const start = plan.steps.indexOf(report.failedStep);
|
|
853
860
|
const remaining = start === -1 ? [report.failedStep] : plan.steps.slice(start);
|
|
@@ -906,6 +913,7 @@ export {
|
|
|
906
913
|
parseReviewProviderAnswer,
|
|
907
914
|
pendingBuildDecisions,
|
|
908
915
|
renderExecuteReport,
|
|
916
|
+
renderStepTimings,
|
|
909
917
|
renderUsage,
|
|
910
918
|
renderVersion,
|
|
911
919
|
reviewProviderConflict,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nx-archweave",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Create a ready-to-work Nx workspace in one command: FSD Lite lint rule, boundaries, AI agent rules, templates and AI PR review",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "clearlydev (https://github.com/clearlydev)",
|
|
7
7
|
"engines": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "git+https://github.com/clearlydev/nx-archweave.git",
|
|
13
13
|
"directory": "packages/create-nx-archweave"
|
|
14
14
|
},
|
|
15
|
-
"homepage": "https://github.com/clearlydev/nx-archweave
|
|
15
|
+
"homepage": "https://github.com/clearlydev/nx-archweave#readme",
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/clearlydev/nx-archweave/issues"
|
|
18
18
|
},
|