create-nx-workspace 21.2.2 → 21.2.4

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.
@@ -132,11 +132,12 @@ exports.commandsObject = yargs
132
132
  .help('help', chalk.dim `Show help`)
133
133
  .updateLocale(decorator_1.yargsDecorator)
134
134
  .version('version', chalk.dim `Show version`, nx_version_1.nxVersion);
135
+ let rawArgs;
135
136
  async function main(parsedArgs) {
136
137
  output_1.output.log({
137
138
  title: `Creating your v${nx_version_1.nxVersion} workspace.`,
138
139
  });
139
- const workspaceInfo = await (0, create_workspace_1.createWorkspace)(parsedArgs.preset, parsedArgs);
140
+ const workspaceInfo = await (0, create_workspace_1.createWorkspace)(parsedArgs.preset, parsedArgs, rawArgs);
140
141
  await (0, ab_testing_1.recordStat)({
141
142
  nxVersion: nx_version_1.nxVersion,
142
143
  command: 'create-nx-workspace',
@@ -145,6 +146,7 @@ async function main(parsedArgs) {
145
146
  ab_testing_1.messages.codeOfSelectedPromptMessage('setupCI'),
146
147
  ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
147
148
  parsedArgs.nxCloud,
149
+ rawArgs.nxCloud,
148
150
  ],
149
151
  });
150
152
  if (parsedArgs.nxCloud && workspaceInfo.nxCloudInfo) {
@@ -166,6 +168,7 @@ async function main(parsedArgs) {
166
168
  * @param argv user arguments
167
169
  */
168
170
  async function normalizeArgsMiddleware(argv) {
171
+ rawArgs = argv;
169
172
  output_1.output.log({
170
173
  title: "Let's create a new workspace [https://nx.dev/getting-started/intro]",
171
174
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "21.2.2",
3
+ "version": "21.2.4",
4
4
  "private": false,
5
5
  "description": "Smart Repos · Fast Builds",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  import { CreateWorkspaceOptions } from './create-workspace-options';
2
- export declare function createWorkspace<T extends CreateWorkspaceOptions>(preset: string, options: T): Promise<{
2
+ export declare function createWorkspace<T extends CreateWorkspaceOptions>(preset: string, options: T, rawArgs?: T): Promise<{
3
3
  nxCloudInfo: string | undefined;
4
4
  directory: string;
5
5
  }>;
@@ -12,7 +12,7 @@ const git_1 = require("./utils/git/git");
12
12
  const get_third_party_preset_1 = require("./utils/preset/get-third-party-preset");
13
13
  const error_utils_1 = require("./utils/error-utils");
14
14
  const preset_1 = require("./utils/preset/preset");
15
- async function createWorkspace(preset, options) {
15
+ async function createWorkspace(preset, options, rawArgs) {
16
16
  const { packageManager, name, nxCloud, skipGit = false, defaultBase = 'main', commit, cliName, useGitHub, } = options;
17
17
  if (cliName) {
18
18
  output_1.output.setCliName(cliName ?? 'NX');
@@ -35,7 +35,7 @@ async function createWorkspace(preset, options) {
35
35
  if (nxCloud !== 'yes') {
36
36
  await (0, setup_ci_1.setupCI)(directory, nxCloud, packageManager);
37
37
  }
38
- const { connectCloudUrl, output } = await (0, nx_cloud_1.getOnboardingInfo)(nxCloud, token, directory, useGitHub);
38
+ const { connectCloudUrl, output } = await (0, nx_cloud_1.getOnboardingInfo)(nxCloud, token, directory, rawArgs?.nxCloud, useGitHub);
39
39
  connectUrl = connectCloudUrl;
40
40
  nxCloudInfo = output;
41
41
  }
@@ -10,7 +10,7 @@ async function setupCI(directory, ci, packageManager) {
10
10
  const ciSpinner = ora(`Generating CI workflow`).start();
11
11
  try {
12
12
  const pmc = (0, package_manager_1.getPackageManagerCommand)(packageManager);
13
- const res = await (0, child_process_utils_1.execAndWait)(`${pmc.exec} nx g @nx/workspace:ci-workflow --ci=${ci}`, directory);
13
+ const res = await (0, child_process_utils_1.execAndWait)(`${pmc.exec} nx g @nx/workspace:ci-workflow --ci=${ci} --useRunMany=true`, directory);
14
14
  ciSpinner.succeed('CI workflow has been generated successfully');
15
15
  return res;
16
16
  }
@@ -1,7 +1,7 @@
1
1
  declare const outputMessages: {
2
2
  readonly 'create-nx-workspace-success-ci-setup': readonly [{
3
3
  readonly code: "ci-setup-visit";
4
- readonly createMessage: (url: string) => {
4
+ readonly createMessage: (url: string | null) => {
5
5
  title: string;
6
6
  type: string;
7
7
  bodyLines: string[];
@@ -9,7 +9,7 @@ declare const outputMessages: {
9
9
  }];
10
10
  readonly 'create-nx-workspace-success-cache-setup': readonly [{
11
11
  readonly code: "remote-cache-visit";
12
- readonly createMessage: (url: string) => {
12
+ readonly createMessage: (url: string | null) => {
13
13
  title: string;
14
14
  type: string;
15
15
  bodyLines: string[];
@@ -19,14 +19,14 @@ declare const outputMessages: {
19
19
  type OutputMessageKey = keyof typeof outputMessages;
20
20
  export declare function getMessageFactory(key: OutputMessageKey): {
21
21
  readonly code: "ci-setup-visit";
22
- readonly createMessage: (url: string) => {
22
+ readonly createMessage: (url: string | null) => {
23
23
  title: string;
24
24
  type: string;
25
25
  bodyLines: string[];
26
26
  };
27
27
  } | {
28
28
  readonly code: "remote-cache-visit";
29
- readonly createMessage: (url: string) => {
29
+ readonly createMessage: (url: string | null) => {
30
30
  title: string;
31
31
  type: string;
32
32
  bodyLines: string[];
@@ -5,21 +5,29 @@ const outputMessages = {
5
5
  'create-nx-workspace-success-ci-setup': [
6
6
  {
7
7
  code: 'ci-setup-visit',
8
- createMessage: (url) => ({
9
- title: `Your CI setup is almost complete.`,
10
- type: 'success',
11
- bodyLines: [`Finish it by visiting: ${url}`],
12
- }),
8
+ createMessage: (url) => {
9
+ return {
10
+ title: `Your CI setup is almost complete.`,
11
+ type: 'success',
12
+ bodyLines: [
13
+ `Push your repository and finish the setup${url ? `: ${url}` : ''}`,
14
+ ],
15
+ };
16
+ },
13
17
  },
14
18
  ],
15
19
  'create-nx-workspace-success-cache-setup': [
16
20
  {
17
21
  code: 'remote-cache-visit',
18
- createMessage: (url) => ({
19
- title: `Your remote cache setup is almost complete.`,
20
- type: 'success',
21
- bodyLines: [`Finish it by visiting: ${url}`],
22
- }),
22
+ createMessage: (url) => {
23
+ return {
24
+ title: `Your remote cache is almost complete.`,
25
+ type: 'success',
26
+ bodyLines: [
27
+ `Push your repository and finish the setup${url ? `: ${url}` : ''}`,
28
+ ],
29
+ };
30
+ },
23
31
  },
24
32
  ],
25
33
  };
@@ -1,6 +1,6 @@
1
1
  export type NxCloud = 'yes' | 'github' | 'gitlab' | 'azure' | 'bitbucket-pipelines' | 'circleci' | 'skip';
2
2
  export declare function readNxCloudToken(directory: string): string | undefined;
3
- export declare function getOnboardingInfo(nxCloud: NxCloud, token: string, directory: string, useGitHub?: boolean): Promise<{
3
+ export declare function getOnboardingInfo(nxCloud: NxCloud, token: string, directory: string, rawNxCloud?: NxCloud, useGitHub?: boolean): Promise<{
4
4
  output: string;
5
5
  connectCloudUrl: string;
6
6
  }>;
@@ -17,7 +17,7 @@ function readNxCloudToken(directory) {
17
17
  nxCloudSpinner.succeed('Nx Cloud has been set up successfully');
18
18
  return accessToken || nxCloudId;
19
19
  }
20
- async function getOnboardingInfo(nxCloud, token, directory, useGitHub) {
20
+ async function getOnboardingInfo(nxCloud, token, directory, rawNxCloud, useGitHub) {
21
21
  // nx-ignore-next-line
22
22
  const { createNxCloudOnboardingURL } = require(require.resolve('nx/src/nx-cloud/utilities/url-shorten', {
23
23
  paths: [directory],
@@ -31,7 +31,7 @@ async function getOnboardingInfo(nxCloud, token, directory, useGitHub) {
31
31
  const connectCloudUrl = await createNxCloudOnboardingURL(source, token, useGitHub ??
32
32
  (nxCloud === 'yes' || nxCloud === 'github' || nxCloud === 'circleci'), code);
33
33
  const out = new output_1.CLIOutput(false);
34
- const message = createMessage(connectCloudUrl);
34
+ const message = createMessage(typeof rawNxCloud === 'string' ? null : connectCloudUrl);
35
35
  if (message.type === 'success') {
36
36
  out.success(message);
37
37
  }