@nx/workspace 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca
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/LICENSE +1 -1
- package/README.md +1 -1
- package/generators.json +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -2
- package/migrations.json +17 -71
- package/package.json +7 -29
- package/src/generators/ci-workflow/ci-workflow.js +9 -1
- package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +9 -6
- package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +9 -8
- package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +8 -6
- package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +20 -14
- package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +8 -6
- package/src/generators/convert-to-monorepo/convert-to-monorepo.js +6 -4
- package/src/generators/move/lib/create-project-configuration-in-new-destination.js +8 -2
- package/src/generators/move/lib/move-project-files.js +1 -0
- package/src/generators/move/lib/normalize-schema.js +32 -133
- package/src/generators/move/lib/update-eslint-config.js +5 -1
- package/src/generators/move/lib/update-imports.js +60 -25
- package/src/generators/move/lib/update-jest-config.js +1 -2
- package/src/generators/move/lib/update-project-root-files.js +6 -2
- package/src/generators/move/lib/utils.d.ts +0 -16
- package/src/generators/move/lib/utils.js +0 -31
- package/src/generators/move/move.d.ts +2 -3
- package/src/generators/move/move.js +19 -8
- package/src/generators/move/schema.d.ts +1 -3
- package/src/generators/move/schema.json +0 -5
- package/src/generators/new/files-integrated-repo/__dot__gitignore +4 -2
- package/src/generators/new/files-package-based-repo/__dot__gitignore +4 -2
- package/src/generators/new/files-package-based-repo/__dot__vscode/extensions.json__tmpl__ +2 -4
- package/src/generators/new/files-package-based-repo/package.json__tmpl__ +1 -1
- package/src/generators/new/files-readme/README.md.template +46 -6
- package/src/generators/new/files-root-app/__dot__gitignore +4 -2
- package/src/generators/new/generate-preset.js +26 -10
- package/src/generators/new/generate-workspace-files.js +29 -22
- package/src/generators/new/new.d.ts +9 -1
- package/src/generators/new/new.js +6 -1
- package/src/generators/new/schema.json +30 -1
- package/src/generators/npm-package/npm-package.d.ts +3 -6
- package/src/generators/npm-package/npm-package.js +5 -13
- package/src/generators/npm-package/schema.json +7 -13
- package/src/generators/preset/preset.js +70 -63
- package/src/generators/preset/schema.d.ts +7 -1
- package/src/generators/preset/schema.json +31 -2
- package/src/generators/remove/lib/update-jest-config.js +1 -2
- package/src/generators/remove/lib/update-tsconfig.js +22 -7
- package/src/generators/utils/get-npm-package-version.js +1 -1
- package/src/generators/utils/presets.d.ts +0 -2
- package/src/generators/utils/presets.js +0 -2
- package/src/utilities/default-base.js +1 -1
- package/src/utilities/package-manager-workspaces.d.ts +5 -0
- package/src/utilities/package-manager-workspaces.js +39 -0
- package/src/utilities/typescript/ts-solution-setup.d.ts +3 -0
- package/src/utilities/typescript/ts-solution-setup.js +105 -0
- package/src/utils/ts-solution-setup.d.ts +2 -0
- package/src/utils/ts-solution-setup.js +21 -0
- package/src/utils/versions.d.ts +3 -2
- package/src/utils/versions.js +4 -3
- package/src/migrations/update-16-0-0/fix-invalid-babelrc.d.ts +0 -2
- package/src/migrations/update-16-0-0/fix-invalid-babelrc.js +0 -41
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.d.ts +0 -2
- package/src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin.js +0 -187
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://circleci.com/gh/nrwl/nx)
|
|
11
11
|
[]()
|
|
12
|
-
[](https://www.npmjs.com/package/nx)
|
|
13
13
|
[]()
|
|
14
14
|
[](http://commitizen.github.io/cz-cli/)
|
|
15
15
|
[](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
package/generators.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"hidden": true
|
|
11
11
|
},
|
|
12
12
|
"move": {
|
|
13
|
-
"factory": "./src/generators/move/move
|
|
13
|
+
"factory": "./src/generators/move/move",
|
|
14
14
|
"schema": "./src/generators/move/schema.json",
|
|
15
15
|
"aliases": ["mv"],
|
|
16
16
|
"description": "Move an application or library to another folder."
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"description": "Fixes projects configuration"
|
|
46
46
|
},
|
|
47
47
|
"npm-package": {
|
|
48
|
-
"factory": "./src/generators/npm-package/npm-package#
|
|
48
|
+
"factory": "./src/generators/npm-package/npm-package#npmPackageGenerator",
|
|
49
49
|
"schema": "./src/generators/npm-package/schema.json",
|
|
50
50
|
"description": "Create a minimal NPM package.",
|
|
51
51
|
"x-type": "library"
|
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { ProjectType, projectRootDir } from './src/utils/project-type';
|
|
|
3
3
|
export { renameSync, updateJsonFile, copyFile, createDirectory, } from './src/utilities/fileutils';
|
|
4
4
|
export { names } from '@nx/devkit';
|
|
5
5
|
export { output } from './src/utilities/output';
|
|
6
|
-
export {
|
|
6
|
+
export { readPackageJson } from 'nx/src/project-graph/file-utils';
|
|
7
7
|
export { getWorkspacePath, editTarget, parseTarget, serializeTarget, } from './src/utils/cli-config-utils';
|
|
8
8
|
export { Linter } from './src/utils/lint';
|
|
9
9
|
export { moveGenerator } from './src/generators/move/move';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToNxProjectGenerator = exports.runCommandsGenerator = exports.removeGenerator = exports.moveGenerator = exports.serializeTarget = exports.parseTarget = exports.editTarget = exports.getWorkspacePath = exports.readPackageJson = exports.
|
|
3
|
+
exports.convertToNxProjectGenerator = exports.runCommandsGenerator = exports.removeGenerator = exports.moveGenerator = exports.serializeTarget = exports.parseTarget = exports.editTarget = exports.getWorkspacePath = exports.readPackageJson = exports.output = exports.names = exports.createDirectory = exports.copyFile = exports.updateJsonFile = exports.renameSync = exports.projectRootDir = exports.ProjectType = exports.readTsConfig = void 0;
|
|
4
4
|
var ts_config_1 = require("./src/utilities/ts-config");
|
|
5
5
|
Object.defineProperty(exports, "readTsConfig", { enumerable: true, get: function () { return ts_config_1.readTsConfig; } });
|
|
6
6
|
var project_type_1 = require("./src/utils/project-type");
|
|
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "names", { enumerable: true, get: function () { r
|
|
|
16
16
|
var output_1 = require("./src/utilities/output");
|
|
17
17
|
Object.defineProperty(exports, "output", { enumerable: true, get: function () { return output_1.output; } });
|
|
18
18
|
var file_utils_1 = require("nx/src/project-graph/file-utils");
|
|
19
|
-
Object.defineProperty(exports, "readWorkspaceConfig", { enumerable: true, get: function () { return file_utils_1.readWorkspaceConfig; } });
|
|
20
19
|
Object.defineProperty(exports, "readPackageJson", { enumerable: true, get: function () { return file_utils_1.readPackageJson; } });
|
|
21
20
|
var cli_config_utils_1 = require("./src/utils/cli-config-utils");
|
|
22
21
|
Object.defineProperty(exports, "getWorkspacePath", { enumerable: true, get: function () { return cli_config_utils_1.getWorkspacePath; } });
|
package/migrations.json
CHANGED
|
@@ -1,95 +1,41 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"update-16-0-0-add-nx-packages": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "16.0.0-beta.1",
|
|
6
|
-
"description": "Replace @nrwl/workspace with @nx/workspace",
|
|
7
|
-
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
8
|
-
},
|
|
9
|
-
"16-0-0-move-workspace-generators-into-local-plugin": {
|
|
10
|
-
"version": "16.0.0-beta.4",
|
|
11
|
-
"description": "Generates a plugin called 'workspace-plugin' containing your workspace generators.",
|
|
12
|
-
"cli": "nx",
|
|
13
|
-
"implementation": "./src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin"
|
|
14
|
-
},
|
|
15
|
-
"16-0-0-fix-invalid-babelrc": {
|
|
16
|
-
"version": "16.0.0-beta.9",
|
|
17
|
-
"description": "Fix .babelrc presets if it contains an invalid entry for @nx/web/babel.",
|
|
18
|
-
"cli": "nx",
|
|
19
|
-
"implementation": "./src/migrations/update-16-0-0/fix-invalid-babelrc"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
2
|
+
"generators": {},
|
|
22
3
|
"packageJsonUpdates": {
|
|
23
|
-
"
|
|
24
|
-
"version": "
|
|
25
|
-
"x-prompt": "Do you want to update to TypeScript v5.
|
|
26
|
-
"requires": {
|
|
27
|
-
"typescript": ">=4.9.5 <5.0.0"
|
|
28
|
-
},
|
|
29
|
-
"packages": {
|
|
30
|
-
"typescript": {
|
|
31
|
-
"version": "~5.0.2"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"16.4.0": {
|
|
36
|
-
"version": "16.4.0-beta.11",
|
|
37
|
-
"x-prompt": "Do you want to update to TypeScript v5.1?",
|
|
38
|
-
"requires": {
|
|
39
|
-
"typescript": ">=5.0.0 <5.1.0"
|
|
40
|
-
},
|
|
41
|
-
"packages": {
|
|
42
|
-
"typescript": {
|
|
43
|
-
"version": "~5.1.3"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"17.1.0": {
|
|
48
|
-
"version": "17.1.0-beta.4",
|
|
49
|
-
"x-prompt": "Do you want to update to TypeScript v5.2?",
|
|
50
|
-
"requires": {
|
|
51
|
-
"typescript": ">=5.1.0 <5.2.0"
|
|
52
|
-
},
|
|
53
|
-
"packages": {
|
|
54
|
-
"typescript": {
|
|
55
|
-
"version": "~5.2.2"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"17.3.0": {
|
|
60
|
-
"version": "17.3.0-beta.10",
|
|
61
|
-
"x-prompt": "Do you want to update to TypeScript v5.3?",
|
|
4
|
+
"19.5.1": {
|
|
5
|
+
"version": "19.5.0-beta.1",
|
|
6
|
+
"x-prompt": "Do you want to update to TypeScript v5.5?",
|
|
62
7
|
"requires": {
|
|
63
|
-
"typescript": ">=5.
|
|
8
|
+
"typescript": ">=5.4.0 <5.5.0"
|
|
64
9
|
},
|
|
65
10
|
"packages": {
|
|
66
11
|
"typescript": {
|
|
67
|
-
"version": "~5.
|
|
12
|
+
"version": "~5.5.2",
|
|
13
|
+
"alwaysAddToPackageJson": false
|
|
68
14
|
}
|
|
69
15
|
}
|
|
70
16
|
},
|
|
71
|
-
"
|
|
72
|
-
"version": "
|
|
73
|
-
"x-prompt": "Do you want to update to TypeScript v5.
|
|
17
|
+
"20.2.0": {
|
|
18
|
+
"version": "20.2.0-beta.5",
|
|
19
|
+
"x-prompt": "Do you want to update to TypeScript v5.6?",
|
|
74
20
|
"requires": {
|
|
75
|
-
"typescript": ">=5.
|
|
21
|
+
"typescript": ">=5.5.0 <5.6.0"
|
|
76
22
|
},
|
|
77
23
|
"packages": {
|
|
78
24
|
"typescript": {
|
|
79
|
-
"version": "~5.
|
|
25
|
+
"version": "~5.6.2",
|
|
80
26
|
"alwaysAddToPackageJson": false
|
|
81
27
|
}
|
|
82
28
|
}
|
|
83
29
|
},
|
|
84
|
-
"
|
|
85
|
-
"version": "
|
|
86
|
-
"x-prompt": "Do you want to update to TypeScript v5.
|
|
30
|
+
"20.4.0": {
|
|
31
|
+
"version": "20.4.0-beta.1",
|
|
32
|
+
"x-prompt": "Do you want to update to TypeScript v5.7?",
|
|
87
33
|
"requires": {
|
|
88
|
-
"typescript": ">=5.
|
|
34
|
+
"typescript": ">=5.6.0 <5.7.0"
|
|
89
35
|
},
|
|
90
36
|
"packages": {
|
|
91
37
|
"typescript": {
|
|
92
|
-
"version": "~5.
|
|
38
|
+
"version": "~5.7.2",
|
|
93
39
|
"alwaysAddToPackageJson": false
|
|
94
40
|
}
|
|
95
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/workspace",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-31313-387cdca",
|
|
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": {
|
|
@@ -33,45 +33,23 @@
|
|
|
33
33
|
"requirements": {},
|
|
34
34
|
"migrations": "./migrations.json",
|
|
35
35
|
"packageGroup": {
|
|
36
|
-
"@nrwl/js": "*",
|
|
37
|
-
"@nrwl/jest": "*",
|
|
38
|
-
"@nrwl/linter": "*",
|
|
39
|
-
"@nrwl/angular": "*",
|
|
40
|
-
"@nrwl/cypress": "*",
|
|
41
|
-
"@nrwl/detox": "*",
|
|
42
|
-
"@nrwl/devkit": "*",
|
|
43
|
-
"@nrwl/esbuild": "*",
|
|
44
|
-
"@nrwl/eslint-plugin-nx": "*",
|
|
45
|
-
"@nrwl/expo": "*",
|
|
46
|
-
"@nrwl/express": "*",
|
|
47
|
-
"@nrwl/nest": "*",
|
|
48
|
-
"@nrwl/next": "*",
|
|
49
|
-
"@nrwl/node": "*",
|
|
50
36
|
"nx-cloud": "latest",
|
|
51
|
-
"@nrwl/nx-plugin": "*",
|
|
52
|
-
"@nrwl/react-native": "*",
|
|
53
|
-
"@nrwl/react": "*",
|
|
54
|
-
"@nrwl/rollup": "*",
|
|
55
|
-
"@nrwl/storybook": "*",
|
|
56
|
-
"@nrwl/tao": "*",
|
|
57
|
-
"@nrwl/vite": "*",
|
|
58
|
-
"@nrwl/web": "*",
|
|
59
|
-
"@nrwl/webpack": "*",
|
|
60
37
|
"nx": "*"
|
|
61
38
|
}
|
|
62
39
|
},
|
|
63
40
|
"dependencies": {
|
|
64
|
-
"@nx/devkit": "0.0.0-pr-
|
|
41
|
+
"@nx/devkit": "0.0.0-pr-31313-387cdca",
|
|
42
|
+
"@zkochan/js-yaml": "0.0.7",
|
|
65
43
|
"chalk": "^4.1.0",
|
|
66
44
|
"enquirer": "~2.3.6",
|
|
45
|
+
"picomatch": "4.0.2",
|
|
67
46
|
"tslib": "^2.3.0",
|
|
68
47
|
"yargs-parser": "21.1.1",
|
|
69
|
-
"nx": "0.0.0-pr-
|
|
70
|
-
"@nrwl/workspace": "0.0.0-pr-31222-862e973"
|
|
48
|
+
"nx": "0.0.0-pr-31313-387cdca"
|
|
71
49
|
},
|
|
72
50
|
"publishConfig": {
|
|
73
51
|
"access": "public"
|
|
74
52
|
},
|
|
75
|
-
"
|
|
76
|
-
"
|
|
53
|
+
"types": "./index.d.ts",
|
|
54
|
+
"type": "commonjs"
|
|
77
55
|
}
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const default_base_1 = require("../../utilities/default-base");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const nx_cloud_utils_1 = require("nx/src/utils/nx-cloud-utils");
|
|
8
|
+
const ts_solution_setup_1 = require("../../utilities/typescript/ts-solution-setup");
|
|
8
9
|
async function ciWorkflowGenerator(tree, schema) {
|
|
9
10
|
const ci = schema.ci;
|
|
10
11
|
const options = normalizeOptions(schema, tree);
|
|
@@ -32,7 +33,10 @@ function normalizeOptions(options, tree) {
|
|
|
32
33
|
...packageJson.dependencies,
|
|
33
34
|
...packageJson.devDependencies,
|
|
34
35
|
};
|
|
35
|
-
const
|
|
36
|
+
const hasCypress = allDependencies['@nx/cypress'];
|
|
37
|
+
const hasPlaywright = allDependencies['@nx/playwright'];
|
|
38
|
+
const hasE2E = hasCypress || hasPlaywright;
|
|
39
|
+
const hasTypecheck = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
36
40
|
const connectedToCloud = (0, nx_cloud_utils_1.isNxCloudUsed)((0, devkit_1.readJson)(tree, 'nx.json'));
|
|
37
41
|
return {
|
|
38
42
|
workflowName,
|
|
@@ -42,7 +46,11 @@ function normalizeOptions(options, tree) {
|
|
|
42
46
|
packageManagerPrefix,
|
|
43
47
|
packageManagerPreInstallPrefix,
|
|
44
48
|
mainBranch: (0, default_base_1.deduceDefaultBase)(),
|
|
49
|
+
packageManagerVersion: packageJson?.packageManager?.split('@')[1],
|
|
50
|
+
hasCypress,
|
|
45
51
|
hasE2E,
|
|
52
|
+
hasPlaywright,
|
|
53
|
+
hasTypecheck,
|
|
46
54
|
nxCloudHost,
|
|
47
55
|
tmpl: '',
|
|
48
56
|
connectedToCloud,
|
|
@@ -23,6 +23,7 @@ jobs:
|
|
|
23
23
|
steps:
|
|
24
24
|
- checkout: self
|
|
25
25
|
fetchDepth: 0
|
|
26
|
+
fetchFilter: tree:0
|
|
26
27
|
# Set Azure Devops CLI default settings
|
|
27
28
|
- bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject)
|
|
28
29
|
displayName: 'Set default Azure DevOps organization and project'
|
|
@@ -55,15 +56,17 @@ jobs:
|
|
|
55
56
|
# This enables task distribution via Nx Cloud
|
|
56
57
|
# Run this command as early as possible, before dependencies are installed
|
|
57
58
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
|
58
|
-
<% if (connectedToCloud) {
|
|
59
|
-
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
|
59
|
+
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
|
60
60
|
# - script: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
61
|
-
|
|
62
|
-
- script: <%= packageManagerInstall %>
|
|
61
|
+
|
|
62
|
+
- script: <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
63
|
+
- script: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
64
|
+
- script: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
|
|
63
65
|
- script: git branch --track <%= mainBranch %> origin/<%= mainBranch %>
|
|
64
66
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
|
65
67
|
|
|
66
68
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
67
69
|
# - script: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
68
|
-
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
69
|
-
|
|
70
|
+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
|
|
71
|
+
# When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
|
|
72
|
+
- script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
|
package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__
CHANGED
|
@@ -22,17 +22,18 @@ pipelines:
|
|
|
22
22
|
# This enables task distribution via Nx Cloud
|
|
23
23
|
# Run this command as early as possible, before dependencies are installed
|
|
24
24
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
|
25
|
-
<% if (connectedToCloud) {
|
|
26
|
-
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
|
25
|
+
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
|
27
26
|
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
28
|
-
|
|
29
|
-
- <%= packageManagerInstall %>
|
|
27
|
+
|
|
28
|
+
- <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
29
|
+
- <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
30
|
+
- <%= packageManagerPrefix %> playwright install --with-deps<% } %>
|
|
30
31
|
|
|
31
32
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
32
33
|
# <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
33
|
-
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
34
|
-
|
|
35
|
-
- <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %>
|
|
34
|
+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
|
|
35
|
+
# When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
|
|
36
|
+
- <%= packageManagerPrefix %> nx affected --base=origin/<%= mainBranch %> -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
|
|
36
37
|
|
|
37
38
|
branches:
|
|
38
39
|
main:
|
|
@@ -58,4 +59,4 @@ pipelines:
|
|
|
58
59
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
59
60
|
# - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
60
61
|
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
61
|
-
- <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
|
|
62
|
+
- <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e-ci<% } %> --base=HEAD~1
|
|
@@ -24,18 +24,20 @@ jobs:
|
|
|
24
24
|
# This enables task distribution via Nx Cloud
|
|
25
25
|
# Run this command as early as possible, before dependencies are installed
|
|
26
26
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
|
27
|
-
<% if (connectedToCloud) {
|
|
28
|
-
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
|
27
|
+
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
|
29
28
|
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
30
|
-
|
|
31
|
-
- run: <%= packageManagerInstall %>
|
|
29
|
+
|
|
30
|
+
- run: <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
31
|
+
- run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
32
|
+
- run: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
|
|
32
33
|
- nx/set-shas:
|
|
33
34
|
main-branch-name: '<%= mainBranch %>'
|
|
34
35
|
|
|
35
36
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
36
37
|
# - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
37
|
-
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
38
|
-
|
|
38
|
+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
|
|
39
|
+
# When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
|
|
40
|
+
- run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
|
|
39
41
|
|
|
40
42
|
workflows:
|
|
41
43
|
version: 2
|
package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__
CHANGED
|
@@ -16,36 +16,42 @@ jobs:
|
|
|
16
16
|
steps:
|
|
17
17
|
- uses: actions/checkout@v4
|
|
18
18
|
with:
|
|
19
|
+
filter: tree:0
|
|
19
20
|
fetch-depth: 0
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
with:
|
|
23
|
-
version: 9
|
|
24
|
-
<% } %>
|
|
25
|
-
<% if(packageManager == 'bun'){ %>
|
|
21
|
+
|
|
22
|
+
<% if(packageManager === 'bun'){ %>
|
|
26
23
|
- uses: oven-sh/setup-bun@v1
|
|
27
24
|
with:
|
|
28
25
|
bun-version: latest
|
|
26
|
+
<% } else if (packageManager === 'yarn' && packageManagerVersion) { %>
|
|
27
|
+
- run: corepack enable
|
|
28
|
+
<% } else if(packageManager ==='pnpm'){ %>
|
|
29
|
+
- uses: pnpm/action-setup@v4
|
|
30
|
+
name: Install pnpm
|
|
31
|
+
with:<% if (!packageManagerVersion) { %>
|
|
32
|
+
version: 9.8.0<% } %>
|
|
33
|
+
run_install: false
|
|
29
34
|
<% } %>
|
|
30
|
-
|
|
31
35
|
# This enables task distribution via Nx Cloud
|
|
32
36
|
# Run this command as early as possible, before dependencies are installed
|
|
33
37
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
|
34
|
-
<% if (connectedToCloud) {
|
|
35
|
-
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
|
38
|
+
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
|
36
39
|
# - run: <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
37
|
-
|
|
38
|
-
<% if(packageManager
|
|
40
|
+
|
|
41
|
+
<% if(packageManager !== 'bun'){ %>
|
|
39
42
|
# Cache node_modules
|
|
40
43
|
- uses: actions/setup-node@v4
|
|
41
44
|
with:
|
|
42
45
|
node-version: 20
|
|
43
46
|
cache: '<%= packageManager %>'
|
|
44
47
|
<% } %>
|
|
45
|
-
- run: <%= packageManagerInstall %>
|
|
48
|
+
- run: <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
49
|
+
- run: <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
50
|
+
- run: <%= packageManagerPrefix %> playwright install --with-deps<% } %>
|
|
46
51
|
- uses: nrwl/nx-set-shas@v4
|
|
47
52
|
|
|
48
53
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
49
54
|
# - run: <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
50
|
-
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
51
|
-
|
|
55
|
+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
|
|
56
|
+
# When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
|
|
57
|
+
- run: <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
|
|
@@ -18,15 +18,17 @@ variables:
|
|
|
18
18
|
# This enables task distribution via Nx Cloud
|
|
19
19
|
# Run this command as early as possible, before dependencies are installed
|
|
20
20
|
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
|
|
21
|
-
<% if (connectedToCloud) {
|
|
22
|
-
<% } else { %># Connect your workspace by running "nx connect" and uncomment this
|
|
21
|
+
<% if (connectedToCloud) { %># Uncomment this line to enable task distribution<% } else { %># Connect your workspace by running "nx connect" and uncomment this line to enable task distribution<% } %>
|
|
23
22
|
# - <%= packageManagerPreInstallPrefix %> nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="<% if(hasE2E){ %>e2e-ci<% } else { %>build<% } %>"
|
|
24
|
-
|
|
25
|
-
- <%= packageManagerInstall %>
|
|
23
|
+
|
|
24
|
+
- <%= packageManagerInstall %><% if(hasCypress){ %>
|
|
25
|
+
- <%= packageManagerPrefix %> cypress install<% } %><% if(hasPlaywright){ %>
|
|
26
|
+
- <%= packageManagerPrefix %> playwright install --with-deps<% } %>
|
|
26
27
|
- NX_HEAD=$CI_COMMIT_SHA
|
|
27
28
|
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
|
|
28
29
|
|
|
29
30
|
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
|
|
30
31
|
# - <%= packageManagerPrefix %> nx-cloud record -- echo Hello World
|
|
31
|
-
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
|
|
32
|
-
|
|
32
|
+
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected<% if(hasE2E){ %>
|
|
33
|
+
# When you enable task distribution, run the e2e-ci task instead of e2e<% } %>
|
|
34
|
+
- <%= packageManagerPrefix %> nx affected -t lint test build<% if(hasTypecheck){ %> typecheck<% } %><% if(hasE2E){ %> e2e<% } %>
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.monorepoGenerator = monorepoGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const move_1 = require("../move/move");
|
|
6
|
+
const ts_solution_setup_1 = require("../../utils/ts-solution-setup");
|
|
6
7
|
async function monorepoGenerator(tree, options) {
|
|
7
8
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
8
9
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
@@ -22,7 +23,8 @@ async function monorepoGenerator(tree, options) {
|
|
|
22
23
|
// Currently, Nx only handles apps+libs or packages. You cannot mix and match them.
|
|
23
24
|
// If the standalone project is an app (React, Angular, etc), then use apps+libs.
|
|
24
25
|
// Otherwise, for TS standalone (lib), use packages.
|
|
25
|
-
const isRootProjectApp = rootProject.projectType ===
|
|
26
|
+
const isRootProjectApp = (0, ts_solution_setup_1.getProjectType)(tree, rootProject.root, rootProject.projectType) ===
|
|
27
|
+
'application';
|
|
26
28
|
const appsDir = isRootProjectApp ? 'apps' : 'packages';
|
|
27
29
|
const libsDir = isRootProjectApp ? 'libs' : 'packages';
|
|
28
30
|
if (rootProject) {
|
|
@@ -38,14 +40,14 @@ async function monorepoGenerator(tree, options) {
|
|
|
38
40
|
});
|
|
39
41
|
}
|
|
40
42
|
for (const project of projectsToMove) {
|
|
43
|
+
const projectType = (0, ts_solution_setup_1.getProjectType)(tree, project.root, project.projectType);
|
|
41
44
|
await (0, move_1.moveGenerator)(tree, {
|
|
42
45
|
projectName: project.name,
|
|
43
46
|
newProjectName: project.name,
|
|
44
|
-
destination:
|
|
47
|
+
destination: projectType === 'application'
|
|
45
48
|
? (0, devkit_1.joinPathFragments)(appsDir, project.root === '.' ? project.name : project.root)
|
|
46
49
|
: (0, devkit_1.joinPathFragments)(libsDir, project.root === '.' ? project.name : project.root),
|
|
47
|
-
updateImportPath:
|
|
48
|
-
projectNameAndRootFormat: 'as-provided',
|
|
50
|
+
updateImportPath: projectType === 'library',
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -48,6 +48,12 @@ function createProjectConfigurationInNewDestination(tree, schema, projectConfig)
|
|
|
48
48
|
if (isRootProject && projectConfig.sourceRoot) {
|
|
49
49
|
newProject.sourceRoot = (0, devkit_1.joinPathFragments)(schema.relativeToRootDestination, projectConfig.sourceRoot);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (schema.isNxConfiguredInPackageJson) {
|
|
52
|
+
// Update the existing project configuration in the package.json
|
|
53
|
+
(0, devkit_1.updateProjectConfiguration)(tree, schema.newProjectName, newProject);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Create a new project with the root replaced
|
|
57
|
+
(0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject);
|
|
58
|
+
}
|
|
53
59
|
}
|