@nx/plugin 0.0.0-pr-22179-271588f

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 (97) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +72 -0
  3. package/executors.json +10 -0
  4. package/generators.d.ts +6 -0
  5. package/generators.js +9 -0
  6. package/generators.json +49 -0
  7. package/index.d.ts +0 -0
  8. package/index.js +0 -0
  9. package/migrations.json +40 -0
  10. package/package.json +44 -0
  11. package/src/executors/e2e/e2e.impl.d.ts +6 -0
  12. package/src/executors/e2e/e2e.impl.js +43 -0
  13. package/src/executors/e2e/schema.d.ts +6 -0
  14. package/src/executors/e2e/schema.json +220 -0
  15. package/src/generators/create-package/create-package.d.ts +5 -0
  16. package/src/generators/create-package/create-package.js +112 -0
  17. package/src/generators/create-package/files/create-framework-package/bin/index.ts__tmpl__ +27 -0
  18. package/src/generators/create-package/files/e2e/__cliName__.spec.ts__tmpl__ +56 -0
  19. package/src/generators/create-package/schema.d.ts +19 -0
  20. package/src/generators/create-package/schema.json +79 -0
  21. package/src/generators/create-package/utils/normalize-schema.d.ts +8 -0
  22. package/src/generators/create-package/utils/normalize-schema.js +22 -0
  23. package/src/generators/e2e-project/e2e.d.ts +6 -0
  24. package/src/generators/e2e-project/e2e.js +144 -0
  25. package/src/generators/e2e-project/files/src/__pluginName__.spec.ts__tmpl__ +66 -0
  26. package/src/generators/e2e-project/files/tsconfig.json__tmpl__ +6 -0
  27. package/src/generators/e2e-project/schema.d.ts +15 -0
  28. package/src/generators/e2e-project/schema.json +57 -0
  29. package/src/generators/executor/executor.d.ts +6 -0
  30. package/src/generators/executor/executor.js +126 -0
  31. package/src/generators/executor/files/executor/executor.spec.ts.template +11 -0
  32. package/src/generators/executor/files/executor/executor.ts.template +11 -0
  33. package/src/generators/executor/files/executor/schema.d.ts.template +1 -0
  34. package/src/generators/executor/files/executor/schema.json.template +9 -0
  35. package/src/generators/executor/files/hasher/hasher.spec.ts.template +23 -0
  36. package/src/generators/executor/files/hasher/hasher.ts.template +12 -0
  37. package/src/generators/executor/schema.d.ts +17 -0
  38. package/src/generators/executor/schema.json +76 -0
  39. package/src/generators/generator/files/generator/generator.spec.ts.template +20 -0
  40. package/src/generators/generator/files/generator/generator.ts.template +26 -0
  41. package/src/generators/generator/files/generator/schema.d.ts.template +3 -0
  42. package/src/generators/generator/files/generator/schema.json.template +18 -0
  43. package/src/generators/generator/generator.d.ts +6 -0
  44. package/src/generators/generator/generator.js +127 -0
  45. package/src/generators/generator/schema.d.ts +16 -0
  46. package/src/generators/generator/schema.json +70 -0
  47. package/src/generators/lint-checks/generator.d.ts +7 -0
  48. package/src/generators/lint-checks/generator.js +187 -0
  49. package/src/generators/lint-checks/schema.d.ts +4 -0
  50. package/src/generators/lint-checks/schema.json +31 -0
  51. package/src/generators/migration/files/migration/__name__.spec.ts__tmpl__ +17 -0
  52. package/src/generators/migration/files/migration/__name__.ts__tmpl__ +6 -0
  53. package/src/generators/migration/migration.d.ts +5 -0
  54. package/src/generators/migration/migration.js +135 -0
  55. package/src/generators/migration/schema.d.ts +16 -0
  56. package/src/generators/migration/schema.json +68 -0
  57. package/src/generators/plugin/files/plugin/src/index.ts__tmpl__ +0 -0
  58. package/src/generators/plugin/plugin.d.ts +5 -0
  59. package/src/generators/plugin/plugin.js +107 -0
  60. package/src/generators/plugin/schema.d.ts +20 -0
  61. package/src/generators/plugin/schema.json +104 -0
  62. package/src/generators/plugin/utils/normalize-schema.d.ts +13 -0
  63. package/src/generators/plugin/utils/normalize-schema.js +44 -0
  64. package/src/generators/preset/generator.d.ts +3 -0
  65. package/src/generators/preset/generator.js +58 -0
  66. package/src/generators/preset/schema.d.ts +4 -0
  67. package/src/generators/preset/schema.json +30 -0
  68. package/src/migrations/update-15-0-0/specify-output-capture.d.ts +2 -0
  69. package/src/migrations/update-15-0-0/specify-output-capture.js +53 -0
  70. package/src/migrations/update-15-9-0/jest-29-configs.d.ts +3 -0
  71. package/src/migrations/update-15-9-0/jest-29-configs.js +147 -0
  72. package/src/migrations/update-15-9-0/jest-29-tests.d.ts +5 -0
  73. package/src/migrations/update-15-9-0/jest-29-tests.js +61 -0
  74. package/src/migrations/update-16-0-0/cli-in-schema-json.d.ts +3 -0
  75. package/src/migrations/update-16-0-0/cli-in-schema-json.js +135 -0
  76. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  77. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  78. package/src/migrations/update-16-2-0/replace-e2e-executor.d.ts +2 -0
  79. package/src/migrations/update-16-2-0/replace-e2e-executor.js +32 -0
  80. package/src/utils/has-generator.d.ts +2 -0
  81. package/src/utils/has-generator.js +16 -0
  82. package/src/utils/testing-utils/async-commands.d.ts +28 -0
  83. package/src/utils/testing-utils/async-commands.js +50 -0
  84. package/src/utils/testing-utils/commands.d.ts +17 -0
  85. package/src/utils/testing-utils/commands.js +63 -0
  86. package/src/utils/testing-utils/index.d.ts +5 -0
  87. package/src/utils/testing-utils/index.js +8 -0
  88. package/src/utils/testing-utils/nx-project.d.ts +25 -0
  89. package/src/utils/testing-utils/nx-project.js +70 -0
  90. package/src/utils/testing-utils/paths.d.ts +15 -0
  91. package/src/utils/testing-utils/paths.js +32 -0
  92. package/src/utils/testing-utils/utils.d.ts +80 -0
  93. package/src/utils/testing-utils/utils.js +144 -0
  94. package/src/utils/versions.d.ts +2 -0
  95. package/src/utils/versions.js +5 -0
  96. package/testing.d.ts +1 -0
  97. package/testing.js +4 -0
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSize = exports.exists = exports.getCwd = exports.removeTmpProject = exports.rmDist = exports.cleanup = exports.readFile = exports.readJson = exports.listFiles = exports.checkFilesExist = exports.renameFile = exports.updateFile = exports.expectTestsPass = exports.copyNodeModules = exports.fileExists = exports.directoryExists = void 0;
4
+ const fs_extra_1 = require("fs-extra");
5
+ const path_1 = require("path");
6
+ const paths_1 = require("./paths");
7
+ const devkit_1 = require("@nx/devkit");
8
+ const fileutils_1 = require("nx/src/utils/fileutils");
9
+ Object.defineProperty(exports, "directoryExists", { enumerable: true, get: function () { return fileutils_1.directoryExists; } });
10
+ Object.defineProperty(exports, "fileExists", { enumerable: true, get: function () { return fileutils_1.fileExists; } });
11
+ /**
12
+ * Copies module folders from the working directory to the e2e directory
13
+ * @param modules a list of module names or scopes to copy
14
+ */
15
+ function copyNodeModules(modules) {
16
+ modules.forEach((module) => {
17
+ (0, fs_extra_1.removeSync)(`${(0, paths_1.tmpProjPath)()}/node_modules/${module}`);
18
+ (0, fs_extra_1.copySync)(`./node_modules/${module}`, `${(0, paths_1.tmpProjPath)()}/node_modules/${module}`);
19
+ });
20
+ }
21
+ exports.copyNodeModules = copyNodeModules;
22
+ /**
23
+ * Assert test output from a asynchronous CLI command.
24
+ *
25
+ * @param output Output from an asynchronous command
26
+ */
27
+ function expectTestsPass(output) {
28
+ expect(output.stderr).toContain('Ran all test suites');
29
+ expect(output.stderr).not.toContain('fail');
30
+ }
31
+ exports.expectTestsPass = expectTestsPass;
32
+ // type callback =
33
+ /**
34
+ * Update a file's content in the e2e directory.
35
+ *
36
+ * If the `content` param is a callback, it will provide the original file content as an argument.
37
+ *
38
+ * @param file Path of the file in the e2e directory
39
+ * @param content Content to replace the original content with
40
+ */
41
+ function updateFile(file, content) {
42
+ (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)((0, paths_1.tmpProjPath)(file)));
43
+ if (typeof content === 'string') {
44
+ (0, fs_extra_1.writeFileSync)((0, paths_1.tmpProjPath)(file), content);
45
+ }
46
+ else {
47
+ (0, fs_extra_1.writeFileSync)((0, paths_1.tmpProjPath)(file), content((0, fs_extra_1.readFileSync)((0, paths_1.tmpProjPath)(file)).toString()));
48
+ }
49
+ }
50
+ exports.updateFile = updateFile;
51
+ /**
52
+ * Rename a file or directory within the e2e directory.
53
+ * @param path Original path
54
+ * @param newPath New path
55
+ */
56
+ function renameFile(path, newPath) {
57
+ (0, fs_extra_1.ensureDirSync)((0, path_1.dirname)((0, paths_1.tmpProjPath)(newPath)));
58
+ (0, fs_extra_1.renameSync)((0, paths_1.tmpProjPath)(path), (0, paths_1.tmpProjPath)(newPath));
59
+ }
60
+ exports.renameFile = renameFile;
61
+ /**
62
+ * Check if the file or directory exists.
63
+ *
64
+ * If a path starts with `/` or `C:/`, it will check it as absolute. Otherwise it will check within the e2e directory.
65
+ *
66
+ * @param expectedPaths Files or directories to check
67
+ * @usage `checkFileExists('file1', 'file2', '/var/user/file')`
68
+ */
69
+ function checkFilesExist(...expectedPaths) {
70
+ expectedPaths.forEach((path) => {
71
+ const filePath = (0, path_1.isAbsolute)(path) ? path : (0, paths_1.tmpProjPath)(path);
72
+ if (!exists(filePath)) {
73
+ throw new Error(`'${filePath}' does not exist`);
74
+ }
75
+ });
76
+ }
77
+ exports.checkFilesExist = checkFilesExist;
78
+ /**
79
+ * Get a list of all files within a directory.
80
+ * @param dirName Directory name within the e2e directory.
81
+ */
82
+ function listFiles(dirName) {
83
+ return (0, fs_extra_1.readdirSync)((0, paths_1.tmpProjPath)(dirName));
84
+ }
85
+ exports.listFiles = listFiles;
86
+ /**
87
+ * Read a JSON file.
88
+ * @param path Path to the JSON file. Absolute or relative to the e2e directory.
89
+ * @param options JSON parse options
90
+ */
91
+ function readJson(path, options) {
92
+ return (0, devkit_1.parseJson)(readFile(path), options);
93
+ }
94
+ exports.readJson = readJson;
95
+ /**
96
+ * Read a file.
97
+ * @param path Path to the file. Absolute or relative to the e2e directory.
98
+ */
99
+ function readFile(path) {
100
+ const filePath = (0, path_1.isAbsolute)(path) ? path : (0, paths_1.tmpProjPath)(path);
101
+ return (0, fs_extra_1.readFileSync)(filePath, 'utf-8');
102
+ }
103
+ exports.readFile = readFile;
104
+ /**
105
+ * Deletes the e2e directory
106
+ */
107
+ function cleanup() {
108
+ (0, fs_extra_1.removeSync)((0, paths_1.tmpProjPath)());
109
+ }
110
+ exports.cleanup = cleanup;
111
+ /**
112
+ * Remove the dist folder from the e2e directory
113
+ */
114
+ function rmDist() {
115
+ (0, fs_extra_1.removeSync)(`${(0, paths_1.tmpProjPath)()}/dist`);
116
+ }
117
+ exports.rmDist = rmDist;
118
+ function removeTmpProject(project) {
119
+ (0, fs_extra_1.removeSync)(`${(0, paths_1.tmpFolder)()}/${project}`);
120
+ }
121
+ exports.removeTmpProject = removeTmpProject;
122
+ /**
123
+ * Get the currend `cwd` in the process
124
+ */
125
+ function getCwd() {
126
+ return process.cwd();
127
+ }
128
+ exports.getCwd = getCwd;
129
+ /**
130
+ * Check if a file or directory exists.
131
+ * @param path Path to file or directory
132
+ */
133
+ function exists(path) {
134
+ return (0, fileutils_1.directoryExists)(path) || (0, fileutils_1.fileExists)(path);
135
+ }
136
+ exports.exists = exists;
137
+ /**
138
+ * Get the size of a file on disk
139
+ * @param filePath Path to the file
140
+ */
141
+ function getSize(filePath) {
142
+ return (0, fs_extra_1.statSync)(filePath).size;
143
+ }
144
+ exports.getSize = getSize;
@@ -0,0 +1,2 @@
1
+ export declare const nxVersion: any;
2
+ export declare const jsoncEslintParserVersion = "^2.1.0";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsoncEslintParserVersion = exports.nxVersion = void 0;
4
+ exports.nxVersion = require('../../package.json').version;
5
+ exports.jsoncEslintParserVersion = '^2.1.0';
package/testing.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './src/utils/testing-utils';
package/testing.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./src/utils/testing-utils"), exports);