create-nx-workspace 22.7.0-beta.4 → 22.7.0-beta.6

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/assets.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "outDir": "dist/packages/create-nx-workspace",
3
+ "assets": [
4
+ {
5
+ "glob": "**/files/**"
6
+ },
7
+ {
8
+ "glob": "**/files/**/.gitkeep"
9
+ },
10
+ {
11
+ "glob": "**/*.json",
12
+ "ignore": ["tsconfig*.json", "project.json", ".eslintrc.json"]
13
+ },
14
+ {
15
+ "glob": "**/*.js",
16
+ "ignore": ["**/jest.config.js"]
17
+ },
18
+ {
19
+ "glob": "**/*.d.ts"
20
+ },
21
+ "LICENSE"
22
+ ]
23
+ }
@@ -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,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,sBAAsB,EAEvB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAwEnE,KAAK,qBAAqB,GACtB,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAEpB,UAAU,aAAc,SAAQ,sBAAsB;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,YAAY,CAAC;IAC9D,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,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AE,MAAM,GAAG,QAAQ,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;CAClD;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,YAAY,GAAG,YAAY,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,UAAU,qBAAsB,SAAQ,aAAa;IACnD,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,KAAK,SAAS,GACV,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,aAAa,GACb,qBAAqB,CAAC;AAE1B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAiJrB,CAAC;AAggB7B,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQxD"}
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,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,sBAAsB,EAEvB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAiB,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAwEnE,KAAK,qBAAqB,GACtB,MAAM,GACN,MAAM,GACN,gBAAgB,GAChB,eAAe,CAAC;AAEpB,UAAU,aAAc,SAAQ,sBAAsB;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAA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IAC1C,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,YAAY,GAAG,YAAY,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,QAAQ,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;CAClD;AAED,UAAU,aAAc,SAAQ,aAAa;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,YAAY,GAAG,YAAY,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;IAC3D,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,UAAU,qBAAsB,SAAQ,aAAa;IACnD,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,KAAK,SAAS,GACV,aAAa,GACb,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,aAAa,GACb,qBAAqB,CAAC;AAE1B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAiJrB,CAAC;AAigB7B,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQxD"}
@@ -253,6 +253,7 @@ async function main(parsedArgs) {
253
253
  nxCloudArg: parsedArgs.nxCloud ?? '',
254
254
  nxCloudArgRaw: rawArgs.nxCloud ?? '',
255
255
  pushedToVcs: workspaceInfo.pushedToVcs ?? '',
256
+ pushFailReason: workspaceInfo.pushFailReason ?? '',
256
257
  template: chosenTemplate ?? '',
257
258
  preset: chosenPreset ?? '',
258
259
  connectUrl: workspaceInfo.connectUrl ?? '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nx-workspace",
3
- "version": "22.7.0-beta.4",
3
+ "version": "22.7.0-beta.6",
4
4
  "private": false,
5
5
  "description": "Smart Monorepos · Fast Builds",
6
6
  "repository": {
@@ -34,6 +34,7 @@
34
34
  "chalk": "^4.1.0",
35
35
  "enquirer": "~2.3.6",
36
36
  "flat": "^5.0.2",
37
+ "open": "^8.4.0",
37
38
  "ora": "5.3.0",
38
39
  "tmp": "~0.2.1",
39
40
  "tslib": "^2.3.0",
@@ -41,8 +42,5 @@
41
42
  },
42
43
  "publishConfig": {
43
44
  "access": "public"
44
- },
45
- "main": "index.js",
46
- "types": "./src/index.d.ts",
47
- "type": "commonjs"
45
+ }
48
46
  }
package/project.json CHANGED
@@ -24,47 +24,7 @@
24
24
  ],
25
25
  "parallel": false
26
26
  },
27
- "dependsOn": ["^build", "build-base", "legacy-post-build"]
28
- },
29
- "legacy-post-build": {
30
- "executor": "@nx/workspace-plugin:legacy-post-build",
31
- "options": {
32
- "tsConfig": "./tsconfig.lib.json",
33
- "assets": [
34
- {
35
- "input": "packages/create-nx-workspace",
36
- "glob": "**/files/**",
37
- "output": "/"
38
- },
39
- {
40
- "input": "packages/create-nx-workspace",
41
- "glob": "**/files/**/.gitkeep",
42
- "output": "/"
43
- },
44
- {
45
- "input": "packages/create-nx-workspace",
46
- "glob": "**/*.json",
47
- "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
48
- "output": "/"
49
- },
50
- {
51
- "input": "packages/create-nx-workspace",
52
- "glob": "**/*.js",
53
- "ignore": ["**/jest.config.js"],
54
- "output": "/"
55
- },
56
- {
57
- "input": "packages/create-nx-workspace",
58
- "glob": "**/*.d.ts",
59
- "output": "/"
60
- },
61
- {
62
- "input": "",
63
- "glob": "LICENSE",
64
- "output": "/"
65
- }
66
- ]
67
- }
27
+ "inputs": ["copyReadme"]
68
28
  }
69
29
  },
70
30
  "implicitDependencies": [
@@ -8,6 +8,7 @@ export declare function createWorkspace<T extends CreateWorkspaceOptions>(preset
8
8
  nxCloudInfo: string;
9
9
  directory: string;
10
10
  pushedToVcs: VcsPushStatus;
11
+ pushFailReason: string;
11
12
  connectUrl: string;
12
13
  }>;
13
14
  export declare function extractConnectUrl(text: string): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAGL,aAAa,EACd,MAAM,iBAAiB,CAAC;AA4BzB,wBAAgB,4BAA4B,IAAI;IAC9C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAEA;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,sBAAsB,EACpE,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;GAmQZ;AAUD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D"}
1
+ {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/src/create-workspace.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAIL,aAAa,EACd,MAAM,iBAAiB,CAAC;AA6BzB,wBAAgB,4BAA4B,IAAI;IAC9C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAEA;AAED,wBAAsB,eAAe,CAAC,CAAC,SAAS,sBAAsB,EACpE,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,CAAC;;;;;;GAyRZ;AAUD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI7D"}
@@ -131,6 +131,7 @@ async function createWorkspace(preset, options, rawArgs) {
131
131
  await (0, setup_ci_1.setupCI)(directory, ciProvider, packageManager);
132
132
  }
133
133
  let pushedToVcs = git_1.VcsPushStatus.SkippedGit;
134
+ let pushFailReason;
134
135
  if (!skipGit) {
135
136
  const aiMode = (0, ai_output_1.isAiAgent)();
136
137
  if (aiMode) {
@@ -153,14 +154,29 @@ async function createWorkspace(preset, options, rawArgs) {
153
154
  }
154
155
  }
155
156
  catch (e) {
156
- if (e instanceof Error) {
157
+ if (e instanceof git_1.GitHubPushError) {
158
+ // GitHub push issues are never fatal — CNW always succeeds.
159
+ // All reasons are logged in telemetry via pushFailReason.
160
+ pushedToVcs = git_1.VcsPushStatus.FailedToPushToVcs;
161
+ pushFailReason = e.reason;
162
+ // Only show the push hint when the user actually attempted a push
163
+ // and it failed. Pre-push issues (gh not installed, auth failed,
164
+ // timed out during auth) are silent — no point telling the user
165
+ // about a push they never asked for.
166
+ if (e.reason === 'push-failed' || e.reason === 'push-timeout') {
167
+ const githubNewUrl = `https://github.com/new?name=${encodeURIComponent(name)}`;
168
+ output_1.output.log({
169
+ title: `Push your repo to GitHub: ${githubNewUrl}`,
170
+ });
171
+ }
172
+ }
173
+ else if (e instanceof Error) {
157
174
  if (!aiMode) {
158
175
  output_1.output.error({
159
176
  title: 'Could not initialize git repository',
160
177
  bodyLines: (0, error_utils_1.mapErrorToBodyLines)(e),
161
178
  });
162
179
  }
163
- // In AI mode, error will be handled by the caller
164
180
  }
165
181
  else {
166
182
  console.error(e);
@@ -194,6 +210,10 @@ async function createWorkspace(preset, options, rawArgs) {
194
210
  }
195
211
  }
196
212
  nxCloudInfo = await (0, nx_cloud_1.getNxCloudInfo)(connectUrl, pushedToVcs, options.completionMessageKey, name);
213
+ // Auto-open the Cloud setup URL in the browser when user selected 'yes'
214
+ if (!options.skipCloudConnect) {
215
+ await (0, nx_cloud_1.openCloudSetupUrl)(connectUrl);
216
+ }
197
217
  }
198
218
  else if (isTemplate && (nxCloud === 'skip' || nxCloud === 'never')) {
199
219
  // Strip marker comments from README
@@ -211,6 +231,7 @@ async function createWorkspace(preset, options, rawArgs) {
211
231
  nxCloudInfo,
212
232
  directory,
213
233
  pushedToVcs,
234
+ pushFailReason,
214
235
  connectUrl,
215
236
  };
216
237
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Use spawn only for interactive shells
3
3
  */
4
- export declare function spawnAndWait(command: string, args: string[], cwd: string): Promise<unknown>;
5
- export declare function execAndWait(command: string, cwd: string, silenceErrors?: boolean): Promise<{
4
+ export declare function spawnAndWait(command: string, args: string[], cwd: string, timeout?: number): Promise<unknown>;
5
+ export declare function execAndWait(command: string, cwd: string, silenceErrors?: boolean, timeout?: number): Promise<{
6
6
  code: number;
7
7
  stdout: string;
8
8
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"child-process-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/child-process-utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,oBA+BxE;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,aAAa,UAAQ;UAEM,MAAM;YAAU,MAAM;GAgClD"}
1
+ {"version":3,"file":"child-process-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/create-nx-workspace/src/utils/child-process-utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,oBA8CjB;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,aAAa,UAAQ,EACrB,OAAO,CAAC,EAAE,MAAM;UAEW,MAAM;YAAU,MAAM;GAiClD"}
@@ -9,7 +9,7 @@ const error_utils_1 = require("./error-utils");
9
9
  /**
10
10
  * Use spawn only for interactive shells
11
11
  */
12
- function spawnAndWait(command, args, cwd) {
12
+ function spawnAndWait(command, args, cwd, timeout) {
13
13
  return new Promise((res, rej) => {
14
14
  // Combine command and args into a single string to avoid DEP0190 warning
15
15
  // (passing args with shell: true is deprecated)
@@ -29,7 +29,21 @@ function spawnAndWait(command, args, cwd) {
29
29
  shell: true,
30
30
  windowsHide: true,
31
31
  });
32
+ let timedOut = false;
33
+ let timer;
34
+ if (timeout) {
35
+ timer = setTimeout(() => {
36
+ timedOut = true;
37
+ childProcess.kill('SIGTERM');
38
+ }, timeout);
39
+ }
32
40
  childProcess.on('exit', (code, signal) => {
41
+ if (timer)
42
+ clearTimeout(timer);
43
+ if (timedOut) {
44
+ rej({ code: 1, timedOut: true });
45
+ return;
46
+ }
33
47
  if (code === null)
34
48
  code = signalToCode(signal);
35
49
  if (code !== 0) {
@@ -41,17 +55,18 @@ function spawnAndWait(command, args, cwd) {
41
55
  });
42
56
  });
43
57
  }
44
- function execAndWait(command, cwd, silenceErrors = false) {
58
+ function execAndWait(command, cwd, silenceErrors = false, timeout) {
45
59
  return new Promise((res, rej) => {
46
60
  (0, child_process_1.exec)(command, {
47
61
  cwd,
48
62
  env: { ...process.env, NX_DAEMON: 'false' },
49
63
  windowsHide: true,
50
64
  maxBuffer: 1024 * 1024 * 10, // 10MB — default 1MB can be exceeded by verbose PM output
65
+ ...(timeout ? { timeout } : {}),
51
66
  }, (error, stdout, stderr) => {
52
67
  if (error) {
53
68
  if (silenceErrors) {
54
- rej();
69
+ rej(error.killed ? { timedOut: true } : undefined);
55
70
  }
56
71
  else {
57
72
  const logFile = (0, path_1.join)(cwd, 'error.log');
@@ -4,9 +4,9 @@ export declare enum VcsPushStatus {
4
4
  FailedToPushToVcs = "FailedToPushToVcs",
5
5
  SkippedGit = "SkippedGit"
6
6
  }
7
- export declare class GitHubPushSkippedError extends Error {
8
- readonly title = "Push your workspace";
9
- constructor(message: string);
7
+ export declare class GitHubPushError extends Error {
8
+ readonly reason: 'gh-not-installed' | 'gh-auth-failed' | 'push-timeout' | 'push-failed' | 'env-skip';
9
+ constructor(message: string, reason: 'gh-not-installed' | 'gh-auth-failed' | 'push-timeout' | 'push-failed' | 'env-skip');
10
10
  }
11
11
  export declare function checkGitVersion(): Promise<string | null | undefined>;
12
12
  /**
@@ -16,7 +16,7 @@ export declare function checkGitVersion(): Promise<string | null | undefined>;
16
16
  export declare function isGitAvailable(): boolean;
17
17
  /**
18
18
  * Synchronously checks if GitHub CLI (gh) is available on the system.
19
- * Returns true if gh command can be executed, false otherwise.
19
+ * Returns true if gh command can be executed within 2 seconds, false otherwise.
20
20
  */
21
21
  export declare function isGhCliAvailable(): boolean;
22
22
  export declare function initializeGitRepo(directory: string, options: {
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/git/git.ts"],"names":[],"mappings":"AAMA,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,sBAAsB,2BAA2B;IACjD,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;CAC1B;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,KAAK,yBAAyB;gBAElC,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAQ1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAO1C;AA0ED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,iBAsDF;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CAuGxB"}
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/git/git.ts"],"names":[],"mappings":"AAMA,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,sBAAsB,2BAA2B;IACjD,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;CAC1B;AAED,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,MAAM,EAClB,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,UAAU;gBANd,OAAO,EAAE,MAAM,EACC,MAAM,EAClB,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,UAAU;CAKjB;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAQ1E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAOxC;AAYD;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAW1C;AA0FD,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,iBAsDF;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IACP,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,OAAO,CAAC,aAAa,CAAC,CAkHxB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GitHubPushSkippedError = exports.VcsPushStatus = void 0;
3
+ exports.GitHubPushError = exports.VcsPushStatus = void 0;
4
4
  exports.checkGitVersion = checkGitVersion;
5
5
  exports.isGitAvailable = isGitAvailable;
6
6
  exports.isGhCliAvailable = isGhCliAvailable;
@@ -19,14 +19,14 @@ var VcsPushStatus;
19
19
  VcsPushStatus["FailedToPushToVcs"] = "FailedToPushToVcs";
20
20
  VcsPushStatus["SkippedGit"] = "SkippedGit";
21
21
  })(VcsPushStatus || (exports.VcsPushStatus = VcsPushStatus = {}));
22
- class GitHubPushSkippedError extends Error {
23
- constructor(message) {
22
+ class GitHubPushError extends Error {
23
+ constructor(message, reason) {
24
24
  super(message);
25
- this.title = 'Push your workspace';
26
- this.name = 'GitHubPushSkippedError';
25
+ this.reason = reason;
26
+ this.name = 'GitHubPushError';
27
27
  }
28
28
  }
29
- exports.GitHubPushSkippedError = GitHubPushSkippedError;
29
+ exports.GitHubPushError = GitHubPushError;
30
30
  async function checkGitVersion() {
31
31
  try {
32
32
  const result = await (0, child_process_utils_1.execAndWait)('git --version', process.cwd());
@@ -50,13 +50,26 @@ function isGitAvailable() {
50
50
  return false;
51
51
  }
52
52
  }
53
+ // 1 second timeout for gh CLI pre-flight checks (version, auth). If gh is
54
+ // wrapped by 1Password, a credential manager, or corporate SSO the call can
55
+ // hang indefinitely. Better to skip the push than freeze the CLI.
56
+ const GH_CLI_TIMEOUT_MS = 1_000;
57
+ // 10 second timeout for repo listing (runs in background while user answers prompts).
58
+ const GH_LIST_TIMEOUT_MS = 10_000;
59
+ // 30 second timeout for the actual repo create + push operation.
60
+ // Longer than other gh commands to account for slow networks.
61
+ const GH_PUSH_TIMEOUT_MS = 30_000;
53
62
  /**
54
63
  * Synchronously checks if GitHub CLI (gh) is available on the system.
55
- * Returns true if gh command can be executed, false otherwise.
64
+ * Returns true if gh command can be executed within 2 seconds, false otherwise.
56
65
  */
57
66
  function isGhCliAvailable() {
58
67
  try {
59
- (0, child_process_1.execSync)('gh --version', { stdio: 'ignore', windowsHide: true });
68
+ (0, child_process_1.execSync)('gh --version', {
69
+ stdio: 'ignore',
70
+ windowsHide: true,
71
+ timeout: GH_CLI_TIMEOUT_MS,
72
+ });
60
73
  return true;
61
74
  }
62
75
  catch {
@@ -64,12 +77,16 @@ function isGhCliAvailable() {
64
77
  }
65
78
  }
66
79
  async function getGitHubUsername(directory) {
67
- const result = await (0, child_process_utils_1.execAndWait)('gh api user --jq .login', directory);
68
- const username = result.stdout.trim();
69
- if (!username) {
70
- throw new GitHubPushSkippedError('GitHub CLI is not authenticated');
80
+ try {
81
+ const result = await (0, child_process_utils_1.execAndWait)('gh api user --jq .login', directory, true, // silenceErrors — gh failures should never write error.log (#34482)
82
+ GH_CLI_TIMEOUT_MS);
83
+ return result.stdout.trim() || null;
84
+ }
85
+ catch {
86
+ // gh is optional — auth failures, timeouts, or missing credentials
87
+ // are silently ignored. The push flow will be skipped.
88
+ return null;
71
89
  }
72
- return username;
73
90
  }
74
91
  // Module-level promise for background repo fetching
75
92
  let existingReposPromise;
@@ -82,8 +99,9 @@ async function getUserRepositories(directory) {
82
99
  // Get user's personal repos and organizations concurrently
83
100
  // Limit to 100 repos for faster response (covers most use cases)
84
101
  const [userRepos, orgsResult] = await Promise.all([
85
- (0, child_process_utils_1.execAndWait)('gh repo list --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"', directory),
86
- (0, child_process_utils_1.execAndWait)('gh api user/orgs --jq ".[].login"', directory),
102
+ (0, child_process_utils_1.execAndWait)('gh repo list --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"', directory, true, // silenceErrors — gh failures should never write error.log
103
+ GH_LIST_TIMEOUT_MS),
104
+ (0, child_process_utils_1.execAndWait)('gh api user/orgs --jq ".[].login"', directory, true, GH_LIST_TIMEOUT_MS),
87
105
  ]);
88
106
  // Add user's personal repos
89
107
  userRepos.stdout
@@ -99,7 +117,8 @@ async function getUserRepositories(directory) {
99
117
  // Get repos from all organizations concurrently
100
118
  const orgRepoPromises = orgs.map(async (org) => {
101
119
  try {
102
- const orgRepos = await (0, child_process_utils_1.execAndWait)(`gh repo list ${org} --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"`, directory);
120
+ const orgRepos = await (0, child_process_utils_1.execAndWait)(`gh repo list ${org} --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"`, directory, true, // silenceErrors
121
+ GH_LIST_TIMEOUT_MS);
103
122
  return orgRepos.stdout
104
123
  .trim()
105
124
  .split('\n')
@@ -167,13 +186,23 @@ ${options.connectUrl}
167
186
  }
168
187
  async function pushToGitHub(directory, options) {
169
188
  try {
189
+ // Pre-flight gates — gh is optional, so any failure here throws
190
+ // GitHubPushError which the caller handles silently (no user output)
191
+ // while still recording the reason in telemetry.
170
192
  if (process.env['NX_SKIP_GH_PUSH'] === 'true') {
171
- throw new GitHubPushSkippedError('NX_SKIP_GH_PUSH is true so skipping GitHub push.');
193
+ throw new GitHubPushError('NX_SKIP_GH_PUSH is true', 'env-skip');
194
+ }
195
+ if (!isGhCliAvailable()) {
196
+ throw new GitHubPushError('gh CLI is not installed', 'gh-not-installed');
172
197
  }
173
- // Note: This call can throw an error even if user hasn't opted in to push yet,
174
- // which could be confusing as they haven't been asked about GitHub push at this point.
175
- // We check gh authentication early to provide a better error message.
198
+ // Check gh authentication with a short timeout. If gh is wrapped by
199
+ // 1Password, a credential manager, or corporate SSO this call can hang
200
+ // indefinitely. A 2 s timeout catches that and skips the push gracefully
201
+ // instead of freezing the CLI.
176
202
  const username = await getGitHubUsername(directory);
203
+ if (!username) {
204
+ throw new GitHubPushError('gh auth failed', 'gh-auth-failed');
205
+ }
177
206
  // Start fetching existing repositories in the background immediately
178
207
  // This runs while user is answering prompts, so validation is usually instant
179
208
  populateExistingRepos(directory);
@@ -213,35 +242,43 @@ async function pushToGitHub(directory, options) {
213
242
  },
214
243
  },
215
244
  ]);
216
- // Create GitHub repository using gh CLI from the workspace directory
217
- // This will automatically add remote origin and push the current branch
245
+ // Create GitHub repository and push using gh CLI.
246
+ // Uses execAndWait (not spawnAndWait) so output is captured rather than
247
+ // streamed to the terminal. This prevents git push output from bleeding
248
+ // into the terminal after CNW exits, and ensures the timeout properly
249
+ // kills the entire process tree.
218
250
  output_1.output.log({
219
251
  title: 'Creating GitHub repository and pushing (this may take a moment)...',
220
252
  });
221
- await (0, child_process_utils_1.spawnAndWait)('gh', [
222
- 'repo',
223
- 'create',
224
- repoName,
225
- '--private',
226
- '--push',
227
- '--source',
228
- directory,
229
- ], directory);
253
+ const cmd = `gh repo create ${repoName} --private --push --source "${directory}"`;
254
+ await (0, child_process_utils_1.execAndWait)(cmd, directory, true, GH_PUSH_TIMEOUT_MS);
230
255
  // Get the actual repository URL from GitHub CLI (it could be different from github.com)
231
- const repoResult = await (0, child_process_utils_1.execAndWait)('gh repo view --json url -q .url', directory);
232
- const repoUrl = repoResult.stdout.trim();
256
+ let repoUrl = `https://github.com/${repoName}`;
257
+ try {
258
+ const repoResult = await (0, child_process_utils_1.execAndWait)('gh repo view --json url -q .url', directory, true, // silenceErrors
259
+ GH_CLI_TIMEOUT_MS);
260
+ if (repoResult.stdout.trim()) {
261
+ repoUrl = repoResult.stdout.trim();
262
+ }
263
+ }
264
+ catch {
265
+ // Fall back to constructed URL
266
+ }
233
267
  output_1.output.success({
234
268
  title: `Successfully pushed to GitHub repository: ${repoUrl}`,
235
269
  });
236
270
  return VcsPushStatus.PushedToVcs;
237
271
  }
238
272
  catch (e) {
239
- // Error code 127 means gh wasn't installed
240
- // GitHubPushSkippedError means user hasn't opted in or we couldn't authenticate
241
- const title = e instanceof GitHubPushSkippedError || e?.code === 127
242
- ? 'Push your workspace to GitHub.'
243
- : 'Could not push.';
244
- output_1.output.log({ title });
245
- return VcsPushStatus.FailedToPushToVcs;
273
+ // Re-throw GitHubPushError as-is (gh not installed, auth failed, env skip)
274
+ if (e instanceof GitHubPushError)
275
+ throw e;
276
+ // Wrap other failures (push timeout, push command failed) as GitHubPushError
277
+ const isTimedOut = e?.timedOut === true;
278
+ if (isTimedOut) {
279
+ throw new GitHubPushError('gh push timed out', 'push-timeout');
280
+ }
281
+ const msg = e instanceof Error ? e.message : String(e);
282
+ throw new GitHubPushError(msg.split('\n')[0].slice(0, 200), 'push-failed');
246
283
  }
247
284
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsEtE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,oBAAoB,CAExE;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAI/C;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAajE;AAED,eAAO,MAAM,cAAc,UAS1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CA6DjD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,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W,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;CACtB,iBAuBA"}
1
+ {"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/ab-testing.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAsEtE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAKvC;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,oBAAoB,CAExE;AAiBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAQ/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CAajE;AAED,eAAO,MAAM,cAAc,UAS1B,CAAC;AAEF,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAyFjD,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,UAAU,WAAW;IACnB,IAAI,EAAE,MAA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AAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;CACtB,iBAuBA"}
@@ -6,5 +6,6 @@ export declare function readNxCloudToken(directory: string): string;
6
6
  export declare function createNxCloudOnboardingUrl(nxCloud: NxCloud, token: string | undefined, directory: string, useGitHub?: boolean): Promise<string>;
7
7
  export declare function getNxCloudInfo(connectCloudUrl: string, pushedToVcs: VcsPushStatus, completionMessageKey?: CompletionMessageKey, workspaceName?: string): Promise<string>;
8
8
  export declare function getSkippedNxCloudInfo(): string;
9
+ export declare function openCloudSetupUrl(connectUrl: string): Promise<void>;
9
10
  export declare function setNeverConnectToCloud(directory: string): void;
10
11
  //# sourceMappingURL=nx-cloud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/nx-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAGL,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAKpB,MAAM,MAAM,OAAO,GACf,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,qBAAqB,GACrB,UAAU,GACV,MAAM,GACN,OAAO,CAAC;AAEZ,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BxB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAgBjD;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC,CAgCjB;AAED,wBAAsB,cAAc,CAClC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,aAAa,EAC1B,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM,mBAuBvB;AAED,wBAAgB,qBAAqB,WAIpC;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAO9D"}
1
+ {"version":3,"file":"nx-cloud.d.ts","sourceRoot":"","sources":["../../../../../../packages/create-nx-workspace/src/utils/nx/nx-cloud.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAGL,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAKpB,MAAM,MAAM,OAAO,GACf,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,qBAAqB,GACrB,UAAU,GACV,MAAM,GACN,OAAO,CAAC;AAEZ,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BxB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,UAgBjD;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,MAAM,CAAC,CAgCjB;AAED,wBAAsB,cAAc,CAClC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,aAAa,EAC1B,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM,mBAuBvB;AAED,wBAAgB,qBAAqB,WAIpC;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWzE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAO9D"}
@@ -5,8 +5,10 @@ exports.readNxCloudToken = readNxCloudToken;
5
5
  exports.createNxCloudOnboardingUrl = createNxCloudOnboardingUrl;
6
6
  exports.getNxCloudInfo = getNxCloudInfo;
7
7
  exports.getSkippedNxCloudInfo = getSkippedNxCloudInfo;
8
+ exports.openCloudSetupUrl = openCloudSetupUrl;
8
9
  exports.setNeverConnectToCloud = setNeverConnectToCloud;
9
10
  const tslib_1 = require("tslib");
11
+ const is_ci_1 = require("../ci/is-ci");
10
12
  const output_1 = require("../output");
11
13
  const messages_1 = require("./messages");
12
14
  const ab_testing_1 = require("./ab-testing");
@@ -86,6 +88,18 @@ function getSkippedNxCloudInfo() {
86
88
  out.success((0, messages_1.getSkippedCloudMessage)());
87
89
  return out.getOutput();
88
90
  }
91
+ async function openCloudSetupUrl(connectUrl) {
92
+ if ((0, is_ci_1.isCI)()) {
93
+ return;
94
+ }
95
+ try {
96
+ const open = require('open');
97
+ await open(connectUrl);
98
+ }
99
+ catch {
100
+ // Fail gracefully — the URL is already displayed in the terminal banner
101
+ }
102
+ }
89
103
  function setNeverConnectToCloud(directory) {
90
104
  const { readFileSync, writeFileSync } = require('fs');
91
105
  const { join } = require('path');