@nx/remix 23.3.0 → 24.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 (157) hide show
  1. package/README.md +10 -7
  2. package/dist/generators.d.ts +1 -13
  3. package/dist/generators.js +3 -28
  4. package/dist/plugin.d.ts +1 -1
  5. package/dist/plugin.js +1 -2
  6. package/dist/plugins/component-testing/index.d.ts +1 -0
  7. package/dist/plugins/component-testing/index.js +1 -0
  8. package/dist/readme-template.md +10 -4
  9. package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +2 -0
  10. package/dist/src/migrations/update-24-0-0/convert-to-inferred.d.ts +2 -0
  11. package/dist/src/migrations/update-24-0-0/convert-to-inferred.js +26 -0
  12. package/dist/src/migrations/update-24-0-0/migrate-to-react-router.md +50 -0
  13. package/dist/src/plugins/plugin.d.ts +5 -3
  14. package/dist/src/plugins/plugin.js +8 -7
  15. package/dist/src/utils/create-watch-paths.d.ts +1 -0
  16. package/dist/src/utils/create-watch-paths.js +1 -0
  17. package/dist/src/utils/deprecation.d.ts +2 -4
  18. package/dist/src/utils/deprecation.js +11 -13
  19. package/dist/src/utils/versions.d.ts +1 -19
  20. package/dist/src/utils/versions.js +1 -28
  21. package/generators.json +2 -79
  22. package/migrations.json +10 -0
  23. package/package.json +8 -19
  24. package/readme-template.md +10 -4
  25. package/dist/src/executors/build/build.impl.d.ts +0 -5
  26. package/dist/src/executors/build/build.impl.js +0 -121
  27. package/dist/src/executors/build/schema.d.ts +0 -8
  28. package/dist/src/executors/build/schema.json +0 -47
  29. package/dist/src/executors/serve/schema.d.ts +0 -9
  30. package/dist/src/executors/serve/schema.json +0 -43
  31. package/dist/src/executors/serve/serve.impl.d.ts +0 -6
  32. package/dist/src/executors/serve/serve.impl.js +0 -79
  33. package/dist/src/generators/action/action.impl.d.ts +0 -3
  34. package/dist/src/generators/action/action.impl.js +0 -37
  35. package/dist/src/generators/action/schema.d.ts +0 -3
  36. package/dist/src/generators/action/schema.json +0 -18
  37. package/dist/src/generators/application/application.impl.d.ts +0 -5
  38. package/dist/src/generators/application/application.impl.js +0 -239
  39. package/dist/src/generators/application/files/common/app/entry.client.tsx__tmpl__ +0 -18
  40. package/dist/src/generators/application/files/common/app/entry.server.tsx__tmpl__ +0 -139
  41. package/dist/src/generators/application/files/common/app/root.tsx__tmpl__ +0 -47
  42. package/dist/src/generators/application/files/common/app/routes/_index.tsx__tmpl__ +0 -9
  43. package/dist/src/generators/application/files/common/public/favicon.ico +0 -0
  44. package/dist/src/generators/application/files/common/tests/routes/_index.spec.tsx__tmpl__ +0 -17
  45. package/dist/src/generators/application/files/common/tsconfig.app.json__tmpl__ +0 -25
  46. package/dist/src/generators/application/files/common/tsconfig.json__tmpl__ +0 -27
  47. package/dist/src/generators/application/files/common/vite.config.mts__tmpl__ +0 -25
  48. package/dist/src/generators/application/files/non-root/.gitignore__tmpl__ +0 -4
  49. package/dist/src/generators/application/files/non-root/package.json__tmpl__ +0 -20
  50. package/dist/src/generators/application/files/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +0 -868
  51. package/dist/src/generators/application/files/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +0 -868
  52. package/dist/src/generators/application/files/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +0 -866
  53. package/dist/src/generators/application/files/ts-solution/package.json__tmpl__ +0 -20
  54. package/dist/src/generators/application/files/ts-solution/tsconfig.app.json__tmpl__ +0 -41
  55. package/dist/src/generators/application/files/ts-solution/tsconfig.json__tmpl__ +0 -10
  56. package/dist/src/generators/application/lib/add-e2e.d.ts +0 -3
  57. package/dist/src/generators/application/lib/add-e2e.js +0 -117
  58. package/dist/src/generators/application/lib/ignore-vite-temp-files.d.ts +0 -2
  59. package/dist/src/generators/application/lib/ignore-vite-temp-files.js +0 -50
  60. package/dist/src/generators/application/lib/index.d.ts +0 -4
  61. package/dist/src/generators/application/lib/index.js +0 -7
  62. package/dist/src/generators/application/lib/normalize-options.d.ts +0 -12
  63. package/dist/src/generators/application/lib/normalize-options.js +0 -40
  64. package/dist/src/generators/application/lib/update-unit-test-config.d.ts +0 -2
  65. package/dist/src/generators/application/lib/update-unit-test-config.js +0 -57
  66. package/dist/src/generators/application/schema.d.ts +0 -18
  67. package/dist/src/generators/application/schema.json +0 -70
  68. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.impl.d.ts +0 -5
  69. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js +0 -35
  70. package/dist/src/generators/cypress-component-configuration/files/cypress.config.ts__tmpl__ +0 -6
  71. package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -6
  72. package/dist/src/generators/cypress-component-configuration/schema.json +0 -41
  73. package/dist/src/generators/error-boundary/error-boundary.impl.d.ts +0 -3
  74. package/dist/src/generators/error-boundary/error-boundary.impl.js +0 -14
  75. package/dist/src/generators/error-boundary/lib/add-v2-error-boundary.d.ts +0 -3
  76. package/dist/src/generators/error-boundary/lib/add-v2-error-boundary.js +0 -37
  77. package/dist/src/generators/error-boundary/lib/index.d.ts +0 -2
  78. package/dist/src/generators/error-boundary/lib/index.js +0 -5
  79. package/dist/src/generators/error-boundary/lib/normalize-options.d.ts +0 -3
  80. package/dist/src/generators/error-boundary/lib/normalize-options.js +0 -13
  81. package/dist/src/generators/error-boundary/schema.d.ts +0 -4
  82. package/dist/src/generators/error-boundary/schema.json +0 -26
  83. package/dist/src/generators/init/init.d.ts +0 -5
  84. package/dist/src/generators/init/init.js +0 -67
  85. package/dist/src/generators/init/schema.d.ts +0 -7
  86. package/dist/src/generators/init/schema.json +0 -33
  87. package/dist/src/generators/library/lib/add-tsconfig-entry-points.d.ts +0 -3
  88. package/dist/src/generators/library/lib/add-tsconfig-entry-points.js +0 -20
  89. package/dist/src/generators/library/lib/add-unit-testing.d.ts +0 -3
  90. package/dist/src/generators/library/lib/add-unit-testing.js +0 -31
  91. package/dist/src/generators/library/lib/index.d.ts +0 -4
  92. package/dist/src/generators/library/lib/index.js +0 -7
  93. package/dist/src/generators/library/lib/normalize-options.d.ts +0 -8
  94. package/dist/src/generators/library/lib/normalize-options.js +0 -31
  95. package/dist/src/generators/library/lib/update-buildable-config.d.ts +0 -3
  96. package/dist/src/generators/library/lib/update-buildable-config.js +0 -23
  97. package/dist/src/generators/library/library.impl.d.ts +0 -6
  98. package/dist/src/generators/library/library.impl.js +0 -78
  99. package/dist/src/generators/library/schema.d.ts +0 -19
  100. package/dist/src/generators/library/schema.json +0 -89
  101. package/dist/src/generators/loader/loader.impl.d.ts +0 -3
  102. package/dist/src/generators/loader/loader.impl.js +0 -37
  103. package/dist/src/generators/loader/schema.d.ts +0 -3
  104. package/dist/src/generators/loader/schema.json +0 -18
  105. package/dist/src/generators/meta/lib/v2.impl.d.ts +0 -3
  106. package/dist/src/generators/meta/lib/v2.impl.js +0 -24
  107. package/dist/src/generators/meta/meta.impl.d.ts +0 -3
  108. package/dist/src/generators/meta/meta.impl.js +0 -9
  109. package/dist/src/generators/meta/schema.d.ts +0 -3
  110. package/dist/src/generators/meta/schema.json +0 -18
  111. package/dist/src/generators/preset/lib/normalize-options.d.ts +0 -10
  112. package/dist/src/generators/preset/lib/normalize-options.js +0 -19
  113. package/dist/src/generators/preset/preset.impl.d.ts +0 -3
  114. package/dist/src/generators/preset/preset.impl.js +0 -34
  115. package/dist/src/generators/preset/schema.d.ts +0 -4
  116. package/dist/src/generators/preset/schema.json +0 -14
  117. package/dist/src/generators/resource-route/resource-route.impl.d.ts +0 -3
  118. package/dist/src/generators/resource-route/resource-route.impl.js +0 -37
  119. package/dist/src/generators/resource-route/schema.d.ts +0 -6
  120. package/dist/src/generators/resource-route/schema.json +0 -44
  121. package/dist/src/generators/route/route.impl.d.ts +0 -3
  122. package/dist/src/generators/route/route.impl.js +0 -62
  123. package/dist/src/generators/route/schema.d.ts +0 -8
  124. package/dist/src/generators/route/schema.json +0 -55
  125. package/dist/src/generators/setup/schema.json +0 -14
  126. package/dist/src/generators/setup/setup.impl.d.ts +0 -2
  127. package/dist/src/generators/setup/setup.impl.js +0 -38
  128. package/dist/src/generators/storybook-configuration/files/vite.config.mts__tpl__ +0 -15
  129. package/dist/src/generators/storybook-configuration/schema.d.ts +0 -14
  130. package/dist/src/generators/storybook-configuration/schema.json +0 -78
  131. package/dist/src/generators/storybook-configuration/storybook-configuration.impl.d.ts +0 -4
  132. package/dist/src/generators/storybook-configuration/storybook-configuration.impl.js +0 -33
  133. package/dist/src/generators/style/schema.d.ts +0 -3
  134. package/dist/src/generators/style/schema.json +0 -25
  135. package/dist/src/generators/style/style.impl.d.ts +0 -3
  136. package/dist/src/generators/style/style.impl.js +0 -55
  137. package/dist/src/generators/utils/update-dependencies.d.ts +0 -2
  138. package/dist/src/generators/utils/update-dependencies.js +0 -32
  139. package/dist/src/utils/assert-and-pin-remix-typescript.d.ts +0 -21
  140. package/dist/src/utils/assert-and-pin-remix-typescript.js +0 -36
  141. package/dist/src/utils/get-default-export-name.d.ts +0 -2
  142. package/dist/src/utils/get-default-export-name.js +0 -7
  143. package/dist/src/utils/get-default-export.d.ts +0 -2
  144. package/dist/src/utils/get-default-export.js +0 -14
  145. package/dist/src/utils/insert-import.d.ts +0 -4
  146. package/dist/src/utils/insert-import.js +0 -53
  147. package/dist/src/utils/insert-statement-after-imports.d.ts +0 -5
  148. package/dist/src/utils/insert-statement-after-imports.js +0 -27
  149. package/dist/src/utils/insert-statement-in-default-function.d.ts +0 -2
  150. package/dist/src/utils/insert-statement-in-default-function.js +0 -22
  151. package/dist/src/utils/remix-config.d.ts +0 -6
  152. package/dist/src/utils/remix-config.js +0 -75
  153. package/dist/src/utils/remix-route-utils.d.ts +0 -4
  154. package/dist/src/utils/remix-route-utils.js +0 -26
  155. package/dist/src/utils/testing-config-utils.d.ts +0 -5
  156. package/dist/src/utils/testing-config-utils.js +0 -83
  157. package/executors.json +0 -14
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateDependencies = updateDependencies;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const versions_1 = require("../../utils/versions");
7
- function updateDependencies(tree) {
8
- // Vite depends on esbuild, whose install script only validates the prebuilt
9
- // binary that ships as an optional dependency.
10
- (0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
11
- esbuild: false,
12
- });
13
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {
14
- '@remix-run/node': versions_1.remixVersion,
15
- '@remix-run/react': versions_1.remixVersion,
16
- isbot: versions_1.isbotVersion,
17
- react: versions_1.reactVersion,
18
- 'react-dom': versions_1.reactDomVersion,
19
- }, {
20
- '@types/react': versions_1.typesReactVersion,
21
- '@types/react-dom': versions_1.typesReactDomVersion,
22
- eslint: versions_1.eslintVersion,
23
- typescript: versions_1.typescriptVersion,
24
- vite: versions_1.viteVersion,
25
- '@nx/vite': versions_1.nxVersion,
26
- '@nx/vitest': versions_1.nxVersion,
27
- }, undefined,
28
- // Don't overwrite a user's installed versions (e.g. React 19 from @nx/react).
29
- // Remix v2's fresh-install defaults are React 18 / Vite 6, but an existing
30
- // pin is respected.
31
- true);
32
- }
@@ -1,21 +0,0 @@
1
- import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
- /**
3
- * Remix has no TypeScript 6-capable release, so Remix generators must keep the
4
- * workspace on TS 5.x. It keys off the DECLARED `typescript` version, consulting
5
- * the installed version only when it satisfies that declared range, and:
6
- * - throws a hard, actionable error when the workspace resolves to TS >= 6 (the
7
- * declared floor is >= 6, or an open range like `>=5.9.0` is satisfied by an
8
- * installed >= 6);
9
- * - pins TS to Remix's own `~5.9.2` only when `typescript` is absent, never
10
- * overwriting an existing (5.x) pin. A typescript present only transitively
11
- * (hoisted, no direct declaration) is treated as absent and gets the pin.
12
- *
13
- * Dist-tags (`latest`/`next`) and unparseable ranges have no resolvable floor,
14
- * so the throw is skipped for them, consistent with devkit's
15
- * `assertSupportedPackageVersion`.
16
- *
17
- * Call before any dependency install in Remix generators that install deps;
18
- * generators that delegate to the init generator (e.g. application) inherit
19
- * the guard from it.
20
- */
21
- export declare function assertAndPinRemixTypescript(tree: Tree): GeneratorCallback;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertAndPinRemixTypescript = assertAndPinRemixTypescript;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/js/internal");
6
- const versions_1 = require("./versions");
7
- /**
8
- * Remix has no TypeScript 6-capable release, so Remix generators must keep the
9
- * workspace on TS 5.x. It keys off the DECLARED `typescript` version, consulting
10
- * the installed version only when it satisfies that declared range, and:
11
- * - throws a hard, actionable error when the workspace resolves to TS >= 6 (the
12
- * declared floor is >= 6, or an open range like `>=5.9.0` is satisfied by an
13
- * installed >= 6);
14
- * - pins TS to Remix's own `~5.9.2` only when `typescript` is absent, never
15
- * overwriting an existing (5.x) pin. A typescript present only transitively
16
- * (hoisted, no direct declaration) is treated as absent and gets the pin.
17
- *
18
- * Dist-tags (`latest`/`next`) and unparseable ranges have no resolvable floor,
19
- * so the throw is skipped for them, consistent with devkit's
20
- * `assertSupportedPackageVersion`.
21
- *
22
- * Call before any dependency install in Remix generators that install deps;
23
- * generators that delegate to the init generator (e.g. application) inherit
24
- * the guard from it.
25
- */
26
- function assertAndPinRemixTypescript(tree) {
27
- const declared = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'typescript');
28
- const minimum = declared ? (0, internal_1.getRangeMinimum)(declared) : undefined;
29
- if (minimum && (0, internal_1.isTypescriptVersionAtLeast)(tree, '6.0.0')) {
30
- throw new Error(`Remix does not support TypeScript 6 (detected \`typescript@${declared}\`).\n\n` +
31
- `Keep \`typescript\` on a 5.x version to continue using Remix, or migrate to ` +
32
- `React Router v7 by generating an application with the @nx/react generator: ` +
33
- `\`nx g @nx/react:application <name> --routing --useReactRouter\`.`);
34
- }
35
- return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { typescript: versions_1.typescriptVersion }, undefined, true);
36
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function getDefaultExportName(tree: Tree, path: string): string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultExportName = getDefaultExportName;
4
- const get_default_export_1 = require("./get-default-export");
5
- function getDefaultExportName(tree, path) {
6
- return (0, get_default_export_1.getDefaultExport)(tree, path)?.name.text ?? 'Unknown';
7
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function getDefaultExport(tree: Tree, path: string): import("typescript").FunctionDeclaration;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultExport = getDefaultExport;
4
- const typescript_1 = require("typescript");
5
- function getDefaultExport(tree, path) {
6
- const contents = tree.read(path, 'utf-8');
7
- const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
8
- const functionDeclarations = sourceFile.statements.filter(typescript_1.isFunctionDeclaration);
9
- return functionDeclarations.find((functionDeclaration) => {
10
- const isDefault = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.DefaultKeyword);
11
- const isExport = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.ExportKeyword);
12
- return isDefault && isExport;
13
- });
14
- }
@@ -1,4 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function insertImport(tree: Tree, path: string, name: string, modulePath: string, options?: {
3
- typeOnly: boolean;
4
- }): void;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertImport = insertImport;
4
- const devkit_1 = require("@nx/devkit");
5
- const typescript_1 = require("typescript");
6
- const insert_statement_after_imports_1 = require("./insert-statement-after-imports");
7
- function insertImport(tree, path, name, modulePath, options = { typeOnly: false }) {
8
- if (!tree.exists(path))
9
- throw Error(`Could not insert import ${name} from ${modulePath} in ${path}: path not found`);
10
- const contents = tree.read(path, 'utf-8');
11
- const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
12
- let importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
13
- if (options.typeOnly) {
14
- importStatements = importStatements.filter((node) => node.importClause.isTypeOnly);
15
- }
16
- else {
17
- importStatements = importStatements.filter((node) => !node.importClause.isTypeOnly);
18
- }
19
- const existingImport = importStatements.find((statement) => (0, typescript_1.isStringLiteral)(statement.moduleSpecifier) &&
20
- statement.moduleSpecifier
21
- .getText(sourceFile)
22
- .replace(/['"`]/g, '')
23
- .trim() === modulePath &&
24
- statement.importClause.namedBindings &&
25
- (0, typescript_1.isNamedImports)(statement.importClause.namedBindings));
26
- if (!existingImport) {
27
- (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, path, options.typeOnly
28
- ? `import type { ${name} } from '${modulePath}';`
29
- : `import { ${name} } from '${modulePath}';`);
30
- return;
31
- }
32
- const namedImports = existingImport.importClause
33
- .namedBindings;
34
- const alreadyImported = namedImports.elements.find((element) => element.name.escapedText === name) !== undefined;
35
- if (!alreadyImported) {
36
- const index = namedImports.getEnd() - 1;
37
- let text;
38
- if (namedImports.elements.hasTrailingComma) {
39
- text = `${name},`;
40
- }
41
- else {
42
- text = `,${name}`;
43
- }
44
- const newContents = (0, devkit_1.applyChangesToString)(contents, [
45
- {
46
- type: devkit_1.ChangeType.Insert,
47
- index,
48
- text,
49
- },
50
- ]);
51
- tree.write(path, newContents);
52
- }
53
- }
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Insert a statement after the last import statement in a file
4
- */
5
- export declare function insertStatementAfterImports(tree: Tree, path: string, statement: string): void;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertStatementAfterImports = insertStatementAfterImports;
4
- const devkit_1 = require("@nx/devkit");
5
- const typescript_1 = require("typescript");
6
- /**
7
- * Insert a statement after the last import statement in a file
8
- */
9
- function insertStatementAfterImports(tree, path, statement) {
10
- const contents = tree.read(path, 'utf-8');
11
- const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
12
- const importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
13
- const index = importStatements.length > 0
14
- ? importStatements[importStatements.length - 1].getEnd()
15
- : 0;
16
- if (importStatements.length > 0) {
17
- statement = `\n${statement}`;
18
- }
19
- const newContents = (0, devkit_1.applyChangesToString)(contents, [
20
- {
21
- type: devkit_1.ChangeType.Insert,
22
- index,
23
- text: statement,
24
- },
25
- ]);
26
- tree.write(path, newContents);
27
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function insertStatementInDefaultFunction(tree: Tree, path: string, statement: any): void;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insertStatementInDefaultFunction = insertStatementInDefaultFunction;
4
- const devkit_1 = require("@nx/devkit");
5
- const get_default_export_1 = require("./get-default-export");
6
- function insertStatementInDefaultFunction(tree, path, statement) {
7
- const defaultExport = (0, get_default_export_1.getDefaultExport)(tree, path);
8
- if (!defaultExport) {
9
- throw Error('No default export found!');
10
- }
11
- const index = defaultExport.body.statements.length > 0
12
- ? defaultExport.body.statements[0].pos
13
- : 0;
14
- const newContents = (0, devkit_1.applyChangesToString)(tree.read(path, 'utf-8'), [
15
- {
16
- type: devkit_1.ChangeType.Insert,
17
- index,
18
- text: statement,
19
- },
20
- ]);
21
- tree.write(path, newContents);
22
- }
@@ -1,6 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import type { AppConfig } from '@remix-run/dev';
3
- export declare function getRemixConfigPathDetails(tree: Tree, projectName: string): string[];
4
- export declare function getRemixConfigPath(tree: Tree, projectName: string): string;
5
- export declare function getRemixConfigPathFromProjectRoot(tree: Tree, projectRoot: string): string;
6
- export declare function getRemixConfigValues(tree: Tree, projectName: string): Promise<AppConfig>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRemixConfigPathDetails = getRemixConfigPathDetails;
4
- exports.getRemixConfigPath = getRemixConfigPath;
5
- exports.getRemixConfigPathFromProjectRoot = getRemixConfigPathFromProjectRoot;
6
- exports.getRemixConfigValues = getRemixConfigValues;
7
- const devkit_1 = require("@nx/devkit");
8
- const executor_utils_1 = require("./executor-utils");
9
- function getRemixConfigPathDetails(tree, projectName) {
10
- const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
11
- if (!project)
12
- throw new Error(`Project does not exist: ${projectName}`);
13
- for (const ext of ['.mjs', '.cjs', '.js', '.mts', '.cts', '.ts']) {
14
- const configPath = (0, devkit_1.joinPathFragments)(project.root, `vite.config${ext}`);
15
- if (tree.exists(configPath)) {
16
- return [configPath, 'vite'];
17
- }
18
- }
19
- for (const ext of ['.mjs', '.cjs', '.js']) {
20
- const configPath = (0, devkit_1.joinPathFragments)(project.root, `remix.config${ext}`);
21
- if (tree.exists(configPath)) {
22
- return [configPath, 'classic'];
23
- }
24
- }
25
- }
26
- function getRemixConfigPath(tree, projectName) {
27
- const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
28
- if (!project)
29
- throw new Error(`Project does not exist: ${projectName}`);
30
- for (const ext of ['.mjs', '.cjs', '.js']) {
31
- const configPath = (0, devkit_1.joinPathFragments)(project.root, `remix.config${ext}`);
32
- if (tree.exists(configPath)) {
33
- return configPath;
34
- }
35
- }
36
- }
37
- function getRemixConfigPathFromProjectRoot(tree, projectRoot) {
38
- let pathToRemixConfig;
39
- for (const ext of ['.js', '.mjs', '.cjs']) {
40
- pathToRemixConfig = (0, devkit_1.joinPathFragments)(projectRoot, `remix.config${ext}`);
41
- if (tree.exists(pathToRemixConfig)) {
42
- return pathToRemixConfig;
43
- }
44
- }
45
- throw new Error(`Could not find a Remix Config File. Please ensure a "remix.config.js" file exists at the root of your project.`);
46
- }
47
- const _remixConfigCache = {};
48
- async function getRemixConfigValues(tree, projectName) {
49
- const [configPath, configType] = getRemixConfigPathDetails(tree, projectName);
50
- const remixConfigPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, configPath);
51
- const cacheKey = `${projectName}/${remixConfigPath}`;
52
- let appConfig = _remixConfigCache[cacheKey];
53
- let resolvedConfig;
54
- if (!appConfig) {
55
- if (configType === 'vite') {
56
- const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
57
- const viteBuildConfig = (await resolveConfig({
58
- configFile: configPath,
59
- mode: 'development',
60
- }, 'build'));
61
- appConfig = viteBuildConfig.__remixPluginContext?.remixConfig;
62
- }
63
- else {
64
- try {
65
- const importedConfig = await Function(`return import("${remixConfigPath}?t=${Date.now()}")`)();
66
- appConfig = (importedConfig?.default || importedConfig);
67
- }
68
- catch {
69
- appConfig = require(remixConfigPath);
70
- }
71
- }
72
- _remixConfigCache[cacheKey] = appConfig;
73
- }
74
- return appConfig;
75
- }
@@ -1,4 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function normalizeRoutePath(path: string): string;
3
- export declare function checkRoutePathForErrors(path: string): RegExpMatchArray;
4
- export declare function resolveRemixAppDirectory(tree: Tree, projectName: string): Promise<string>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeRoutePath = normalizeRoutePath;
4
- exports.checkRoutePathForErrors = checkRoutePathForErrors;
5
- exports.resolveRemixAppDirectory = resolveRemixAppDirectory;
6
- const devkit_1 = require("@nx/devkit");
7
- const path_1 = require("path");
8
- const remix_config_1 = require("./remix-config");
9
- function normalizeRoutePath(path) {
10
- return path.indexOf('/routes/') > -1
11
- ? path.substring(path.indexOf('/routes/') + 8)
12
- : path;
13
- }
14
- function checkRoutePathForErrors(path) {
15
- return (path.match(/\w\.\.\w/) || // route.$withParams.tsx => route..tsx
16
- path.match(/\w\/\/\w/) || // route/$withParams/index.tsx => route//index.tsx
17
- path.match(/\w\/\.\w/) // route/$withParams.tsx => route/.tsx
18
- );
19
- }
20
- async function resolveRemixAppDirectory(tree, projectName) {
21
- const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
22
- const remixConfig = await (0, remix_config_1.getRemixConfigValues)(tree, projectName);
23
- return (0, devkit_1.joinPathFragments)(project.root, remixConfig.appDirectory
24
- ? (0, path_1.relative)(project.root, remixConfig.appDirectory)
25
- : 'app');
26
- }
@@ -1,5 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function updateVitestTestSetup(tree: Tree, pathToVitestConfig: string, pathToTestSetup: string): void;
3
- export declare function updateJestTestSetup(tree: Tree, pathToJestConfig: string, pathToTestSetup: string): void;
4
- export declare function updateJestTestMatch(tree: Tree, pathToJestConfig: string, includesString: string): void;
5
- export declare function updateVitestTestIncludes(tree: Tree, pathToVitestConfig: string, includesString: string): void;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateVitestTestSetup = updateVitestTestSetup;
4
- exports.updateJestTestSetup = updateJestTestSetup;
5
- exports.updateJestTestMatch = updateJestTestMatch;
6
- exports.updateVitestTestIncludes = updateVitestTestIncludes;
7
- const devkit_1 = require("@nx/devkit");
8
- const internal_1 = require("@nx/js/internal");
9
- let tsModule;
10
- function updateVitestTestSetup(tree, pathToVitestConfig, pathToTestSetup) {
11
- if (!tsModule) {
12
- tsModule = (0, internal_1.ensureTypescript)();
13
- }
14
- const { ast, query } = require('@phenomnomnominal/tsquery');
15
- const fileContents = tree.read(pathToVitestConfig, 'utf-8');
16
- const sourceFile = ast(fileContents);
17
- const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=setupFiles])';
18
- const nodes = query(sourceFile, TEST_SETUPFILES_SELECTOR);
19
- let updatedFileContents = fileContents;
20
- if (nodes.length === 0) {
21
- const TEST_CONFIG_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) > ObjectLiteralExpression';
22
- const testConfigNodes = query(sourceFile, TEST_CONFIG_SELECTOR);
23
- updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, testConfigNodes[0].getStart() + 1)}setupFiles: ['${pathToTestSetup}'],${fileContents.slice(testConfigNodes[0].getStart() + 1)}`;
24
- }
25
- else {
26
- const arrayNodes = query(nodes[0], 'ArrayLiteralExpression');
27
- if (arrayNodes.length !== 0) {
28
- updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
29
- }
30
- }
31
- tree.write(pathToVitestConfig, updatedFileContents);
32
- }
33
- function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
34
- if (!tsModule) {
35
- tsModule = (0, internal_1.ensureTypescript)();
36
- }
37
- const { ast, query } = require('@phenomnomnominal/tsquery');
38
- const fileContents = tree.read(pathToJestConfig, 'utf-8');
39
- const sourceFile = ast(fileContents);
40
- const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=setupFilesAfterEnv])';
41
- const nodes = query(sourceFile, TEST_SETUPFILES_SELECTOR);
42
- if (nodes.length === 0) {
43
- const CONFIG_SELECTOR = 'ObjectLiteralExpression';
44
- const nodes = query(sourceFile, CONFIG_SELECTOR);
45
- const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart() + 1)}setupFilesAfterEnv: ['${pathToTestSetup}'],${fileContents.slice(nodes[0].getStart() + 1)}`;
46
- tree.write(pathToJestConfig, updatedFileContents);
47
- }
48
- else {
49
- const arrayNodes = query(nodes[0], 'ArrayLiteralExpression');
50
- if (arrayNodes.length !== 0) {
51
- const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
52
- tree.write(pathToJestConfig, updatedFileContents);
53
- }
54
- }
55
- }
56
- function updateJestTestMatch(tree, pathToJestConfig, includesString) {
57
- if (!tsModule) {
58
- tsModule = (0, internal_1.ensureTypescript)();
59
- }
60
- const { ast, query } = require('@phenomnomnominal/tsquery');
61
- const fileContents = tree.read(pathToJestConfig, 'utf-8');
62
- const sourceFile = ast(fileContents);
63
- const TEST_MATCH_SELECTOR = 'PropertyAssignment:has(Identifier[name=testMatch])';
64
- const nodes = query(sourceFile, TEST_MATCH_SELECTOR);
65
- if (nodes.length !== 0) {
66
- const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}testMatch: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
67
- tree.write(pathToJestConfig, updatedFileContents);
68
- }
69
- }
70
- function updateVitestTestIncludes(tree, pathToVitestConfig, includesString) {
71
- if (!tsModule) {
72
- tsModule = (0, internal_1.ensureTypescript)();
73
- }
74
- const { ast, query } = require('@phenomnomnominal/tsquery');
75
- const fileContents = tree.read(pathToVitestConfig, 'utf-8');
76
- const sourceFile = ast(fileContents);
77
- const TEST_INCLUDE_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=include])';
78
- const nodes = query(sourceFile, TEST_INCLUDE_SELECTOR);
79
- if (nodes.length !== 0) {
80
- const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}include: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
81
- tree.write(pathToVitestConfig, updatedFileContents);
82
- }
83
- }
package/executors.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "executors": {
3
- "serve": {
4
- "implementation": "./dist/src/executors/serve/serve.impl",
5
- "schema": "./dist/src/executors/serve/schema.json",
6
- "description": "Serve a Remix application."
7
- },
8
- "build": {
9
- "implementation": "./dist/src/executors/build/build.impl",
10
- "schema": "./dist/src/executors/build/schema.json",
11
- "description": "Build a Remix application."
12
- }
13
- }
14
- }