@cbnventures/nova 0.25.1 → 0.26.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/build/package.json +10 -8
- package/build/src/cli/generate/github/workflows-blueprint-validate.js +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -3
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.js +122 -26
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
- package/build/src/cli/index.js +79 -28
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/recipe/github/gh-commands.d.ts +3 -0
- package/build/src/cli/recipe/github/gh-commands.d.ts.map +1 -0
- package/build/src/cli/recipe/github/gh-commands.js +28 -0
- package/build/src/cli/recipe/github/gh-commands.js.map +1 -0
- package/build/src/cli/recipe/github/sync-actions.d.ts +5 -0
- package/build/src/cli/recipe/github/sync-actions.d.ts.map +1 -0
- package/build/src/cli/recipe/github/sync-actions.js +103 -0
- package/build/src/cli/recipe/github/sync-actions.js.map +1 -0
- package/build/src/cli/recipe/github/sync-features.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-features.js +46 -11
- package/build/src/cli/recipe/github/sync-features.js.map +1 -1
- package/build/src/cli/recipe/github/sync-labels.d.ts +5 -0
- package/build/src/cli/recipe/github/sync-labels.d.ts.map +1 -0
- package/build/src/cli/recipe/github/sync-labels.js +40 -0
- package/build/src/cli/recipe/github/sync-labels.js.map +1 -0
- package/build/src/cli/recipe/github/sync-policies.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-policies.js +89 -10
- package/build/src/cli/recipe/github/sync-policies.js.map +1 -1
- package/build/src/cli/recipe/github/sync-rulesets.d.ts +5 -0
- package/build/src/cli/recipe/github/sync-rulesets.d.ts.map +1 -0
- package/build/src/cli/recipe/github/sync-rulesets.js +137 -0
- package/build/src/cli/recipe/github/sync-rulesets.js.map +1 -0
- package/build/src/cli/recipe/github/sync-security.d.ts +5 -0
- package/build/src/cli/recipe/github/sync-security.d.ts.map +1 -0
- package/build/src/cli/recipe/github/sync-security.js +69 -0
- package/build/src/cli/recipe/github/sync-security.js.map +1 -0
- package/build/src/cli/recipe/index.d.ts.map +1 -1
- package/build/src/cli/recipe/index.js +20 -0
- package/build/src/cli/recipe/index.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.js +16 -15
- package/build/src/cli/recipe/package-json/sync-environment.js.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.d.ts +2 -1
- package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
- package/build/src/cli/scaffold/docs/docusaurus.js +41 -1
- package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
- package/build/src/cli/scaffold/starter/base.d.ts.map +1 -1
- package/build/src/cli/scaffold/starter/base.js +57 -6
- package/build/src/cli/scaffold/starter/base.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts +1 -0
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +183 -67
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/initialize.d.ts.map +1 -1
- package/build/src/cli/utility/initialize.js +133 -45
- package/build/src/cli/utility/initialize.js.map +1 -1
- package/build/src/cli/utility/run-scripts.d.ts +5 -5
- package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
- package/build/src/cli/utility/run-scripts.js +28 -252
- package/build/src/cli/utility/run-scripts.js.map +1 -1
- package/build/src/cli/utility/transpile.d.ts.map +1 -1
- package/build/src/cli/utility/transpile.js +23 -5
- package/build/src/cli/utility/transpile.js.map +1 -1
- package/build/src/cli/utility/type-check.d.ts +2 -4
- package/build/src/cli/utility/type-check.d.ts.map +1 -1
- package/build/src/cli/utility/type-check.js +13 -54
- package/build/src/cli/utility/type-check.js.map +1 -1
- package/build/src/cli/utility/version.d.ts.map +1 -1
- package/build/src/cli/utility/version.js +0 -12
- package/build/src/cli/utility/version.js.map +1 -1
- package/build/src/lib/corepack.d.ts +5 -0
- package/build/src/lib/corepack.d.ts.map +1 -0
- package/build/src/lib/corepack.js +26 -0
- package/build/src/lib/corepack.js.map +1 -0
- package/build/src/lib/item.d.ts.map +1 -1
- package/build/src/lib/item.js +4 -1
- package/build/src/lib/item.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +8 -0
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +329 -7
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/regex.d.ts +7 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +8 -1
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/release-history.d.ts +5 -0
- package/build/src/lib/release-history.d.ts.map +1 -0
- package/build/src/lib/release-history.js +86 -0
- package/build/src/lib/release-history.js.map +1 -0
- package/build/src/lib/run-scripts.d.ts +10 -0
- package/build/src/lib/run-scripts.d.ts.map +1 -0
- package/build/src/lib/run-scripts.js +310 -0
- package/build/src/lib/run-scripts.js.map +1 -0
- package/build/src/lib/scaffold.d.ts +7 -2
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +398 -53
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/type-check.d.ts +3 -0
- package/build/src/lib/type-check.d.ts.map +1 -0
- package/build/src/lib/type-check.js +69 -0
- package/build/src/lib/type-check.js.map +1 -0
- package/build/src/presets/tsconfig/dx-strict.json +0 -1
- package/build/src/presets/tsconfig/fw-homebridge.json +11 -0
- package/build/src/rules/eslint/regex/no-regex-literals.d.ts +1 -0
- package/build/src/rules/eslint/regex/no-regex-literals.d.ts.map +1 -1
- package/build/src/rules/eslint/regex/no-regex-literals.js +20 -1
- package/build/src/rules/eslint/regex/no-regex-literals.js.map +1 -1
- package/build/src/rules/eslint/typescript/no-shared-type-import.d.ts +1 -0
- package/build/src/rules/eslint/typescript/no-shared-type-import.d.ts.map +1 -1
- package/build/src/rules/eslint/typescript/no-shared-type-import.js +19 -1
- package/build/src/rules/eslint/typescript/no-shared-type-import.js.map +1 -1
- package/build/src/toolkit/index.d.ts +1 -0
- package/build/src/toolkit/index.d.ts.map +1 -1
- package/build/src/toolkit/index.js +1 -0
- package/build/src/toolkit/index.js.map +1 -1
- package/build/src/toolkit/vitest-setup.d.ts +6 -0
- package/build/src/toolkit/vitest-setup.d.ts.map +1 -0
- package/build/src/toolkit/vitest-setup.js +21 -0
- package/build/src/toolkit/vitest-setup.js.map +1 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +4 -4
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +69 -3
- package/build/src/types/cli/recipe/github/gh-commands.d.ts +34 -0
- package/build/src/types/cli/recipe/github/sync-actions.d.ts +43 -0
- package/build/src/types/cli/recipe/github/sync-features.d.ts +16 -2
- package/build/src/types/cli/recipe/github/sync-labels.d.ts +36 -0
- package/build/src/types/cli/recipe/github/sync-policies.d.ts +14 -2
- package/build/src/types/cli/recipe/github/sync-rulesets.d.ts +71 -0
- package/build/src/types/cli/recipe/github/sync-security.d.ts +34 -0
- package/build/src/types/cli/recipe/package-json/sync-environment.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/expressjs.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/nextjs.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/vite.d.ts +3 -0
- package/build/src/types/cli/scaffold/app/workers.d.ts +3 -0
- package/build/src/types/cli/scaffold/docs/docusaurus.d.ts +15 -0
- package/build/src/types/cli/scaffold/starter/base.d.ts +11 -0
- package/build/src/types/cli/utility/changelog.d.ts +87 -26
- package/build/src/types/cli/utility/initialize.d.ts +39 -29
- package/build/src/types/cli/utility/run-scripts.d.ts +22 -174
- package/build/src/types/cli/utility/transpile.d.ts +9 -1
- package/build/src/types/cli/utility/type-check.d.ts +9 -71
- package/build/src/types/cli/utility/version.d.ts +1 -7
- package/build/src/types/lib/corepack.d.ts +19 -0
- package/build/src/types/lib/nova-config.d.ts +256 -23
- package/build/src/types/lib/regex.d.ts +42 -0
- package/build/src/types/lib/release-history.d.ts +57 -0
- package/build/src/types/lib/run-scripts.d.ts +264 -0
- package/build/src/types/lib/scaffold.d.ts +187 -10
- package/build/src/types/lib/type-check.d.ts +102 -0
- package/build/src/types/rules/eslint/regex/no-regex-literals.d.ts +21 -0
- package/build/src/types/rules/eslint/typescript/no-shared-type-import.d.ts +21 -0
- package/build/src/types/shared.d.ts +264 -22
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +4 -0
- package/build/src/types/tests/cli/index.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/package-json/normalize-tooling.test.d.ts +27 -0
- package/build/src/types/tests/cli/scaffold/app/expressjs.test.d.ts +4 -0
- package/build/src/types/tests/cli/scaffold/app/nextjs.test.d.ts +4 -0
- package/build/src/types/tests/cli/scaffold/app/vite.test.d.ts +48 -0
- package/build/src/types/tests/cli/scaffold/app/workers.test.d.ts +4 -0
- package/build/src/types/tests/cli/scaffold/docs/docusaurus.test.d.ts +10 -2
- package/build/src/types/tests/cli/utility/changelog.test.d.ts +99 -0
- package/build/src/types/tests/cli/utility/initialize.test.d.ts +43 -0
- package/build/src/types/tests/cli/utility/run-scripts.test.d.ts +29 -0
- package/build/src/types/tests/cli/utility/transpile.test.d.ts +28 -0
- package/build/src/types/tests/cli/utility/type-check.test.d.ts +33 -0
- package/build/src/types/tests/lib/nova-config.test.d.ts +19 -19
- package/build/src/types/tests/lib/regex.test.d.ts +7 -0
- package/build/src/types/tests/lib/release-history.test.d.ts +94 -0
- package/build/src/types/tests/lib/scaffold.test.d.ts +88 -0
- package/build/src/types/tests/rules/eslint/regex/no-regex-literals.test.d.ts +46 -0
- package/build/src/types/tests/rules/eslint/typescript/no-shared-type-import.test.d.ts +46 -0
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +104 -0
- package/build/src/types/tests/scaffold-template-source.test.d.ts +42 -0
- package/build/src/types/tests/toolkit/vitest-setup.test.d.ts +36 -0
- package/build/src/types/tests/tsconfig-presets.test.d.ts +81 -0
- package/build/src/types/toolkit/vitest-setup.d.ts +24 -0
- package/build/templates/generators/github/workflows/publish/base.yml +1 -1
- package/build/templates/generators/github/workflows/publish/targets/cloudflare-workers.yml +1 -1
- package/build/templates/generators/must-haves/agent-conventions/PROJECT_RULES.md +11 -11
- package/build/templates/generators/must-haves/agent-conventions/conventions/documentation.md +4 -4
- package/build/templates/scaffold/app/express/package.json +2 -2
- package/build/templates/scaffold/app/express/tsconfig.json +1 -0
- package/build/templates/scaffold/app/nextjs/package.json +9 -10
- package/build/templates/scaffold/app/nextjs/tsconfig.json +3 -2
- package/build/templates/scaffold/app/vite/package.json +3 -3
- package/build/templates/scaffold/app/workers/package.json +4 -4
- package/build/templates/scaffold/app/workers/wrangler.toml +1 -1
- package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +14 -12
- package/build/templates/scaffold/docs/docusaurus/package.json +13 -9
- package/build/templates/scaffold/docs/docusaurus/src/pages/index.mdx +8 -0
- package/build/templates/scaffold/docs/docusaurus/tsconfig.json +11 -5
- package/build/templates/scaffold/docs/docusaurus/{vitest.config.ts → vitest.config.mts} +11 -0
- package/build/templates/scaffold/docs/docusaurus/vitest.setup.ts +5 -14
- package/package.json +10 -8
- /package/build/templates/scaffold/docs/docusaurus/docs/{intro.md → intro.mdx} +0 -0
|
@@ -1,9 +1,126 @@
|
|
|
1
1
|
import { promises as fs } from 'node:fs';
|
|
2
|
-
import { join, relative, resolve } from 'node:path';
|
|
2
|
+
import { isAbsolute, join, relative, resolve, sep, } from 'node:path';
|
|
3
|
+
import { minimatch } from 'minimatch';
|
|
3
4
|
import prompts from 'prompts';
|
|
5
|
+
import novaPackageJson from '../../package.json' with { type: 'json' };
|
|
4
6
|
import { Logger } from '../toolkit/index.js';
|
|
5
|
-
import { LIB_REGEX_PLACEHOLDER_PROJECT_SLUG } from './regex.js';
|
|
6
|
-
import { discoverPathsWithFile, resolveTemplatePath, saveGeneratedFile } from './utility.js';
|
|
7
|
+
import { LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PLACEHOLDER_PROJECT_SLUG, LIB_REGEX_PLACEHOLDER_WORKSPACE_PACKAGE_NAME, } from './regex.js';
|
|
8
|
+
import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, saveGeneratedFile, } from './utility.js';
|
|
9
|
+
function reportError(message) {
|
|
10
|
+
Logger.customize({
|
|
11
|
+
name: 'CliScaffold.run',
|
|
12
|
+
purpose: 'validate',
|
|
13
|
+
}).error(message);
|
|
14
|
+
process.exitCode = 1;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
export function resolveWorkspacePackageName(projectSlug, workspaceName, category) {
|
|
18
|
+
return (category === 'docs') ? `${projectSlug}-docs` : `${projectSlug}-app-${workspaceName}`;
|
|
19
|
+
}
|
|
20
|
+
export function normalizeWorkspaceRelativePath(rootDirectory, workspaceDirectory) {
|
|
21
|
+
const relativePath = relative(rootDirectory, workspaceDirectory);
|
|
22
|
+
if (relativePath === ''
|
|
23
|
+
|| relativePath === '..'
|
|
24
|
+
|| relativePath.startsWith(`..${sep}`) === true
|
|
25
|
+
|| isAbsolute(relativePath) === true) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const normalizedPath = relativePath.split(sep).join('/');
|
|
29
|
+
return `./${normalizedPath}`;
|
|
30
|
+
}
|
|
31
|
+
export async function findFileConflicts(plannedPaths) {
|
|
32
|
+
const exists = await Promise.all(plannedPaths.map((plannedPath) => pathExists(plannedPath)));
|
|
33
|
+
return plannedPaths.filter((_plannedPath, index) => exists[index] === true);
|
|
34
|
+
}
|
|
35
|
+
export async function loadExistingRoot(rootDirectory) {
|
|
36
|
+
const packageJsonPath = join(rootDirectory, 'package.json');
|
|
37
|
+
const configFilePath = join(rootDirectory, 'nova.config.json');
|
|
38
|
+
let parsedPackageJson = undefined;
|
|
39
|
+
try {
|
|
40
|
+
const packageJsonRaw = await fs.readFile(packageJsonPath, 'utf-8');
|
|
41
|
+
parsedPackageJson = JSON.parse(packageJsonRaw);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
reportError('The root package.json is missing or contains invalid JSON. No scaffold files were written.');
|
|
45
|
+
Logger.customize({
|
|
46
|
+
name: 'loadExistingRoot',
|
|
47
|
+
purpose: 'packageJson',
|
|
48
|
+
}).debug(error);
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
if (isPlainObject(parsedPackageJson) === false) {
|
|
52
|
+
reportError('The root package.json must contain a JSON object. No scaffold files were written.');
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
const packageJson = parsedPackageJson;
|
|
56
|
+
const workspacesValue = packageJson['workspaces'];
|
|
57
|
+
let workspacePatterns = undefined;
|
|
58
|
+
if (Array.isArray(workspacesValue) === true
|
|
59
|
+
&& workspacesValue.every((workspacePattern) => typeof workspacePattern === 'string' && workspacePattern.trim() !== '') === true) {
|
|
60
|
+
workspacePatterns = workspacesValue;
|
|
61
|
+
}
|
|
62
|
+
else if (isPlainObject(workspacesValue) === true) {
|
|
63
|
+
const workspacesObject = workspacesValue;
|
|
64
|
+
const workspacePatternsValue = workspacesObject['packages'];
|
|
65
|
+
if (Array.isArray(workspacePatternsValue) === true
|
|
66
|
+
&& workspacePatternsValue.every((workspacePattern) => typeof workspacePattern === 'string' && workspacePattern.trim() !== '') === true) {
|
|
67
|
+
workspacePatterns = workspacePatternsValue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (workspacePatterns === undefined) {
|
|
71
|
+
reportError('The root package.json "workspaces" field must be a string array or an object with a string "packages" array. No scaffold files were written.');
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
let parsedConfig = undefined;
|
|
75
|
+
try {
|
|
76
|
+
const configRaw = await fs.readFile(configFilePath, 'utf-8');
|
|
77
|
+
parsedConfig = JSON.parse(configRaw);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
reportError('A readable nova.config.json is required at the monorepo root. Run "nova utility initialize" before adding a workspace. No scaffold files were written.');
|
|
81
|
+
Logger.customize({
|
|
82
|
+
name: 'loadExistingRoot',
|
|
83
|
+
purpose: 'novaConfig',
|
|
84
|
+
}).debug(error);
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
if (isPlainObject(parsedConfig) === false) {
|
|
88
|
+
reportError('The root nova.config.json must contain a JSON object. No scaffold files were written.');
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
const config = parsedConfig;
|
|
92
|
+
const projectValue = config['project'];
|
|
93
|
+
if (isPlainObject(projectValue) === false) {
|
|
94
|
+
reportError('The root nova.config.json must define project.name.slug before adding a workspace. No scaffold files were written.');
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
const project = projectValue;
|
|
98
|
+
const projectNameValue = project['name'];
|
|
99
|
+
if (isPlainObject(projectNameValue) === false) {
|
|
100
|
+
reportError('The root nova.config.json must define project.name.slug before adding a workspace. No scaffold files were written.');
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const projectName = projectNameValue;
|
|
104
|
+
const projectSlugValue = projectName['slug'];
|
|
105
|
+
if (typeof projectSlugValue !== 'string' || LIB_REGEX_PATTERN_SLUG_SIMPLE.test(projectSlugValue) === false) {
|
|
106
|
+
reportError('The root nova.config.json project.name.slug must be a lowercase slug before adding a workspace. No scaffold files were written.');
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const projectSlug = projectSlugValue;
|
|
110
|
+
const configWorkspacesValue = config['workspaces'];
|
|
111
|
+
if (configWorkspacesValue !== undefined && isPlainObject(configWorkspacesValue) === false) {
|
|
112
|
+
reportError('The root nova.config.json "workspaces" field must be an object. No scaffold files were written.');
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
const configWorkspaces = (configWorkspacesValue === undefined) ? {} : configWorkspacesValue;
|
|
116
|
+
return {
|
|
117
|
+
config,
|
|
118
|
+
packageJson,
|
|
119
|
+
projectSlug,
|
|
120
|
+
workspacePatterns,
|
|
121
|
+
workspaces: configWorkspaces,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
7
124
|
export async function detectMonorepoContext(currentWorkingDirectory) {
|
|
8
125
|
const locations = await discoverPathsWithFile('package.json', 'backward');
|
|
9
126
|
if (locations.length === 0) {
|
|
@@ -14,7 +131,24 @@ export async function detectMonorepoContext(currentWorkingDirectory) {
|
|
|
14
131
|
&& locations[0] !== currentWorkingDirectory)) {
|
|
15
132
|
return { context: 'nested' };
|
|
16
133
|
}
|
|
17
|
-
const
|
|
134
|
+
const packageJsonPath = join(currentWorkingDirectory, 'package.json');
|
|
135
|
+
let parsedPackageJson = {};
|
|
136
|
+
try {
|
|
137
|
+
const packageJsonRaw = await fs.readFile(packageJsonPath, 'utf-8');
|
|
138
|
+
parsedPackageJson = JSON.parse(packageJsonRaw);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return {
|
|
142
|
+
context: 'invalid',
|
|
143
|
+
reason: 'The current package.json contains invalid JSON.',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (isPlainObject(parsedPackageJson) === false) {
|
|
147
|
+
return {
|
|
148
|
+
context: 'invalid',
|
|
149
|
+
reason: 'The current package.json must contain a JSON object.',
|
|
150
|
+
};
|
|
151
|
+
}
|
|
18
152
|
if (parsedPackageJson['workspaces'] !== undefined) {
|
|
19
153
|
return {
|
|
20
154
|
context: 'workspace',
|
|
@@ -47,9 +181,12 @@ export async function promptScaffoldOptions(context, defaults) {
|
|
|
47
181
|
initial: defaults['typeName'],
|
|
48
182
|
});
|
|
49
183
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
184
|
+
let monorepoPromptsAnswers = {};
|
|
185
|
+
if (monorepoQuestions.length > 0) {
|
|
186
|
+
monorepoPromptsAnswers = await prompts(monorepoQuestions, {
|
|
187
|
+
onCancel: () => false,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
53
190
|
if (monorepoNameValue === undefined && monorepoPromptsAnswers['name'] === undefined) {
|
|
54
191
|
cancelled = true;
|
|
55
192
|
}
|
|
@@ -134,7 +271,7 @@ export async function promptScaffoldOptions(context, defaults) {
|
|
|
134
271
|
questions.push({
|
|
135
272
|
type: 'text',
|
|
136
273
|
name: 'name',
|
|
137
|
-
message: '
|
|
274
|
+
message: 'Project name (slug):',
|
|
138
275
|
initial: defaults['typeName'],
|
|
139
276
|
});
|
|
140
277
|
}
|
|
@@ -158,9 +295,12 @@ export async function promptScaffoldOptions(context, defaults) {
|
|
|
158
295
|
initial: resolveInitialOutput,
|
|
159
296
|
});
|
|
160
297
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
298
|
+
let promptsAnswers = {};
|
|
299
|
+
if (questions.length > 0) {
|
|
300
|
+
promptsAnswers = await prompts(questions, {
|
|
301
|
+
onCancel: () => false,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
164
304
|
if (nameValue === undefined && promptsAnswers['name'] === undefined) {
|
|
165
305
|
cancelled = true;
|
|
166
306
|
}
|
|
@@ -183,6 +323,52 @@ export async function promptScaffoldOptions(context, defaults) {
|
|
|
183
323
|
outputDirectory: resolve(currentDirectory, resolvedOutput),
|
|
184
324
|
};
|
|
185
325
|
}
|
|
326
|
+
export async function resolveTemplateAnswers(options, questions, isNonInteractive) {
|
|
327
|
+
const replacements = new Map();
|
|
328
|
+
for (const question of questions) {
|
|
329
|
+
const providedValue = Reflect.get(options, question['name']);
|
|
330
|
+
let resolvedValue = undefined;
|
|
331
|
+
if (providedValue !== undefined) {
|
|
332
|
+
if (typeof providedValue !== 'string'
|
|
333
|
+
|| question['choices'].some((choice) => choice['value'] === providedValue) !== true) {
|
|
334
|
+
const allowedValues = question['choices'].map((choice) => choice['value']).join(', ');
|
|
335
|
+
Logger.customize({
|
|
336
|
+
name: 'resolveTemplateAnswers',
|
|
337
|
+
purpose: 'validate',
|
|
338
|
+
}).error(`Invalid ${question['flag']} value "${String(providedValue)}". Expected one of: ${allowedValues}.`);
|
|
339
|
+
process.exitCode = 1;
|
|
340
|
+
return undefined;
|
|
341
|
+
}
|
|
342
|
+
resolvedValue = providedValue;
|
|
343
|
+
}
|
|
344
|
+
else if (isNonInteractive === true) {
|
|
345
|
+
Logger.customize({
|
|
346
|
+
name: 'resolveTemplateAnswers',
|
|
347
|
+
purpose: 'validate',
|
|
348
|
+
}).error(`Non-interactive scaffolding requires ${question['flag']}.`);
|
|
349
|
+
process.exitCode = 1;
|
|
350
|
+
return undefined;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
const answers = await prompts({
|
|
354
|
+
type: 'select',
|
|
355
|
+
name: question['name'],
|
|
356
|
+
message: question['message'],
|
|
357
|
+
choices: question['choices'],
|
|
358
|
+
initial: question['initial'],
|
|
359
|
+
}, {
|
|
360
|
+
onCancel: () => false,
|
|
361
|
+
});
|
|
362
|
+
const answer = answers[question['name']];
|
|
363
|
+
if (typeof answer !== 'string') {
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
resolvedValue = answer;
|
|
367
|
+
}
|
|
368
|
+
replacements.set(question['placeholder'], resolvedValue);
|
|
369
|
+
}
|
|
370
|
+
return replacements;
|
|
371
|
+
}
|
|
186
372
|
export async function createWorkspaceDirectory(basePath, workspaceName) {
|
|
187
373
|
const workspaceDirectory = join(basePath, workspaceName);
|
|
188
374
|
await fs.mkdir(workspaceDirectory, { recursive: true });
|
|
@@ -241,15 +427,25 @@ export async function createMonorepoRoot(outputDirectory, projectSlug) {
|
|
|
241
427
|
name: `${projectSlug}-project`,
|
|
242
428
|
version: '0.0.0',
|
|
243
429
|
private: true,
|
|
430
|
+
allowScripts: {
|
|
431
|
+
'core-js': false,
|
|
432
|
+
'core-js-pure': false,
|
|
433
|
+
'es5-ext': false,
|
|
434
|
+
'esbuild': false,
|
|
435
|
+
'sharp': false,
|
|
436
|
+
'unrs-resolver': false,
|
|
437
|
+
'workerd': false,
|
|
438
|
+
},
|
|
244
439
|
workspaces: [
|
|
245
440
|
'apps/*',
|
|
246
441
|
'packages/*',
|
|
247
442
|
],
|
|
248
|
-
|
|
249
|
-
'@cbnventures/nova': 'latest',
|
|
250
|
-
},
|
|
443
|
+
packageManager: 'npm@11.18.0',
|
|
251
444
|
engines: {
|
|
252
|
-
node: '
|
|
445
|
+
node: '^22 || ^24',
|
|
446
|
+
},
|
|
447
|
+
devDependencies: {
|
|
448
|
+
'@cbnventures/nova': novaPackageJson['version'],
|
|
253
449
|
},
|
|
254
450
|
};
|
|
255
451
|
const packageJsonPath = join(outputDirectory, 'package.json');
|
|
@@ -446,29 +642,33 @@ export async function registerWorkspaceInConfig(configFilePath, workspaceRelPath
|
|
|
446
642
|
const raw = await fs.readFile(configFilePath, 'utf-8');
|
|
447
643
|
parsedConfig = JSON.parse(raw);
|
|
448
644
|
}
|
|
449
|
-
catch {
|
|
645
|
+
catch (error) {
|
|
646
|
+
reportError('Unable to read nova.config.json while registering the scaffolded workspace.');
|
|
450
647
|
Logger.customize({
|
|
451
648
|
name: 'registerWorkspaceInConfig',
|
|
452
|
-
purpose: '
|
|
453
|
-
}).
|
|
649
|
+
purpose: 'config',
|
|
650
|
+
}).debug(error);
|
|
454
651
|
return;
|
|
455
652
|
}
|
|
456
|
-
if (parsedConfig ===
|
|
653
|
+
if (isPlainObject(parsedConfig) === false) {
|
|
654
|
+
reportError('The root nova.config.json must contain a JSON object.');
|
|
457
655
|
return;
|
|
458
656
|
}
|
|
459
657
|
const project = parsedConfig['project'];
|
|
460
658
|
const projectName = (project !== undefined) ? project['name'] : undefined;
|
|
461
659
|
const projectSlug = (projectName !== undefined) ? projectName['slug'] : undefined;
|
|
462
|
-
if (projectSlug ===
|
|
463
|
-
|
|
464
|
-
name: 'registerWorkspaceInConfig',
|
|
465
|
-
purpose: 'skip',
|
|
466
|
-
}).warn('No project slug found in nova.config.json. Skipping workspace registration.');
|
|
660
|
+
if (typeof projectSlug !== 'string' || LIB_REGEX_PATTERN_SLUG_SIMPLE.test(projectSlug) === false) {
|
|
661
|
+
reportError('The root nova.config.json must define a valid project.name.slug before registering a workspace.');
|
|
467
662
|
return;
|
|
468
663
|
}
|
|
469
664
|
const role = (category === 'docs') ? 'docs' : 'app';
|
|
470
|
-
const configName = (
|
|
471
|
-
const
|
|
665
|
+
const configName = resolveWorkspacePackageName(projectSlug, workspaceName, category);
|
|
666
|
+
const parsedWorkspaces = parsedConfig['workspaces'];
|
|
667
|
+
if (parsedWorkspaces !== undefined && isPlainObject(parsedWorkspaces) === false) {
|
|
668
|
+
reportError('The root nova.config.json "workspaces" field must be an object.');
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const workspaces = parsedWorkspaces ?? {};
|
|
472
672
|
Reflect.set(workspaces, workspaceRelPath, {
|
|
473
673
|
name: configName,
|
|
474
674
|
role,
|
|
@@ -482,9 +682,10 @@ export async function registerWorkspaceInConfig(configFilePath, workspaceRelPath
|
|
|
482
682
|
}).info(`Registered workspace "${configName}" in nova.config.json.`);
|
|
483
683
|
return;
|
|
484
684
|
}
|
|
485
|
-
export async function runScaffold(options, category, typeName, templateSubpath, importMetaUrl) {
|
|
685
|
+
export async function runScaffold(options, category, typeName, templateSubpath, importMetaUrl, templateQuestions = []) {
|
|
486
686
|
const currentDirectory = process.cwd();
|
|
487
687
|
const isDryRun = options['dryRun'] === true;
|
|
688
|
+
const isNonInteractive = options['nonInteractive'] === true;
|
|
488
689
|
if (isDryRun === true) {
|
|
489
690
|
Logger.customize({
|
|
490
691
|
name: 'CliScaffold.run',
|
|
@@ -492,28 +693,51 @@ export async function runScaffold(options, category, typeName, templateSubpath,
|
|
|
492
693
|
}).warn('Dry run enabled. File changes will not be made in this session.');
|
|
493
694
|
}
|
|
494
695
|
const context = await detectMonorepoContext(currentDirectory);
|
|
696
|
+
if (context['context'] === 'invalid') {
|
|
697
|
+
reportError(`${context['reason']} No scaffold files were written.`);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
495
700
|
if (context['context'] === 'nested') {
|
|
496
|
-
|
|
497
|
-
name: 'CliScaffold.run',
|
|
498
|
-
purpose: 'context',
|
|
499
|
-
}).error('Re-run this command from the monorepo root directory.');
|
|
500
|
-
process.exitCode = 1;
|
|
701
|
+
reportError('Re-run this command from the monorepo root directory. No scaffold files were written.');
|
|
501
702
|
return;
|
|
502
703
|
}
|
|
503
704
|
if (context['context'] === 'standalone') {
|
|
504
|
-
|
|
505
|
-
name: 'CliScaffold.run',
|
|
506
|
-
purpose: 'context',
|
|
507
|
-
}).error('Found a standalone project. Run from an empty directory to create a new monorepo, or add a "workspaces" field to use workspace mode.');
|
|
508
|
-
process.exitCode = 1;
|
|
705
|
+
reportError('Found a standalone project. Run from an empty directory to create a new monorepo, or add a valid "workspaces" field to use workspace mode. No scaffold files were written.');
|
|
509
706
|
return;
|
|
510
707
|
}
|
|
511
708
|
Logger.customize({
|
|
512
709
|
name: 'CliScaffold.run',
|
|
513
710
|
purpose: 'context',
|
|
514
711
|
}).info(`Detected mode: ${context['context']}.`);
|
|
712
|
+
let existingRoot = undefined;
|
|
713
|
+
if (context['context'] === 'workspace') {
|
|
714
|
+
existingRoot = await loadExistingRoot(context['root']);
|
|
715
|
+
if (existingRoot === undefined) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
if (options['name'] !== undefined && options['name'] !== existingRoot['projectSlug']) {
|
|
719
|
+
reportError(`This monorepo's project slug is "${existingRoot['projectSlug']}", not "${options['name']}". Omit --name when adding a workspace. No scaffold files were written.`);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
if (isNonInteractive === true
|
|
724
|
+
&& (options['output'] === undefined
|
|
725
|
+
|| options['workspaceName'] === undefined)) {
|
|
726
|
+
reportError('Non-interactive scaffolding requires --workspace-name and --output. No scaffold files were written.');
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
if (isNonInteractive === true
|
|
730
|
+
&& context['context'] === 'monorepo'
|
|
731
|
+
&& options['name'] === undefined) {
|
|
732
|
+
reportError('Creating a new monorepo non-interactively also requires --name. No scaffold files were written.');
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
let configNameDefault = options['name'];
|
|
736
|
+
if (context['context'] === 'workspace' && existingRoot !== undefined) {
|
|
737
|
+
configNameDefault = existingRoot['projectSlug'];
|
|
738
|
+
}
|
|
515
739
|
const config = await promptScaffoldOptions(context, {
|
|
516
|
-
name:
|
|
740
|
+
name: configNameDefault,
|
|
517
741
|
output: options['output'],
|
|
518
742
|
typeName,
|
|
519
743
|
workspaceName: options['workspaceName'],
|
|
@@ -525,37 +749,158 @@ export async function runScaffold(options, category, typeName, templateSubpath,
|
|
|
525
749
|
}).warn('Scaffold cancelled.');
|
|
526
750
|
return;
|
|
527
751
|
}
|
|
752
|
+
if (LIB_REGEX_PATTERN_SLUG_SIMPLE.test(config['name']) === false) {
|
|
753
|
+
reportError('The project name must be a lowercase slug containing only letters, numbers, hyphens, or underscores. No scaffold files were written.');
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (LIB_REGEX_PATTERN_SLUG_SIMPLE.test(config['workspaceName']) === false) {
|
|
757
|
+
reportError('The workspace name must be a lowercase slug containing only letters, numbers, hyphens, or underscores. No scaffold files were written.');
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
const projectSlug = config['name'];
|
|
761
|
+
const workspacePackageName = resolveWorkspacePackageName(projectSlug, config['workspaceName'], category);
|
|
762
|
+
const configRoot = (config['mode'] === 'monorepo') ? config['outputDirectory'] : currentDirectory;
|
|
763
|
+
const configFilePath = join(configRoot, 'nova.config.json');
|
|
764
|
+
const workspaceDirectory = (config['mode'] === 'monorepo') ? join(configRoot, 'apps', config['workspaceName']) : config['outputDirectory'];
|
|
765
|
+
const workspaceRelPath = normalizeWorkspaceRelativePath(configRoot, workspaceDirectory);
|
|
766
|
+
if (workspaceRelPath === undefined) {
|
|
767
|
+
reportError('The workspace output must be a child directory of the monorepo root. No scaffold files were written.');
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const normalizedWorkspaceRelPath = workspaceRelPath.slice(2);
|
|
771
|
+
if (existingRoot !== undefined) {
|
|
772
|
+
const existingWorkspaceEntries = Object.entries(existingRoot['workspaces']);
|
|
773
|
+
for (const existingWorkspaceEntry of existingWorkspaceEntries) {
|
|
774
|
+
const existingWorkspacePath = existingWorkspaceEntry[0];
|
|
775
|
+
const existingWorkspaceValue = existingWorkspaceEntry[1];
|
|
776
|
+
const existingWorkspaceNormalizedPath = resolve(configRoot, existingWorkspacePath);
|
|
777
|
+
if (existingWorkspaceNormalizedPath === workspaceDirectory) {
|
|
778
|
+
reportError(`The workspace path "${workspaceRelPath}" is already registered in nova.config.json. No scaffold files were written.`);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (existingWorkspaceNormalizedPath !== configRoot
|
|
782
|
+
&& (workspaceDirectory.startsWith(`${existingWorkspaceNormalizedPath}${sep}`) === true
|
|
783
|
+
|| existingWorkspaceNormalizedPath.startsWith(`${workspaceDirectory}${sep}`) === true)) {
|
|
784
|
+
reportError(`The workspace path "${workspaceRelPath}" overlaps the registered workspace "${existingWorkspacePath}". Workspaces cannot be nested inside one another. No scaffold files were written.`);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
if (isPlainObject(existingWorkspaceValue) === false) {
|
|
788
|
+
reportError(`The nova.config.json workspace "${existingWorkspacePath}" must be an object. No scaffold files were written.`);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
const existingWorkspace = existingWorkspaceValue;
|
|
792
|
+
const existingWorkspaceName = existingWorkspace['name'];
|
|
793
|
+
const existingWorkspaceRole = existingWorkspace['role'];
|
|
794
|
+
if (typeof existingWorkspaceName !== 'string' || typeof existingWorkspaceRole !== 'string') {
|
|
795
|
+
reportError(`The nova.config.json workspace "${existingWorkspacePath}" must define string name and role fields. No scaffold files were written.`);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (category === 'docs' && existingWorkspaceRole === 'docs') {
|
|
799
|
+
reportError(`A documentation workspace is already registered at "${existingWorkspacePath}". Nova projects support one canonical docs workspace. No scaffold files were written.`);
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
if (existingWorkspaceName === workspacePackageName) {
|
|
803
|
+
reportError(`The workspace package name "${workspacePackageName}" is already registered in nova.config.json. No scaffold files were written.`);
|
|
804
|
+
return;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
const templateDirectory = resolveTemplatePath(importMetaUrl, templateSubpath);
|
|
809
|
+
const templateEntries = await collectFiles(templateDirectory, '');
|
|
810
|
+
const plannedPaths = templateEntries.map((templateEntry) => join(workspaceDirectory, templateEntry));
|
|
811
|
+
if (config['mode'] === 'monorepo') {
|
|
812
|
+
plannedPaths.push(join(configRoot, 'package.json'), configFilePath);
|
|
813
|
+
}
|
|
814
|
+
const conflictingPaths = await findFileConflicts(plannedPaths);
|
|
815
|
+
if (conflictingPaths.length > 0) {
|
|
816
|
+
const conflictMessage = conflictingPaths.map((conflictingPath) => relative(configRoot, conflictingPath)).join(', ');
|
|
817
|
+
reportError(`Scaffolding would overwrite files Nova does not own: ${conflictMessage}. Move or remove those files, then run the command again. No scaffold files were written.`);
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
let isWorkspaceCovered = existingRoot === undefined;
|
|
821
|
+
if (existingRoot !== undefined) {
|
|
822
|
+
for (const workspacePattern of existingRoot['workspacePatterns']) {
|
|
823
|
+
const normalizedWorkspacePattern = (workspacePattern.startsWith('./') === true) ? workspacePattern.slice(2) : workspacePattern;
|
|
824
|
+
if (minimatch(normalizedWorkspaceRelPath, normalizedWorkspacePattern, { dot: true }) === true) {
|
|
825
|
+
isWorkspaceCovered = true;
|
|
826
|
+
break;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
const templateReplacements = await resolveTemplateAnswers(options, templateQuestions, isNonInteractive);
|
|
831
|
+
if (templateReplacements === undefined) {
|
|
832
|
+
if (process.exitCode !== 1) {
|
|
833
|
+
Logger.customize({
|
|
834
|
+
name: 'CliScaffold.run',
|
|
835
|
+
purpose: 'cancelled',
|
|
836
|
+
}).warn('Scaffold cancelled.');
|
|
837
|
+
}
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
528
840
|
Logger.customize({
|
|
529
841
|
name: 'CliScaffold.run',
|
|
530
842
|
purpose: 'config',
|
|
531
|
-
}).info(`Scaffolding ${category} ${typeName} "${
|
|
843
|
+
}).info(`Scaffolding ${category} ${typeName} workspace "${workspacePackageName}" in "${workspaceDirectory}".`);
|
|
532
844
|
if (isDryRun === true) {
|
|
533
|
-
|
|
845
|
+
if (config['mode'] === 'monorepo') {
|
|
846
|
+
Logger.customize({
|
|
847
|
+
name: 'CliScaffold.run',
|
|
848
|
+
purpose: 'dryRunRoot',
|
|
849
|
+
}).info(`Would create monorepo root at "${configRoot}".`);
|
|
850
|
+
}
|
|
534
851
|
Logger.customize({
|
|
535
852
|
name: 'CliScaffold.run',
|
|
536
|
-
purpose: '
|
|
537
|
-
}).info(`Would create ${
|
|
853
|
+
purpose: 'dryRunWorkspace',
|
|
854
|
+
}).info(`Would create workspace at "${workspaceDirectory}" and register "${workspaceRelPath}".`);
|
|
855
|
+
if (existingRoot !== undefined && isWorkspaceCovered === false) {
|
|
856
|
+
Logger.customize({
|
|
857
|
+
name: 'CliScaffold.run',
|
|
858
|
+
purpose: 'dryRunWorkspaces',
|
|
859
|
+
}).info(`Would add "${normalizedWorkspaceRelPath}" to the root package.json workspaces.`);
|
|
860
|
+
}
|
|
538
861
|
return;
|
|
539
862
|
}
|
|
540
863
|
if (config['mode'] === 'monorepo') {
|
|
541
|
-
await createMonorepoRoot(
|
|
864
|
+
await createMonorepoRoot(configRoot, projectSlug);
|
|
542
865
|
}
|
|
543
|
-
const workspaceDirectory = (config['mode'] === 'monorepo') ? join(config['outputDirectory'], 'apps', config['workspaceName']) : config['outputDirectory'];
|
|
544
866
|
await fs.mkdir(workspaceDirectory, { recursive: true });
|
|
545
|
-
const
|
|
546
|
-
|
|
867
|
+
const replacements = new Map([
|
|
868
|
+
[
|
|
547
869
|
LIB_REGEX_PLACEHOLDER_PROJECT_SLUG,
|
|
548
|
-
|
|
549
|
-
]
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
870
|
+
projectSlug,
|
|
871
|
+
],
|
|
872
|
+
[
|
|
873
|
+
LIB_REGEX_PLACEHOLDER_WORKSPACE_PACKAGE_NAME,
|
|
874
|
+
workspacePackageName,
|
|
875
|
+
],
|
|
876
|
+
...templateReplacements,
|
|
877
|
+
]);
|
|
878
|
+
await writeTemplateFiles(templateDirectory, workspaceDirectory, replacements);
|
|
879
|
+
if (existingRoot !== undefined && isWorkspaceCovered === false) {
|
|
880
|
+
existingRoot['workspacePatterns'].push(normalizedWorkspaceRelPath);
|
|
881
|
+
const rootPackageJsonPath = join(configRoot, 'package.json');
|
|
882
|
+
const rootWorkspacesValue = existingRoot['packageJson']['workspaces'];
|
|
883
|
+
if (isPlainObject(rootWorkspacesValue) === true) {
|
|
884
|
+
const rootWorkspacesObject = rootWorkspacesValue;
|
|
885
|
+
Reflect.set(rootWorkspacesObject, 'packages', existingRoot['workspacePatterns']);
|
|
886
|
+
}
|
|
887
|
+
else {
|
|
888
|
+
Reflect.set(existingRoot['packageJson'], 'workspaces', existingRoot['workspacePatterns']);
|
|
889
|
+
}
|
|
890
|
+
const rootPackageJsonContents = `${JSON.stringify(existingRoot['packageJson'], null, 2)}\n`;
|
|
891
|
+
await fs.writeFile(rootPackageJsonPath, rootPackageJsonContents, 'utf-8');
|
|
892
|
+
Logger.customize({
|
|
893
|
+
name: 'CliScaffold.run',
|
|
894
|
+
purpose: 'workspaces',
|
|
895
|
+
}).info(`Added "${normalizedWorkspaceRelPath}" to the root package.json workspaces.`);
|
|
896
|
+
}
|
|
897
|
+
await registerWorkspaceInConfig(configFilePath, workspaceRelPath, config['workspaceName'], category);
|
|
553
898
|
Logger.customize({
|
|
554
899
|
name: 'CliScaffold.run',
|
|
555
900
|
purpose: 'complete',
|
|
556
901
|
}).info(`Scaffold complete for ${category} ${typeName}.`);
|
|
557
|
-
if (config['mode'] === 'monorepo') {
|
|
558
|
-
await promptPostScaffoldGenerators(
|
|
902
|
+
if (config['mode'] === 'monorepo' && isNonInteractive === false) {
|
|
903
|
+
await promptPostScaffoldGenerators(configRoot);
|
|
559
904
|
}
|
|
560
905
|
return;
|
|
561
906
|
}
|