@t0.labs/daxta 0.4.4 → 0.4.6
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 +51 -20
- package/assets/viewer.html +53 -15
- package/dist/build/build-spec.js +16 -7
- package/dist/catalog/index.d.ts +24 -1
- package/dist/catalog/index.js +105 -10
- package/dist/cli/inject-main.d.ts +2 -0
- package/dist/cli/inject-main.js +26 -0
- package/dist/cli/install.js +4 -1
- package/dist/cli/jest-hooks.d.ts +2 -0
- package/dist/cli/jest-hooks.js +100 -0
- package/dist/cli/main.js +17 -1
- package/dist/cli/migrate.d.ts +1 -0
- package/dist/cli/migrate.js +1 -0
- package/dist/cli/tree.d.ts +1 -3
- package/dist/cli/tree.js +127 -105
- package/dist/cli/uninstall.d.ts +12 -0
- package/dist/cli/uninstall.js +281 -0
- package/dist/config.d.ts +31 -7
- package/dist/config.js +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/serve/spec-utils.d.ts +5 -0
- package/dist/serve/spec-utils.js +54 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -9,13 +9,15 @@ const install_1 = require("./install");
|
|
|
9
9
|
const migrate_1 = require("./migrate");
|
|
10
10
|
const test_1 = require("./test");
|
|
11
11
|
const tree_1 = require("./tree");
|
|
12
|
+
const uninstall_1 = require("./uninstall");
|
|
12
13
|
function usage() {
|
|
13
14
|
console.log(`DAxTA CLI (@t0.labs/daxta)
|
|
14
15
|
|
|
15
16
|
Usage:
|
|
16
17
|
daxta install [--dry-run] [--skip-dep] [--skip-main] [--yes] [--main <path>] [--fast]
|
|
17
18
|
daxta init (alias of install)
|
|
18
|
-
daxta
|
|
19
|
+
daxta uninstall [--yes] [--dry-run] [--keep-dep] [--fast]
|
|
20
|
+
daxta migrate [--yes] (force upgrade + sidebar prompts)
|
|
19
21
|
daxta test [--script <name>] [--config <jest.json>] [--serve] [--port <n>] [--yes]
|
|
20
22
|
daxta build
|
|
21
23
|
daxta serve [--port <n>]
|
|
@@ -28,6 +30,10 @@ One-shot setup:
|
|
|
28
30
|
pnpm dlx @t0.labs/daxta install
|
|
29
31
|
npx @t0.labs/daxta install
|
|
30
32
|
|
|
33
|
+
Remove completely:
|
|
34
|
+
pnpm dlx @t0.labs/daxta uninstall
|
|
35
|
+
npx @t0.labs/daxta uninstall
|
|
36
|
+
|
|
31
37
|
daxta test = forwards to your package script (Jest stays parent; DAxTA is a plugin)
|
|
32
38
|
daxta tree = choose how paths appear in the /docs sidebar
|
|
33
39
|
`);
|
|
@@ -77,6 +83,16 @@ async function main() {
|
|
|
77
83
|
else {
|
|
78
84
|
(0, migrate_1.reportMigration)({ ...migration, skipped: false });
|
|
79
85
|
}
|
|
86
|
+
await (0, tree_1.runTreeWizard)({ embedded: true, yes: Boolean(flags.yes) });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (command === 'uninstall' || command === 'remove') {
|
|
90
|
+
await (0, uninstall_1.uninstallDaxta)({
|
|
91
|
+
dryRun: Boolean(flags['dry-run']),
|
|
92
|
+
yes: Boolean(flags.yes),
|
|
93
|
+
fast: Boolean(flags.fast),
|
|
94
|
+
keepDep: Boolean(flags['keep-dep']),
|
|
95
|
+
});
|
|
80
96
|
return;
|
|
81
97
|
}
|
|
82
98
|
(0, migrate_1.reportMigration)((0, migrate_1.migrateProject)());
|
package/dist/cli/migrate.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type MigrateResult = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Migrate only when package version ≠ daxta.config `daxtaVersion`
|
|
11
11
|
* (or when `daxtaVersion` is missing). Otherwise no-op.
|
|
12
|
+
* Interactive sidebar prompts run from `daxta migrate` / `daxta install` (CLI), not here.
|
|
12
13
|
*/
|
|
13
14
|
export declare function migrateProject(cwd?: string, options?: {
|
|
14
15
|
force?: boolean;
|
package/dist/cli/migrate.js
CHANGED
|
@@ -193,6 +193,7 @@ function migrateConfigDefaults(configPath, configText) {
|
|
|
193
193
|
/**
|
|
194
194
|
* Migrate only when package version ≠ daxta.config `daxtaVersion`
|
|
195
195
|
* (or when `daxtaVersion` is missing). Otherwise no-op.
|
|
196
|
+
* Interactive sidebar prompts run from `daxta migrate` / `daxta install` (CLI), not here.
|
|
196
197
|
*/
|
|
197
198
|
function migrateProject(cwd = process.cwd(), options = {}) {
|
|
198
199
|
const toVersion = packageVersion();
|
package/dist/cli/tree.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export type TreeWizardOptions = {
|
|
2
2
|
path?: string;
|
|
3
3
|
layout?: string;
|
|
4
|
-
/** Called from install — no extra banner, always ask layout when TTY */
|
|
5
4
|
embedded?: boolean;
|
|
6
5
|
yes?: boolean;
|
|
7
6
|
};
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Also used at the end of `daxta install` so the question is not a hidden separate command.
|
|
8
|
+
* Company docs presentation wizard — install / migrate / `daxta tree`.
|
|
11
9
|
*/
|
|
12
10
|
export declare function runTreeWizard(options?: TreeWizardOptions): Promise<void>;
|
package/dist/cli/tree.js
CHANGED
|
@@ -23,31 +23,20 @@ function normalizePathInput(raw) {
|
|
|
23
23
|
return trimmed;
|
|
24
24
|
return trimmed.startsWith('/') ? trimmed.replace(/\/+$/, '') || '/' : `/${trimmed.replace(/\/+$/, '')}`;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
26
|
+
function layoutSegments(pathTemplate, layout, skipParams, maxDepth) {
|
|
27
|
+
let parts = pathTemplate.split('/').filter(Boolean);
|
|
28
|
+
if (parts.length >= 3 && /^v\d+$/i.test(parts[0]) && layout === 'resource-role') {
|
|
29
|
+
parts = [parts[0], parts[2], parts[1], ...parts.slice(3)];
|
|
30
|
+
}
|
|
31
|
+
if (skipParams) {
|
|
32
|
+
const idx = parts.findIndex((part) => part.startsWith('{'));
|
|
33
|
+
if (idx >= 0)
|
|
34
|
+
parts = parts.slice(0, idx);
|
|
33
35
|
}
|
|
36
|
+
if (typeof maxDepth === 'number' && maxDepth > 0)
|
|
37
|
+
parts = parts.slice(0, maxDepth);
|
|
34
38
|
return parts;
|
|
35
39
|
}
|
|
36
|
-
/** Put known "area" segments (admin/device/…) right after version. */
|
|
37
|
-
function areaFirstSegments(pathTemplate) {
|
|
38
|
-
const parts = urlOrderSegments(pathTemplate);
|
|
39
|
-
if (parts.length < 3 || !/^v\d+$/i.test(parts[0]))
|
|
40
|
-
return parts;
|
|
41
|
-
const areas = new Set(['admin', 'device', 'devices', 'user', 'users', 'me', 'internal', 'public']);
|
|
42
|
-
const version = parts[0];
|
|
43
|
-
const rest = parts.slice(1);
|
|
44
|
-
const areaIdx = rest.findIndex((part) => areas.has(part.toLowerCase()) && !part.startsWith('{'));
|
|
45
|
-
if (areaIdx <= 0)
|
|
46
|
-
return parts;
|
|
47
|
-
const area = rest[areaIdx];
|
|
48
|
-
const without = [...rest.slice(0, areaIdx), ...rest.slice(areaIdx + 1)];
|
|
49
|
-
return [version, area, ...without];
|
|
50
|
-
}
|
|
51
40
|
function listKnownPaths() {
|
|
52
41
|
const fromSpec = new Set();
|
|
53
42
|
try {
|
|
@@ -66,7 +55,7 @@ function listKnownPaths() {
|
|
|
66
55
|
fromSpec.add(pathTemplate);
|
|
67
56
|
}
|
|
68
57
|
catch {
|
|
69
|
-
//
|
|
58
|
+
// ignore
|
|
70
59
|
}
|
|
71
60
|
return [...fromSpec].sort((a, b) => a.localeCompare(b));
|
|
72
61
|
}
|
|
@@ -87,8 +76,7 @@ async function pickPath(flagPath) {
|
|
|
87
76
|
return normalizePathInput(flagPath);
|
|
88
77
|
const known = listKnownPaths();
|
|
89
78
|
printPathChoices(known);
|
|
90
|
-
const answer = await prompt(` ${ui_1.c.yellow('?')} ${ui_1.c.bold('Path')}
|
|
91
|
-
` ${ui_1.c.dim('number · /v1/admin/baskets · or n to skip')}\n ${ui_1.c.cyan('›')} `);
|
|
79
|
+
const answer = await prompt(` ${ui_1.c.yellow('?')} ${ui_1.c.bold('Path')} override ${ui_1.c.dim('(number · path · n skip)')}\n ${ui_1.c.cyan('›')} `);
|
|
92
80
|
if (!answer || /^n(o)?$/i.test(answer))
|
|
93
81
|
return null;
|
|
94
82
|
if (/^\d+$/.test(answer)) {
|
|
@@ -99,136 +87,170 @@ async function pickPath(flagPath) {
|
|
|
99
87
|
}
|
|
100
88
|
return normalizePathInput(answer);
|
|
101
89
|
}
|
|
102
|
-
async function
|
|
103
|
-
const sample = '/v1/admin/baskets';
|
|
90
|
+
async function pickLayout(current) {
|
|
91
|
+
const sample = '/v1/admin/baskets/{id}/lock';
|
|
104
92
|
console.log('');
|
|
105
|
-
console.log(` ${ui_1.c.bold('
|
|
106
|
-
console.log(` ${ui_1.c.dim('
|
|
93
|
+
console.log(` ${ui_1.c.bold('Folder order')} ${ui_1.c.dim('(company default)')}`);
|
|
94
|
+
console.log(` ${ui_1.c.dim('sample')} ${ui_1.c.cyan(sample)}`);
|
|
107
95
|
console.log('');
|
|
108
|
-
console.log(` ${ui_1.c.cyan('1')} resource
|
|
109
|
-
console.log(` ${(0, config_edit_1.previewTree)(
|
|
110
|
-
console.log(` ${ui_1.c.dim('v1
|
|
96
|
+
console.log(` ${ui_1.c.cyan('1')} role → resource ${ui_1.c.dim('recommended')}`);
|
|
97
|
+
console.log(` ${(0, config_edit_1.previewTree)(layoutSegments(sample, 'role-resource', true, null))}`);
|
|
98
|
+
console.log(` ${ui_1.c.dim('v1 › admin › baskets (ops under baskets, not under {id})')}`);
|
|
111
99
|
console.log('');
|
|
112
|
-
console.log(` ${ui_1.c.cyan('2')}
|
|
113
|
-
console.log(` ${(0, config_edit_1.previewTree)(
|
|
114
|
-
console.log(` ${ui_1.c.dim('v1
|
|
100
|
+
console.log(` ${ui_1.c.cyan('2')} resource → role`);
|
|
101
|
+
console.log(` ${(0, config_edit_1.previewTree)(layoutSegments(sample, 'resource-role', true, null))}`);
|
|
102
|
+
console.log(` ${ui_1.c.dim('v1 › baskets › admin')}`);
|
|
115
103
|
console.log('');
|
|
116
104
|
console.log(` ${ui_1.c.cyan('3')} keep ${ui_1.c.dim(`(${current})`)}`);
|
|
117
|
-
const answer = await prompt(` ${ui_1.c.yellow('?')}
|
|
105
|
+
const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
|
|
118
106
|
if (!answer || answer === '3' || /^k(eep)?$/i.test(answer))
|
|
107
|
+
return current;
|
|
108
|
+
if (answer === '1' || /^role/i.test(answer))
|
|
109
|
+
return 'role-resource';
|
|
110
|
+
if (answer === '2' || /^resource/i.test(answer))
|
|
111
|
+
return 'resource-role';
|
|
112
|
+
throw new Error(`Unknown layout: ${answer}`);
|
|
113
|
+
}
|
|
114
|
+
async function pickSkipParams(current) {
|
|
115
|
+
console.log('');
|
|
116
|
+
console.log(` ${ui_1.c.bold('Stop folders at path params')}`);
|
|
117
|
+
console.log(` ${ui_1.c.dim('Avoid')} ${ui_1.c.cyan('{id}')} ${ui_1.c.dim('→ complete / lock / pay as nested folders')}`);
|
|
118
|
+
console.log(` ${ui_1.c.cyan('1')} yes — fold under resource ${ui_1.c.dim('(recommended)')}`);
|
|
119
|
+
console.log(` ${ui_1.c.cyan('2')} no — nest full path`);
|
|
120
|
+
console.log(` ${ui_1.c.cyan('3')} keep ${ui_1.c.dim(`(${current ? 'yes' : 'no'})`)}`);
|
|
121
|
+
const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
|
|
122
|
+
if (!answer || answer === '3' || /^k(eep)?$/i.test(answer))
|
|
123
|
+
return current;
|
|
124
|
+
if (answer === '1' || /^y/i.test(answer))
|
|
125
|
+
return true;
|
|
126
|
+
if (answer === '2' || /^n/i.test(answer))
|
|
127
|
+
return false;
|
|
128
|
+
throw new Error(`Unknown choice: ${answer}`);
|
|
129
|
+
}
|
|
130
|
+
async function pickMaxDepth(current) {
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log(` ${ui_1.c.bold('Max folder depth')} ${ui_1.c.dim('(optional)')}`);
|
|
133
|
+
console.log(` ${ui_1.c.dim('Counts version. Empty = no limit beyond param fold.')}`);
|
|
134
|
+
console.log(` ${ui_1.c.dim('e.g. 3 → v1 / admin / baskets')}`);
|
|
135
|
+
const hint = current == null ? 'none' : String(current);
|
|
136
|
+
const answer = await prompt(` ${ui_1.c.yellow('?')} Depth ${ui_1.c.dim(`[${hint}]`)}\n ${ui_1.c.cyan('›')} `);
|
|
137
|
+
if (!answer)
|
|
138
|
+
return current ?? null;
|
|
139
|
+
if (/^(none|null|n)$/i.test(answer))
|
|
119
140
|
return null;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
throw new Error(`Unknown layout choice: ${answer}`);
|
|
141
|
+
const n = Number(answer);
|
|
142
|
+
if (!Number.isFinite(n) || n < 1)
|
|
143
|
+
throw new Error(`Invalid depth: ${answer}`);
|
|
144
|
+
return Math.floor(n);
|
|
125
145
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
async function pickExampleStyle(current) {
|
|
147
|
+
console.log('');
|
|
148
|
+
console.log(` ${ui_1.c.bold('Example / scenario labels')}`);
|
|
149
|
+
console.log(` ${ui_1.c.cyan('1')} status-title-case`);
|
|
150
|
+
console.log(` ${ui_1.c.dim('200 — Admin Find One Basket By Id API — returns basket when found')}`);
|
|
151
|
+
console.log(` ${ui_1.c.cyan('2')} status-case`);
|
|
152
|
+
console.log(` ${ui_1.c.dim('200 — returns basket when found')}`);
|
|
153
|
+
console.log(` ${ui_1.c.cyan('3')} full`);
|
|
154
|
+
console.log(` ${ui_1.c.dim('200 — Admin Find… API - GET /v1/admin/baskets/{id} POSITIVE CASES returns…')}`);
|
|
155
|
+
console.log(` ${ui_1.c.cyan('4')} keep ${ui_1.c.dim(`(${current})`)}`);
|
|
156
|
+
const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
|
|
157
|
+
if (!answer || answer === '4' || /^k(eep)?$/i.test(answer))
|
|
158
|
+
return current;
|
|
159
|
+
if (answer === '1' || /title/i.test(answer))
|
|
160
|
+
return 'status-title-case';
|
|
161
|
+
if (answer === '2' || /status-case/i.test(answer))
|
|
162
|
+
return 'status-case';
|
|
163
|
+
if (answer === '3' || /^full/i.test(answer))
|
|
164
|
+
return 'full';
|
|
165
|
+
throw new Error(`Unknown style: ${answer}`);
|
|
166
|
+
}
|
|
167
|
+
function layoutChoicesFor(pathTemplate, layout, skipParams, maxDepth) {
|
|
168
|
+
const role = layoutSegments(pathTemplate, 'role-resource', skipParams, maxDepth);
|
|
169
|
+
const resource = layoutSegments(pathTemplate, 'resource-role', skipParams, maxDepth);
|
|
130
170
|
const choices = [
|
|
131
|
-
{ id: '
|
|
132
|
-
{ id: 'resource', label: '
|
|
171
|
+
{ id: 'role', label: 'role → resource', segments: role },
|
|
172
|
+
{ id: 'resource', label: 'resource → role', segments: resource },
|
|
173
|
+
{ id: 'custom', label: 'Custom segments', segments: role },
|
|
133
174
|
];
|
|
134
|
-
if (area.join('/') !== url.join('/') && area.join('/') !== resource.join('/')) {
|
|
135
|
-
choices.push({ id: 'area', label: 'Area-first (admin/device/…)', segments: area });
|
|
136
|
-
}
|
|
137
|
-
choices.push({ id: 'custom', label: 'Custom segments', segments: url });
|
|
138
175
|
return choices;
|
|
139
176
|
}
|
|
140
|
-
async function pickSegments(pathTemplate) {
|
|
141
|
-
const choices = layoutChoicesFor(pathTemplate);
|
|
177
|
+
async function pickSegments(pathTemplate, layout, skipParams, maxDepth) {
|
|
178
|
+
const choices = layoutChoicesFor(pathTemplate, layout, skipParams, maxDepth);
|
|
142
179
|
console.log('');
|
|
143
|
-
console.log(` ${ui_1.c.bold('
|
|
144
|
-
console.log(` ${ui_1.c.dim('Which nesting do you want?')}`);
|
|
180
|
+
console.log(` ${ui_1.c.bold('Override')} ${ui_1.c.cyan(pathTemplate)}`);
|
|
145
181
|
choices.forEach((choice, index) => {
|
|
146
|
-
|
|
147
|
-
console.log(` ${mark} ${ui_1.c.bold(choice.label)}`);
|
|
182
|
+
console.log(` ${ui_1.c.cyan(String(index + 1))} ${ui_1.c.bold(choice.label)}`);
|
|
148
183
|
console.log(` ${(0, config_edit_1.previewTree)(choice.segments)}`);
|
|
149
184
|
});
|
|
150
185
|
const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
|
|
151
186
|
if (!answer || /^n(o)?$/i.test(answer))
|
|
152
187
|
return null;
|
|
153
|
-
const index = /^\d+$/.test(answer)
|
|
154
|
-
? Number(answer) - 1
|
|
155
|
-
: choices.findIndex((choice) => choice.id === answer || choice.label.toLowerCase().startsWith(answer.toLowerCase()));
|
|
188
|
+
const index = /^\d+$/.test(answer) ? Number(answer) - 1 : -1;
|
|
156
189
|
const selected = choices[index];
|
|
157
190
|
if (!selected)
|
|
158
191
|
throw new Error(`Unknown choice: ${answer}`);
|
|
159
192
|
if (selected.id !== 'custom')
|
|
160
193
|
return selected.segments;
|
|
161
|
-
const typed = await prompt(` ${ui_1.c.yellow('?')} Segments
|
|
162
|
-
` ${ui_1.c.dim('e.g. v1 baskets admin')}\n ${ui_1.c.cyan('›')} `);
|
|
194
|
+
const typed = await prompt(` ${ui_1.c.yellow('?')} Segments ${ui_1.c.dim('(space separated)')}\n ${ui_1.c.cyan('›')} `);
|
|
163
195
|
if (!typed)
|
|
164
196
|
return null;
|
|
165
|
-
return typed
|
|
166
|
-
.split(/›|>|,|\s+/)
|
|
167
|
-
.map((part) => part.trim())
|
|
168
|
-
.filter(Boolean);
|
|
169
|
-
}
|
|
170
|
-
function saveLayout(configPath, layout) {
|
|
171
|
-
(0, config_edit_1.upsertConfigValue)(configPath, 'treeLayout', (0, config_edit_1.formatTsString)(layout));
|
|
172
|
-
}
|
|
173
|
-
function saveOverride(configPath, pathTemplate, segments) {
|
|
174
|
-
const overrides = (0, config_edit_1.readTreePathOverrides)();
|
|
175
|
-
overrides[pathTemplate] = segments;
|
|
176
|
-
(0, config_edit_1.upsertConfigValue)(configPath, 'treePathOverrides', (0, config_edit_1.formatTsStringRecord)(overrides));
|
|
197
|
+
return typed.split(/›|>|,|\s+/).map((part) => part.trim()).filter(Boolean);
|
|
177
198
|
}
|
|
178
199
|
/**
|
|
179
|
-
*
|
|
180
|
-
* Also used at the end of `daxta install` so the question is not a hidden separate command.
|
|
200
|
+
* Company docs presentation wizard — install / migrate / `daxta tree`.
|
|
181
201
|
*/
|
|
182
202
|
async function runTreeWizard(options = {}) {
|
|
183
203
|
if (options.yes || !process.stdin.isTTY) {
|
|
184
|
-
if (!options.embedded)
|
|
204
|
+
if (!options.embedded)
|
|
185
205
|
console.log(` ${ui_1.c.dim('tree wizard skipped (non-interactive)')}`);
|
|
186
|
-
}
|
|
187
206
|
return;
|
|
188
207
|
}
|
|
189
208
|
if (!options.embedded)
|
|
190
|
-
(0, ui_1.banner)('DAxTA tree', '
|
|
209
|
+
(0, ui_1.banner)('DAxTA tree', 'docs presentation');
|
|
191
210
|
const configPath = (0, config_edit_1.findDaxtaConfigPath)();
|
|
192
|
-
if (!configPath)
|
|
211
|
+
if (!configPath)
|
|
193
212
|
throw new Error('No daxta.config.ts found. Run `daxta install` first.');
|
|
194
|
-
}
|
|
195
213
|
(0, config_1.resetConfig)();
|
|
196
214
|
const config = (0, config_1.getConfig)(true);
|
|
197
215
|
console.log('');
|
|
198
|
-
console.log(` ${ui_1.c.yellow(ui_1.c.bold('?'))} ${ui_1.c.bold('
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
216
|
+
console.log(` ${ui_1.c.yellow(ui_1.c.bold('?'))} ${ui_1.c.bold('Docs presentation')} ${ui_1.c.dim('— sidebar + OpenAPI export')}`);
|
|
217
|
+
let layout = (0, config_1.normalizeTreeLayout)(options.layout === 'resource-first' || options.layout === 'resource-role'
|
|
218
|
+
? 'resource-role'
|
|
219
|
+
: options.layout === 'url-order' || options.layout === 'role-resource'
|
|
220
|
+
? 'role-resource'
|
|
221
|
+
: config.treeLayout);
|
|
222
|
+
if (!options.layout)
|
|
223
|
+
layout = await pickLayout(layout);
|
|
224
|
+
(0, config_edit_1.upsertConfigValue)(configPath, 'treeLayout', (0, config_edit_1.formatTsString)(layout));
|
|
225
|
+
console.log(` ${ui_1.c.green('✔')} treeLayout → ${ui_1.c.cyan(layout)}`);
|
|
226
|
+
const skipParams = await pickSkipParams(config.treeSkipParams !== false);
|
|
227
|
+
(0, config_edit_1.upsertConfigValue)(configPath, 'treeSkipParams', skipParams ? 'true' : 'false');
|
|
228
|
+
console.log(` ${ui_1.c.green('✔')} treeSkipParams → ${ui_1.c.cyan(String(skipParams))}`);
|
|
229
|
+
const maxDepth = await pickMaxDepth(config.treeMaxDepth ?? null);
|
|
230
|
+
(0, config_edit_1.upsertConfigValue)(configPath, 'treeMaxDepth', maxDepth == null ? 'null' : String(maxDepth));
|
|
231
|
+
console.log(` ${ui_1.c.green('✔')} treeMaxDepth → ${ui_1.c.cyan(maxDepth == null ? 'null' : String(maxDepth))}`);
|
|
232
|
+
const exampleStyle = await pickExampleStyle(config.exampleLabelStyle ?? 'status-title-case');
|
|
233
|
+
(0, config_edit_1.upsertConfigValue)(configPath, 'exampleLabelStyle', (0, config_edit_1.formatTsString)(exampleStyle));
|
|
234
|
+
console.log(` ${ui_1.c.green('✔')} exampleLabelStyle → ${ui_1.c.cyan(exampleStyle)}`);
|
|
213
235
|
const customize = options.path
|
|
214
236
|
? 'y'
|
|
215
|
-
: await prompt(` ${ui_1.c.yellow('?')}
|
|
216
|
-
` ${ui_1.c.dim('Y')} yes · ${ui_1.c.dim('n')} later
|
|
237
|
+
: await prompt(` ${ui_1.c.yellow('?')} Per-path override now?\n` +
|
|
238
|
+
` ${ui_1.c.dim('Y')} yes · ${ui_1.c.dim('n')} later\n ${ui_1.c.cyan('›')} `);
|
|
217
239
|
if (customize && !/^n(o)?$/i.test(customize)) {
|
|
218
240
|
const pathTemplate = await pickPath(options.path);
|
|
219
241
|
if (pathTemplate) {
|
|
220
|
-
const segments = await pickSegments(pathTemplate);
|
|
242
|
+
const segments = await pickSegments(pathTemplate, layout, skipParams, maxDepth);
|
|
221
243
|
if (segments?.length) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
console.log(`
|
|
244
|
+
const overrides = (0, config_edit_1.readTreePathOverrides)();
|
|
245
|
+
overrides[pathTemplate] = segments;
|
|
246
|
+
(0, config_edit_1.upsertConfigValue)(configPath, 'treePathOverrides', (0, config_edit_1.formatTsStringRecord)(overrides));
|
|
247
|
+
console.log(` ${ui_1.c.green('✔')} ${ui_1.c.cyan(pathTemplate)} → ${(0, config_edit_1.previewTree)(segments)}`);
|
|
226
248
|
}
|
|
227
249
|
}
|
|
228
250
|
}
|
|
229
251
|
if (!options.embedded) {
|
|
230
|
-
console.log(` ${ui_1.c.dim('saved
|
|
231
|
-
console.log(` ${ui_1.c.dim('refresh
|
|
252
|
+
console.log(` ${ui_1.c.dim('saved')} ${configPath}`);
|
|
253
|
+
console.log(` ${ui_1.c.dim('refresh')} ${ui_1.c.cyan('daxta build')}`);
|
|
232
254
|
console.log('');
|
|
233
255
|
}
|
|
234
256
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type UninstallOptions = {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
yes?: boolean;
|
|
5
|
+
fast?: boolean;
|
|
6
|
+
/** Keep @t0.labs/daxta in package.json (only unwind project wiring) */
|
|
7
|
+
keepDep?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Fully unwind DAxTA from a consumer project.
|
|
11
|
+
*/
|
|
12
|
+
export declare function uninstallDaxta(options?: UninstallOptions): Promise<void>;
|