@nx/remix 23.3.0 → 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.
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,18 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "meta",
4
- "type": "object",
5
- "description": "Generate a meta function for a given route.",
6
- "properties": {
7
- "path": {
8
- "type": "string",
9
- "description": "The route path or path to the filename of the route.",
10
- "$default": {
11
- "$source": "argv",
12
- "index": 0
13
- },
14
- "x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
15
- }
16
- },
17
- "required": ["path"]
18
- }
@@ -1,10 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { RemixGeneratorSchema } from '../schema';
3
- export interface NormalizedSchema extends RemixGeneratorSchema {
4
- appName: string;
5
- projectRoot: string;
6
- parsedTags: string[];
7
- unitTestRunner?: 'jest' | 'none' | 'vitest';
8
- e2eTestRunner?: 'cypress' | 'none';
9
- }
10
- export declare function normalizeOptions(tree: Tree, options: RemixGeneratorSchema): NormalizedSchema;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeOptions = normalizeOptions;
4
- function normalizeOptions(tree, options) {
5
- // There is a bug in Nx core where custom preset args are not passed correctly for boolean values, thus causing the name to be "commit" or "nx-cloud" when not passed.
6
- // TODO(jack): revert this hack once Nx core is fixed for custom preset args.
7
- // TODO(philip): presets should probably be using the `appName` flag to name the app, but it's not getting passed down to this generator properly and is always an empty string
8
- const appName = options.name;
9
- const projectRoot = `packages/${appName}`;
10
- const parsedTags = options.tags
11
- ? options.tags.split(',').map((s) => s.trim())
12
- : [];
13
- return {
14
- ...options,
15
- appName,
16
- projectRoot,
17
- parsedTags,
18
- };
19
- }
@@ -1,3 +0,0 @@
1
- import { GeneratorCallback, Tree } from '@nx/devkit';
2
- import { RemixGeneratorSchema } from './schema';
3
- export default function (tree: Tree, _options: RemixGeneratorSchema): Promise<GeneratorCallback>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nx/devkit");
6
- const application_impl_1 = tslib_1.__importDefault(require("../application/application.impl"));
7
- const setup_impl_1 = tslib_1.__importDefault(require("../setup/setup.impl"));
8
- const normalize_options_1 = require("./lib/normalize-options");
9
- const versions_1 = require("../../utils/versions");
10
- async function default_1(tree, _options) {
11
- (0, versions_1.assertSupportedRemixVersion)(tree);
12
- const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
13
- const tasks = [];
14
- const setupGenTask = await (0, setup_impl_1.default)(tree);
15
- tasks.push(setupGenTask);
16
- const nxJson = (0, devkit_1.readNxJson)(tree);
17
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
18
- nxJson.useInferencePlugins !== false;
19
- const appGenTask = await (0, application_impl_1.default)(tree, {
20
- name: options.appName,
21
- directory: '.',
22
- tags: options.tags,
23
- skipFormat: true,
24
- rootProject: true,
25
- unitTestRunner: options.unitTestRunner ?? 'vitest',
26
- e2eTestRunner: options.e2eTestRunner ?? 'cypress',
27
- addPlugin: addPluginDefault,
28
- });
29
- tasks.push(appGenTask);
30
- tree.delete('apps');
31
- tree.delete('libs');
32
- await (0, devkit_1.formatFiles)(tree);
33
- return (0, devkit_1.runTasksInSerial)(...tasks);
34
- }
@@ -1,4 +0,0 @@
1
- export interface RemixGeneratorSchema {
2
- name: string;
3
- tags?: string;
4
- }
@@ -1,14 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "Remix",
4
- "title": "",
5
- "type": "object",
6
- "description": "Generate a Remix application in a standalone workspace. Can be used with `create-nx-workspace --preset=@nx/remix`.",
7
- "properties": {
8
- "tags": {
9
- "type": "string",
10
- "description": "Add tags to the app (used for linting).",
11
- "alias": "t"
12
- }
13
- }
14
- }
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { RemixRouteSchema } from './schema';
3
- export default function (tree: Tree, options: RemixRouteSchema): Promise<void>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nx/devkit");
6
- const internal_1 = require("@nx/devkit/internal");
7
- const remix_route_utils_1 = require("../../utils/remix-route-utils");
8
- const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
9
- const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
10
- const versions_1 = require("../../utils/versions");
11
- async function default_1(tree, options) {
12
- (0, versions_1.assertSupportedRemixVersion)(tree);
13
- const { filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
14
- path: options.path.replace(/^\//, '').replace(/\/$/, ''),
15
- allowedFileExtensions: ['ts', 'tsx'],
16
- fileExtension: 'tsx',
17
- });
18
- if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
19
- throw new Error(`Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.`);
20
- }
21
- if (tree.exists(routeFilePath))
22
- throw new Error(`Path already exists: ${options.path}`);
23
- if (!options.loader && !options.action)
24
- throw new Error('The resource route generator requires either `loader` or `action` to be true');
25
- tree.write(routeFilePath, '');
26
- if (options.loader) {
27
- await (0, loader_impl_1.default)(tree, {
28
- path: routeFilePath,
29
- });
30
- }
31
- if (options.action) {
32
- await (0, action_impl_1.default)(tree, {
33
- path: routeFilePath,
34
- });
35
- }
36
- await (0, devkit_1.formatFiles)(tree);
37
- }
@@ -1,6 +0,0 @@
1
- export interface RemixRouteSchema {
2
- path: string;
3
- action: boolean;
4
- loader: boolean;
5
- skipChecks: boolean;
6
- }
@@ -1,44 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxRemixResourceRoute",
4
- "title": "Create a Resource Route",
5
- "type": "object",
6
- "description": "Generate a resource route.",
7
- "examples": [
8
- {
9
- "description": "Generate a resource route at `myapp/app/routes/foo.ts`",
10
- "command": "nx g resource-route myapp/app/routes/foo.ts"
11
- },
12
- {
13
- "description": "Generate a resource route without providing the file extension at `myapp/app/routes/foo.tsx`",
14
- "command": "nx g resource-route myapp/app/routes/foo"
15
- }
16
- ],
17
- "properties": {
18
- "path": {
19
- "type": "string",
20
- "description": "The file path to the route. Relative to the current working directory.",
21
- "$default": {
22
- "$source": "argv",
23
- "index": 0
24
- },
25
- "x-prompt": "What is the route file path?"
26
- },
27
- "action": {
28
- "type": "boolean",
29
- "description": "Generate an action function",
30
- "default": false
31
- },
32
- "loader": {
33
- "type": "boolean",
34
- "description": "Generate a loader function",
35
- "default": true
36
- },
37
- "skipChecks": {
38
- "type": "boolean",
39
- "description": "Skip route error detection",
40
- "default": false
41
- }
42
- },
43
- "required": ["path"]
44
- }
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { RemixRouteSchema } from './schema';
3
- export default function (tree: Tree, options: RemixRouteSchema): Promise<void>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nx/devkit");
6
- const internal_1 = require("@nx/devkit/internal");
7
- const path_1 = require("path");
8
- const remix_route_utils_1 = require("../../utils/remix-route-utils");
9
- const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
10
- const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
11
- const meta_impl_1 = tslib_1.__importDefault(require("../meta/meta.impl"));
12
- const style_impl_1 = tslib_1.__importDefault(require("../style/style.impl"));
13
- const versions_1 = require("../../utils/versions");
14
- async function default_1(tree, options) {
15
- (0, versions_1.assertSupportedRemixVersion)(tree);
16
- const { artifactName: name, filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
17
- path: options.path.replace(/^\//, '').replace(/\/$/, ''),
18
- allowedFileExtensions: ['ts', 'tsx'],
19
- fileExtension: 'tsx',
20
- });
21
- if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
22
- throw new Error(`Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.`);
23
- }
24
- const { className: componentName } = (0, devkit_1.names)(name === '.' || name === '' ? (0, path_1.basename)((0, path_1.dirname)(routeFilePath)) : name);
25
- if (tree.exists(routeFilePath))
26
- throw new Error(`Path already exists: ${routeFilePath}`);
27
- tree.write(routeFilePath, (0, devkit_1.stripIndents) `
28
-
29
- export default function ${componentName}() {
30
- ${options.loader
31
- ? `
32
- return (
33
- <p>
34
- Message: {data.message}
35
- </p>
36
- );
37
- `
38
- : `return (<p>${componentName} works!</p>)`}
39
- }
40
- `);
41
- if (options.loader) {
42
- await (0, loader_impl_1.default)(tree, {
43
- path: routeFilePath,
44
- });
45
- }
46
- if (options.meta) {
47
- await (0, meta_impl_1.default)(tree, {
48
- path: routeFilePath,
49
- });
50
- }
51
- if (options.action) {
52
- await (0, action_impl_1.default)(tree, {
53
- path: routeFilePath,
54
- });
55
- }
56
- if (options.style === 'css') {
57
- await (0, style_impl_1.default)(tree, {
58
- path: routeFilePath,
59
- });
60
- }
61
- await (0, devkit_1.formatFiles)(tree);
62
- }
@@ -1,8 +0,0 @@
1
- export interface RemixRouteSchema {
2
- path: string;
3
- style: 'css' | 'none';
4
- action: boolean;
5
- meta: boolean;
6
- loader: boolean;
7
- skipChecks: boolean;
8
- }
@@ -1,55 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxRemixRoute",
4
- "title": "Create a Route",
5
- "description": "Generate a route.",
6
- "type": "object",
7
- "examples": [
8
- {
9
- "description": "Generate a route at `myapp/app/routes/foo.tsx`",
10
- "command": "nx g resource-route myapp/app/routes/foo.tsx"
11
- },
12
- {
13
- "description": "Generate a route without providing the file extension at `myapp/app/routes/foo.tsx`",
14
- "command": "nx g resource-route myapp/app/routes/foo"
15
- }
16
- ],
17
- "properties": {
18
- "path": {
19
- "type": "string",
20
- "description": "The file path to the route. Relative to the current working directory.",
21
- "$default": {
22
- "$source": "argv",
23
- "index": 0
24
- },
25
- "x-prompt": "What is the route file path?"
26
- },
27
- "style": {
28
- "type": "string",
29
- "description": "Generate a stylesheet",
30
- "enum": ["none", "css"],
31
- "default": "css"
32
- },
33
- "meta": {
34
- "type": "boolean",
35
- "description": "Generate a meta function",
36
- "default": false
37
- },
38
- "action": {
39
- "type": "boolean",
40
- "description": "Generate an action function",
41
- "default": false
42
- },
43
- "loader": {
44
- "type": "boolean",
45
- "description": "Generate a loader function",
46
- "default": false
47
- },
48
- "skipChecks": {
49
- "type": "boolean",
50
- "description": "Skip route error detection",
51
- "default": false
52
- }
53
- },
54
- "required": ["path"]
55
- }
@@ -1,14 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxRemixSetup",
4
- "title": "",
5
- "type": "object",
6
- "description": "Generate initial files required for Remix to work within the workspace.",
7
- "properties": {
8
- "packageManager": {
9
- "type": "string",
10
- "description": "The package manager to setup for",
11
- "enum": ["yarn", "npm", "pnpm"]
12
- }
13
- }
14
- }
@@ -1,2 +0,0 @@
1
- import { GeneratorCallback, Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<GeneratorCallback>;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- const js_1 = require("@nx/js");
6
- const assert_and_pin_remix_typescript_1 = require("../../utils/assert-and-pin-remix-typescript");
7
- const versions_1 = require("../../utils/versions");
8
- async function default_1(tree) {
9
- (0, versions_1.assertSupportedRemixVersion)(tree);
10
- const tasks = [];
11
- tasks.push((0, assert_and_pin_remix_typescript_1.assertAndPinRemixTypescript)(tree));
12
- const jsInitTask = await (0, js_1.initGenerator)(tree, {
13
- skipFormat: true,
14
- });
15
- tasks.push(jsInitTask);
16
- // Ignore nested project files
17
- let ignoreFile = tree.read('.gitignore').toString();
18
- if (ignoreFile.indexOf('/dist') !== -1) {
19
- ignoreFile = ignoreFile.replace('/dist', 'dist');
20
- }
21
- if (ignoreFile.indexOf('/node_modules') !== -1) {
22
- ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
23
- }
24
- if (ignoreFile.indexOf('# Remix files') === -1) {
25
- ignoreFile = `${ignoreFile}
26
- # Remix files
27
- apps/**/build
28
- apps/**/.cache
29
- `;
30
- }
31
- tree.write('.gitignore', ignoreFile);
32
- (0, devkit_1.updateJson)(tree, `package.json`, (json) => {
33
- json.type = 'module';
34
- return json;
35
- });
36
- await (0, devkit_1.formatFiles)(tree);
37
- return (0, devkit_1.runTasksInSerial)(...tasks);
38
- }
@@ -1,15 +0,0 @@
1
- /// <reference types="vitest" />
2
- import {defineConfig} from 'vite';
3
- import react from '@vitejs/plugin-react';
4
- import viteTsConfigPaths from 'vite-tsconfig-paths';
5
-
6
- export default defineConfig({
7
- cacheDir: '<%= cacheDir %>',
8
-
9
- plugins: [
10
- react(),
11
- viteTsConfigPaths({
12
- root: '../../../',
13
- }),
14
- ],
15
- })
@@ -1,14 +0,0 @@
1
- import { LinterType } from '@nx/js';
2
-
3
- export interface StorybookConfigurationSchema {
4
- project: string;
5
- interactionTests?: boolean;
6
- generateStories?: boolean;
7
- js?: boolean;
8
- tsConfiguration?: boolean;
9
- linter?: LinterType;
10
- ignorePaths?: string[];
11
- configureTestRunner?: boolean;
12
- configureStaticServe?: boolean;
13
- addPlugin?: boolean;
14
- }
@@ -1,78 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "NxRemixStorybookConfigure",
5
- "title": "Remix Storybook Configuration",
6
- "description": "Set up Storybook for a Remix library.",
7
- "type": "object",
8
- "properties": {
9
- "project": {
10
- "type": "string",
11
- "aliases": ["name", "projectName"],
12
- "description": "Project for which to generate Storybook configuration.",
13
- "$default": {
14
- "$source": "argv",
15
- "index": 0
16
- },
17
- "x-prompt": "For which project do you want to generate Storybook configuration?",
18
- "x-dropdown": "projects",
19
- "x-priority": "important"
20
- },
21
- "interactionTests": {
22
- "type": "boolean",
23
- "description": "Set up Storybook interaction tests.",
24
- "x-prompt": "Do you want to set up Storybook interaction tests?",
25
- "x-priority": "important",
26
- "alias": ["configureTestRunner"],
27
- "default": true
28
- },
29
- "generateStories": {
30
- "type": "boolean",
31
- "description": "Automatically generate `*.stories.ts` files for components declared in this project?",
32
- "x-prompt": "Automatically generate *.stories.ts files for components declared in this project?",
33
- "default": true,
34
- "x-priority": "important"
35
- },
36
- "configureStaticServe": {
37
- "type": "boolean",
38
- "description": "Specifies whether to configure a static file server target for serving storybook. Helpful for speeding up CI build/test times.",
39
- "x-prompt": "Configure a static file server for the storybook instance?",
40
- "default": true,
41
- "x-priority": "important"
42
- },
43
- "js": {
44
- "type": "boolean",
45
- "description": "Generate JavaScript story files rather than TypeScript story files.",
46
- "default": false
47
- },
48
- "tsConfiguration": {
49
- "type": "boolean",
50
- "description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
51
- "default": false
52
- },
53
- "linter": {
54
- "description": "The tool to use for running lint checks.",
55
- "type": "string",
56
- "enum": ["eslint", "oxlint"]
57
- },
58
- "ignorePaths": {
59
- "type": "array",
60
- "description": "Paths to ignore when looking for components.",
61
- "items": {
62
- "type": "string",
63
- "description": "Path to ignore."
64
- },
65
- "examples": [
66
- "**/**/src/**/not-stories/**",
67
- "libs/my-lib/**/*.something.ts",
68
- "**/**/src/**/*.other.*",
69
- "libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
70
- ]
71
- },
72
- "configureTestRunner": {
73
- "type": "boolean",
74
- "description": "Add a Storybook Test-Runner target."
75
- }
76
- },
77
- "required": ["project"]
78
- }
@@ -1,4 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- import type { StorybookConfigurationSchema } from './schema';
3
- export declare function remixStorybookConfiguration(tree: Tree, schema: StorybookConfigurationSchema): Promise<import("@nx/devkit").GeneratorCallback>;
4
- export default function remixStorybookConfigurationInternal(tree: Tree, schema: StorybookConfigurationSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.remixStorybookConfiguration = remixStorybookConfiguration;
4
- exports.default = remixStorybookConfigurationInternal;
5
- const devkit_1 = require("@nx/devkit");
6
- const path_1 = require("path");
7
- const react_1 = require("@nx/react");
8
- const versions_1 = require("../../utils/versions");
9
- async function remixStorybookConfiguration(tree, schema) {
10
- return remixStorybookConfigurationInternal(tree, {
11
- addPlugin: false,
12
- ...schema,
13
- });
14
- }
15
- function normalizedJoinPaths(...paths) {
16
- const path = (0, devkit_1.joinPathFragments)(...paths);
17
- return path.startsWith('.') ? path : `./${path}`;
18
- }
19
- async function remixStorybookConfigurationInternal(tree, schema) {
20
- (0, versions_1.assertSupportedRemixVersion)(tree);
21
- const nxJson = (0, devkit_1.readNxJson)(tree);
22
- const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
23
- nxJson.useInferencePlugins !== false;
24
- schema.addPlugin ??= addPluginDefault;
25
- const { root } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
26
- if (!tree.exists((0, devkit_1.joinPathFragments)(root, 'vite.config.mts')) &&
27
- !tree.exists((0, devkit_1.joinPathFragments)(root, 'vite.config.ts'))) {
28
- const cacheDir = normalizedJoinPaths((0, devkit_1.offsetFromRoot)(root), 'node_modules', '.vite', 'storybook', root === '.' ? schema.project : root);
29
- (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), root, { cacheDir, tpl: '' });
30
- }
31
- const task = await (0, react_1.storybookConfigurationGenerator)(tree, schema);
32
- return task;
33
- }
@@ -1,3 +0,0 @@
1
- export interface RemixStyleSchema {
2
- path: string;
3
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxRemixRouteStyle",
4
- "title": "Add style import to a route",
5
- "description": "Generate a style import and file for a given route.",
6
- "type": "object",
7
- "examples": [
8
- {
9
- "description": "Generate a stylesheet at `myapp/app/styles/foo.css`",
10
- "command": "nx g style myapp/app/routes/foo.tsx"
11
- }
12
- ],
13
- "properties": {
14
- "path": {
15
- "type": "string",
16
- "description": "The file path to the route. Relative to the current working directory.",
17
- "$default": {
18
- "$source": "argv",
19
- "index": 0
20
- },
21
- "x-prompt": "What is the route file path?"
22
- }
23
- },
24
- "required": ["path"]
25
- }
@@ -1,3 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { RemixStyleSchema } from './schema';
3
- export default function (tree: Tree, options: RemixStyleSchema): Promise<void>;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const internal_1 = require("@nx/devkit/internal");
5
- const devkit_1 = require("@nx/devkit");
6
- const versions_1 = require("../../utils/versions");
7
- const path_1 = require("path");
8
- const insert_import_1 = require("../../utils/insert-import");
9
- const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
10
- const remix_route_utils_1 = require("../../utils/remix-route-utils");
11
- async function default_1(tree, options) {
12
- (0, versions_1.assertSupportedRemixVersion)(tree);
13
- const { project: projectName, directory, fileName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
14
- path: options.path,
15
- });
16
- const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
17
- if (!project)
18
- throw new Error(`Project does not exist: ${projectName}`);
19
- const appDir = await (0, remix_route_utils_1.resolveRemixAppDirectory)(tree, project.name);
20
- const normalizedRoutePath = `${(0, remix_route_utils_1.normalizeRoutePath)((0, devkit_1.joinPathFragments)(directory, fileName)).replace(/^\//, '')}.css`;
21
- const stylesheetPath = (0, devkit_1.joinPathFragments)(appDir, 'styles', normalizedRoutePath);
22
- tree.write(stylesheetPath, (0, devkit_1.stripIndents) `
23
- :root {
24
- --color-foreground: #fff;
25
- --color-background: #143157;
26
- --color-links: hsl(214, 73%, 69%);
27
- --color-border: #275da8;
28
- --font-body: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
29
- Liberation Mono, Courier New, monospace;
30
- }
31
- `);
32
- const routeFilePath = options.path;
33
- (0, insert_import_1.insertImport)(tree, routeFilePath, 'LinksFunction', '@remix-run/node', {
34
- typeOnly: true,
35
- });
36
- if (project.root === '.') {
37
- (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
38
- import stylesUrl from '~/styles/${normalizedRoutePath}'
39
-
40
- export const links: LinksFunction = () => {
41
- return [{ rel: 'stylesheet', href: stylesUrl }];
42
- };
43
- `);
44
- }
45
- else {
46
- (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
47
- import stylesUrl from '${(0, path_1.relative)((0, path_1.dirname)(routeFilePath), stylesheetPath)}';
48
-
49
- export const links: LinksFunction = () => {
50
- return [{ rel: 'stylesheet', href: stylesUrl }];
51
- };
52
- `);
53
- }
54
- await (0, devkit_1.formatFiles)(tree);
55
- }
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function updateDependencies(tree: Tree): import("@nx/devkit").GeneratorCallback;