@nrwl/nx-plugin 15.9.2 → 16.0.0-beta.1

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.
Files changed (103) hide show
  1. package/executors.json +4 -4
  2. package/generators.d.ts +1 -5
  3. package/generators.js +1 -5
  4. package/generators.js.map +1 -1
  5. package/generators.json +2 -64
  6. package/index.js.map +1 -1
  7. package/package.json +7 -15
  8. package/testing.d.ts +1 -1
  9. package/testing.js +1 -1
  10. package/testing.js.map +1 -1
  11. package/README.md +0 -67
  12. package/migrations.json +0 -34
  13. package/src/executors/e2e/compat.d.ts +0 -1
  14. package/src/executors/e2e/compat.js +0 -7
  15. package/src/executors/e2e/compat.js.map +0 -1
  16. package/src/executors/e2e/e2e.impl.d.ts +0 -7
  17. package/src/executors/e2e/e2e.impl.js +0 -81
  18. package/src/executors/e2e/e2e.impl.js.map +0 -1
  19. package/src/executors/e2e/schema.d.ts +0 -6
  20. package/src/executors/e2e/schema.json +0 -219
  21. package/src/generators/e2e-project/e2e.d.ts +0 -6
  22. package/src/generators/e2e-project/e2e.js +0 -105
  23. package/src/generators/e2e-project/e2e.js.map +0 -1
  24. package/src/generators/e2e-project/files/tests/__pluginName__.spec.ts__tmpl__ +0 -61
  25. package/src/generators/e2e-project/files/tsconfig.json__tmpl__ +0 -6
  26. package/src/generators/e2e-project/schema.d.ts +0 -12
  27. package/src/generators/e2e-project/schema.json +0 -57
  28. package/src/generators/executor/executor.d.ts +0 -5
  29. package/src/generators/executor/executor.js +0 -90
  30. package/src/generators/executor/executor.js.map +0 -1
  31. package/src/generators/executor/files/executor/__fileName__/executor.spec.ts__tmpl__ +0 -11
  32. package/src/generators/executor/files/executor/__fileName__/executor.ts__tmpl__ +0 -11
  33. package/src/generators/executor/files/executor/__fileName__/schema.d.ts__tmpl__ +0 -1
  34. package/src/generators/executor/files/executor/__fileName__/schema.json__tmpl__ +0 -10
  35. package/src/generators/executor/files/hasher/__fileName__/hasher.spec.ts__tmpl__ +0 -22
  36. package/src/generators/executor/files/hasher/__fileName__/hasher.ts__tmpl__ +0 -12
  37. package/src/generators/executor/schema.d.ts +0 -7
  38. package/src/generators/executor/schema.json +0 -53
  39. package/src/generators/generator/files/generator/__fileName__/generator.spec.ts__tmpl__ +0 -20
  40. package/src/generators/generator/files/generator/__fileName__/generator.ts__tmpl__ +0 -69
  41. package/src/generators/generator/files/generator/__fileName__/schema.d.ts__tmpl__ +0 -5
  42. package/src/generators/generator/files/generator/__fileName__/schema.json__tmpl__ +0 -28
  43. package/src/generators/generator/generator.d.ts +0 -5
  44. package/src/generators/generator/generator.js +0 -88
  45. package/src/generators/generator/generator.js.map +0 -1
  46. package/src/generators/generator/schema.d.ts +0 -6
  47. package/src/generators/generator/schema.json +0 -49
  48. package/src/generators/lint-checks/generator.d.ts +0 -7
  49. package/src/generators/lint-checks/generator.js +0 -168
  50. package/src/generators/lint-checks/generator.js.map +0 -1
  51. package/src/generators/lint-checks/schema.d.ts +0 -3
  52. package/src/generators/lint-checks/schema.json +0 -19
  53. package/src/generators/migration/files/migration/__name__/__name__.ts__tmpl__ +0 -6
  54. package/src/generators/migration/migration.d.ts +0 -5
  55. package/src/generators/migration/migration.js +0 -110
  56. package/src/generators/migration/migration.js.map +0 -1
  57. package/src/generators/migration/schema.d.ts +0 -7
  58. package/src/generators/migration/schema.json +0 -54
  59. package/src/generators/plugin/files/plugin/executors.json__tmpl__ +0 -4
  60. package/src/generators/plugin/files/plugin/generators.json__tmpl__ +0 -6
  61. package/src/generators/plugin/files/plugin/package.json__tmpl__ +0 -7
  62. package/src/generators/plugin/files/plugin/src/index.ts__tmpl__ +0 -0
  63. package/src/generators/plugin/plugin.d.ts +0 -5
  64. package/src/generators/plugin/plugin.js +0 -106
  65. package/src/generators/plugin/plugin.js.map +0 -1
  66. package/src/generators/plugin/schema.d.ts +0 -17
  67. package/src/generators/plugin/schema.json +0 -99
  68. package/src/generators/plugin/utils/normalize-schema.d.ts +0 -14
  69. package/src/generators/plugin/utils/normalize-schema.js +0 -27
  70. package/src/generators/plugin/utils/normalize-schema.js.map +0 -1
  71. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.d.ts +0 -2
  72. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js +0 -14
  73. package/src/migrations/update-14-1-9/add-swc-deps-if-needed.js.map +0 -1
  74. package/src/migrations/update-15-0-0/specify-output-capture.d.ts +0 -2
  75. package/src/migrations/update-15-0-0/specify-output-capture.js +0 -57
  76. package/src/migrations/update-15-0-0/specify-output-capture.js.map +0 -1
  77. package/src/migrations/update-15-9-0/jest-29-configs.d.ts +0 -3
  78. package/src/migrations/update-15-9-0/jest-29-configs.js +0 -154
  79. package/src/migrations/update-15-9-0/jest-29-configs.js.map +0 -1
  80. package/src/migrations/update-15-9-0/jest-29-tests.d.ts +0 -5
  81. package/src/migrations/update-15-9-0/jest-29-tests.js +0 -65
  82. package/src/migrations/update-15-9-0/jest-29-tests.js.map +0 -1
  83. package/src/utils/testing-utils/async-commands.d.ts +0 -26
  84. package/src/utils/testing-utils/async-commands.js +0 -50
  85. package/src/utils/testing-utils/async-commands.js.map +0 -1
  86. package/src/utils/testing-utils/commands.d.ts +0 -15
  87. package/src/utils/testing-utils/commands.js +0 -63
  88. package/src/utils/testing-utils/commands.js.map +0 -1
  89. package/src/utils/testing-utils/index.d.ts +0 -5
  90. package/src/utils/testing-utils/index.js +0 -9
  91. package/src/utils/testing-utils/index.js.map +0 -1
  92. package/src/utils/testing-utils/nx-project.d.ts +0 -25
  93. package/src/utils/testing-utils/nx-project.js +0 -64
  94. package/src/utils/testing-utils/nx-project.js.map +0 -1
  95. package/src/utils/testing-utils/paths.d.ts +0 -14
  96. package/src/utils/testing-utils/paths.js +0 -28
  97. package/src/utils/testing-utils/paths.js.map +0 -1
  98. package/src/utils/testing-utils/utils.d.ts +0 -79
  99. package/src/utils/testing-utils/utils.js +0 -141
  100. package/src/utils/testing-utils/utils.js.map +0 -1
  101. package/src/utils/versions.d.ts +0 -3
  102. package/src/utils/versions.js +0 -7
  103. package/src/utils/versions.js.map +0 -1
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.e2eProjectSchematic = exports.e2eProjectGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const jest_1 = require("@nrwl/jest");
7
- const js_1 = require("@nrwl/js");
8
- const path = require("path");
9
- const linter_1 = require("@nrwl/linter");
10
- function normalizeOptions(host, options) {
11
- var _a, _b;
12
- const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.projectDirectory);
13
- const { npmScope, appsDir: defaultAppsDir } = (0, devkit_1.getWorkspaceLayout)(host);
14
- const appsDir = layoutDirectory !== null && layoutDirectory !== void 0 ? layoutDirectory : defaultAppsDir;
15
- const projectName = `${options.pluginName}-e2e`;
16
- const projectRoot = projectDirectory
17
- ? (0, devkit_1.joinPathFragments)(appsDir, `${projectDirectory}-e2e`)
18
- : (0, devkit_1.joinPathFragments)(appsDir, projectName);
19
- const pluginPropertyName = (0, devkit_1.names)(options.pluginName).propertyName;
20
- return Object.assign(Object.assign({}, options), { minimal: (_a = options.minimal) !== null && _a !== void 0 ? _a : false, projectName, linter: (_b = options.linter) !== null && _b !== void 0 ? _b : linter_1.Linter.EsLint, pluginPropertyName,
21
- projectRoot,
22
- npmScope });
23
- }
24
- function validatePlugin(host, pluginName) {
25
- try {
26
- (0, devkit_1.readProjectConfiguration)(host, pluginName);
27
- }
28
- catch (_a) {
29
- throw new Error(`Project name "${pluginName}" doesn't not exist.`);
30
- }
31
- }
32
- function addFiles(host, options) {
33
- (0, devkit_1.generateFiles)(host, path.join(__dirname, './files'), options.projectRoot, Object.assign(Object.assign({}, options), { tmpl: '', rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot) }));
34
- }
35
- function updateWorkspaceConfiguration(host, options) {
36
- (0, devkit_1.addProjectConfiguration)(host, options.projectName, {
37
- root: options.projectRoot,
38
- projectType: 'application',
39
- sourceRoot: `${options.projectRoot}/src`,
40
- targets: {
41
- e2e: {
42
- executor: '@nrwl/nx-plugin:e2e',
43
- options: { target: `${options.pluginName}:build` },
44
- },
45
- },
46
- tags: [],
47
- implicitDependencies: [options.pluginName],
48
- });
49
- }
50
- function addJest(host, options) {
51
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
- yield (0, jest_1.jestProjectGenerator)(host, {
53
- project: options.projectName,
54
- setupFile: 'none',
55
- supportTsx: false,
56
- skipSerializers: true,
57
- skipFormat: true,
58
- });
59
- const project = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
60
- const testOptions = project.targets.test.options;
61
- const e2eOptions = project.targets.e2e.options;
62
- project.targets.e2e.options = Object.assign(Object.assign({}, e2eOptions), { jestConfig: testOptions.jestConfig });
63
- // remove the jest build target
64
- delete project.targets.test;
65
- (0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
66
- });
67
- }
68
- function addLintingToApplication(tree, options) {
69
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
- const lintTask = yield (0, linter_1.lintProjectGenerator)(tree, {
71
- linter: options.linter,
72
- project: options.projectName,
73
- tsConfigPaths: [
74
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
75
- ],
76
- eslintFilePatterns: [`${options.projectRoot}/**/*.ts`],
77
- unitTestRunner: 'jest',
78
- skipFormat: true,
79
- setParserOptionsProject: false,
80
- });
81
- return lintTask;
82
- });
83
- }
84
- function e2eProjectGenerator(host, schema) {
85
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
86
- const tasks = [];
87
- validatePlugin(host, schema.pluginName);
88
- const options = normalizeOptions(host, schema);
89
- addFiles(host, options);
90
- updateWorkspaceConfiguration(host, options);
91
- yield addJest(host, options);
92
- if (options.linter !== linter_1.Linter.None) {
93
- const lintTask = yield addLintingToApplication(host, Object.assign({}, options));
94
- tasks.push(lintTask);
95
- }
96
- if (!options.skipFormat) {
97
- yield (0, devkit_1.formatFiles)(host);
98
- }
99
- return (0, devkit_1.runTasksInSerial)(...tasks);
100
- });
101
- }
102
- exports.e2eProjectGenerator = e2eProjectGenerator;
103
- exports.default = e2eProjectGenerator;
104
- exports.e2eProjectSchematic = (0, devkit_1.convertNxGenerator)(e2eProjectGenerator);
105
- //# sourceMappingURL=e2e.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"e2e.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/generators/e2e-project/e2e.ts"],"names":[],"mappings":";;;;AACA,yCAasB;AACtB,qCAAkD;AAClD,iCAAyD;AACzD,6BAA6B;AAG7B,yCAA4D;AAU5D,SAAS,gBAAgB,CAAC,IAAU,EAAE,OAAe;;IACnD,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAClE,OAAO,CAAC,gBAAgB,CACzB,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IACvE,MAAM,OAAO,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,cAAc,CAAC;IAElD,MAAM,WAAW,GAAG,GAAG,OAAO,CAAC,UAAU,MAAM,CAAC;IAChD,MAAM,WAAW,GAAG,gBAAgB;QAClC,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,GAAG,gBAAgB,MAAM,CAAC;QACvD,CAAC,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC5C,MAAM,kBAAkB,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;IAElE,uCACK,OAAO,KACV,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,mCAAI,KAAK,EACjC,WAAW,EACX,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,eAAM,CAAC,MAAM,EACvC,kBAA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AI,EAAE,OAAO,CAAC,CAAC;QACxB,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7B,IAAI,OAAO,CAAC,MAAM,KAAK,eAAM,CAAC,IAAI,EAAE;YAClC,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,IAAI,oBAC9C,OAAO,EACV,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AArBD,kDAqBC;AAED,kBAAe,mBAAmB,CAAC;AACtB,QAAA,mBAAmB,GAAG,IAAA,2BAAkB,EAAC,mBAAmB,CAAC,CAAC"}
@@ -1,61 +0,0 @@
1
- import {
2
- checkFilesExist,
3
- ensureNxProject,
4
- readJson,
5
- runNxCommandAsync,
6
- uniq,
7
- } from '@nrwl/nx-plugin/testing';
8
-
9
- describe('<%= pluginName %> e2e', () => {
10
- // Setting up individual workspaces per
11
- // test can cause e2e runs to take a long time.
12
- // For this reason, we recommend each suite only
13
- // consumes 1 workspace. The tests should each operate
14
- // on a unique project in the workspace, such that they
15
- // are not dependant on one another.
16
- beforeAll(() => {
17
- ensureNxProject('<%= npmPackageName %>', '<%= pluginOutputPath %>');
18
- });
19
-
20
- afterAll(() => {
21
- // `nx reset` kills the daemon, and performs
22
- // some work which can help clean up e2e leftovers
23
- runNxCommandAsync('reset');
24
- });
25
-
26
- <% if(!minimal) { %>
27
-
28
- it('should create <%= pluginName %>', async () => {
29
- const project = uniq('<%= pluginName %>');
30
- await runNxCommandAsync(
31
- `generate <%=npmPackageName%>:<%= pluginName %> ${project}`
32
- );
33
- const result = await runNxCommandAsync(`build ${project}`);
34
- expect(result.stdout).toContain('Executor ran');
35
- }, 120000);
36
-
37
- describe('--directory', () => {
38
- it('should create src in the specified directory', async () => {
39
- const project = uniq('<%= pluginName %>');
40
- await runNxCommandAsync(
41
- `generate <%=npmPackageName%>:<%= pluginName %> ${project} --directory subdir`
42
- );
43
- expect(() =>
44
- checkFilesExist(`libs/subdir/${project}/src/index.ts`)
45
- ).not.toThrow();
46
- }, 120000);
47
- });
48
-
49
- describe('--tags', () => {
50
- it('should add tags to the project', async () => {
51
- const projectName = uniq('<%= pluginName %>');
52
- ensureNxProject('<%= npmPackageName %>', '<%= pluginOutputPath %>');
53
- await runNxCommandAsync(
54
- `generate <%=npmPackageName%>:<%= pluginName %> ${projectName} --tags e2etag,e2ePackage`
55
- );
56
- const project = readJson(`libs/${projectName}/project.json`);
57
- expect(project.tags).toEqual(['e2etag', 'e2ePackage']);
58
- }, 120000);
59
- });
60
- <% } %>
61
- });
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "<%= rootTsConfigPath %>",
3
- "files": [],
4
- "include": [],
5
- "references": []
6
- }
@@ -1,12 +0,0 @@
1
- import { Linter } from '@nrwl/linter';
2
-
3
- export interface Schema {
4
- pluginName: string;
5
- npmPackageName: string;
6
- projectDirectory?: string;
7
- pluginOutputPath?: string;
8
- jestConfig?: string;
9
- minimal?: boolean;
10
- linter?: Linter;
11
- skipFormat?: boolean;
12
- }
@@ -1,57 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "NxPluginE2E",
5
- "title": "Create an E2E app for a Nx Plugin",
6
- "description": "Create an E2E app for a Nx Plugin.",
7
- "type": "object",
8
- "properties": {
9
- "pluginName": {
10
- "type": "string",
11
- "description": "the project name of the plugin to be tested.",
12
- "x-priority": "important"
13
- },
14
- "npmPackageName": {
15
- "type": "string",
16
- "description": "the package name of the plugin as it would be published to NPM.",
17
- "x-priority": "important"
18
- },
19
- "projectDirectory": {
20
- "type": "string",
21
- "description": "the directory where the plugin is placed."
22
- },
23
- "pluginOutputPath": {
24
- "type": "string",
25
- "description": "the output path of the plugin after it builds.",
26
- "x-priority": "important"
27
- },
28
- "jestConfig": {
29
- "type": "string",
30
- "description": "Jest config file."
31
- },
32
- "standaloneConfig": {
33
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
34
- "type": "boolean",
35
- "default": true,
36
- "x-deprecated": "Nx only supports standaloneConfig"
37
- },
38
- "linter": {
39
- "description": "The tool to use for running lint checks.",
40
- "type": "string",
41
- "enum": ["eslint", "none"],
42
- "default": "eslint"
43
- },
44
- "minimal": {
45
- "type": "boolean",
46
- "description": "Generate the e2e project with a minimal setup. This would involve not generating tests for a default executor and generator.",
47
- "default": false
48
- },
49
- "skipFormat": {
50
- "description": "Skip formatting files.",
51
- "type": "boolean",
52
- "default": false,
53
- "x-priority": "internal"
54
- }
55
- },
56
- "required": ["pluginName", "npmPackageName"]
57
- }
@@ -1,5 +0,0 @@
1
- import type { Tree } from '@nrwl/devkit';
2
- import type { Schema } from './schema';
3
- export declare function executorGenerator(host: Tree, schema: Schema): Promise<void>;
4
- export default executorGenerator;
5
- export declare const executorSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.executorSchematic = exports.executorGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nrwl/devkit");
6
- const path = require("path");
7
- function addFiles(host, options) {
8
- (0, devkit_1.generateFiles)(host, path.join(__dirname, './files/executor'), `${options.projectSourceRoot}/executors`, Object.assign(Object.assign({}, options), { tmpl: '' }));
9
- if (options.unitTestRunner === 'none') {
10
- host.delete((0, devkit_1.joinPathFragments)(options.projectSourceRoot, 'executors', options.fileName, `executor.spec.ts`));
11
- }
12
- }
13
- function addHasherFiles(host, options) {
14
- (0, devkit_1.generateFiles)(host, path.join(__dirname, './files/hasher'), `${options.projectSourceRoot}/executors`, Object.assign(Object.assign({}, options), { tmpl: '' }));
15
- if (options.unitTestRunner === 'none') {
16
- host.delete((0, devkit_1.joinPathFragments)(options.projectSourceRoot, 'executors', options.fileName, 'hasher.spec.ts'));
17
- }
18
- }
19
- function createExecutorsJson(host, options) {
20
- (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
21
- var _a;
22
- (_a = json.executors) !== null && _a !== void 0 ? _a : (json.executors = 'executors.json');
23
- return json;
24
- });
25
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'executors.json'), {
26
- executors: {},
27
- });
28
- }
29
- function updateExecutorJson(host, options) {
30
- var _a;
31
- const packageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'));
32
- const packageJsonExecutors = (_a = packageJson.executors) !== null && _a !== void 0 ? _a : packageJson.builders;
33
- let executorsPath = packageJsonExecutors
34
- ? (0, devkit_1.joinPathFragments)(options.projectRoot, packageJsonExecutors)
35
- : null;
36
- if (!executorsPath) {
37
- executorsPath = (0, devkit_1.joinPathFragments)(options.projectRoot, 'executors.json');
38
- }
39
- if (!host.exists(executorsPath)) {
40
- createExecutorsJson(host, options);
41
- }
42
- return (0, devkit_1.updateJson)(host, executorsPath, (json) => {
43
- var _a;
44
- let executors = (_a = json.executors) !== null && _a !== void 0 ? _a : json.builders;
45
- executors || (executors = {});
46
- executors[options.name] = {
47
- implementation: `./src/executors/${options.fileName}/executor`,
48
- schema: `./src/executors/${options.fileName}/schema.json`,
49
- description: options.description,
50
- };
51
- if (options.includeHasher) {
52
- executors[options.name].hasher = `./src/executors/${options.fileName}/hasher`;
53
- }
54
- json.executors = executors;
55
- return json;
56
- });
57
- }
58
- function normalizeOptions(host, options) {
59
- const { npmScope } = (0, devkit_1.getWorkspaceLayout)(host);
60
- const { fileName, className, propertyName } = (0, devkit_1.names)(options.name);
61
- const { root: projectRoot, sourceRoot: projectSourceRoot } = (0, devkit_1.readProjectConfiguration)(host, options.project);
62
- let description;
63
- if (options.description) {
64
- description = options.description;
65
- }
66
- else {
67
- description = `${options.name} executor`;
68
- }
69
- return Object.assign(Object.assign({}, options), { fileName,
70
- className,
71
- propertyName,
72
- description,
73
- projectRoot,
74
- projectSourceRoot,
75
- npmScope });
76
- }
77
- function executorGenerator(host, schema) {
78
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
- const options = normalizeOptions(host, schema);
80
- addFiles(host, options);
81
- if (options.includeHasher) {
82
- addHasherFiles(host, options);
83
- }
84
- updateExecutorJson(host, options);
85
- });
86
- }
87
- exports.executorGenerator = executorGenerator;
88
- exports.default = executorGenerator;
89
- exports.executorSchematic = (0, devkit_1.convertNxGenerator)(executorGenerator);
90
- //# sourceMappingURL=executor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../packages/nx-plugin/src/generators/executor/executor.ts"],"names":[],"mappings":";;;;AAAA,yCAWsB;AAGtB,6BAA6B;AAY7B,SAAS,QAAQ,CAAC,IAAU,EAAE,OAAyB;IACrD,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,EACxC,GAAG,OAAO,CAAC,iBAAiB,YAAY,kCAEnC,OAAO,KACV,IAAI,EAAE,EAAE,IAEX,CAAC;IAEF,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;QACrC,IAAI,CAAC,MAAM,CACT,IAAA,0BAAiB,EACf,OAAO,CAAC,iBAAiB,EACzB,WAAW,EACX,OAAO,CAAC,QAAQ,EAChB,kBAAkB,CACnB,CACF,CAAC;KACH;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAU,EAAE,OAAyB;IAC3D,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,EACtC,GAAG,OAAO,CAAC,iBAAiB,YAAY,kCAEnC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AO,CAAC,IAAI,WAAW,CAAC;KAC1C;IAED,uCACK,OAAO,KACV,QAAQ;QACR,SAAS;QACT,YAAY;QACZ,WAAW;QACX,WAAW;QACX,iBAAiB;QACjB,QAAQ,IACR;AACJ,CAAC;AAED,SAAsB,iBAAiB,CAAC,IAAU,EAAE,MAAc;;QAChE,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC/B;QAED,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;CAAA;AATD,8CASC;AAED,kBAAe,iBAAiB,CAAC;AACpB,QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { <%= className %>ExecutorSchema } from './schema';
2
- import executor from './executor';
3
-
4
- const options: <%= className %>ExecutorSchema = {};
5
-
6
- describe('<%= className %> Executor', () => {
7
- it('can run', async () => {
8
- const output = await executor(options);
9
- expect(output.success).toBe(true);
10
- });
11
- });
@@ -1,11 +0,0 @@
1
- import { <%= className %>ExecutorSchema } from './schema';
2
-
3
- export default async function runExecutor(
4
- options: <%= className %>ExecutorSchema,
5
- ) {
6
- console.log('Executor ran for <%= className %>', options);
7
- return {
8
- success: true
9
- };
10
- }
11
-
@@ -1 +0,0 @@
1
- export interface <%= className %>ExecutorSchema {} // eslint-disable-line
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "version": 2,
4
- "cli": "nx",
5
- "title": "<%= className %> executor",
6
- "description": "",
7
- "type": "object",
8
- "properties": {},
9
- "required": []
10
- }
@@ -1,22 +0,0 @@
1
- import { Hasher, HasherContext } from '@nrwl/devkit';
2
-
3
- import { <%=propertyName%>Hasher } from './hasher';
4
-
5
- describe('<%=propertyName%>Hasher', () => {
6
- it('should generate hash', async () => {
7
- const mockHasher: Hasher = {
8
- hashTask: jest.fn().mockReturnValue({value: 'hashed-task'})
9
- } as unknown as Hasher
10
- const hash = await <%=propertyName%>Hasher({
11
- id: 'my-task-id',
12
- target: {
13
- project: 'proj',
14
- target: 'target'
15
- },
16
- overrides: {}
17
- }, {
18
- hasher: mockHasher
19
- } as unknown as HasherContext)
20
- expect(hash).toEqual({value: 'hashed-task'})
21
- })
22
- })
@@ -1,12 +0,0 @@
1
- import { CustomHasher } from '@nrwl/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)
10
- };
11
-
12
- export default <%=propertyName%>Hasher;
@@ -1,7 +0,0 @@
1
- export interface Schema {
2
- project: string;
3
- name: string;
4
- description?: string;
5
- unitTestRunner: 'jest' | 'none';
6
- includeHasher: boolean;
7
- }
@@ -1,53 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "NxPluginExecutor",
5
- "title": "Create an Executor for an Nx Plugin",
6
- "description": "Create an Executor for an Nx Plugin.",
7
- "type": "object",
8
- "examples": [
9
- {
10
- "command": "nx g executor my-executor --project=my-plugin",
11
- "description": "Generate `libs/my-plugin/src/executors/my-executor`"
12
- }
13
- ],
14
- "properties": {
15
- "project": {
16
- "type": "string",
17
- "description": "The name of the project.",
18
- "alias": "p",
19
- "$default": {
20
- "$source": "projectName"
21
- },
22
- "x-prompt": "What is the name of the project for the executor?",
23
- "x-priority": "important"
24
- },
25
- "name": {
26
- "type": "string",
27
- "description": "Executor name.",
28
- "$default": {
29
- "$source": "argv",
30
- "index": 0
31
- },
32
- "x-prompt": "What name would you like to use for the executor?",
33
- "x-priority": "important"
34
- },
35
- "description": {
36
- "type": "string",
37
- "description": "Executor description."
38
- },
39
- "unitTestRunner": {
40
- "type": "string",
41
- "enum": ["jest", "none"],
42
- "description": "Test runner to use for unit tests.",
43
- "default": "jest"
44
- },
45
- "includeHasher": {
46
- "type": "boolean",
47
- "default": false,
48
- "description": "Should the boilerplate for a custom hasher be generated?"
49
- }
50
- },
51
- "required": ["project", "name"],
52
- "additionalProperties": false
53
- }
@@ -1,20 +0,0 @@
1
- import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
2
- import { Tree, readProjectConfiguration } from '@nrwl/devkit';
3
-
4
- import generator from './generator';
5
- import { <%= className %>GeneratorSchema } from './schema';
6
-
7
- describe('<%= name %> generator', () => {
8
- let appTree: Tree;
9
- const options: <%= className %>GeneratorSchema = { name: 'test' };
10
-
11
- beforeEach(() => {
12
- appTree = createTreeWithEmptyWorkspace({layout: 'apps-libs'});
13
- });
14
-
15
- it('should run successfully', async () => {
16
- await generator(appTree, options);
17
- const config = readProjectConfiguration(appTree, 'test');
18
- expect(config).toBeDefined();
19
- });
20
- });
@@ -1,69 +0,0 @@
1
- import {
2
- addProjectConfiguration,
3
- formatFiles,
4
- generateFiles,
5
- getWorkspaceLayout,
6
- names,
7
- offsetFromRoot,
8
- Tree,
9
- } from '@nrwl/devkit';
10
- import * as path from 'path';
11
- import { <%= className %>GeneratorSchema } from './schema';
12
-
13
- interface NormalizedSchema extends <%= className %>GeneratorSchema {
14
- projectName: string;
15
- projectRoot: string;
16
- projectDirectory: string;
17
- parsedTags: string[];
18
- }
19
-
20
- function normalizeOptions(tree: Tree, options: <%= className %>GeneratorSchema): NormalizedSchema {
21
- const name = names(options.name).fileName;
22
- const projectDirectory = options.directory
23
- ? `${names(options.directory).fileName}/${name}`
24
- : name;
25
- const projectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
26
- const projectRoot = `${getWorkspaceLayout(tree).libsDir}/${projectDirectory}`;
27
- const parsedTags = options.tags
28
- ? options.tags.split(',').map((s) => s.trim())
29
- : [];
30
-
31
- return {
32
- ...options,
33
- projectName,
34
- projectRoot,
35
- projectDirectory,
36
- parsedTags,
37
- };
38
- }
39
-
40
- function addFiles(tree: Tree, options: NormalizedSchema) {
41
- const templateOptions = {
42
- ...options,
43
- ...names(options.name),
44
- offsetFromRoot: offsetFromRoot(options.projectRoot),
45
- template: ''
46
- };
47
- generateFiles(tree, path.join(__dirname, 'files'), options.projectRoot, templateOptions);
48
- }
49
-
50
- export default async function (tree: Tree, options: <%= className %>GeneratorSchema) {
51
- const normalizedOptions = normalizeOptions(tree, options);
52
- addProjectConfiguration(
53
- tree,
54
- normalizedOptions.projectName,
55
- {
56
- root: normalizedOptions.projectRoot,
57
- projectType: 'library',
58
- sourceRoot: `${normalizedOptions.projectRoot}/src`,
59
- targets: {
60
- build: {
61
- executor: "<%= npmPackageName %>:build",
62
- },
63
- },
64
- tags: normalizedOptions.parsedTags,
65
- }
66
- );
67
- addFiles(tree, normalizedOptions);
68
- await formatFiles(tree);
69
- }
@@ -1,5 +0,0 @@
1
- export interface <%= className %>GeneratorSchema {
2
- name: string;
3
- tags?: string;
4
- directory?: string;
5
- }
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "<%= className %>",
5
- "title": "",
6
- "type": "object",
7
- "properties": {
8
- "name": {
9
- "type": "string",
10
- "description": "",
11
- "$default": {
12
- "$source": "argv",
13
- "index": 0
14
- },
15
- "x-prompt": "What name would you like to use?"
16
- },
17
- "tags": {
18
- "type": "string",
19
- "description": "Add tags to the project (used for linting)",
20
- "alias": "t"
21
- },
22
- "directory": {
23
- "type": "string",
24
- "description": "A directory where the project is placed"
25
- }
26
- },
27
- "required": ["name"]
28
- }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nrwl/devkit';
2
- import type { Schema } from './schema';
3
- export declare function generatorGenerator(host: Tree, schema: Schema): Promise<void>;
4
- export default generatorGenerator;
5
- export declare const generatorSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;