create-o2s-app 4.0.0 → 4.1.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/CHANGELOG.md +14 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -2
- package/dist/index.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/logger.d.ts +2 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +84 -34
- package/dist/wizard/prompts.d.ts.map +1 -1
- package/dist/wizard/prompts.js +12 -3
- package/package.json +3 -3
- package/src/constants.ts +2 -1
- package/src/index.ts +6 -4
- package/src/utils/logger.ts +139 -36
- package/src/wizard/prompts.ts +23 -3
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TemplateType } from '../types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const printBanner: () => void;
|
|
3
|
+
export declare const printSummary: (targetDir: string, template: TemplateType, selectedBlocks: string[], selectedIntegrations: string[], uncoveredModules?: string[], skipInstall?: boolean) => void;
|
|
3
4
|
export declare const printError: (message: string, error?: unknown) => void;
|
|
4
5
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,eAAO,MAAM,WAAW,QAAO,IAyB9B,CAAC;AAEF,eAAO,MAAM,YAAY,GACrB,WAAW,MAAM,EACjB,UAAU,YAAY,EACtB,gBAAgB,MAAM,EAAE,EACxB,sBAAsB,MAAM,EAAE,EAC9B,mBAAkB,MAAM,EAAO,EAC/B,qBAAmB,KACpB,IA0HF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,QAAQ,OAAO,KAAG,IAS7D,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -3,54 +3,104 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.printError = exports.printSummary = void 0;
|
|
6
|
+
exports.printError = exports.printSummary = exports.printBanner = void 0;
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
const templates_1 = require("../wizard/templates");
|
|
9
9
|
const kleur_1 = __importDefault(require("kleur"));
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const printBanner = () => {
|
|
12
|
+
const title = 'Open Self Service CLI';
|
|
13
|
+
const desc = 'Scaffold your custom composable frontend';
|
|
14
|
+
const contentWidth = 46;
|
|
15
|
+
const topLine = ` ${kleur_1.default.blue('╭' + '─'.repeat(contentWidth) + '╮')}`;
|
|
16
|
+
const empty = ` ${kleur_1.default.blue('│')}${' '.repeat(contentWidth)}${kleur_1.default.blue('│')}`;
|
|
17
|
+
const bottomLine = ` ${kleur_1.default.blue('╰' + '─'.repeat(contentWidth) + '╯')}`;
|
|
18
|
+
const titlePad = Math.floor((contentWidth - title.length) / 2);
|
|
19
|
+
const titleRightPad = contentWidth - title.length - titlePad;
|
|
20
|
+
const titleLine = ` ${kleur_1.default.blue('│')}${' '.repeat(titlePad)}${kleur_1.default.bold().white(title)}${' '.repeat(titleRightPad)}${kleur_1.default.blue('│')}`;
|
|
21
|
+
const descPad = Math.floor((contentWidth - desc.length) / 2);
|
|
22
|
+
const descRightPad = contentWidth - desc.length - descPad;
|
|
23
|
+
const descLine = ` ${kleur_1.default.blue('│')}${' '.repeat(descPad)}${kleur_1.default.dim().white(desc)}${' '.repeat(descRightPad)}${kleur_1.default.blue('│')}`;
|
|
14
24
|
console.log();
|
|
15
|
-
console.log(
|
|
16
|
-
console.log(
|
|
17
|
-
console.log(
|
|
18
|
-
console.log(
|
|
25
|
+
console.log(topLine);
|
|
26
|
+
console.log(empty);
|
|
27
|
+
console.log(titleLine);
|
|
28
|
+
console.log(descLine);
|
|
29
|
+
console.log(empty);
|
|
30
|
+
console.log(bottomLine);
|
|
19
31
|
console.log();
|
|
32
|
+
};
|
|
33
|
+
exports.printBanner = printBanner;
|
|
34
|
+
const printSummary = (targetDir, template, selectedBlocks, selectedIntegrations, uncoveredModules = [], skipInstall = false) => {
|
|
35
|
+
const templateName = templates_1.TEMPLATES[template].name;
|
|
36
|
+
const relativeDir = path_1.default.relative(process.cwd(), targetDir) || '.';
|
|
37
|
+
// Collect all content lines to measure max width
|
|
38
|
+
const lines = [];
|
|
39
|
+
const addLine = (text, plain) => {
|
|
40
|
+
lines.push({ text, plain });
|
|
41
|
+
};
|
|
42
|
+
const addEmpty = () => {
|
|
43
|
+
lines.push({ text: '', plain: '' });
|
|
44
|
+
};
|
|
45
|
+
addLine(` ${kleur_1.default.green().bold('Project created successfully!')}`, ' Project created successfully!');
|
|
46
|
+
addEmpty();
|
|
47
|
+
addLine(` Location: ${kleur_1.default.cyan(`./${relativeDir}`)}`, ` Location: ./${relativeDir}`);
|
|
48
|
+
addLine(` Template: ${templateName}`, ` Template: ${templateName}`);
|
|
49
|
+
addEmpty();
|
|
50
|
+
addLine(` ${kleur_1.default.bold('Blocks')} ${kleur_1.default.dim(`(${selectedBlocks.length})`)}`, ` Blocks (${selectedBlocks.length})`);
|
|
51
|
+
for (const block of selectedBlocks) {
|
|
52
|
+
addLine(` ${kleur_1.default.cyan('•')} ${block}`, ` • ${block}`);
|
|
53
|
+
}
|
|
54
|
+
addEmpty();
|
|
55
|
+
addLine(` ${kleur_1.default.bold('Integrations')} ${kleur_1.default.dim(`(${selectedIntegrations.length})`)}`, ` Integrations (${selectedIntegrations.length})`);
|
|
56
|
+
for (const integration of selectedIntegrations) {
|
|
57
|
+
addLine(` ${kleur_1.default.yellow('•')} ${integration}`, ` • ${integration}`);
|
|
58
|
+
}
|
|
20
59
|
if (uncoveredModules.length > 0) {
|
|
21
|
-
|
|
22
|
-
|
|
60
|
+
addEmpty();
|
|
61
|
+
addLine(` ${kleur_1.default.yellow().bold('⚠ Uncovered modules')}`, ' ⚠ Uncovered modules');
|
|
23
62
|
for (const mod of uncoveredModules) {
|
|
24
|
-
|
|
63
|
+
addLine(` ${kleur_1.default.red('•')} ${mod}`, ` • ${mod}`);
|
|
25
64
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
65
|
+
addEmpty();
|
|
66
|
+
addLine(` ${kleur_1.default.red('The project will NOT start until these are configured.')}`, ' The project will NOT start until these are configured.');
|
|
67
|
+
addLine(` ${kleur_1.default.dim('Edit packages/configs/integrations/src/models/<module>.ts')}`, ' Edit packages/configs/integrations/src/models/<module>.ts');
|
|
68
|
+
}
|
|
69
|
+
addEmpty();
|
|
70
|
+
addLine(` ${kleur_1.default.bold('Next steps:')}`, ' Next steps:');
|
|
71
|
+
addEmpty();
|
|
72
|
+
addLine(` ${kleur_1.default.white(`cd ./${relativeDir}`)}`, ` cd ./${relativeDir}`);
|
|
73
|
+
if (uncoveredModules.length > 0) {
|
|
74
|
+
addLine(` ${kleur_1.default.dim('# 1. Configure the uncovered modules above')}`, ' # 1. Configure the uncovered modules above');
|
|
75
|
+
addLine(` ${kleur_1.default.dim('# 2. Add required env vars to apps/api-harmonization/.env.local')}`, ' # 2. Add required env vars to apps/api-harmonization/.env.local');
|
|
76
|
+
addLine(` ${kleur_1.default.dim('# 3. Start development (two terminals):')}`, ' # 3. Start development (two terminals):');
|
|
77
|
+
addLine(` ${kleur_1.default.dim('npm run watch:deps')}`, ' npm run watch:deps');
|
|
78
|
+
addLine(` ${kleur_1.default.dim('npm run watch:apps')}`, ' npm run watch:apps');
|
|
39
79
|
}
|
|
40
80
|
else {
|
|
41
|
-
console.log(kleur_1.default.bold('Next steps:'));
|
|
42
|
-
console.log();
|
|
43
|
-
console.log(` cd ${targetDir}`);
|
|
44
81
|
if (skipInstall) {
|
|
45
|
-
|
|
46
|
-
|
|
82
|
+
addLine(` ${kleur_1.default.dim('# Install dependencies (npm install was skipped)')}`, ' # Install dependencies (npm install was skipped)');
|
|
83
|
+
addLine(' npm install', ' npm install');
|
|
47
84
|
}
|
|
48
|
-
|
|
49
|
-
|
|
85
|
+
addLine(` npm run watch:deps ${kleur_1.default.dim('# Terminal 1: watch & build packages')}`, ' npm run watch:deps # Terminal 1: watch & build packages');
|
|
86
|
+
addLine(` npm run watch:apps ${kleur_1.default.dim('# Terminal 2: run frontend + API')}`, ' npm run watch:apps # Terminal 2: run frontend + API');
|
|
50
87
|
}
|
|
88
|
+
addEmpty();
|
|
89
|
+
addLine(` ${kleur_1.default.bold('Useful links:')}`, ' Useful links:');
|
|
90
|
+
addLine(` ${kleur_1.default.dim('Docs & installation:')} ${kleur_1.default.cyan(constants_1.DOCS_URL)}`, ` Docs & installation: ${constants_1.DOCS_URL}`);
|
|
91
|
+
addLine(` ${kleur_1.default.dim('Storybook (blocks):')} ${kleur_1.default.cyan(constants_1.STORYBOOK_URL)}`, ` Storybook (blocks): ${constants_1.STORYBOOK_URL}`);
|
|
92
|
+
addLine(` ${kleur_1.default.dim('Integrations guide:')} ${kleur_1.default.cyan(constants_1.DOCS_INTEGRATIONS_URL)}`, ` Integrations guide: ${constants_1.DOCS_INTEGRATIONS_URL}`);
|
|
93
|
+
// Calculate box width
|
|
94
|
+
const maxPlainWidth = Math.max(...lines.map((l) => l.plain.length));
|
|
95
|
+
const boxWidth = maxPlainWidth + 4; // 2 padding each side
|
|
96
|
+
// Print box
|
|
51
97
|
console.log();
|
|
52
|
-
console.log(kleur_1.default.
|
|
53
|
-
|
|
98
|
+
console.log(` ${kleur_1.default.blue('╭' + '─'.repeat(boxWidth) + '╮')}`);
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
const rightPad = boxWidth - line.plain.length;
|
|
101
|
+
console.log(` ${kleur_1.default.blue('│')}${line.text}${' '.repeat(rightPad)}${kleur_1.default.blue('│')}`);
|
|
102
|
+
}
|
|
103
|
+
console.log(` ${kleur_1.default.blue('╰' + '─'.repeat(boxWidth) + '╯')}`);
|
|
54
104
|
console.log();
|
|
55
105
|
};
|
|
56
106
|
exports.printSummary = printSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKnF,eAAO,MAAM,iBAAiB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAa3E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,YAAY,CAiB3D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,iBAAiB,SAAS,EAAE,EAAE,aAAa,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CAqBhH,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACnC,uBAAuB,eAAe,EAAE,EACxC,aAAa,MAAM,EAAE,KACtB,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,iBAAiB,SAAS,EAAE,EAC5B,uBAAuB,eAAe,EAAE,EACxC,UAAU,MAAM,EAChB,cAAc,YAAY,KAC3B,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/wizard/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKnF,eAAO,MAAM,iBAAiB,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,MAAM,CAa3E,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,YAAY,CAiB3D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAU,iBAAiB,SAAS,EAAE,EAAE,aAAa,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,EAAE,CAqBhH,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACnC,uBAAuB,eAAe,EAAE,EACxC,aAAa,MAAM,EAAE,KACtB,OAAO,CAAC,MAAM,EAAE,CAgBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,iBAAiB,SAAS,EAAE,EAC5B,uBAAuB,eAAe,EAAE,EACxC,UAAU,MAAM,EAChB,cAAc,YAAY,KAC3B,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAiDnD,CAAC"}
|
package/dist/wizard/prompts.js
CHANGED
|
@@ -82,10 +82,19 @@ const runWizardPrompts = async (availableBlocks, availableIntegrations, cliName,
|
|
|
82
82
|
let selectedBlocks;
|
|
83
83
|
let selectedIntegrations;
|
|
84
84
|
if (template === 'custom') {
|
|
85
|
+
const tipLines = [
|
|
86
|
+
`${kleur_1.default.blue().bold('Tip:')} Not sure which blocks to pick?`,
|
|
87
|
+
`Browse our Storybook to preview all available components:`,
|
|
88
|
+
kleur_1.default.cyan(constants_1.STORYBOOK_URL),
|
|
89
|
+
];
|
|
90
|
+
const tipWidth = Math.max('Tip: Not sure which blocks to pick?'.length, 'Browse our Storybook to preview all available components:'.length, constants_1.STORYBOOK_URL.length);
|
|
91
|
+
const boxWidth = tipWidth + 4;
|
|
85
92
|
console.log();
|
|
86
|
-
console.log(kleur_1.default.
|
|
87
|
-
console.log(`
|
|
88
|
-
console.log(kleur_1.default.
|
|
93
|
+
console.log(` ${kleur_1.default.blue('╭' + '─'.repeat(boxWidth) + '╮')}`);
|
|
94
|
+
console.log(` ${kleur_1.default.blue('│')} ${tipLines[0]}${' '.repeat(boxWidth - 2 - 'Tip: Not sure which blocks to pick?'.length)}${kleur_1.default.blue('│')}`);
|
|
95
|
+
console.log(` ${kleur_1.default.blue('│')} ${tipLines[1]}${' '.repeat(boxWidth - 2 - 'Browse our Storybook to preview all available components:'.length)}${kleur_1.default.blue('│')}`);
|
|
96
|
+
console.log(` ${kleur_1.default.blue('│')} ${tipLines[2]}${' '.repeat(boxWidth - 2 - constants_1.STORYBOOK_URL.length)}${kleur_1.default.blue('│')}`);
|
|
97
|
+
console.log(` ${kleur_1.default.blue('╰' + '─'.repeat(boxWidth) + '╯')}`);
|
|
89
98
|
console.log();
|
|
90
99
|
selectedBlocks = await (0, exports.promptBlockSelection)(availableBlocks, []);
|
|
91
100
|
selectedIntegrations = await (0, exports.promptIntegrationSelection)(availableIntegrations, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-o2s-app",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "CLI tool to scaffold new O2S applications with Next.js and NestJS setup.",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,json}\""
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@o2s/telemetry": "^1.2.
|
|
35
|
+
"@o2s/telemetry": "^1.2.2",
|
|
36
36
|
"@types/prompts": "^2.4.9",
|
|
37
37
|
"cli-progress": "^3.12.0",
|
|
38
38
|
"commander": "^14.0.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@o2s/typescript-config": "*",
|
|
50
50
|
"@types/cli-progress": "^3.11.6",
|
|
51
51
|
"@types/fs-extra": "^11.0.4",
|
|
52
|
-
"eslint": "^9.39.
|
|
52
|
+
"eslint": "^9.39.4",
|
|
53
53
|
"prettier": "^3.8.1",
|
|
54
54
|
"typescript": "^5.9.3"
|
|
55
55
|
}
|
package/src/constants.ts
CHANGED
|
@@ -4,7 +4,8 @@ export const GITHUB_REPO_URL = 'https://github.com/o2sdev/openselfservice';
|
|
|
4
4
|
export const GITHUB_BRANCH = 'create-o2s-app/base';
|
|
5
5
|
export const PROJECT_PREFIX = 'o2s';
|
|
6
6
|
export const STORYBOOK_URL = 'https://storybook-o2s.openselfservice.com/';
|
|
7
|
-
export const DOCS_URL = 'https://
|
|
7
|
+
export const DOCS_URL = 'https://www.openselfservice.com/docs/getting-started/installation';
|
|
8
|
+
export const DOCS_INTEGRATIONS_URL = 'https://www.openselfservice.com/docs/integrations';
|
|
8
9
|
|
|
9
10
|
export const BLOCKS_PATH = 'packages/blocks';
|
|
10
11
|
export const INTEGRATIONS_PATH = 'packages/integrations';
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cleanupTempDir, cloneRepository } from './scaffold/clone';
|
|
3
3
|
import { scaffold } from './scaffold/index';
|
|
4
4
|
import { TemplateType } from './types';
|
|
5
|
-
import { printError, printSummary } from './utils/logger';
|
|
5
|
+
import { printBanner, printError, printSummary } from './utils/logger';
|
|
6
6
|
import { runWizard } from './wizard/index';
|
|
7
7
|
import * as telemetry from '@o2s/telemetry';
|
|
8
8
|
import { Command } from 'commander';
|
|
@@ -11,7 +11,7 @@ const program = new Command();
|
|
|
11
11
|
|
|
12
12
|
program
|
|
13
13
|
.name('create-o2s-app')
|
|
14
|
-
.description('
|
|
14
|
+
.description('Scaffold your custom frontend')
|
|
15
15
|
.argument('[name]', 'Name of the new project')
|
|
16
16
|
.option('--directory [directory]', 'Specify the destination directory')
|
|
17
17
|
.option('--template [template]', 'Template: o2s | dxp | custom')
|
|
@@ -19,6 +19,8 @@ program
|
|
|
19
19
|
.option('--integrations [integrations]', 'Comma-separated list of integration names (for non-interactive mode)')
|
|
20
20
|
.option('--skip-install', 'Skip npm install step')
|
|
21
21
|
.action(async (name, options) => {
|
|
22
|
+
printBanner();
|
|
23
|
+
|
|
22
24
|
telemetry.sendEvent('o2s', 'create-o2s-app', 'create-project');
|
|
23
25
|
await telemetry.flushEvents();
|
|
24
26
|
|
|
@@ -51,8 +53,8 @@ program
|
|
|
51
53
|
printSummary(
|
|
52
54
|
targetDir,
|
|
53
55
|
answers.template,
|
|
54
|
-
answers.selectedBlocks
|
|
55
|
-
answers.selectedIntegrations
|
|
56
|
+
answers.selectedBlocks,
|
|
57
|
+
answers.selectedIntegrations,
|
|
56
58
|
uncoveredModules,
|
|
57
59
|
options.skipInstall,
|
|
58
60
|
);
|
package/src/utils/logger.ts
CHANGED
|
@@ -1,61 +1,164 @@
|
|
|
1
|
-
import { DOCS_URL } from '../constants';
|
|
1
|
+
import { DOCS_INTEGRATIONS_URL, DOCS_URL, STORYBOOK_URL } from '../constants';
|
|
2
2
|
import { TemplateType } from '../types';
|
|
3
3
|
import { TEMPLATES } from '../wizard/templates';
|
|
4
4
|
import kleur from 'kleur';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
export const printBanner = (): void => {
|
|
8
|
+
const title = 'Open Self Service CLI';
|
|
9
|
+
const desc = 'Scaffold your custom composable frontend';
|
|
10
|
+
const contentWidth = 46;
|
|
11
|
+
|
|
12
|
+
const topLine = ` ${kleur.blue('╭' + '─'.repeat(contentWidth) + '╮')}`;
|
|
13
|
+
const empty = ` ${kleur.blue('│')}${' '.repeat(contentWidth)}${kleur.blue('│')}`;
|
|
14
|
+
const bottomLine = ` ${kleur.blue('╰' + '─'.repeat(contentWidth) + '╯')}`;
|
|
15
|
+
|
|
16
|
+
const titlePad = Math.floor((contentWidth - title.length) / 2);
|
|
17
|
+
const titleRightPad = contentWidth - title.length - titlePad;
|
|
18
|
+
const titleLine = ` ${kleur.blue('│')}${' '.repeat(titlePad)}${kleur.bold().white(title)}${' '.repeat(titleRightPad)}${kleur.blue('│')}`;
|
|
19
|
+
|
|
20
|
+
const descPad = Math.floor((contentWidth - desc.length) / 2);
|
|
21
|
+
const descRightPad = contentWidth - desc.length - descPad;
|
|
22
|
+
const descLine = ` ${kleur.blue('│')}${' '.repeat(descPad)}${kleur.dim().white(desc)}${' '.repeat(descRightPad)}${kleur.blue('│')}`;
|
|
23
|
+
|
|
24
|
+
console.log();
|
|
25
|
+
console.log(topLine);
|
|
26
|
+
console.log(empty);
|
|
27
|
+
console.log(titleLine);
|
|
28
|
+
console.log(descLine);
|
|
29
|
+
console.log(empty);
|
|
30
|
+
console.log(bottomLine);
|
|
31
|
+
console.log();
|
|
32
|
+
};
|
|
5
33
|
|
|
6
34
|
export const printSummary = (
|
|
7
35
|
targetDir: string,
|
|
8
36
|
template: TemplateType,
|
|
9
|
-
|
|
10
|
-
|
|
37
|
+
selectedBlocks: string[],
|
|
38
|
+
selectedIntegrations: string[],
|
|
11
39
|
uncoveredModules: string[] = [],
|
|
12
40
|
skipInstall = false,
|
|
13
41
|
): void => {
|
|
14
42
|
const templateName = TEMPLATES[template].name;
|
|
43
|
+
const relativeDir = path.relative(process.cwd(), targetDir) || '.';
|
|
15
44
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
45
|
+
// Collect all content lines to measure max width
|
|
46
|
+
const lines: Array<{ text: string; plain: string }> = [];
|
|
47
|
+
|
|
48
|
+
const addLine = (text: string, plain: string): void => {
|
|
49
|
+
lines.push({ text, plain });
|
|
50
|
+
};
|
|
51
|
+
const addEmpty = (): void => {
|
|
52
|
+
lines.push({ text: '', plain: '' });
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
addLine(` ${kleur.green().bold('Project created successfully!')}`, ' Project created successfully!');
|
|
56
|
+
addEmpty();
|
|
57
|
+
addLine(` Location: ${kleur.cyan(`./${relativeDir}`)}`, ` Location: ./${relativeDir}`);
|
|
58
|
+
addLine(` Template: ${templateName}`, ` Template: ${templateName}`);
|
|
59
|
+
addEmpty();
|
|
60
|
+
|
|
61
|
+
addLine(
|
|
62
|
+
` ${kleur.bold('Blocks')} ${kleur.dim(`(${selectedBlocks.length})`)}`,
|
|
63
|
+
` Blocks (${selectedBlocks.length})`,
|
|
64
|
+
);
|
|
65
|
+
for (const block of selectedBlocks) {
|
|
66
|
+
addLine(` ${kleur.cyan('•')} ${block}`, ` • ${block}`);
|
|
67
|
+
}
|
|
68
|
+
addEmpty();
|
|
69
|
+
|
|
70
|
+
addLine(
|
|
71
|
+
` ${kleur.bold('Integrations')} ${kleur.dim(`(${selectedIntegrations.length})`)}`,
|
|
72
|
+
` Integrations (${selectedIntegrations.length})`,
|
|
73
|
+
);
|
|
74
|
+
for (const integration of selectedIntegrations) {
|
|
75
|
+
addLine(` ${kleur.yellow('•')} ${integration}`, ` • ${integration}`);
|
|
76
|
+
}
|
|
24
77
|
|
|
25
78
|
if (uncoveredModules.length > 0) {
|
|
26
|
-
|
|
27
|
-
|
|
79
|
+
addEmpty();
|
|
80
|
+
addLine(` ${kleur.yellow().bold('⚠ Uncovered modules')}`, ' ⚠ Uncovered modules');
|
|
28
81
|
for (const mod of uncoveredModules) {
|
|
29
|
-
|
|
82
|
+
addLine(` ${kleur.red('•')} ${mod}`, ` • ${mod}`);
|
|
30
83
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
84
|
+
addEmpty();
|
|
85
|
+
addLine(
|
|
86
|
+
` ${kleur.red('The project will NOT start until these are configured.')}`,
|
|
87
|
+
' The project will NOT start until these are configured.',
|
|
88
|
+
);
|
|
89
|
+
addLine(
|
|
90
|
+
` ${kleur.dim('Edit packages/configs/integrations/src/models/<module>.ts')}`,
|
|
91
|
+
' Edit packages/configs/integrations/src/models/<module>.ts',
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
addEmpty();
|
|
96
|
+
addLine(` ${kleur.bold('Next steps:')}`, ' Next steps:');
|
|
97
|
+
addEmpty();
|
|
98
|
+
addLine(` ${kleur.white(`cd ./${relativeDir}`)}`, ` cd ./${relativeDir}`);
|
|
99
|
+
|
|
100
|
+
if (uncoveredModules.length > 0) {
|
|
101
|
+
addLine(
|
|
102
|
+
` ${kleur.dim('# 1. Configure the uncovered modules above')}`,
|
|
103
|
+
' # 1. Configure the uncovered modules above',
|
|
104
|
+
);
|
|
105
|
+
addLine(
|
|
106
|
+
` ${kleur.dim('# 2. Add required env vars to apps/api-harmonization/.env.local')}`,
|
|
107
|
+
' # 2. Add required env vars to apps/api-harmonization/.env.local',
|
|
108
|
+
);
|
|
109
|
+
addLine(
|
|
110
|
+
` ${kleur.dim('# 3. Start development (two terminals):')}`,
|
|
111
|
+
' # 3. Start development (two terminals):',
|
|
112
|
+
);
|
|
113
|
+
addLine(` ${kleur.dim('npm run watch:deps')}`, ' npm run watch:deps');
|
|
114
|
+
addLine(` ${kleur.dim('npm run watch:apps')}`, ' npm run watch:apps');
|
|
44
115
|
} else {
|
|
45
|
-
console.log(kleur.bold('Next steps:'));
|
|
46
|
-
console.log();
|
|
47
|
-
console.log(` cd ${targetDir}`);
|
|
48
116
|
if (skipInstall) {
|
|
49
|
-
|
|
50
|
-
|
|
117
|
+
addLine(
|
|
118
|
+
` ${kleur.dim('# Install dependencies (npm install was skipped)')}`,
|
|
119
|
+
' # Install dependencies (npm install was skipped)',
|
|
120
|
+
);
|
|
121
|
+
addLine(' npm install', ' npm install');
|
|
51
122
|
}
|
|
52
|
-
|
|
53
|
-
|
|
123
|
+
addLine(
|
|
124
|
+
` npm run watch:deps ${kleur.dim('# Terminal 1: watch & build packages')}`,
|
|
125
|
+
' npm run watch:deps # Terminal 1: watch & build packages',
|
|
126
|
+
);
|
|
127
|
+
addLine(
|
|
128
|
+
` npm run watch:apps ${kleur.dim('# Terminal 2: run frontend + API')}`,
|
|
129
|
+
' npm run watch:apps # Terminal 2: run frontend + API',
|
|
130
|
+
);
|
|
54
131
|
}
|
|
55
132
|
|
|
133
|
+
addEmpty();
|
|
134
|
+
addLine(` ${kleur.bold('Useful links:')}`, ' Useful links:');
|
|
135
|
+
addLine(
|
|
136
|
+
` ${kleur.dim('Docs & installation:')} ${kleur.cyan(DOCS_URL)}`,
|
|
137
|
+
` Docs & installation: ${DOCS_URL}`,
|
|
138
|
+
);
|
|
139
|
+
addLine(
|
|
140
|
+
` ${kleur.dim('Storybook (blocks):')} ${kleur.cyan(STORYBOOK_URL)}`,
|
|
141
|
+
` Storybook (blocks): ${STORYBOOK_URL}`,
|
|
142
|
+
);
|
|
143
|
+
addLine(
|
|
144
|
+
` ${kleur.dim('Integrations guide:')} ${kleur.cyan(DOCS_INTEGRATIONS_URL)}`,
|
|
145
|
+
` Integrations guide: ${DOCS_INTEGRATIONS_URL}`,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// Calculate box width
|
|
149
|
+
const maxPlainWidth = Math.max(...lines.map((l) => l.plain.length));
|
|
150
|
+
const boxWidth = maxPlainWidth + 4; // 2 padding each side
|
|
151
|
+
|
|
152
|
+
// Print box
|
|
56
153
|
console.log();
|
|
57
|
-
console.log(kleur.
|
|
58
|
-
|
|
154
|
+
console.log(` ${kleur.blue('╭' + '─'.repeat(boxWidth) + '╮')}`);
|
|
155
|
+
|
|
156
|
+
for (const line of lines) {
|
|
157
|
+
const rightPad = boxWidth - line.plain.length;
|
|
158
|
+
console.log(` ${kleur.blue('│')}${line.text}${' '.repeat(rightPad)}${kleur.blue('│')}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
console.log(` ${kleur.blue('╰' + '─'.repeat(boxWidth) + '╯')}`);
|
|
59
162
|
console.log();
|
|
60
163
|
};
|
|
61
164
|
|
package/src/wizard/prompts.ts
CHANGED
|
@@ -95,10 +95,30 @@ export const runWizardPrompts = async (
|
|
|
95
95
|
let selectedIntegrations: string[];
|
|
96
96
|
|
|
97
97
|
if (template === 'custom') {
|
|
98
|
+
const tipLines = [
|
|
99
|
+
`${kleur.blue().bold('Tip:')} Not sure which blocks to pick?`,
|
|
100
|
+
`Browse our Storybook to preview all available components:`,
|
|
101
|
+
kleur.cyan(STORYBOOK_URL),
|
|
102
|
+
];
|
|
103
|
+
const tipWidth = Math.max(
|
|
104
|
+
'Tip: Not sure which blocks to pick?'.length,
|
|
105
|
+
'Browse our Storybook to preview all available components:'.length,
|
|
106
|
+
STORYBOOK_URL.length,
|
|
107
|
+
);
|
|
108
|
+
const boxWidth = tipWidth + 4;
|
|
109
|
+
|
|
98
110
|
console.log();
|
|
99
|
-
console.log(kleur.
|
|
100
|
-
console.log(
|
|
101
|
-
|
|
111
|
+
console.log(` ${kleur.blue('╭' + '─'.repeat(boxWidth) + '╮')}`);
|
|
112
|
+
console.log(
|
|
113
|
+
` ${kleur.blue('│')} ${tipLines[0]}${' '.repeat(boxWidth - 2 - 'Tip: Not sure which blocks to pick?'.length)}${kleur.blue('│')}`,
|
|
114
|
+
);
|
|
115
|
+
console.log(
|
|
116
|
+
` ${kleur.blue('│')} ${tipLines[1]}${' '.repeat(boxWidth - 2 - 'Browse our Storybook to preview all available components:'.length)}${kleur.blue('│')}`,
|
|
117
|
+
);
|
|
118
|
+
console.log(
|
|
119
|
+
` ${kleur.blue('│')} ${tipLines[2]}${' '.repeat(boxWidth - 2 - STORYBOOK_URL.length)}${kleur.blue('│')}`,
|
|
120
|
+
);
|
|
121
|
+
console.log(` ${kleur.blue('╰' + '─'.repeat(boxWidth) + '╯')}`);
|
|
102
122
|
console.log();
|
|
103
123
|
|
|
104
124
|
selectedBlocks = await promptBlockSelection(availableBlocks, []);
|