@nx/plugin 23.3.0-rc.1 → 24.0.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/README.md +3 -6
- package/dist/src/generators/executor/executor.js +4 -14
- package/dist/src/generators/executor/schema.json +1 -1
- package/package.json +7 -7
- package/readme-template.md +3 -3
- package/dist/src/generators/executor/files/hasher/hasher.spec.ts.template +0 -25
- package/dist/src/generators/executor/files/hasher/hasher.ts.template +0 -12
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<p
|
|
1
|
+
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-
|
|
4
|
-
<img alt="Nx
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo-light.svg">
|
|
4
|
+
<img alt="Nx Logo" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.svg" width="140">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
@@ -66,6 +66,3 @@ npx nx@latest init
|
|
|
66
66
|
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
|
|
67
67
|
- [Blog Posts About Nx](https://nx.dev/blog)
|
|
68
68
|
|
|
69
|
-
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
70
|
-
width="100%" alt="Nx - Smart Monorepos · Fast Builds"></a></p>
|
|
71
|
-
|
|
@@ -18,14 +18,6 @@ function addFiles(host, options) {
|
|
|
18
18
|
host.delete((0, devkit_1.joinPathFragments)(options.directory, `${options.fileName}.spec.ts`));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function addHasherFiles(host, options) {
|
|
22
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, './files/hasher'), options.directory, {
|
|
23
|
-
...options,
|
|
24
|
-
});
|
|
25
|
-
if (options.unitTestRunner === 'none') {
|
|
26
|
-
host.delete((0, devkit_1.joinPathFragments)(options.directory, 'hasher.spec.ts'));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
21
|
async function createExecutorsJson(host, projectRoot, projectName, skipLintChecks) {
|
|
30
22
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'), (json) => {
|
|
31
23
|
json.executors ??= './executors.json';
|
|
@@ -77,9 +69,6 @@ async function updateExecutorJson(host, options) {
|
|
|
77
69
|
schema: `${dir}/schema.json`,
|
|
78
70
|
description: options.description,
|
|
79
71
|
};
|
|
80
|
-
if (options.includeHasher) {
|
|
81
|
-
executors[options.name].hasher = `${dir}/hasher`;
|
|
82
|
-
}
|
|
83
72
|
json.executors = executors;
|
|
84
73
|
return json;
|
|
85
74
|
});
|
|
@@ -128,11 +117,12 @@ async function normalizeOptions(tree, options) {
|
|
|
128
117
|
};
|
|
129
118
|
}
|
|
130
119
|
async function executorGenerator(host, schema) {
|
|
120
|
+
// TODO(v25): remove the includeHasher option.
|
|
121
|
+
if (schema.includeHasher) {
|
|
122
|
+
throw new Error('Custom hashers are deprecated and will be removed in Nx 25, so the executor generator no longer creates them. Declare what the executor depends on as target inputs instead: https://nx.dev/docs/kb/local-executors#replace-a-custom-hasher-with-inputs');
|
|
123
|
+
}
|
|
131
124
|
const options = await normalizeOptions(host, schema);
|
|
132
125
|
addFiles(host, options);
|
|
133
|
-
if (options.includeHasher) {
|
|
134
|
-
addHasherFiles(host, options);
|
|
135
|
-
}
|
|
136
126
|
await updateExecutorJson(host, options);
|
|
137
127
|
if (!schema.skipFormat) {
|
|
138
128
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"includeHasher": {
|
|
36
36
|
"type": "boolean",
|
|
37
37
|
"default": false,
|
|
38
|
-
"description": "
|
|
38
|
+
"description": "No longer supported. Passing this option throws an error, because custom hashers are deprecated. Use target inputs instead."
|
|
39
39
|
},
|
|
40
40
|
"skipLintChecks": {
|
|
41
41
|
"type": "boolean",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
|
|
6
6
|
"repository": {
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"@nx/devkit": "
|
|
40
|
-
"@nx/jest": "
|
|
41
|
-
"@nx/js": "
|
|
42
|
-
"@nx/eslint": "
|
|
39
|
+
"@nx/devkit": "24.0.0-beta.0",
|
|
40
|
+
"@nx/jest": "24.0.0-beta.0",
|
|
41
|
+
"@nx/js": "24.0.0-beta.0",
|
|
42
|
+
"@nx/eslint": "24.0.0-beta.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"nx": "
|
|
45
|
+
"nx": "24.0.0-beta.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@nx/vitest": "
|
|
48
|
+
"@nx/vitest": "24.0.0-beta.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@nx/vitest": {
|
package/readme-template.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<p
|
|
1
|
+
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-
|
|
4
|
-
<img alt="Nx
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo-light.svg">
|
|
4
|
+
<img alt="Nx Logo" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.svg" width="140">
|
|
5
5
|
</picture>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { TaskHasher, HasherContext } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
import { <%=propertyName%>Hasher } from './hasher';
|
|
4
|
-
|
|
5
|
-
describe('<%=propertyName%>Hasher', () => {
|
|
6
|
-
it('should generate hash', async () => {
|
|
7
|
-
const mockHasher: TaskHasher = {
|
|
8
|
-
hashTask: jest.fn().mockReturnValue({value: 'hashed-task'})
|
|
9
|
-
} as unknown as TaskHasher
|
|
10
|
-
const hash = await <%=propertyName%>Hasher({
|
|
11
|
-
id: 'my-task-id',
|
|
12
|
-
target: {
|
|
13
|
-
project: 'proj',
|
|
14
|
-
target: 'target'
|
|
15
|
-
},
|
|
16
|
-
overrides: {},
|
|
17
|
-
outputs: [],
|
|
18
|
-
parallelism: true,
|
|
19
|
-
cache: false
|
|
20
|
-
}, {
|
|
21
|
-
hasher: mockHasher
|
|
22
|
-
} as unknown as HasherContext)
|
|
23
|
-
expect(hash).toEqual({value: 'hashed-task'})
|
|
24
|
-
})
|
|
25
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CustomHasher } from '@nx/devkit';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a boilerplate custom hasher that matches
|
|
5
|
-
* the default Nx hasher. If you need to extend the behavior,
|
|
6
|
-
* you can consume workspace details from the context.
|
|
7
|
-
*/
|
|
8
|
-
export const <%=propertyName%>Hasher: CustomHasher = async (task, context) => {
|
|
9
|
-
return context.hasher.hashTask(task, context.taskGraph);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default <%=propertyName%>Hasher;
|