create-nx-workspace 22.7.0-beta.0 → 22.7.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-nx-workspace.d.ts +1 -1
- package/bin/create-nx-workspace.d.ts.map +1 -1
- package/bin/create-nx-workspace.js +61 -60
- package/bin/decorator.js +12 -11
- package/package.json +1 -1
- package/src/create-empty-workspace.js +3 -2
- package/src/create-sandbox.js +3 -2
- package/src/internal-utils/prompts.d.ts +1 -1
- package/src/internal-utils/prompts.d.ts.map +1 -1
- package/src/internal-utils/prompts.js +13 -12
- package/src/utils/child-process-utils.js +2 -2
- package/src/utils/ci/setup-ci.js +3 -2
- package/src/utils/git/default-base.js +1 -1
- package/src/utils/git/git.js +6 -5
- package/src/utils/nx/ab-testing.js +1 -1
- package/src/utils/nx/nx-cloud.js +3 -2
- package/src/utils/output.d.ts +1 -1
- package/src/utils/output.d.ts.map +1 -1
- package/src/utils/output.js +20 -19
- package/src/utils/package-manager.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import yargs from 'yargs';
|
|
2
2
|
import { CreateWorkspaceOptions } from '../src/create-workspace-options';
|
|
3
3
|
import { Preset } from '../src/utils/preset/preset';
|
|
4
4
|
type AngularUnitTestRunner = 'none' | 'jest' | 'vitest-angular' | 'vitest-analog';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-nx-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/create-nx-workspace.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"create-nx-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/create-nx-workspace.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commandsObject = void 0;
|
|
4
4
|
exports.validateWorkspaceName = validateWorkspaceName;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const enquirer_1 = tslib_1.__importDefault(require("enquirer"));
|
|
7
|
+
const yargs_1 = tslib_1.__importDefault(require("yargs"));
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
9
|
const create_workspace_options_1 = require("../src/create-workspace-options");
|
|
9
10
|
const create_workspace_1 = require("../src/create-workspace");
|
|
10
11
|
const preset_1 = require("../src/utils/preset/preset");
|
|
@@ -41,8 +42,8 @@ let chosenPreset;
|
|
|
41
42
|
let useCloud;
|
|
42
43
|
// For stats
|
|
43
44
|
let packageManager;
|
|
44
|
-
exports.commandsObject =
|
|
45
|
-
.wrap(
|
|
45
|
+
exports.commandsObject = yargs_1.default
|
|
46
|
+
.wrap(yargs_1.default.terminalWidth())
|
|
46
47
|
.parserConfiguration({
|
|
47
48
|
'strip-dashed': true,
|
|
48
49
|
'dot-notation': true,
|
|
@@ -51,140 +52,140 @@ exports.commandsObject = yargs
|
|
|
51
52
|
// this is the default and only command
|
|
52
53
|
'$0 [name] [options]', 'Create a new Nx workspace', (yargs) => (0, yargs_options_1.withOptions)(yargs
|
|
53
54
|
.option('name', {
|
|
54
|
-
describe:
|
|
55
|
+
describe: chalk_1.default.dim `Workspace name (e.g. org name).`,
|
|
55
56
|
type: 'string',
|
|
56
57
|
})
|
|
57
58
|
.option('preset', {
|
|
58
59
|
// This describe is hard to auto-fix because of the loop in the code.
|
|
59
60
|
// eslint-disable-next-line @nx/workspace/valid-command-object
|
|
60
|
-
describe:
|
|
61
|
+
describe: chalk_1.default.dim `Customizes the initial content of your workspace. Default presets include: [${Object.values(preset_1.Preset)
|
|
61
62
|
.map((p) => `"${p}"`)
|
|
62
63
|
.join(', ')}]. To build your own see https://nx.dev/extending-nx/recipes/create-preset.`,
|
|
63
64
|
type: 'string',
|
|
64
65
|
})
|
|
65
66
|
.option('interactive', {
|
|
66
|
-
describe:
|
|
67
|
+
describe: chalk_1.default.dim `Enable interactive mode with presets.`,
|
|
67
68
|
type: 'boolean',
|
|
68
69
|
default: true,
|
|
69
70
|
})
|
|
70
71
|
.option('workspaceType', {
|
|
71
|
-
describe:
|
|
72
|
+
describe: chalk_1.default.dim `The type of workspace to create.`,
|
|
72
73
|
choices: ['integrated', 'package-based', 'standalone'],
|
|
73
74
|
type: 'string',
|
|
74
75
|
})
|
|
75
76
|
.option('appName', {
|
|
76
|
-
describe:
|
|
77
|
+
describe: chalk_1.default.dim `The name of the app when using a monorepo with certain stacks.`,
|
|
77
78
|
type: 'string',
|
|
78
79
|
})
|
|
79
80
|
.option('style', {
|
|
80
|
-
describe:
|
|
81
|
+
describe: chalk_1.default.dim `Stylesheet type to be used with certain stacks.`,
|
|
81
82
|
type: 'string',
|
|
82
83
|
})
|
|
83
84
|
.option('standaloneApi', {
|
|
84
|
-
describe:
|
|
85
|
+
describe: chalk_1.default.dim `Use Standalone Components if generating an Angular app.`,
|
|
85
86
|
type: 'boolean',
|
|
86
87
|
default: true,
|
|
87
88
|
})
|
|
88
89
|
.option('routing', {
|
|
89
|
-
describe:
|
|
90
|
+
describe: chalk_1.default.dim `Add a routing setup for an Angular or React app.`,
|
|
90
91
|
type: 'boolean',
|
|
91
92
|
default: true,
|
|
92
93
|
})
|
|
93
94
|
.option('useReactRouter', {
|
|
94
|
-
describe:
|
|
95
|
+
describe: chalk_1.default.dim `Generate a Server-Side Rendered (SSR) React app using React Router.`,
|
|
95
96
|
type: 'boolean',
|
|
96
97
|
})
|
|
97
98
|
.option('bundler', {
|
|
98
|
-
describe:
|
|
99
|
+
describe: chalk_1.default.dim `Bundler to be used to build the app.`,
|
|
99
100
|
type: 'string',
|
|
100
101
|
})
|
|
101
102
|
.option('workspaces', {
|
|
102
|
-
describe:
|
|
103
|
+
describe: chalk_1.default.dim `Use package manager workspaces.`,
|
|
103
104
|
type: 'boolean',
|
|
104
105
|
default: true,
|
|
105
106
|
})
|
|
106
107
|
.option('useProjectJson', {
|
|
107
|
-
describe:
|
|
108
|
+
describe: chalk_1.default.dim `Use a 'project.json' file for the Nx configuration instead of a 'package.json' file. This defaults to 'true' when '--no-workspaces' is used. Otherwise, it defaults to 'false'.`,
|
|
108
109
|
type: 'boolean',
|
|
109
110
|
})
|
|
110
111
|
.option('formatter', {
|
|
111
|
-
describe:
|
|
112
|
+
describe: chalk_1.default.dim `Code formatter to use.`,
|
|
112
113
|
type: 'string',
|
|
113
114
|
})
|
|
114
115
|
.option('framework', {
|
|
115
|
-
describe:
|
|
116
|
+
describe: chalk_1.default.dim `Framework option to be used with certain stacks.`,
|
|
116
117
|
type: 'string',
|
|
117
118
|
})
|
|
118
119
|
.option('docker', {
|
|
119
|
-
describe:
|
|
120
|
+
describe: chalk_1.default.dim `Generate a Dockerfile for the Node API.`,
|
|
120
121
|
type: 'boolean',
|
|
121
122
|
})
|
|
122
123
|
.option('nextAppDir', {
|
|
123
|
-
describe:
|
|
124
|
+
describe: chalk_1.default.dim `Enable the App Router for Next.js.`,
|
|
124
125
|
type: 'boolean',
|
|
125
126
|
})
|
|
126
127
|
.option('nextSrcDir', {
|
|
127
|
-
describe:
|
|
128
|
+
describe: chalk_1.default.dim `Generate a 'src/' directory for Next.js.`,
|
|
128
129
|
type: 'boolean',
|
|
129
130
|
})
|
|
130
131
|
.option('e2eTestRunner', {
|
|
131
|
-
describe:
|
|
132
|
+
describe: chalk_1.default.dim `Test runner to use for end to end (E2E) tests.`,
|
|
132
133
|
choices: ['playwright', 'cypress', 'none'],
|
|
133
134
|
type: 'string',
|
|
134
135
|
})
|
|
135
136
|
.option('unitTestRunner', {
|
|
136
|
-
describe:
|
|
137
|
+
describe: chalk_1.default.dim `Test runner to use for unit tests.`,
|
|
137
138
|
choices: ['jest', 'vitest', 'none'],
|
|
138
139
|
type: 'string',
|
|
139
140
|
})
|
|
140
141
|
.option('ssr', {
|
|
141
|
-
describe:
|
|
142
|
+
describe: chalk_1.default.dim `Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.`,
|
|
142
143
|
type: 'boolean',
|
|
143
144
|
})
|
|
144
145
|
.option('prefix', {
|
|
145
|
-
describe:
|
|
146
|
+
describe: chalk_1.default.dim `Prefix to use for Angular component and directive selectors.`,
|
|
146
147
|
type: 'string',
|
|
147
148
|
})
|
|
148
149
|
.option('zoneless', {
|
|
149
|
-
describe:
|
|
150
|
+
describe: chalk_1.default.dim `Generate an application that does not use 'zone.js'.`,
|
|
150
151
|
type: 'boolean',
|
|
151
152
|
default: true,
|
|
152
153
|
})
|
|
153
154
|
.option('aiAgents', {
|
|
154
|
-
describe:
|
|
155
|
+
describe: chalk_1.default.dim `List of AI agents to configure.`,
|
|
155
156
|
type: 'array',
|
|
156
157
|
choices: [...create_workspace_options_1.supportedAgents],
|
|
157
158
|
})
|
|
158
159
|
.option('template', {
|
|
159
|
-
describe:
|
|
160
|
+
describe: chalk_1.default.dim `GitHub template repository to use. Available templates: nrwl/empty-template, nrwl/react-template, nrwl/angular-template, nrwl/typescript-template`,
|
|
160
161
|
type: 'string',
|
|
161
162
|
}), yargs_options_1.withNxCloud, yargs_options_1.withUseGitHub, yargs_options_1.withAllPrompts, yargs_options_1.withPackageManager, yargs_options_1.withGitOptions, yargs_options_1.withAnalytics), async function handler(argv) {
|
|
162
163
|
await main(argv).catch(handleError);
|
|
163
164
|
}, [normalizeArgsMiddleware])
|
|
164
|
-
.help('help',
|
|
165
|
+
.help('help', chalk_1.default.dim `Show help`)
|
|
165
166
|
.updateLocale(decorator_1.yargsDecorator)
|
|
166
|
-
.version('version',
|
|
167
|
+
.version('version', chalk_1.default.dim `Show version`, nx_version_1.nxVersion);
|
|
167
168
|
// Add AI-specific examples and epilogue only when AI agent detected
|
|
168
169
|
// This keeps --help clean for human users
|
|
169
170
|
if ((0, ai_output_1.isAiAgent)()) {
|
|
170
171
|
exports.commandsObject
|
|
171
|
-
.example(
|
|
172
|
+
.example(chalk_1.default.green('AI AGENTS (RECOMMENDED):'), '')
|
|
172
173
|
.example(' npx create-nx-workspace@latest myorg --template=nrwl/empty-template --nxCloud=yes --interactive=false', '')
|
|
173
174
|
.example('', '')
|
|
174
|
-
.example(
|
|
175
|
+
.example(chalk_1.default.green('AVAILABLE TEMPLATES:'), '')
|
|
175
176
|
.example(' --template=nrwl/empty-template Empty monorepo', '')
|
|
176
177
|
.example(' --template=nrwl/react-template React fullstack', '')
|
|
177
178
|
.example(' --template=nrwl/angular-template Angular fullstack', '')
|
|
178
179
|
.example(' --template=nrwl/typescript-template NPM packages', '')
|
|
179
|
-
.epilogue(`${
|
|
180
|
+
.epilogue(`${chalk_1.default.cyan('AI Agent Mode:')}
|
|
180
181
|
Set CLAUDECODE=1 or OPENCODE=1 for JSON output and non-interactive mode.
|
|
181
182
|
In AI mode: auto non-interactive, NDJSON progress output, structured results.
|
|
182
183
|
|
|
183
|
-
${
|
|
184
|
+
${chalk_1.default.cyan('Documentation:')}
|
|
184
185
|
https://nx.dev/getting-started/intro`);
|
|
185
186
|
}
|
|
186
187
|
else {
|
|
187
|
-
exports.commandsObject.epilogue(`${
|
|
188
|
+
exports.commandsObject.epilogue(`${chalk_1.default.cyan('Documentation:')}
|
|
188
189
|
https://nx.dev/getting-started/intro`);
|
|
189
190
|
}
|
|
190
191
|
// Node 24 has stricter readline behavior, and enquirer is not checking for closed state
|
|
@@ -638,7 +639,7 @@ async function determineFolder(parsedArgs) {
|
|
|
638
639
|
return promptForFolder(parsedArgs);
|
|
639
640
|
}
|
|
640
641
|
async function promptForFolder(parsedArgs) {
|
|
641
|
-
const reply = await
|
|
642
|
+
const reply = await enquirer_1.default.prompt([
|
|
642
643
|
{
|
|
643
644
|
name: 'folderName',
|
|
644
645
|
message: `Where would you like to create your workspace?`,
|
|
@@ -701,7 +702,7 @@ async function determineStack(parsedArgs) {
|
|
|
701
702
|
return 'unknown';
|
|
702
703
|
}
|
|
703
704
|
}
|
|
704
|
-
const { stack } = await
|
|
705
|
+
const { stack } = await enquirer_1.default.prompt([
|
|
705
706
|
{
|
|
706
707
|
name: 'stack',
|
|
707
708
|
message: `Which stack do you want to use?`,
|
|
@@ -753,7 +754,7 @@ async function determinePresetOptions(parsedArgs) {
|
|
|
753
754
|
async function determineFormatterOptions(args, opts) {
|
|
754
755
|
if (args.formatter)
|
|
755
756
|
return args.formatter;
|
|
756
|
-
const reply = await
|
|
757
|
+
const reply = await enquirer_1.default.prompt([
|
|
757
758
|
{
|
|
758
759
|
name: 'prettier',
|
|
759
760
|
message: `Would you like to use Prettier for code formatting?`,
|
|
@@ -773,7 +774,7 @@ async function determineFormatterOptions(args, opts) {
|
|
|
773
774
|
return reply.prettier === 'Yes' ? 'prettier' : 'none';
|
|
774
775
|
}
|
|
775
776
|
async function determineLinterOptions(args, opts) {
|
|
776
|
-
const reply = await
|
|
777
|
+
const reply = await enquirer_1.default.prompt([
|
|
777
778
|
{
|
|
778
779
|
name: 'eslint',
|
|
779
780
|
message: `Would you like to use ESLint?`,
|
|
@@ -830,7 +831,7 @@ async function determineNoneOptions(parsedArgs) {
|
|
|
830
831
|
else if (preset === preset_1.Preset.TsStandalone) {
|
|
831
832
|
// Only standalone TS preset generates a default package, so we need to provide --js and --appName options.
|
|
832
833
|
appName = parsedArgs.name;
|
|
833
|
-
const reply = await
|
|
834
|
+
const reply = await enquirer_1.default.prompt([
|
|
834
835
|
{
|
|
835
836
|
name: 'ts',
|
|
836
837
|
message: `Would you like to use TypeScript with this project?`,
|
|
@@ -939,7 +940,7 @@ async function determineReactOptions(parsedArgs) {
|
|
|
939
940
|
preset === preset_1.Preset.ReactMonorepo ||
|
|
940
941
|
preset === preset_1.Preset.NextJs ||
|
|
941
942
|
preset === preset_1.Preset.NextJsStandalone) {
|
|
942
|
-
const reply = await
|
|
943
|
+
const reply = await enquirer_1.default.prompt([
|
|
943
944
|
{
|
|
944
945
|
name: 'style',
|
|
945
946
|
message: `Default stylesheet format`,
|
|
@@ -1060,7 +1061,7 @@ async function determineVueOptions(parsedArgs) {
|
|
|
1060
1061
|
style = parsedArgs.style;
|
|
1061
1062
|
}
|
|
1062
1063
|
else {
|
|
1063
|
-
const reply = await
|
|
1064
|
+
const reply = await enquirer_1.default.prompt([
|
|
1064
1065
|
{
|
|
1065
1066
|
name: 'style',
|
|
1066
1067
|
message: `Default stylesheet format`,
|
|
@@ -1154,7 +1155,7 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
1154
1155
|
bundler = parsedArgs.bundler;
|
|
1155
1156
|
}
|
|
1156
1157
|
else {
|
|
1157
|
-
const reply = await
|
|
1158
|
+
const reply = await enquirer_1.default.prompt([
|
|
1158
1159
|
{
|
|
1159
1160
|
name: 'bundler',
|
|
1160
1161
|
message: `Which bundler would you like to use?`,
|
|
@@ -1183,7 +1184,7 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
1183
1184
|
style = parsedArgs.style;
|
|
1184
1185
|
}
|
|
1185
1186
|
else {
|
|
1186
|
-
const reply = await
|
|
1187
|
+
const reply = await enquirer_1.default.prompt([
|
|
1187
1188
|
{
|
|
1188
1189
|
name: 'style',
|
|
1189
1190
|
message: `Default stylesheet format`,
|
|
@@ -1212,7 +1213,7 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
1212
1213
|
ssr = parsedArgs.ssr;
|
|
1213
1214
|
}
|
|
1214
1215
|
else {
|
|
1215
|
-
const reply = await
|
|
1216
|
+
const reply = await enquirer_1.default.prompt([
|
|
1216
1217
|
{
|
|
1217
1218
|
name: 'ssr',
|
|
1218
1219
|
message: `Do you want to enable Server-Side Rendering (SSR)${bundler !== 'rspack'
|
|
@@ -1233,7 +1234,7 @@ async function determineAngularOptions(parsedArgs) {
|
|
|
1233
1234
|
unitTestRunner = undefined;
|
|
1234
1235
|
}
|
|
1235
1236
|
else {
|
|
1236
|
-
unitTestRunner = await
|
|
1237
|
+
unitTestRunner = await enquirer_1.default
|
|
1237
1238
|
.prompt([
|
|
1238
1239
|
{
|
|
1239
1240
|
message: 'Which unit test runner would you like to use?',
|
|
@@ -1326,7 +1327,7 @@ async function determineNodeOptions(parsedArgs) {
|
|
|
1326
1327
|
docker = parsedArgs.docker;
|
|
1327
1328
|
}
|
|
1328
1329
|
else {
|
|
1329
|
-
const reply = await
|
|
1330
|
+
const reply = await enquirer_1.default.prompt([
|
|
1330
1331
|
{
|
|
1331
1332
|
name: 'docker',
|
|
1332
1333
|
message: 'Would you like to generate a Dockerfile? [https://docs.docker.com/]',
|
|
@@ -1371,7 +1372,7 @@ async function determineNodeOptions(parsedArgs) {
|
|
|
1371
1372
|
};
|
|
1372
1373
|
}
|
|
1373
1374
|
async function determinePackageBasedOrIntegratedOrStandalone() {
|
|
1374
|
-
const { workspaceType } = await
|
|
1375
|
+
const { workspaceType } = await enquirer_1.default.prompt([
|
|
1375
1376
|
{
|
|
1376
1377
|
type: 'autocomplete',
|
|
1377
1378
|
name: 'workspaceType',
|
|
@@ -1397,7 +1398,7 @@ async function determinePackageBasedOrIntegratedOrStandalone() {
|
|
|
1397
1398
|
return workspaceType;
|
|
1398
1399
|
}
|
|
1399
1400
|
async function determineStandaloneOrMonorepo() {
|
|
1400
|
-
const { workspaceType } = await
|
|
1401
|
+
const { workspaceType } = await enquirer_1.default.prompt([
|
|
1401
1402
|
{
|
|
1402
1403
|
type: 'autocomplete',
|
|
1403
1404
|
name: 'workspaceType',
|
|
@@ -1421,7 +1422,7 @@ async function determineStandaloneOrMonorepo() {
|
|
|
1421
1422
|
async function determineAppName(parsedArgs) {
|
|
1422
1423
|
if (parsedArgs.appName)
|
|
1423
1424
|
return parsedArgs.appName;
|
|
1424
|
-
const { appName } = await
|
|
1425
|
+
const { appName } = await enquirer_1.default.prompt([
|
|
1425
1426
|
{
|
|
1426
1427
|
name: 'appName',
|
|
1427
1428
|
message: `Application name`,
|
|
@@ -1440,7 +1441,7 @@ async function determineReactFramework(parsedArgs) {
|
|
|
1440
1441
|
if (!parsedArgs.interactive) {
|
|
1441
1442
|
return 'none';
|
|
1442
1443
|
}
|
|
1443
|
-
const reply = await
|
|
1444
|
+
const reply = await enquirer_1.default.prompt([
|
|
1444
1445
|
{
|
|
1445
1446
|
name: 'framework',
|
|
1446
1447
|
message: 'What framework would you like to use?',
|
|
@@ -1472,7 +1473,7 @@ async function determineReactFramework(parsedArgs) {
|
|
|
1472
1473
|
async function determineReactBundler(parsedArgs) {
|
|
1473
1474
|
if (parsedArgs.bundler)
|
|
1474
1475
|
return parsedArgs.bundler;
|
|
1475
|
-
const reply = await
|
|
1476
|
+
const reply = await enquirer_1.default.prompt([
|
|
1476
1477
|
{
|
|
1477
1478
|
name: 'bundler',
|
|
1478
1479
|
message: `Which bundler would you like to use?`,
|
|
@@ -1500,7 +1501,7 @@ async function determineReactBundler(parsedArgs) {
|
|
|
1500
1501
|
async function determineNextAppDir(parsedArgs) {
|
|
1501
1502
|
if (parsedArgs.nextAppDir !== undefined)
|
|
1502
1503
|
return parsedArgs.nextAppDir;
|
|
1503
|
-
const reply = await
|
|
1504
|
+
const reply = await enquirer_1.default.prompt([
|
|
1504
1505
|
{
|
|
1505
1506
|
name: 'nextAppDir',
|
|
1506
1507
|
message: 'Would you like to use the App Router (recommended)?',
|
|
@@ -1522,7 +1523,7 @@ async function determineNextAppDir(parsedArgs) {
|
|
|
1522
1523
|
async function determineNextSrcDir(parsedArgs) {
|
|
1523
1524
|
if (parsedArgs.nextSrcDir !== undefined)
|
|
1524
1525
|
return parsedArgs.nextSrcDir;
|
|
1525
|
-
const reply = await
|
|
1526
|
+
const reply = await enquirer_1.default.prompt([
|
|
1526
1527
|
{
|
|
1527
1528
|
name: 'nextSrcDir',
|
|
1528
1529
|
message: 'Would you like to use the src/ directory?',
|
|
@@ -1544,7 +1545,7 @@ async function determineNextSrcDir(parsedArgs) {
|
|
|
1544
1545
|
async function determineVueFramework(parsedArgs) {
|
|
1545
1546
|
if (!!parsedArgs.framework)
|
|
1546
1547
|
return parsedArgs.framework;
|
|
1547
|
-
const reply = await
|
|
1548
|
+
const reply = await enquirer_1.default.prompt([
|
|
1548
1549
|
{
|
|
1549
1550
|
name: 'framework',
|
|
1550
1551
|
message: 'What framework would you like to use?',
|
|
@@ -1569,7 +1570,7 @@ async function determineVueFramework(parsedArgs) {
|
|
|
1569
1570
|
async function determineNodeFramework(parsedArgs) {
|
|
1570
1571
|
if (!!parsedArgs.framework)
|
|
1571
1572
|
return parsedArgs.framework;
|
|
1572
|
-
const reply = await
|
|
1573
|
+
const reply = await enquirer_1.default.prompt([
|
|
1573
1574
|
{
|
|
1574
1575
|
message: 'What framework should be used?',
|
|
1575
1576
|
type: 'autocomplete',
|
|
@@ -1609,7 +1610,7 @@ async function determineUnitTestRunner(parsedArgs, options) {
|
|
|
1609
1610
|
else if (!parsedArgs.workspaces) {
|
|
1610
1611
|
return undefined;
|
|
1611
1612
|
}
|
|
1612
|
-
const reply = await
|
|
1613
|
+
const reply = await enquirer_1.default.prompt([
|
|
1613
1614
|
{
|
|
1614
1615
|
message: 'Which unit test runner would you like to use?',
|
|
1615
1616
|
type: 'autocomplete',
|
|
@@ -1649,7 +1650,7 @@ async function determineUnitTestRunner(parsedArgs, options) {
|
|
|
1649
1650
|
async function determineE2eTestRunner(parsedArgs) {
|
|
1650
1651
|
if (parsedArgs.e2eTestRunner)
|
|
1651
1652
|
return parsedArgs.e2eTestRunner;
|
|
1652
|
-
const reply = await
|
|
1653
|
+
const reply = await enquirer_1.default.prompt([
|
|
1653
1654
|
{
|
|
1654
1655
|
message: 'Test runner to use for end to end (E2E) tests',
|
|
1655
1656
|
type: 'autocomplete',
|
|
@@ -1679,7 +1680,7 @@ async function determineReactRouter(parsedArgs) {
|
|
|
1679
1680
|
return false;
|
|
1680
1681
|
if (parsedArgs.useReactRouter !== undefined)
|
|
1681
1682
|
return parsedArgs.useReactRouter;
|
|
1682
|
-
const reply = await
|
|
1683
|
+
const reply = await enquirer_1.default.prompt([
|
|
1683
1684
|
{
|
|
1684
1685
|
message: 'Would you like to use React Router for server-side rendering [https://reactrouter.com/]?',
|
|
1685
1686
|
type: 'autocomplete',
|
package/bin/decorator.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yargsDecorator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
6
|
exports.yargsDecorator = {
|
|
6
|
-
'Options:': `${
|
|
7
|
-
'Examples:': `${
|
|
8
|
-
boolean: `${
|
|
9
|
-
count: `${
|
|
10
|
-
string: `${
|
|
11
|
-
array: `${
|
|
12
|
-
required: `${
|
|
13
|
-
'default:': `${
|
|
14
|
-
'choices:': `${
|
|
15
|
-
'aliases:': `${
|
|
7
|
+
'Options:': `${chalk_1.default.green `Options`}:`,
|
|
8
|
+
'Examples:': `${chalk_1.default.green `Examples`}:`,
|
|
9
|
+
boolean: `${chalk_1.default.blue `boolean`}`,
|
|
10
|
+
count: `${chalk_1.default.blue `count`}`,
|
|
11
|
+
string: `${chalk_1.default.blue `string`}`,
|
|
12
|
+
array: `${chalk_1.default.blue `array`}`,
|
|
13
|
+
required: `${chalk_1.default.blue `required`}`,
|
|
14
|
+
'default:': `${chalk_1.default.blue `default`}:`,
|
|
15
|
+
'choices:': `${chalk_1.default.blue `choices`}:`,
|
|
16
|
+
'aliases:': `${chalk_1.default.blue `aliases`}:`,
|
|
16
17
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createEmptyWorkspace = createEmptyWorkspace;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const child_process_utils_1 = require("./utils/child-process-utils");
|
|
7
8
|
const error_utils_1 = require("./utils/error-utils");
|
|
@@ -43,7 +44,7 @@ async function createEmptyWorkspace(tmpDir, name, packageManager, options) {
|
|
|
43
44
|
nxWorkspaceRoot = `\\"${nxWorkspaceRoot.slice(1, -1)}\\"`;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
let workspaceSetupSpinner =
|
|
47
|
+
let workspaceSetupSpinner = (0, ora_1.default)(`Creating your workspace in ${directory}`).start();
|
|
47
48
|
try {
|
|
48
49
|
const fullCommand = `${pmc.exec} nx ${command} --nxWorkspaceRoot=${nxWorkspaceRoot}`;
|
|
49
50
|
await (0, child_process_utils_1.execAndWait)(fullCommand, tmpDir);
|
package/src/create-sandbox.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSandbox = createSandbox;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const tmp_1 = require("tmp");
|
|
6
|
-
const
|
|
7
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
7
8
|
const path_1 = require("path");
|
|
8
9
|
const package_manager_1 = require("./utils/package-manager");
|
|
9
10
|
const child_process_utils_1 = require("./utils/child-process-utils");
|
|
@@ -15,7 +16,7 @@ const error_utils_1 = require("./utils/error-utils");
|
|
|
15
16
|
* @returns directory where Nx is installed
|
|
16
17
|
*/
|
|
17
18
|
async function createSandbox(packageManager) {
|
|
18
|
-
const installSpinner =
|
|
19
|
+
const installSpinner = (0, ora_1.default)(`Installing dependencies with ${packageManager}`).start();
|
|
19
20
|
const { install, preInstall } = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
20
21
|
const tmpDir = (0, tmp_1.dirSync)().name;
|
|
21
22
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/internal-utils/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/internal-utils/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAEL,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EACL,KAAK,EAGN,MAAM,6BAA6B,CAAC;AAIrC,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GAChD,OAAO,CAAC,OAAO,CAAC,CAQlB;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACvE,OAAO,CAAC,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC,CAiBnC;AAED,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACrE,OAAO,CAAC,OAAO,CAAC,CAelB;AA4BD,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC,GACD,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,CA4C5B;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACzE,OAAO,CAAC,KAAK,EAAE,CAAC,CASlB;AAqBD,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GACnD,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,OAAO,CAAC,MAAM,CAAC,CAwBjB;AAED,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
|
|
@@ -8,8 +8,9 @@ exports.determineAiAgents = determineAiAgents;
|
|
|
8
8
|
exports.determineAnalytics = determineAnalytics;
|
|
9
9
|
exports.determineDefaultBase = determineDefaultBase;
|
|
10
10
|
exports.determinePackageManager = determinePackageManager;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const enquirer_1 = tslib_1.__importDefault(require("enquirer"));
|
|
13
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
13
14
|
const ab_testing_1 = require("../utils/nx/ab-testing");
|
|
14
15
|
const default_base_1 = require("../utils/git/default-base");
|
|
15
16
|
const git_1 = require("../utils/git/git");
|
|
@@ -54,7 +55,7 @@ async function determineIfGitHubWillBeUsed(parsedArgs) {
|
|
|
54
55
|
if (parsedArgs.nxCloud === 'yes' || parsedArgs.nxCloud === 'circleci') {
|
|
55
56
|
if (parsedArgs?.useGitHub)
|
|
56
57
|
return true;
|
|
57
|
-
const reply = await
|
|
58
|
+
const reply = await enquirer_1.default.prompt([
|
|
58
59
|
{
|
|
59
60
|
name: 'github',
|
|
60
61
|
message: 'Will you be using GitHub as your git hosting provider?',
|
|
@@ -77,12 +78,12 @@ async function nxCloudPrompt(key) {
|
|
|
77
78
|
initial,
|
|
78
79
|
}; // meeroslav: types in enquirer are not up to date
|
|
79
80
|
if (footer) {
|
|
80
|
-
promptConfig.footer = () =>
|
|
81
|
+
promptConfig.footer = () => chalk_1.default.dim(footer);
|
|
81
82
|
}
|
|
82
83
|
if (hint) {
|
|
83
|
-
promptConfig.hint = () =>
|
|
84
|
+
promptConfig.hint = () => chalk_1.default.dim(hint);
|
|
84
85
|
}
|
|
85
|
-
return
|
|
86
|
+
return enquirer_1.default.prompt([promptConfig]).then((a) => {
|
|
86
87
|
if (fallback && a.NxCloud === fallback.value) {
|
|
87
88
|
return nxCloudPrompt(fallback.key);
|
|
88
89
|
}
|
|
@@ -102,7 +103,7 @@ async function determineTemplate(parsedArgs) {
|
|
|
102
103
|
// Template flow requires git for cloning - fall back to custom preset if git is not available
|
|
103
104
|
if (!(0, git_1.isGitAvailable)())
|
|
104
105
|
return 'custom';
|
|
105
|
-
const { template } = await
|
|
106
|
+
const { template } = await enquirer_1.default.prompt([
|
|
106
107
|
{
|
|
107
108
|
name: 'template',
|
|
108
109
|
message: 'Which starter do you want to use?',
|
|
@@ -153,9 +154,9 @@ async function aiAgentsPrompt() {
|
|
|
153
154
|
name: a,
|
|
154
155
|
message: create_workspace_options_1.agentDisplayMap[a],
|
|
155
156
|
})),
|
|
156
|
-
footer: () =>
|
|
157
|
+
footer: () => chalk_1.default.dim('Multiple selections possible. <Space> to select. <Enter> to confirm.'),
|
|
157
158
|
};
|
|
158
|
-
return (await
|
|
159
|
+
return (await enquirer_1.default.prompt([promptConfig])).agents;
|
|
159
160
|
}
|
|
160
161
|
async function determineAnalytics(parsedArgs) {
|
|
161
162
|
if (typeof parsedArgs.analytics === 'boolean') {
|
|
@@ -165,7 +166,7 @@ async function determineAnalytics(parsedArgs) {
|
|
|
165
166
|
// Default to false in non-interactive/CI
|
|
166
167
|
return false;
|
|
167
168
|
}
|
|
168
|
-
const { enableAnalytics } = await
|
|
169
|
+
const { enableAnalytics } = await enquirer_1.default.prompt([
|
|
169
170
|
{
|
|
170
171
|
name: 'enableAnalytics',
|
|
171
172
|
message: 'Help improve Nx by sharing your usage data?',
|
|
@@ -181,7 +182,7 @@ async function determineDefaultBase(parsedArgs) {
|
|
|
181
182
|
return parsedArgs.defaultBase;
|
|
182
183
|
}
|
|
183
184
|
else if (parsedArgs.allPrompts) {
|
|
184
|
-
return
|
|
185
|
+
return enquirer_1.default
|
|
185
186
|
.prompt([
|
|
186
187
|
{
|
|
187
188
|
name: 'DefaultBase',
|
|
@@ -210,7 +211,7 @@ async function determinePackageManager(parsedArgs) {
|
|
|
210
211
|
])}`);
|
|
211
212
|
}
|
|
212
213
|
else if (parsedArgs.allPrompts) {
|
|
213
|
-
return
|
|
214
|
+
return enquirer_1.default
|
|
214
215
|
.prompt([
|
|
215
216
|
{
|
|
216
217
|
name: 'packageManager',
|
|
@@ -27,7 +27,7 @@ function spawnAndWait(command, args, cwd) {
|
|
|
27
27
|
ESLINT_USE_FLAT_CONFIG: process.env.ESLINT_USE_FLAT_CONFIG ?? 'true',
|
|
28
28
|
},
|
|
29
29
|
shell: true,
|
|
30
|
-
windowsHide:
|
|
30
|
+
windowsHide: true,
|
|
31
31
|
});
|
|
32
32
|
childProcess.on('exit', (code, signal) => {
|
|
33
33
|
if (code === null)
|
|
@@ -46,7 +46,7 @@ function execAndWait(command, cwd, silenceErrors = false) {
|
|
|
46
46
|
(0, child_process_1.exec)(command, {
|
|
47
47
|
cwd,
|
|
48
48
|
env: { ...process.env, NX_DAEMON: 'false' },
|
|
49
|
-
windowsHide:
|
|
49
|
+
windowsHide: true,
|
|
50
50
|
maxBuffer: 1024 * 1024 * 10, // 10MB — default 1MB can be exceeded by verbose PM output
|
|
51
51
|
}, (error, stdout, stderr) => {
|
|
52
52
|
if (error) {
|
package/src/utils/ci/setup-ci.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupCI = setupCI;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
5
6
|
const child_process_utils_1 = require("../child-process-utils");
|
|
6
7
|
const error_utils_1 = require("../error-utils");
|
|
7
8
|
const package_manager_1 = require("../package-manager");
|
|
8
9
|
async function setupCI(directory, ci, packageManager) {
|
|
9
|
-
const ciSpinner =
|
|
10
|
+
const ciSpinner = (0, ora_1.default)(`Generating CI workflow`).start();
|
|
10
11
|
try {
|
|
11
12
|
const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
|
|
12
13
|
const res = await (0, child_process_utils_1.execAndWait)(`${pmc.exec} nx g @nx/workspace:ci-workflow --ci=${ci} --useRunMany=true`, directory);
|
|
@@ -9,7 +9,7 @@ const child_process_1 = require("child_process");
|
|
|
9
9
|
function deduceDefaultBase() {
|
|
10
10
|
const nxDefaultBase = 'main';
|
|
11
11
|
try {
|
|
12
|
-
return ((0, child_process_1.execSync)('git config --get init.defaultBranch', { windowsHide:
|
|
12
|
+
return ((0, child_process_1.execSync)('git config --get init.defaultBranch', { windowsHide: true })
|
|
13
13
|
.toString()
|
|
14
14
|
.trim() || nxDefaultBase);
|
|
15
15
|
}
|
package/src/utils/git/git.js
CHANGED
|
@@ -6,11 +6,12 @@ exports.isGitAvailable = isGitAvailable;
|
|
|
6
6
|
exports.isGhCliAvailable = isGhCliAvailable;
|
|
7
7
|
exports.initializeGitRepo = initializeGitRepo;
|
|
8
8
|
exports.pushToGitHub = pushToGitHub;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
9
10
|
const child_process_1 = require("child_process");
|
|
10
11
|
const default_base_1 = require("./default-base");
|
|
11
12
|
const output_1 = require("../output");
|
|
12
13
|
const child_process_utils_1 = require("../child-process-utils");
|
|
13
|
-
const
|
|
14
|
+
const enquirer_1 = tslib_1.__importDefault(require("enquirer"));
|
|
14
15
|
var VcsPushStatus;
|
|
15
16
|
(function (VcsPushStatus) {
|
|
16
17
|
VcsPushStatus["PushedToVcs"] = "PushedToVcs";
|
|
@@ -42,7 +43,7 @@ async function checkGitVersion() {
|
|
|
42
43
|
*/
|
|
43
44
|
function isGitAvailable() {
|
|
44
45
|
try {
|
|
45
|
-
(0, child_process_1.execSync)('git --version', { stdio: 'ignore' });
|
|
46
|
+
(0, child_process_1.execSync)('git --version', { stdio: 'ignore', windowsHide: true });
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
48
49
|
catch {
|
|
@@ -55,7 +56,7 @@ function isGitAvailable() {
|
|
|
55
56
|
*/
|
|
56
57
|
function isGhCliAvailable() {
|
|
57
58
|
try {
|
|
58
|
-
(0, child_process_1.execSync)('gh --version', { stdio: 'ignore' });
|
|
59
|
+
(0, child_process_1.execSync)('gh --version', { stdio: 'ignore', windowsHide: true });
|
|
59
60
|
return true;
|
|
60
61
|
}
|
|
61
62
|
catch {
|
|
@@ -177,7 +178,7 @@ async function pushToGitHub(directory, options) {
|
|
|
177
178
|
// This runs while user is answering prompts, so validation is usually instant
|
|
178
179
|
populateExistingRepos(directory);
|
|
179
180
|
// First prompt: Ask if they want to push to GitHub
|
|
180
|
-
const { push } = await
|
|
181
|
+
const { push } = await enquirer_1.default.prompt([
|
|
181
182
|
{
|
|
182
183
|
name: 'push',
|
|
183
184
|
message: 'Would you like to push this workspace to GitHub?',
|
|
@@ -193,7 +194,7 @@ async function pushToGitHub(directory, options) {
|
|
|
193
194
|
const defaultRepo = `${username}/${options.name}`;
|
|
194
195
|
const createRepoUrl = `https://github.com/new?name=${encodeURIComponent(options.name)}`;
|
|
195
196
|
// Second prompt: Ask where to create the repository with validation
|
|
196
|
-
const { repoName } = await
|
|
197
|
+
const { repoName } = await enquirer_1.default.prompt([
|
|
197
198
|
{
|
|
198
199
|
name: 'repoName',
|
|
199
200
|
message: 'Repository name (format: username/repo-name):',
|
|
@@ -285,7 +285,7 @@ function shouldRecordStats() {
|
|
|
285
285
|
// Use npm to check registry - this works regardless of which package manager invoked us
|
|
286
286
|
const stdout = (0, node_child_process_1.execSync)('npm config get registry', {
|
|
287
287
|
encoding: 'utf-8',
|
|
288
|
-
windowsHide:
|
|
288
|
+
windowsHide: true,
|
|
289
289
|
});
|
|
290
290
|
const url = new URL(stdout.trim());
|
|
291
291
|
// don't record stats when testing locally
|
package/src/utils/nx/nx-cloud.js
CHANGED
|
@@ -6,11 +6,12 @@ exports.createNxCloudOnboardingUrl = createNxCloudOnboardingUrl;
|
|
|
6
6
|
exports.getNxCloudInfo = getNxCloudInfo;
|
|
7
7
|
exports.getSkippedNxCloudInfo = getSkippedNxCloudInfo;
|
|
8
8
|
exports.setNeverConnectToCloud = setNeverConnectToCloud;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
9
10
|
const output_1 = require("../output");
|
|
10
11
|
const messages_1 = require("./messages");
|
|
11
12
|
const ab_testing_1 = require("./ab-testing");
|
|
12
13
|
const nx_version_1 = require("./nx-version");
|
|
13
|
-
const
|
|
14
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
14
15
|
async function connectToNxCloudForTemplate(directory, installationSource, useGitHub) {
|
|
15
16
|
// nx-ignore-next-line
|
|
16
17
|
const { connectToNxCloud } = require(require.resolve('nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud', {
|
|
@@ -34,7 +35,7 @@ async function connectToNxCloudForTemplate(directory, installationSource, useGit
|
|
|
34
35
|
return result;
|
|
35
36
|
}
|
|
36
37
|
function readNxCloudToken(directory) {
|
|
37
|
-
const nxCloudSpinner =
|
|
38
|
+
const nxCloudSpinner = (0, ora_1.default)(`Checking Nx Cloud setup`).start();
|
|
38
39
|
// nx-ignore-next-line
|
|
39
40
|
const { getCloudOptions } = require(require.resolve('nx/src/nx-cloud/utilities/get-cloud-options', {
|
|
40
41
|
paths: [directory],
|
package/src/utils/output.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/output.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/output.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AASD,qBAAa,SAAS;IAER,OAAO,CAAC,IAAI;IADxB,OAAO,CAAC,SAAS,CAAiD;gBAC9C,IAAI,UAAO;IAC/B;;;OAGG;IACH,OAAO,KAAK,kBAAkB,GAM7B;IAED;;;;OAIG;IACH,MAAM;;;;;;MAMJ;IACF,IAAI,cAAc;IAClB,SAAS,cAAmB;IAC5B,GAAG,cAAa;IAEhB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,OAAO,CAAQ;IAEvB,UAAU,CAAC,IAAI,EAAE,MAAM;IAIvB,cAAc,CAAC,KAAK,QAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAUpD,UAAU;IAIV;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE;IAI1B,oBAAoB,CAAC,KAAK,SAAS;IAMnC,mCAAmC,CAAC,KAAK,SAAS;IAMlD,KAAK,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,qBAAqB;IAajD,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,oBAAoB;IAa/C,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,oBAAoB;IAa/C,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,uBAAuB;IAWrD,aAAa,CAAC,OAAO,EAAE,MAAM;IAW7B,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,oBAAoB,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAa1E,SAAS;CAGV;AAED,eAAO,MAAM,MAAM,WAAkB,CAAC"}
|
package/src/utils/output.js
CHANGED
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.output = exports.CLIOutput = void 0;
|
|
8
|
-
const
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
10
|
const os_1 = require("os");
|
|
10
11
|
const is_ci_1 = require("./ci/is-ci");
|
|
11
12
|
/**
|
|
12
13
|
* Automatically disable styling applied by chalk if CI=true
|
|
13
14
|
*/
|
|
14
15
|
if ((0, is_ci_1.isCI)()) {
|
|
15
|
-
|
|
16
|
+
chalk_1.default.level = 0;
|
|
16
17
|
}
|
|
17
18
|
class CLIOutput {
|
|
18
19
|
constructor(real = true) {
|
|
@@ -24,15 +25,15 @@ class CLIOutput {
|
|
|
24
25
|
* implementation.
|
|
25
26
|
*/
|
|
26
27
|
this.colors = {
|
|
27
|
-
gray:
|
|
28
|
-
green:
|
|
29
|
-
red:
|
|
30
|
-
cyan:
|
|
31
|
-
white:
|
|
28
|
+
gray: chalk_1.default.gray,
|
|
29
|
+
green: chalk_1.default.green,
|
|
30
|
+
red: chalk_1.default.red,
|
|
31
|
+
cyan: chalk_1.default.cyan,
|
|
32
|
+
white: chalk_1.default.white,
|
|
32
33
|
};
|
|
33
|
-
this.bold =
|
|
34
|
-
this.underline =
|
|
35
|
-
this.dim =
|
|
34
|
+
this.bold = chalk_1.default.bold;
|
|
35
|
+
this.underline = chalk_1.default.underline;
|
|
36
|
+
this.dim = chalk_1.default.dim;
|
|
36
37
|
this.cliName = 'NX';
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
@@ -64,11 +65,11 @@ class CLIOutput {
|
|
|
64
65
|
}
|
|
65
66
|
applyCLIPrefix(color = 'cyan', text) {
|
|
66
67
|
let cliPrefix = '';
|
|
67
|
-
if (
|
|
68
|
-
cliPrefix =
|
|
68
|
+
if (chalk_1.default[color]) {
|
|
69
|
+
cliPrefix = chalk_1.default.reset.inverse.bold[color](` ${this.cliName} `);
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
|
-
cliPrefix =
|
|
72
|
+
cliPrefix = chalk_1.default.reset.inverse.bold.keyword(color)(` ${this.cliName} `);
|
|
72
73
|
}
|
|
73
74
|
return `${cliPrefix} ${text}`;
|
|
74
75
|
}
|
|
@@ -88,13 +89,13 @@ class CLIOutput {
|
|
|
88
89
|
this.addNewline();
|
|
89
90
|
}
|
|
90
91
|
addVerticalSeparatorWithoutNewLines(color = 'gray') {
|
|
91
|
-
this.writeToStdOut(`${
|
|
92
|
+
this.writeToStdOut(`${chalk_1.default.dim[color](this.VERTICAL_SEPARATOR)}${os_1.EOL}`);
|
|
92
93
|
}
|
|
93
94
|
error({ title, bodyLines }) {
|
|
94
95
|
this.addNewline();
|
|
95
96
|
this.writeOutputTitle({
|
|
96
97
|
color: 'red',
|
|
97
|
-
title:
|
|
98
|
+
title: chalk_1.default.red(title),
|
|
98
99
|
});
|
|
99
100
|
this.writeOptionalOutputBody(bodyLines);
|
|
100
101
|
this.addNewline();
|
|
@@ -103,7 +104,7 @@ class CLIOutput {
|
|
|
103
104
|
this.addNewline();
|
|
104
105
|
this.writeOutputTitle({
|
|
105
106
|
color: 'yellow',
|
|
106
|
-
title:
|
|
107
|
+
title: chalk_1.default.yellow(title),
|
|
107
108
|
});
|
|
108
109
|
this.writeOptionalOutputBody(bodyLines);
|
|
109
110
|
this.addNewline();
|
|
@@ -112,7 +113,7 @@ class CLIOutput {
|
|
|
112
113
|
this.addNewline();
|
|
113
114
|
this.writeOutputTitle({
|
|
114
115
|
color: 'orange',
|
|
115
|
-
title:
|
|
116
|
+
title: chalk_1.default.keyword('orange')(title),
|
|
116
117
|
});
|
|
117
118
|
this.writeOptionalOutputBody(bodyLines);
|
|
118
119
|
this.addNewline();
|
|
@@ -121,7 +122,7 @@ class CLIOutput {
|
|
|
121
122
|
this.addNewline();
|
|
122
123
|
this.writeOutputTitle({
|
|
123
124
|
color: 'green',
|
|
124
|
-
title:
|
|
125
|
+
title: chalk_1.default.green(title),
|
|
125
126
|
});
|
|
126
127
|
this.writeOptionalOutputBody(bodyLines);
|
|
127
128
|
}
|
|
@@ -137,7 +138,7 @@ class CLIOutput {
|
|
|
137
138
|
this.addNewline();
|
|
138
139
|
this.writeOutputTitle({
|
|
139
140
|
color: 'cyan',
|
|
140
|
-
title: color ?
|
|
141
|
+
title: color ? chalk_1.default[color](title) : title,
|
|
141
142
|
});
|
|
142
143
|
this.writeOptionalOutputBody(bodyLines);
|
|
143
144
|
this.addNewline();
|
|
@@ -217,7 +217,7 @@ function getPackageManagerVersion(packageManager, cwd = process.cwd()) {
|
|
|
217
217
|
const version = (0, node_child_process_1.execSync)(`${packageManager} --version`, {
|
|
218
218
|
cwd,
|
|
219
219
|
encoding: 'utf-8',
|
|
220
|
-
windowsHide:
|
|
220
|
+
windowsHide: true,
|
|
221
221
|
}).trim();
|
|
222
222
|
pmVersionCache.set(packageManager, version);
|
|
223
223
|
return version;
|