@nx/workspace 21.4.0-beta.1 → 21.4.0-beta.11

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": "21.4.0-beta.1",
3
+ "version": "21.4.0-beta.11",
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": {
@@ -38,17 +38,17 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "21.4.0-beta.1",
41
+ "@nx/devkit": "21.4.0-beta.11",
42
42
  "@zkochan/js-yaml": "0.0.7",
43
43
  "chalk": "^4.1.0",
44
44
  "enquirer": "~2.3.6",
45
45
  "picomatch": "4.0.2",
46
46
  "tslib": "^2.3.0",
47
47
  "yargs-parser": "21.1.1",
48
- "nx": "21.4.0-beta.1"
48
+ "nx": "21.4.0-beta.11"
49
49
  },
50
50
  "devDependencies": {
51
- "nx": "21.4.0-beta.1"
51
+ "nx": "21.4.0-beta.11"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
@@ -224,7 +224,7 @@ async function createReadme(tree, { name, appName, directory, preset, nxCloud, w
224
224
  generateLibCmd: null,
225
225
  };
226
226
  const nxCloudOnboardingUrl = nxCloudToken
227
- ? await (0, url_shorten_1.createNxCloudOnboardingURL)('readme', nxCloudToken)
227
+ ? await (0, url_shorten_1.createNxCloudOnboardingURL)('readme', nxCloudToken, undefined, false)
228
228
  : null;
229
229
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files-readme'), directory, {
230
230
  formattedNames,
@@ -1 +1 @@
1
- {"version":3,"file":"ts-solution-setup.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/utilities/typescript/ts-solution-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAqEpB,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAO3D;AAED,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,iBAuDnB"}
1
+ {"version":3,"file":"ts-solution-setup.d.ts","sourceRoot":"","sources":["../../../../../../packages/workspace/src/utilities/typescript/ts-solution-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAgFpB,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,CAO3D;AAED,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,iBAuDnB"}
@@ -21,6 +21,15 @@ function isWorkspacesEnabled(tree) {
21
21
  }
22
22
  return false;
23
23
  }
24
+ /**
25
+ * The TS solution setup requires:
26
+ * - `tsconfig.base.json`: TS config with common compiler options needed by the
27
+ * majority of projects in the workspace. It's meant to be extended by other
28
+ * tsconfig files in the workspace to reuse them.
29
+ * - `tsconfig.json`: TS solution config file that references all other projects
30
+ * in the repo. It shouldn't include any file and it's not meant to be
31
+ * extended or define any common compiler options.
32
+ */
24
33
  function isWorkspaceSetupWithTsSolution(tree) {
25
34
  if (!tree.exists('tsconfig.base.json') || !tree.exists('tsconfig.json')) {
26
35
  return false;
@@ -30,25 +39,28 @@ function isWorkspaceSetupWithTsSolution(tree) {
30
39
  return false;
31
40
  }
32
41
  /**
33
- * New setup:
34
- * - `files` is defined and set to an empty array
35
- * - `references` is defined and set to an empty array
36
- * - `include` is not defined or is set to an empty array
42
+ * TS solution setup requires:
43
+ * - One of `files` or `include` defined
44
+ * - If set, they must be empty arrays
45
+ *
46
+ * Note: while the TS solution setup uses TS project references, in the initial
47
+ * state of the workspace, where there are no projects, `references` is not
48
+ * required to be defined.
37
49
  */
38
- if (!tsconfigJson.files ||
39
- tsconfigJson.files.length > 0 ||
40
- !tsconfigJson.references ||
41
- !!tsconfigJson.include?.length) {
50
+ if ((!tsconfigJson.files && !tsconfigJson.include) ||
51
+ tsconfigJson.files?.length > 0 ||
52
+ tsconfigJson.include?.length > 0) {
42
53
  return false;
43
54
  }
55
+ /**
56
+ * TS solution setup requires:
57
+ * - `compilerOptions.composite`: true
58
+ * - `compilerOptions.declaration`: true or not set (default to true)
59
+ */
44
60
  const baseTsconfigJson = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
45
61
  if (!baseTsconfigJson.compilerOptions ||
46
62
  !baseTsconfigJson.compilerOptions.composite ||
47
- !baseTsconfigJson.compilerOptions.declaration) {
48
- return false;
49
- }
50
- const { compilerOptions, ...rest } = baseTsconfigJson;
51
- if (Object.keys(rest).length > 0) {
63
+ baseTsconfigJson.compilerOptions.declaration === false) {
52
64
  return false;
53
65
  }
54
66
  return true;