@nx/js 20.0.0-beta.2 → 20.0.0-beta.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.
- package/generators.json +1 -1
- package/package.json +5 -4
- package/src/generators/init/files/ts-solution/tsconfig.base.json__tmpl__ +34 -0
- package/src/generators/init/files/ts-solution/tsconfig.json__tmpl__ +6 -0
- package/src/generators/init/init.js +52 -9
- package/src/generators/init/schema.d.ts +4 -1
- package/src/generators/init/schema.json +6 -6
- package/src/generators/library/files/lib/src/lib/__fileName__.spec.ts__tmpl__ +4 -4
- package/src/generators/library/files/lib/src/lib/__fileName__.ts__tmpl__ +1 -1
- package/src/generators/library/files/readme/README.md +3 -11
- package/src/generators/library/files/tsconfig-lib/ts-solution/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/library.d.ts +2 -11
- package/src/generators/library/library.js +294 -93
- package/src/generators/library/schema.d.ts +53 -0
- package/src/generators/library/schema.json +18 -17
- package/src/generators/library/utils/package-manager-workspaces.d.ts +3 -0
- package/src/generators/library/utils/package-manager-workspaces.js +52 -0
- package/src/generators/library/utils/plugin-registrations.d.ts +3 -0
- package/src/generators/library/utils/plugin-registrations.js +108 -0
- package/src/generators/setup-prettier/generator.js +3 -3
- package/src/generators/setup-verdaccio/generator.js +14 -10
- package/src/generators/typescript-sync/typescript-sync.d.ts +1 -1
- package/src/generators/typescript-sync/typescript-sync.js +9 -8
- package/src/plugins/typescript/plugin.js +8 -0
- package/src/utils/find-npm-dependencies.js +12 -0
- package/src/utils/package-manager-workspaces.d.ts +4 -0
- package/src/utils/package-manager-workspaces.js +19 -0
- package/src/utils/prettier.d.ts +1 -0
- package/src/utils/prettier.js +53 -0
- package/src/utils/schema.d.ts +0 -32
- package/src/utils/swc/add-swc-dependencies.d.ts +4 -0
- package/src/utils/swc/add-swc-dependencies.js +11 -4
- package/src/utils/typescript/configuration.d.ts +7 -0
- package/src/utils/typescript/configuration.js +64 -0
- package/src/utils/typescript/ts-solution-setup.d.ts +3 -0
- package/src/utils/typescript/ts-solution-setup.js +48 -0
- /package/src/generators/init/files/{__fileName__ → non-ts-solution/__fileName__} +0 -0
- /package/src/generators/library/files/{lib → tsconfig-lib/non-ts-solution}/tsconfig.lib.json__tmpl__ +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUsingTypeScriptPlugin = isUsingTypeScriptPlugin;
|
|
4
|
+
exports.isUsingTsSolutionSetup = isUsingTsSolutionSetup;
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const package_manager_workspaces_1 = require("../package-manager-workspaces");
|
|
7
|
+
function isUsingTypeScriptPlugin(tree) {
|
|
8
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
9
|
+
return (nxJson?.plugins?.some((p) => typeof p === 'string'
|
|
10
|
+
? p === '@nx/js/typescript'
|
|
11
|
+
: p.plugin === '@nx/js/typescript') ?? false);
|
|
12
|
+
}
|
|
13
|
+
function isUsingTsSolutionSetup(tree) {
|
|
14
|
+
return ((0, package_manager_workspaces_1.isUsingPackageManagerWorkspaces)(tree) &&
|
|
15
|
+
isWorkspaceSetupWithTsSolution(tree));
|
|
16
|
+
}
|
|
17
|
+
function isWorkspaceSetupWithTsSolution(tree) {
|
|
18
|
+
if (!tree.exists('tsconfig.base.json') || !tree.exists('tsconfig.json')) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const tsconfigJson = (0, devkit_1.readJson)(tree, 'tsconfig.json');
|
|
22
|
+
if (tsconfigJson.extends !== './tsconfig.base.json') {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* New setup:
|
|
27
|
+
* - `files` is defined and set to an empty array
|
|
28
|
+
* - `references` is defined and set to an empty array
|
|
29
|
+
* - `include` is not defined or is set to an empty array
|
|
30
|
+
*/
|
|
31
|
+
if (!tsconfigJson.files ||
|
|
32
|
+
tsconfigJson.files.length > 0 ||
|
|
33
|
+
!tsconfigJson.references ||
|
|
34
|
+
!!tsconfigJson.include?.length) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const baseTsconfigJson = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
38
|
+
if (!baseTsconfigJson.compilerOptions ||
|
|
39
|
+
!baseTsconfigJson.compilerOptions.composite ||
|
|
40
|
+
!baseTsconfigJson.compilerOptions.declaration) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const { compilerOptions, ...rest } = baseTsconfigJson;
|
|
44
|
+
if (Object.keys(rest).length > 0) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
File without changes
|
/package/src/generators/library/files/{lib → tsconfig-lib/non-ts-solution}/tsconfig.lib.json__tmpl__
RENAMED
|
File without changes
|