create-nx-workspace 19.5.5 → 19.6.0-beta.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.
@@ -121,6 +121,7 @@ async function main(parsedArgs) {
121
121
  meta: [
122
122
  ab_testing_1.messages.codeOfSelectedPromptMessage('setupCI'),
123
123
  ab_testing_1.messages.codeOfSelectedPromptMessage('setupNxCloud'),
124
+ parsedArgs.nxCloud,
124
125
  ],
125
126
  });
126
127
  if (parsedArgs.nxCloud && workspaceInfo.nxCloudInfo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "19.5.5",
3
+ "version": "19.6.0-beta.0",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast CI",
6
6
  "repository": {
@@ -29,7 +29,7 @@ async function createWorkspace(preset, options) {
29
29
  let connectUrl;
30
30
  let nxCloudInfo;
31
31
  if (nxCloud !== 'skip') {
32
- const token = await (0, nx_cloud_1.setupNxCloud)(directory, nxCloud, useGitHub);
32
+ const token = (0, nx_cloud_1.readNxCloudToken)(directory);
33
33
  if (nxCloud !== 'yes') {
34
34
  await (0, setup_ci_1.setupCI)(directory, nxCloud, packageManager);
35
35
  }
@@ -1,218 +1,29 @@
1
1
  declare const outputMessages: {
2
2
  readonly 'create-nx-workspace-success-ci-setup': readonly [{
3
- readonly code: "nx-cloud-workspace-push-goto";
4
- readonly createMessage: (url: string) => {
5
- title: string;
6
- type: string;
7
- bodyLines: string[];
8
- };
9
- }, {
10
- readonly code: "nx-cloud-powered-ci-setup-visit";
11
- readonly createMessage: (url: string) => {
12
- title: string;
13
- type: string;
14
- bodyLines: string[];
15
- };
16
- }, {
17
- readonly code: "nx-cloud-powered-ci-setup-connect";
18
- readonly createMessage: (url: string) => {
19
- title: string;
20
- type: string;
21
- bodyLines: string[];
22
- };
23
- }, {
24
3
  readonly code: "ci-setup-visit";
25
4
  readonly createMessage: (url: string) => {
26
5
  title: string;
27
6
  type: string;
28
7
  bodyLines: string[];
29
8
  };
30
- }, {
31
- readonly code: "ci-setup-connect";
32
- readonly createMessage: (url: string) => {
33
- title: string;
34
- type: string;
35
- bodyLines: string[];
36
- };
37
- }, {
38
- readonly code: "nx-cloud-powered-ci-setup-visit-warn";
39
- readonly createMessage: (url: string) => {
40
- title: string;
41
- type: string;
42
- bodyLines: string[];
43
- };
44
- }, {
45
- readonly code: "nx-cloud-powered-ci-setup-connect-warn";
46
- readonly createMessage: (url: string) => {
47
- title: string;
48
- type: string;
49
- bodyLines: string[];
50
- };
51
- }, {
52
- readonly code: "ci-setup-visit-warn";
53
- readonly createMessage: (url: string) => {
54
- title: string;
55
- type: string;
56
- bodyLines: string[];
57
- };
58
- }, {
59
- readonly code: "ci-setup-connect-warn";
60
- readonly createMessage: (url: string) => {
61
- title: string;
62
- type: string;
63
- bodyLines: string[];
64
- };
65
9
  }];
66
10
  readonly 'create-nx-workspace-success-cache-setup': readonly [{
67
- readonly code: "nx-cloud-workspace-push-goto";
68
- readonly createMessage: (url: string) => {
69
- title: string;
70
- type: string;
71
- bodyLines: string[];
72
- };
73
- }, {
74
- readonly code: "nx-cloud-remote-cache-setup-finish";
75
- readonly createMessage: (url: string) => {
76
- title: string;
77
- type: string;
78
- bodyLines: string[];
79
- };
80
- }, {
81
- readonly code: "nx-cloud-remote-cache-setup-connect";
82
- readonly createMessage: (url: string) => {
83
- title: string;
84
- type: string;
85
- bodyLines: string[];
86
- };
87
- }, {
88
11
  readonly code: "remote-cache-visit";
89
12
  readonly createMessage: (url: string) => {
90
13
  title: string;
91
14
  type: string;
92
15
  bodyLines: string[];
93
16
  };
94
- }, {
95
- readonly code: "remote-cache-connect";
96
- readonly createMessage: (url: string) => {
97
- title: string;
98
- type: string;
99
- bodyLines: string[];
100
- };
101
- }, {
102
- readonly code: "nx-cloud-remote-cache-setup-visit-warn";
103
- readonly createMessage: (url: string) => {
104
- title: string;
105
- type: string;
106
- bodyLines: string[];
107
- };
108
- }, {
109
- readonly code: "nx-cloud-remote-cache-setup-connect-warn";
110
- readonly createMessage: (url: string) => {
111
- title: string;
112
- type: string;
113
- bodyLines: string[];
114
- };
115
- }, {
116
- readonly code: "remote-cache-visit-warn";
117
- readonly createMessage: (url: string) => {
118
- title: string;
119
- type: string;
120
- bodyLines: string[];
121
- };
122
- }, {
123
- readonly code: "remote-cache-connect-warn";
124
- readonly createMessage: (url: string) => {
125
- title: string;
126
- type: string;
127
- bodyLines: string[];
128
- };
129
17
  }];
130
18
  };
131
19
  type OutputMessageKey = keyof typeof outputMessages;
132
20
  export declare function getMessageFactory(key: OutputMessageKey): {
133
- readonly code: "nx-cloud-workspace-push-goto";
134
- readonly createMessage: (url: string) => {
135
- title: string;
136
- type: string;
137
- bodyLines: string[];
138
- };
139
- } | {
140
- readonly code: "nx-cloud-powered-ci-setup-visit";
141
- readonly createMessage: (url: string) => {
142
- title: string;
143
- type: string;
144
- bodyLines: string[];
145
- };
146
- } | {
147
- readonly code: "nx-cloud-powered-ci-setup-connect";
148
- readonly createMessage: (url: string) => {
149
- title: string;
150
- type: string;
151
- bodyLines: string[];
152
- };
153
- } | {
154
21
  readonly code: "ci-setup-visit";
155
22
  readonly createMessage: (url: string) => {
156
23
  title: string;
157
24
  type: string;
158
25
  bodyLines: string[];
159
26
  };
160
- } | {
161
- readonly code: "ci-setup-connect";
162
- readonly createMessage: (url: string) => {
163
- title: string;
164
- type: string;
165
- bodyLines: string[];
166
- };
167
- } | {
168
- readonly code: "nx-cloud-powered-ci-setup-visit-warn";
169
- readonly createMessage: (url: string) => {
170
- title: string;
171
- type: string;
172
- bodyLines: string[];
173
- };
174
- } | {
175
- readonly code: "nx-cloud-powered-ci-setup-connect-warn";
176
- readonly createMessage: (url: string) => {
177
- title: string;
178
- type: string;
179
- bodyLines: string[];
180
- };
181
- } | {
182
- readonly code: "ci-setup-visit-warn";
183
- readonly createMessage: (url: string) => {
184
- title: string;
185
- type: string;
186
- bodyLines: string[];
187
- };
188
- } | {
189
- readonly code: "ci-setup-connect-warn";
190
- readonly createMessage: (url: string) => {
191
- title: string;
192
- type: string;
193
- bodyLines: string[];
194
- };
195
- } | {
196
- readonly code: "nx-cloud-workspace-push-goto";
197
- readonly createMessage: (url: string) => {
198
- title: string;
199
- type: string;
200
- bodyLines: string[];
201
- };
202
- } | {
203
- readonly code: "nx-cloud-remote-cache-setup-finish";
204
- readonly createMessage: (url: string) => {
205
- title: string;
206
- type: string;
207
- bodyLines: string[];
208
- };
209
- } | {
210
- readonly code: "nx-cloud-remote-cache-setup-connect";
211
- readonly createMessage: (url: string) => {
212
- title: string;
213
- type: string;
214
- bodyLines: string[];
215
- };
216
27
  } | {
217
28
  readonly code: "remote-cache-visit";
218
29
  readonly createMessage: (url: string) => {
@@ -220,40 +31,5 @@ export declare function getMessageFactory(key: OutputMessageKey): {
220
31
  type: string;
221
32
  bodyLines: string[];
222
33
  };
223
- } | {
224
- readonly code: "remote-cache-connect";
225
- readonly createMessage: (url: string) => {
226
- title: string;
227
- type: string;
228
- bodyLines: string[];
229
- };
230
- } | {
231
- readonly code: "nx-cloud-remote-cache-setup-visit-warn";
232
- readonly createMessage: (url: string) => {
233
- title: string;
234
- type: string;
235
- bodyLines: string[];
236
- };
237
- } | {
238
- readonly code: "nx-cloud-remote-cache-setup-connect-warn";
239
- readonly createMessage: (url: string) => {
240
- title: string;
241
- type: string;
242
- bodyLines: string[];
243
- };
244
- } | {
245
- readonly code: "remote-cache-visit-warn";
246
- readonly createMessage: (url: string) => {
247
- title: string;
248
- type: string;
249
- bodyLines: string[];
250
- };
251
- } | {
252
- readonly code: "remote-cache-connect-warn";
253
- readonly createMessage: (url: string) => {
254
- title: string;
255
- type: string;
256
- bodyLines: string[];
257
- };
258
34
  };
259
35
  export {};
@@ -3,36 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMessageFactory = getMessageFactory;
4
4
  const outputMessages = {
5
5
  'create-nx-workspace-success-ci-setup': [
6
- {
7
- code: 'nx-cloud-workspace-push-goto',
8
- createMessage: (url) => ({
9
- title: `Your Nx Cloud workspace is ready.`,
10
- type: 'success',
11
- bodyLines: [
12
- `To claim it, connect it to your Nx Cloud account:`,
13
- `- Push your repository to your git hosting provider.`,
14
- `- Go to the following URL to connect your workspace to Nx Cloud:`,
15
- '',
16
- `${url}`,
17
- ],
18
- }),
19
- },
20
- {
21
- code: 'nx-cloud-powered-ci-setup-visit',
22
- createMessage: (url) => ({
23
- title: `Your CI setup powered by Nx Cloud is almost complete.`,
24
- type: 'success',
25
- bodyLines: [`Finish it by visiting: ${url}`],
26
- }),
27
- },
28
- {
29
- code: 'nx-cloud-powered-ci-setup-connect',
30
- createMessage: (url) => ({
31
- title: `Your CI setup powered by Nx Cloud is almost complete.`,
32
- type: 'success',
33
- bodyLines: [`Connect your repository: ${url}`],
34
- }),
35
- },
36
6
  {
37
7
  code: 'ci-setup-visit',
38
8
  createMessage: (url) => ({
@@ -41,78 +11,8 @@ const outputMessages = {
41
11
  bodyLines: [`Finish it by visiting: ${url}`],
42
12
  }),
43
13
  },
44
- {
45
- code: 'ci-setup-connect',
46
- createMessage: (url) => ({
47
- title: `Your CI setup is almost complete.`,
48
- type: 'success',
49
- bodyLines: [`Connect your repository: ${url}`],
50
- }),
51
- },
52
- {
53
- code: 'nx-cloud-powered-ci-setup-visit-warn',
54
- createMessage: (url) => ({
55
- title: `Your CI setup powered by Nx Cloud is almost complete.`,
56
- type: 'warning',
57
- bodyLines: [`Finish it by visiting: ${url}`],
58
- }),
59
- },
60
- {
61
- code: 'nx-cloud-powered-ci-setup-connect-warn',
62
- createMessage: (url) => ({
63
- title: `Your CI setup powered by Nx Cloud is almost complete.`,
64
- type: 'warning',
65
- bodyLines: [`Connect your repository: ${url}`],
66
- }),
67
- },
68
- {
69
- code: 'ci-setup-visit-warn',
70
- createMessage: (url) => ({
71
- title: `Your CI setup is almost complete.`,
72
- type: 'warning',
73
- bodyLines: [`Finish it by visiting: ${url}`],
74
- }),
75
- },
76
- {
77
- code: 'ci-setup-connect-warn',
78
- createMessage: (url) => ({
79
- title: `Your CI setup is almost complete.`,
80
- type: 'warning',
81
- bodyLines: [`Connect your repository: ${url}`],
82
- }),
83
- },
84
14
  ],
85
15
  'create-nx-workspace-success-cache-setup': [
86
- {
87
- code: 'nx-cloud-workspace-push-goto',
88
- createMessage: (url) => ({
89
- title: `Your Nx Cloud workspace is ready.`,
90
- type: 'success',
91
- bodyLines: [
92
- `To claim it, connect it to your Nx Cloud account:`,
93
- `- Push your repository to your git hosting provider.`,
94
- `- Go to the following URL to connect your workspace to Nx Cloud:`,
95
- '',
96
- `${url}`,
97
- ],
98
- }),
99
- },
100
- {
101
- code: 'nx-cloud-remote-cache-setup-finish',
102
- createMessage: (url) => ({
103
- title: `Your Nx Cloud remote cache setup is almost complete.`,
104
- type: 'success',
105
- bodyLines: [`Finish it by visiting: ${url}`],
106
- }),
107
- },
108
- {
109
- code: 'nx-cloud-remote-cache-setup-connect',
110
- createMessage: (url) => ({
111
- title: `Your Nx Cloud remote cache setup is almost complete.`,
112
- type: 'success',
113
- bodyLines: [`Connect your repository: ${url}`],
114
- }),
115
- },
116
16
  {
117
17
  code: 'remote-cache-visit',
118
18
  createMessage: (url) => ({
@@ -121,46 +21,6 @@ const outputMessages = {
121
21
  bodyLines: [`Finish it by visiting: ${url}`],
122
22
  }),
123
23
  },
124
- {
125
- code: 'remote-cache-connect',
126
- createMessage: (url) => ({
127
- title: `Your remote cache setup is almost complete.`,
128
- type: 'success',
129
- bodyLines: [`Connect your repository: ${url}`],
130
- }),
131
- },
132
- {
133
- code: 'nx-cloud-remote-cache-setup-visit-warn',
134
- createMessage: (url) => ({
135
- title: `Your Nx Cloud remote cache setup is almost complete.`,
136
- type: 'warning',
137
- bodyLines: [`Finish it by visiting: ${url}`],
138
- }),
139
- },
140
- {
141
- code: 'nx-cloud-remote-cache-setup-connect-warn',
142
- createMessage: (url) => ({
143
- title: `Your Nx Cloud remote cache setup is almost complete.`,
144
- type: 'warning',
145
- bodyLines: [`Connect your repository: ${url}`],
146
- }),
147
- },
148
- {
149
- code: 'remote-cache-visit-warn',
150
- createMessage: (url) => ({
151
- title: `Your remote cache setup is almost complete.`,
152
- type: 'warning',
153
- bodyLines: [`Finish it by visiting: ${url}`],
154
- }),
155
- },
156
- {
157
- code: 'remote-cache-connect-warn',
158
- createMessage: (url) => ({
159
- title: `Your remote cache setup is almost complete.`,
160
- type: 'warning',
161
- bodyLines: [`Connect your repository: ${url}`],
162
- }),
163
- },
164
24
  ],
165
25
  };
166
26
  class ABTestingMessages {
@@ -1,5 +1,5 @@
1
1
  export type NxCloud = 'yes' | 'github' | 'circleci' | 'skip';
2
- export declare function setupNxCloud(directory: string, nxCloud: NxCloud, useGitHub?: boolean): Promise<string>;
2
+ export declare function readNxCloudToken(directory: string): string | undefined;
3
3
  export declare function getOnboardingInfo(nxCloud: NxCloud, token: string, directory: string, useGithub?: boolean): Promise<{
4
4
  output: string;
5
5
  connectCloudUrl: string;
@@ -1,44 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupNxCloud = setupNxCloud;
3
+ exports.readNxCloudToken = readNxCloudToken;
4
4
  exports.getOnboardingInfo = getOnboardingInfo;
5
- const ora = require("ora");
6
5
  const output_1 = require("../output");
7
- const error_utils_1 = require("../error-utils");
8
6
  const messages_1 = require("./messages");
9
- async function setupNxCloud(directory, nxCloud, useGitHub) {
10
- const nxCloudSpinner = ora(`Setting up Nx Cloud`).start();
11
- try {
12
- // nx-ignore-next-line
13
- const { connectWorkspaceToCloud } = require(require.resolve('nx/src/command-line/connect/connect-to-nx-cloud', {
14
- paths: [directory],
15
- }
16
- // nx-ignore-next-line
17
- ));
18
- const accessToken = await connectWorkspaceToCloud({
19
- installationSource: 'create-nx-workspace',
20
- directory,
21
- github: useGitHub,
22
- });
23
- nxCloudSpinner.succeed('Nx Cloud has been set up successfully');
24
- return accessToken;
25
- }
26
- catch (e) {
27
- nxCloudSpinner.fail();
28
- if (e instanceof Error) {
29
- output_1.output.error({
30
- title: `Failed to setup Nx Cloud`,
31
- bodyLines: (0, error_utils_1.mapErrorToBodyLines)(e),
32
- });
33
- }
34
- else {
35
- console.error(e);
36
- }
37
- process.exit(1);
38
- }
39
- finally {
40
- nxCloudSpinner.stop();
7
+ const ora = require("ora");
8
+ function readNxCloudToken(directory) {
9
+ const nxCloudSpinner = ora(`Checking Nx Cloud setup`).start();
10
+ // nx-ignore-next-line
11
+ const { getCloudOptions } = require(require.resolve('nx/src/nx-cloud/utilities/get-cloud-options', {
12
+ paths: [directory],
41
13
  }
14
+ // nx-ignore-next-line
15
+ ));
16
+ const { accessToken } = getCloudOptions(directory);
17
+ nxCloudSpinner.succeed('Nx Cloud has been set up successfully');
18
+ return accessToken;
42
19
  }
43
20
  async function getOnboardingInfo(nxCloud, token, directory, useGithub) {
44
21
  // nx-ignore-next-line