@codapult/cli 0.10.2 → 0.11.0
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/commands/setup.js +16 -6
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -4,15 +4,17 @@ import { createInterface } from 'node:readline';
|
|
|
4
4
|
import { findProjectRoot } from '../utils/project.js';
|
|
5
5
|
import { ENV_EXAMPLE_FILE_NAME, ENV_FILE_NAME, } from '../utils/project-env.js';
|
|
6
6
|
import { heading, success, fail, info, dim, ask, confirm } from '../utils/ui.js';
|
|
7
|
-
async function selectPrompt(iface, question, options
|
|
7
|
+
async function selectPrompt(iface, question, options) {
|
|
8
8
|
console.log(`\n ${question}`);
|
|
9
9
|
options.forEach((opt, i) => console.log(` ${i + 1}. ${opt}`));
|
|
10
10
|
const answer = await ask(iface, 'Choose', '1');
|
|
11
|
-
if (lastEmptyLine)
|
|
12
|
-
console.log();
|
|
13
11
|
const idx = parseInt(answer, 10) - 1;
|
|
14
12
|
return options[Math.max(0, Math.min(idx, options.length - 1))];
|
|
15
13
|
}
|
|
14
|
+
function line() {
|
|
15
|
+
console.log();
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
16
18
|
// ---------------------------------------------------------------------------
|
|
17
19
|
// Built-in presets for non-interactive (CI/CD) setup via --preset flag.
|
|
18
20
|
// ---------------------------------------------------------------------------
|
|
@@ -565,6 +567,7 @@ function pruneMarkedBlocksInFiles(root, config) {
|
|
|
565
567
|
}
|
|
566
568
|
}
|
|
567
569
|
function removeModules(root, config) {
|
|
570
|
+
let totalRemoved = 0;
|
|
568
571
|
for (const removal of MODULE_REMOVALS) {
|
|
569
572
|
if (config[removal.key])
|
|
570
573
|
continue;
|
|
@@ -582,6 +585,7 @@ function removeModules(root, config) {
|
|
|
582
585
|
missing.push(p);
|
|
583
586
|
}
|
|
584
587
|
}
|
|
588
|
+
totalRemoved += removed;
|
|
585
589
|
// Surface stale paths so removals don't silently no-op when the host
|
|
586
590
|
// project's file layout changes (e.g. moving routes under [locale]).
|
|
587
591
|
if (removed === 0 && missing.length > 0) {
|
|
@@ -589,6 +593,9 @@ function removeModules(root, config) {
|
|
|
589
593
|
}
|
|
590
594
|
}
|
|
591
595
|
pruneMarkedBlocksInFiles(root, config);
|
|
596
|
+
if (totalRemoved > 0) {
|
|
597
|
+
dim(`Total removed: ${totalRemoved}`);
|
|
598
|
+
}
|
|
592
599
|
}
|
|
593
600
|
async function interactiveSetup() {
|
|
594
601
|
const iface = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -608,9 +615,12 @@ async function interactiveSetup() {
|
|
|
608
615
|
authProvider,
|
|
609
616
|
paymentProvider: await selectPrompt(iface, 'Payment provider:', ['stripe', 'lemonsqueezy']),
|
|
610
617
|
storageProvider: await selectPrompt(iface, 'Storage provider:', ['local', 's3']),
|
|
611
|
-
jobProvider: await selectPrompt(iface, 'Background jobs:', [
|
|
618
|
+
jobProvider: await selectPrompt(iface, 'Background jobs:', [
|
|
619
|
+
'memory',
|
|
620
|
+
'bullmq',
|
|
621
|
+
]),
|
|
612
622
|
enableAuth: authEnabled,
|
|
613
|
-
enableAI: await confirm(iface, 'Enable AI Chat module?'),
|
|
623
|
+
enableAI: line() && (await confirm(iface, 'Enable AI Chat module?')),
|
|
614
624
|
enableBlog: await confirm(iface, 'Enable Blog module?'),
|
|
615
625
|
enableTeams: authEnabled && (await confirm(iface, 'Enable Teams/Organizations?')),
|
|
616
626
|
enableWaitlist: await confirm(iface, 'Enable Waitlist page?'),
|
|
@@ -637,7 +647,7 @@ async function interactiveSetup() {
|
|
|
637
647
|
enableBranding: authEnabled && (await confirm(iface, 'Enable per-org branding (white-label)?')),
|
|
638
648
|
enableTwoFactor: authEnabled && (await confirm(iface, 'Enable two-factor authentication (TOTP)?')),
|
|
639
649
|
enablePlugins: await confirm(iface, 'Enable plugin marketplace (/plugins)?'),
|
|
640
|
-
removeUnusedCode: await confirm(iface, '
|
|
650
|
+
removeUnusedCode: line() && (await confirm(iface, 'Remove unused module code?', false)),
|
|
641
651
|
};
|
|
642
652
|
iface.close();
|
|
643
653
|
return config;
|