@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "19.5.5",
3
+ "version": "19.6.0-beta.0",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -61,13 +61,13 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "19.5.5",
64
+ "@nx/devkit": "19.6.0-beta.0",
65
65
  "chalk": "^4.1.0",
66
66
  "enquirer": "~2.3.6",
67
67
  "tslib": "^2.3.0",
68
68
  "yargs-parser": "21.1.1",
69
- "nx": "19.5.5",
70
- "@nrwl/workspace": "19.5.5"
69
+ "nx": "19.6.0-beta.0",
70
+ "@nrwl/workspace": "19.6.0-beta.0"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
@@ -1,3 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema } from './new';
3
- export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<void>;
3
+ export declare function generateWorkspaceFiles(tree: Tree, options: NormalizedSchema): Promise<string>;
@@ -6,6 +6,7 @@ const versions_1 = require("../../utils/versions");
6
6
  const path_1 = require("path");
7
7
  const presets_1 = require("../utils/presets");
8
8
  const default_base_1 = require("../../utilities/default-base");
9
+ const connect_to_nx_cloud_1 = require("nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud");
9
10
  async function generateWorkspaceFiles(tree, options) {
10
11
  if (!options.name) {
11
12
  throw new Error(`Invalid options, "name" is required.`);
@@ -16,7 +17,14 @@ async function generateWorkspaceFiles(tree, options) {
16
17
  options = normalizeOptions(options);
17
18
  createReadme(tree, options);
18
19
  createFiles(tree, options);
19
- createNxJson(tree, options);
20
+ const nxJson = createNxJson(tree, options);
21
+ const token = options.nxCloud !== 'skip'
22
+ ? await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, {
23
+ installationSource: 'create-nx-workspace',
24
+ directory: options.directory,
25
+ github: options.useGitHub,
26
+ }, nxJson)
27
+ : null;
20
28
  const [packageMajor] = packageManagerVersion.split('.');
21
29
  if (options.packageManager === 'pnpm' && +packageMajor >= 7) {
22
30
  createNpmrc(tree, options);
@@ -31,7 +39,7 @@ async function generateWorkspaceFiles(tree, options) {
31
39
  setPresetProperty(tree, options);
32
40
  addNpmScripts(tree, options);
33
41
  setUpWorkspacesInPackageJson(tree, options);
34
- await (0, devkit_1.formatFiles)(tree);
42
+ return token;
35
43
  }
36
44
  function setPresetProperty(tree, options) {
37
45
  (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'nx.json'), (json) => {
@@ -72,6 +80,7 @@ function createNxJson(tree, { directory, defaultBase, preset }) {
72
80
  }
73
81
  }
74
82
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(directory, 'nx.json'), nxJson);
83
+ return nxJson;
75
84
  }
76
85
  function createFiles(tree, options) {
77
86
  const formattedNames = (0, devkit_1.names)(options.name);
@@ -171,6 +180,7 @@ function normalizeOptions(options) {
171
180
  name,
172
181
  ...options,
173
182
  defaultBase,
183
+ nxCloud: options.nxCloud ?? 'skip',
174
184
  };
175
185
  }
176
186
  function setUpWorkspacesInPackageJson(tree, options) {
@@ -21,6 +21,8 @@ interface Schema {
21
21
  e2eTestRunner?: 'cypress' | 'playwright' | 'detox' | 'jest' | 'none';
22
22
  ssr?: boolean;
23
23
  prefix?: string;
24
+ useGitHub?: boolean;
25
+ nxCloud?: 'yes' | 'skip' | 'circleci' | 'github';
24
26
  }
25
27
  export interface NormalizedSchema extends Schema {
26
28
  presetVersion?: string;
@@ -10,8 +10,9 @@ const child_process_1 = require("child_process");
10
10
  async function newGenerator(tree, opts) {
11
11
  const options = normalizeOptions(opts);
12
12
  validateOptions(options, tree);
13
- await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, { ...options, nxCloud: undefined });
13
+ await (0, generate_workspace_files_1.generateWorkspaceFiles)(tree, options);
14
14
  (0, generate_preset_1.addPresetDependencies)(tree, options);
15
+ await (0, devkit_1.formatFiles)(tree);
15
16
  return async () => {
16
17
  if (!options.skipInstall) {
17
18
  const pmc = (0, devkit_1.getPackageManagerCommand)(options.packageManager);