@nrwl/workspace 14.0.0-beta.2 → 14.0.0-beta.5
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/.eslintrc.json +24 -0
- package/package.json +24 -24
- package/src/generators/ci-workflow/ci-workflow.js +7 -1
- package/src/generators/ci-workflow/ci-workflow.js.map +1 -1
- package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +15 -22
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +76 -0
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +26 -0
- package/src/generators/ci-workflow/schema.json +1 -0
- package/src/generators/library/files/lib/tsconfig.lib.json +1 -1
- package/src/generators/move/lib/update-jest-config.js +3 -3
- package/src/generators/move/lib/update-project-root-files.js +3 -1
- package/src/generators/move/lib/update-project-root-files.js.map +1 -1
- package/src/generators/remove/lib/test-files/jest.config.d.ts +0 -0
- package/src/generators/remove/lib/test-files/jest.config.js +9 -0
- package/src/generators/remove/lib/test-files/jest.config.js.map +1 -0
- package/src/generators/remove/lib/update-jest-config.js +8 -8
- package/src/utils/versions.js +1 -1
package/.eslintrc.json
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"extends": "../../.eslintrc",
|
3
|
+
"rules": {},
|
4
|
+
"overrides": [
|
5
|
+
{
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
7
|
+
"rules": {}
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"files": ["**/*.ts"],
|
11
|
+
"excludedFiles": ["./src/migrations/**", "./src/utils/**"],
|
12
|
+
"rules": {
|
13
|
+
"no-restricted-imports": [
|
14
|
+
"error",
|
15
|
+
"@nrwl/workspace",
|
16
|
+
"@angular-devkit/core",
|
17
|
+
"@angular-devkit/architect",
|
18
|
+
"@angular-devkit/schematics"
|
19
|
+
]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
],
|
23
|
+
"ignorePatterns": ["!**/*"]
|
24
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nrwl/workspace",
|
3
|
-
"version": "14.0.0-beta.
|
3
|
+
"version": "14.0.0-beta.5",
|
4
4
|
"description": "Smart, Fast and Extensible Build System.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -32,26 +32,26 @@
|
|
32
32
|
"requirements": {},
|
33
33
|
"migrations": "./migrations.json",
|
34
34
|
"packageGroup": {
|
35
|
-
"@nrwl/angular": "14.0.0-beta.
|
36
|
-
"@nrwl/cypress": "14.0.0-beta.
|
37
|
-
"@nrwl/devkit": "14.0.0-beta.
|
38
|
-
"@nrwl/eslint-plugin-nx": "14.0.0-beta.
|
39
|
-
"@nrwl/express": "14.0.0-beta.
|
40
|
-
"@nrwl/jest": "14.0.0-beta.
|
41
|
-
"@nrwl/linter": "14.0.0-beta.
|
42
|
-
"@nrwl/nest": "14.0.0-beta.
|
43
|
-
"@nrwl/next": "14.0.0-beta.
|
44
|
-
"@nrwl/node": "14.0.0-beta.
|
45
|
-
"@nrwl/nx-plugin": "14.0.0-beta.
|
46
|
-
"@nrwl/react": "14.0.0-beta.
|
47
|
-
"@nrwl/storybook": "14.0.0-beta.
|
48
|
-
"@nrwl/web": "14.0.0-beta.
|
49
|
-
"@nrwl/js": "14.0.0-beta.
|
50
|
-
"@nrwl/cli": "14.0.0-beta.
|
35
|
+
"@nrwl/angular": "14.0.0-beta.5",
|
36
|
+
"@nrwl/cypress": "14.0.0-beta.5",
|
37
|
+
"@nrwl/devkit": "14.0.0-beta.5",
|
38
|
+
"@nrwl/eslint-plugin-nx": "14.0.0-beta.5",
|
39
|
+
"@nrwl/express": "14.0.0-beta.5",
|
40
|
+
"@nrwl/jest": "14.0.0-beta.5",
|
41
|
+
"@nrwl/linter": "14.0.0-beta.5",
|
42
|
+
"@nrwl/nest": "14.0.0-beta.5",
|
43
|
+
"@nrwl/next": "14.0.0-beta.5",
|
44
|
+
"@nrwl/node": "14.0.0-beta.5",
|
45
|
+
"@nrwl/nx-plugin": "14.0.0-beta.5",
|
46
|
+
"@nrwl/react": "14.0.0-beta.5",
|
47
|
+
"@nrwl/storybook": "14.0.0-beta.5",
|
48
|
+
"@nrwl/web": "14.0.0-beta.5",
|
49
|
+
"@nrwl/js": "14.0.0-beta.5",
|
50
|
+
"@nrwl/cli": "14.0.0-beta.5",
|
51
51
|
"@nrwl/nx-cloud": "latest",
|
52
|
-
"@nrwl/react-native": "14.0.0-beta.
|
53
|
-
"@nrwl/detox": "14.0.0-beta.
|
54
|
-
"nx": "14.0.0-beta.
|
52
|
+
"@nrwl/react-native": "14.0.0-beta.5",
|
53
|
+
"@nrwl/detox": "14.0.0-beta.5",
|
54
|
+
"nx": "14.0.0-beta.5"
|
55
55
|
}
|
56
56
|
},
|
57
57
|
"peerDependencies": {
|
@@ -84,9 +84,9 @@
|
|
84
84
|
"minimatch": "3.0.4",
|
85
85
|
"enquirer": "~2.3.6",
|
86
86
|
"tslib": "^2.3.0",
|
87
|
-
"nx": "14.0.0-beta.
|
88
|
-
"@nrwl/devkit": "14.0.0-beta.
|
89
|
-
"@nrwl/jest": "14.0.0-beta.
|
90
|
-
"@nrwl/linter": "14.0.0-beta.
|
87
|
+
"nx": "14.0.0-beta.5",
|
88
|
+
"@nrwl/devkit": "14.0.0-beta.5",
|
89
|
+
"@nrwl/jest": "14.0.0-beta.5",
|
90
|
+
"@nrwl/linter": "14.0.0-beta.5"
|
91
91
|
}
|
92
92
|
}
|
@@ -8,12 +8,18 @@ function ciWorkflowGenerator(host, schema) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
9
9
|
const ci = schema.ci;
|
10
10
|
const options = normalizeOptions(schema);
|
11
|
+
const nxJson = (0, devkit_1.readJson)(host, 'nx.json');
|
12
|
+
const nxCloudUsed = Object.values(nxJson.tasksRunnerOptions).find((r) => r.runner == '@nrwl/nx-cloud');
|
13
|
+
if (!nxCloudUsed) {
|
14
|
+
throw new Error('This workspace is not connected to Nx Cloud.');
|
15
|
+
}
|
11
16
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, 'files', ci), '', options);
|
17
|
+
yield (0, devkit_1.formatFiles)(host);
|
12
18
|
});
|
13
19
|
}
|
14
20
|
exports.ciWorkflowGenerator = ciWorkflowGenerator;
|
15
21
|
function normalizeOptions(options) {
|
16
|
-
const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name || '
|
22
|
+
const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name || 'CI');
|
17
23
|
const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } = (0, devkit_1.getPackageManagerCommand)();
|
18
24
|
return {
|
19
25
|
workflowName,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ci-workflow.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/ci-workflow/ci-workflow.ts"],"names":[],"mappings":";;;;AAAA,
|
1
|
+
{"version":3,"file":"ci-workflow.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/ci-workflow/ci-workflow.ts"],"names":[],"mappings":";;;;AAAA,yCASsB;AACtB,+DAAiE;AAOjE,SAAsB,mBAAmB,CAAC,IAAU,EAAE,MAAc;;QAClE,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAwB,IAAA,iBAAQ,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,gBAAgB,CACpC,CAAC;QACF,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QAED,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QAC5E,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAdD,kDAcC;AAWD,SAAS,gBAAgB,CAAC,OAAe;IACvC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAA,cAAK,EAC9D,OAAO,CAAC,IAAI,IAAI,IAAI,CACrB,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,qBAAqB,EAAE,GACpE,IAAA,iCAAwB,GAAE,CAAC;IAC7B,OAAO;QACL,YAAY;QACZ,gBAAgB;QAChB,qBAAqB;QACrB,oBAAoB;QACpB,UAAU,EAAE,IAAA,gCAAiB,GAAE;QAC/B,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC"}
|
@@ -6,29 +6,22 @@ pr:
|
|
6
6
|
- <%= mainBranch %>
|
7
7
|
|
8
8
|
variables:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
$
|
13
|
-
|
14
|
-
$
|
15
|
-
|
16
|
-
|
17
|
-
$
|
18
|
-
|
19
|
-
- name: BASE_SHA
|
20
|
-
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
21
|
-
value: $(git merge-base $(TARGET_BRANCH) HEAD)
|
22
|
-
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
|
23
|
-
value: $(git rev-parse HEAD~1)
|
24
|
-
- name: HEAD_SHA
|
25
|
-
value: $(git rev-parse HEAD)
|
9
|
+
CI: 'true'
|
10
|
+
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
11
|
+
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
|
12
|
+
NX_BRANCH: $(System.PullRequest.PullRequestNumber)
|
13
|
+
TARGET_BRANCH: $[replace(variables['System.PullRequest.TargetBranch'],'refs/heads/','origin/')]
|
14
|
+
BASE_SHA: $(git merge-base $(TARGET_BRANCH) HEAD)
|
15
|
+
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
|
16
|
+
NX_BRANCH: $(Build.SourceBranchName)
|
17
|
+
BASE_SHA: $(git rev-parse HEAD~1)
|
18
|
+
HEAD_SHA: $(git rev-parse HEAD)
|
26
19
|
|
27
20
|
jobs:
|
28
21
|
- job: agents
|
29
22
|
strategy:
|
30
23
|
parallel: 3
|
31
|
-
displayName:
|
24
|
+
displayName: Nx Cloud Agent
|
32
25
|
pool:
|
33
26
|
vmImage: 'ubuntu-latest'
|
34
27
|
steps:
|
@@ -38,10 +31,10 @@ jobs:
|
|
38
31
|
<% } %>- script: <%= packageManagerInstall %>
|
39
32
|
displayName: NPM Install Dependencies
|
40
33
|
- script: npx nx-cloud start-agent
|
41
|
-
displayName:
|
34
|
+
displayName: Start Nx-Cloud agent
|
42
35
|
|
43
36
|
- job: main
|
44
|
-
displayName:
|
37
|
+
displayName: Nx Cloud Main
|
45
38
|
pool:
|
46
39
|
vmImage: 'ubuntu-latest'
|
47
40
|
steps:
|
@@ -52,9 +45,9 @@ jobs:
|
|
52
45
|
displayName: NPM Install Dependencies
|
53
46
|
- script: <%= packageManagerPrefix %> nx-cloud start-ci-run
|
54
47
|
displayName: Start CI run
|
55
|
-
- script: <%= packageManagerPrefix %> nx workspace-lint
|
48
|
+
- script: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx workspace-lint
|
56
49
|
displayName: Run workspace lint
|
57
|
-
- script: <%= packageManagerPrefix %> nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA)
|
50
|
+
- script: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA)
|
58
51
|
displayName: Check format
|
59
52
|
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=lint --parallel=3
|
60
53
|
displayName: Run lint
|
@@ -0,0 +1,76 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
nx: nrwl/nx@1.4.0
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
agent:
|
8
|
+
docker:
|
9
|
+
- image: cimg/node:lts-browsers
|
10
|
+
parameters:
|
11
|
+
ordinal:
|
12
|
+
type: integer
|
13
|
+
steps:
|
14
|
+
- checkout
|
15
|
+
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
16
|
+
- run:
|
17
|
+
name: Install PNPM
|
18
|
+
command: npm install --prefix=$HOME/.local -g pnpm@6.32.4
|
19
|
+
<% } %>- run:
|
20
|
+
name: Install dependencies
|
21
|
+
command: <%= packageManagerInstall %>
|
22
|
+
- run:
|
23
|
+
name: Start the agent << parameters.ordinal >>
|
24
|
+
command: <%= packageManagerPrefix %> nx-cloud start-agent
|
25
|
+
no_output_timeout: 60m
|
26
|
+
main:
|
27
|
+
docker:
|
28
|
+
- image: cimg/node:lts-browsers
|
29
|
+
environment:
|
30
|
+
NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
|
31
|
+
steps:
|
32
|
+
- checkout
|
33
|
+
<% if(packageManagerPrefix == 'pnpm exec'){ %>
|
34
|
+
- run:
|
35
|
+
name: Install PNPM
|
36
|
+
command: npm install --prefix=$HOME/.local -g pnpm@6.32.4
|
37
|
+
<% } %>- run:
|
38
|
+
name: Install dependencies
|
39
|
+
command: <%= packageManagerInstall %>
|
40
|
+
- nx/set-shas:
|
41
|
+
main-branch-name: '<%= mainBranch %>'
|
42
|
+
- run:
|
43
|
+
name: Initialize the Nx Cloud distributed CI run
|
44
|
+
command: <%= packageManagerPrefix %> nx-cloud start-ci-run
|
45
|
+
- run:
|
46
|
+
name: Run workspace lint
|
47
|
+
command: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx workspace-lint
|
48
|
+
- run:
|
49
|
+
name: Check format
|
50
|
+
command: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$NX_BASE --head=$NX_HEAD
|
51
|
+
- run:
|
52
|
+
name: Run lint
|
53
|
+
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3
|
54
|
+
- run:
|
55
|
+
name: Run test
|
56
|
+
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage
|
57
|
+
- run:
|
58
|
+
name: Run build
|
59
|
+
command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
|
60
|
+
- run:
|
61
|
+
name: Stop all agents
|
62
|
+
command: <%= packageManagerPrefix %> nx-cloud stop-all-agents
|
63
|
+
when: always
|
64
|
+
|
65
|
+
workflows:
|
66
|
+
version: 2
|
67
|
+
|
68
|
+
<%= workflowFileName %>:
|
69
|
+
jobs:
|
70
|
+
- agent:
|
71
|
+
name: Nx Cloud Agent << matrix.ordinal >>
|
72
|
+
matrix:
|
73
|
+
parameters:
|
74
|
+
ordinal: [1, 2, 3]
|
75
|
+
- main:
|
76
|
+
name: Nx Cloud Main
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
name: <%= workflowName %>
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- <%= mainBranch %>
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
main:
|
11
|
+
name: Nx Cloud - Main Job
|
12
|
+
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.2
|
13
|
+
with:
|
14
|
+
parallel-commands: |
|
15
|
+
<%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx workspace-lint
|
16
|
+
<%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check
|
17
|
+
parallel-commands-on-agents: |
|
18
|
+
<%= packageManagerPrefix %> nx affected --target=lint --parallel=3
|
19
|
+
<%= packageManagerPrefix %> nx affected --target=test --parallel=3 --ci --code-coverage
|
20
|
+
<%= packageManagerPrefix %> nx affected --target=build --parallel=3
|
21
|
+
|
22
|
+
agents:
|
23
|
+
name: Nx Cloud - Agents
|
24
|
+
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.2
|
25
|
+
with:
|
26
|
+
number-of-agents: 3
|
@@ -10,7 +10,7 @@ const path = require("path");
|
|
10
10
|
* @param schema The options provided to the schematic
|
11
11
|
*/
|
12
12
|
function updateJestConfig(tree, schema, project) {
|
13
|
-
const jestConfigPath = path.join(schema.relativeToRootDestination, 'jest.config.
|
13
|
+
const jestConfigPath = path.join(schema.relativeToRootDestination, 'jest.config.ts');
|
14
14
|
if (tree.exists(jestConfigPath)) {
|
15
15
|
const oldContent = tree.read(jestConfigPath, 'utf-8');
|
16
16
|
const findName = new RegExp(`'${schema.projectName}'`, 'g');
|
@@ -20,8 +20,8 @@ function updateJestConfig(tree, schema, project) {
|
|
20
20
|
.replace(findDir, schema.relativeToRootDestination);
|
21
21
|
tree.write(jestConfigPath, newContent);
|
22
22
|
}
|
23
|
-
// update root jest.config.
|
24
|
-
const rootJestConfigPath = '/jest.config.
|
23
|
+
// update root jest.config.ts
|
24
|
+
const rootJestConfigPath = '/jest.config.ts';
|
25
25
|
if (!tree.exists(rootJestConfigPath)) {
|
26
26
|
return;
|
27
27
|
}
|
@@ -4,6 +4,7 @@ exports.updateProjectRootFiles = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
5
5
|
const path = require("path");
|
6
6
|
const path_1 = require("path");
|
7
|
+
const allowedExt = ['.ts', '.js', '.json'];
|
7
8
|
/**
|
8
9
|
* Updates the files in the root of the project
|
9
10
|
*
|
@@ -27,7 +28,8 @@ function updateProjectRootFiles(tree, schema, project) {
|
|
27
28
|
const dots = /\./g;
|
28
29
|
const regex = new RegExp(oldRelativeRoot.replace(dots, '\\.'), 'g');
|
29
30
|
for (const file of tree.children(schema.relativeToRootDestination)) {
|
30
|
-
|
31
|
+
const ext = (0, path_1.extname)(file);
|
32
|
+
if (!allowedExt.includes(ext)) {
|
31
33
|
continue;
|
32
34
|
}
|
33
35
|
if (file === '.eslintrc.json') {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"update-project-root-files.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-project-root-files.ts"],"names":[],"mappings":";;;AACA,yCAA6C;AAC7C,6BAA6B;AAC7B,+BAAqC;
|
1
|
+
{"version":3,"file":"update-project-root-files.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-project-root-files.ts"],"names":[],"mappings":";;;AACA,yCAA6C;AAC7C,6BAA6B;AAC7B,+BAAqC;AAErC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC3C;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,MAAM,eAAe,GAAG,IAAI;SACzB,QAAQ,CACP,IAAI,CAAC,IAAI,CAAC,sBAAa,EAAE,MAAM,CAAC,yBAAyB,CAAC,EAC1D,sBAAa,CACd;SACA,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,MAAM,eAAe,GAAG,IAAI;SACzB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAa,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,sBAAa,CAAC;SAC/D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,IAAI,eAAe,KAAK,eAAe,EAAE;QACvC,gBAAgB;QAChB,OAAO;KACR;IAED,MAAM,IAAI,GAAG,KAAK,CAAC;IACnB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,yBAAyB,CAAC,EAAE;QAClE,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC7B,SAAS;SACV;QACD,IAAI,IAAI,KAAK,gBAAgB,EAAE;YAC7B,SAAS;SACV;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAC1B,IAAA,WAAI,EAAC,MAAM,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAC5C,OAAO,CACR,CAAC;QACF,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,IAAA,WAAI,EAAC,MAAM,CAAC,yBAAyB,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;KACtE;AACH,CAAC;AAxCD,wDAwCC"}
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../../../../../../../../packages/workspace/src/generators/remove/lib/test-files/jest.config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,GAAG;IACf,QAAQ,EAAE;QACR,wBAAwB;QACxB,6BAA6B;QAC7B,uBAAuB;QACvB,8BAA8B;KAC/B;CACF,CAAC"}
|
@@ -6,39 +6,39 @@ const get_source_nodes_1 = require("../../../utilities/typescript/get-source-nod
|
|
6
6
|
const typescript_1 = require("typescript");
|
7
7
|
const path_1 = require("path");
|
8
8
|
function isUsingUtilityFunction(host) {
|
9
|
-
return host.read('jest.config.
|
9
|
+
return host.read('jest.config.ts').toString().includes('getJestProjects()');
|
10
10
|
}
|
11
11
|
/**
|
12
12
|
* Updates the root jest config projects array and removes the project.
|
13
13
|
*/
|
14
14
|
function updateJestConfig(tree, schema, projectConfig) {
|
15
15
|
const projectToRemove = schema.projectName;
|
16
|
-
if (!tree.exists('jest.config.
|
17
|
-
!tree.exists((0, path_1.join)(projectConfig.root, 'jest.config.
|
16
|
+
if (!tree.exists('jest.config.ts') ||
|
17
|
+
!tree.exists((0, path_1.join)(projectConfig.root, 'jest.config.ts')) ||
|
18
18
|
isUsingUtilityFunction(tree)) {
|
19
19
|
return;
|
20
20
|
}
|
21
|
-
const contents = tree.read('jest.config.
|
22
|
-
const sourceFile = (0, typescript_1.createSourceFile)('jest.config.
|
21
|
+
const contents = tree.read('jest.config.ts', 'utf-8');
|
22
|
+
const sourceFile = (0, typescript_1.createSourceFile)('jest.config.ts', contents, typescript_1.ScriptTarget.Latest);
|
23
23
|
const sourceNodes = (0, get_source_nodes_1.getSourceNodes)(sourceFile);
|
24
24
|
const projectsAssignment = sourceNodes.find((node) => (0, typescript_1.isPropertyAssignment)(node) &&
|
25
25
|
node.name.getText(sourceFile) === 'projects' &&
|
26
26
|
(0, typescript_1.isArrayLiteralExpression)(node.initializer));
|
27
27
|
if (!projectsAssignment) {
|
28
|
-
throw Error(`Could not remove ${projectToRemove} from projects in /jest.config.
|
28
|
+
throw Error(`Could not remove ${projectToRemove} from projects in /jest.config.ts. Please remove ${projectToRemove} from your projects.`);
|
29
29
|
}
|
30
30
|
const projectsArray = projectsAssignment.initializer;
|
31
31
|
const project = projectsArray.elements.find((item) => (0, typescript_1.isStringLiteral)(item) &&
|
32
32
|
item.text.startsWith(`<rootDir>/${projectConfig.root}`));
|
33
33
|
if (!project) {
|
34
|
-
console.warn(`Could not find ${projectToRemove} in projects in /jest.config.
|
34
|
+
console.warn(`Could not find ${projectToRemove} in projects in /jest.config.ts.`);
|
35
35
|
return;
|
36
36
|
}
|
37
37
|
const previousProject = projectsArray.elements[projectsArray.elements.indexOf(project) - 1];
|
38
38
|
const start = previousProject
|
39
39
|
? previousProject.getEnd()
|
40
40
|
: project.getStart(sourceFile);
|
41
|
-
tree.write('jest.config.
|
41
|
+
tree.write('jest.config.ts', (0, devkit_1.applyChangesToString)(contents, [
|
42
42
|
{
|
43
43
|
type: devkit_1.ChangeType.Delete,
|
44
44
|
start,
|
package/src/utils/versions.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.eslintConfigPrettierVersion = exports.eslintVersion = exports.typescriptESLintVersion = exports.tslintVersion = exports.prettierVersion = exports.typescriptVersion = exports.angularCliVersion = exports.nxVersion = void 0;
|
4
|
-
exports.nxVersion = '14.0.0-beta.
|
4
|
+
exports.nxVersion = '14.0.0-beta.5';
|
5
5
|
exports.angularCliVersion = '~13.3.0';
|
6
6
|
exports.typescriptVersion = '~4.6.2';
|
7
7
|
exports.prettierVersion = '^2.5.1';
|