@nx/remix 20.2.0-beta.2 → 20.2.0-beta.4

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 (30) hide show
  1. package/package.json +4 -4
  2. package/src/generators/action/schema.d.ts +0 -3
  3. package/src/generators/action/schema.json +0 -5
  4. package/src/generators/application/application.impl.js +33 -16
  5. package/src/generators/application/files/{integrated → non-root}/package.json__tmpl__ +1 -4
  6. package/src/generators/application/files/ts-solution/package.json__tmpl__ +32 -0
  7. package/src/generators/application/files/ts-solution/tsconfig.app.json__tmpl__ +39 -0
  8. package/src/generators/application/files/ts-solution/tsconfig.json__tmpl__ +10 -0
  9. package/src/generators/application/lib/add-e2e.js +45 -16
  10. package/src/generators/application/schema.d.ts +3 -0
  11. package/src/generators/application/schema.json +7 -4
  12. package/src/generators/error-boundary/schema.d.ts +0 -3
  13. package/src/generators/error-boundary/schema.json +0 -5
  14. package/src/generators/init/init.d.ts +1 -1
  15. package/src/generators/init/init.js +0 -2
  16. package/src/generators/library/library.impl.js +17 -5
  17. package/src/generators/library/schema.d.ts +3 -0
  18. package/src/generators/library/schema.json +23 -5
  19. package/src/generators/loader/schema.d.ts +0 -3
  20. package/src/generators/loader/schema.json +0 -5
  21. package/src/generators/meta/schema.d.ts +0 -3
  22. package/src/generators/meta/schema.json +0 -5
  23. package/src/generators/resource-route/__snapshots__/resource-route.impl.spec.ts.snap +2 -2
  24. package/src/generators/resource-route/resource-route.impl.js +0 -2
  25. package/src/generators/resource-route/schema.d.ts +0 -2
  26. package/src/generators/route/__snapshots__/route.impl.spec.ts.snap +4 -4
  27. package/src/generators/route/route.impl.js +0 -3
  28. package/src/generators/route/schema.d.ts +0 -2
  29. package/src/generators/style/schema.d.ts +0 -2
  30. /package/src/generators/application/files/{integrated → non-root}/.gitignore__tmpl__ +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "20.2.0-beta.2",
3
+ "version": "20.2.0-beta.4",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "20.2.0-beta.2",
33
- "@nx/js": "20.2.0-beta.2",
34
- "@nx/react": "20.2.0-beta.2",
32
+ "@nx/devkit": "20.2.0-beta.4",
33
+ "@nx/js": "20.2.0-beta.4",
34
+ "@nx/react": "20.2.0-beta.4",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -1,6 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface LoaderSchema {
4
2
  path: string;
5
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
6
3
  }
@@ -12,11 +12,6 @@
12
12
  "index": 0
13
13
  },
14
14
  "x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
15
- },
16
- "nameAndDirectoryFormat": {
17
- "description": "Whether to generate the action in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
18
- "type": "string",
19
- "enum": ["as-provided", "derived"]
20
15
  }
21
16
  },
22
17
  "required": ["path"]
@@ -6,7 +6,6 @@ const devkit_1 = require("@nx/devkit");
6
6
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
7
7
  const js_1 = require("@nx/js");
8
8
  const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
9
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
9
  const node_path_1 = require("node:path");
11
10
  const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
12
11
  const testing_config_utils_1 = require("../../utils/testing-config-utils");
@@ -14,6 +13,7 @@ const versions_1 = require("../../utils/versions");
14
13
  const init_1 = require("../init/init");
15
14
  const update_dependencies_1 = require("../utils/update-dependencies");
16
15
  const lib_1 = require("./lib");
16
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
17
17
  function remixApplicationGenerator(tree, options) {
18
18
  return remixApplicationGeneratorInternal(tree, {
19
19
  addPlugin: true,
@@ -21,25 +21,31 @@ function remixApplicationGenerator(tree, options) {
21
21
  });
22
22
  }
23
23
  async function remixApplicationGeneratorInternal(tree, _options) {
24
- (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'application');
25
- const options = await (0, lib_1.normalizeOptions)(tree, _options);
26
- if (!options.addPlugin) {
27
- throw new Error(`To generate a new Remix Vite application, you must use Inference Plugins. Check you do not have NX_ADD_PLUGINS=false or useInferencePlugins: false in your nx.json.`);
28
- }
29
24
  const tasks = [
30
25
  await (0, init_1.default)(tree, {
31
26
  skipFormat: true,
32
27
  addPlugin: true,
33
28
  }),
34
- await (0, js_1.initGenerator)(tree, { skipFormat: true }),
29
+ await (0, js_1.initGenerator)(tree, {
30
+ skipFormat: true,
31
+ addTsPlugin: _options.useTsSolution,
32
+ formatter: _options.formatter,
33
+ }),
35
34
  ];
36
- (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
37
- root: options.projectRoot,
38
- sourceRoot: `${options.projectRoot}`,
39
- projectType: 'application',
40
- tags: options.parsedTags,
41
- targets: {},
42
- });
35
+ const options = await (0, lib_1.normalizeOptions)(tree, _options);
36
+ if (!options.addPlugin) {
37
+ throw new Error(`To generate a new Remix Vite application, you must use Inference Plugins. Check you do not have NX_ADD_PLUGINS=false or useInferencePlugins: false in your nx.json.`);
38
+ }
39
+ const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
40
+ if (!isUsingTsSolution) {
41
+ (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
42
+ root: options.projectRoot,
43
+ sourceRoot: `${options.projectRoot}`,
44
+ projectType: 'application',
45
+ tags: options.parsedTags,
46
+ targets: {},
47
+ });
48
+ }
43
49
  const installTask = (0, update_dependencies_1.updateDependencies)(tree);
44
50
  tasks.push(installTask);
45
51
  const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
@@ -58,6 +64,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
58
64
  eslintVersion: versions_1.eslintVersion,
59
65
  typescriptVersion: versions_1.typescriptVersion,
60
66
  viteVersion: versions_1.viteVersion,
67
+ isUsingTsSolution,
61
68
  };
62
69
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/common'), options.projectRoot, vars);
63
70
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/nx-welcome', onBoardingStatus), options.projectRoot, { ...vars, connectCloudUrl });
@@ -66,7 +73,10 @@ async function remixApplicationGeneratorInternal(tree, _options) {
66
73
  tree.write('.gitignore', `${gitignore}\n.cache\nbuild\npublic/build\n.env\n`);
67
74
  }
68
75
  else {
69
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/integrated'), options.projectRoot, vars);
76
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/non-root'), options.projectRoot, vars);
77
+ }
78
+ if (isUsingTsSolution) {
79
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
70
80
  }
71
81
  if (options.unitTestRunner !== 'none') {
72
82
  if (options.unitTestRunner === 'vitest') {
@@ -103,7 +113,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
103
113
  addPlugin: true,
104
114
  });
105
115
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
106
- if (projectConfig.targets['test']?.options) {
116
+ if (projectConfig.targets?.['test']?.options) {
107
117
  projectConfig.targets['test'].options.passWithNoTests = true;
108
118
  (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
109
119
  }
@@ -212,6 +222,13 @@ export default {...nxPreset};
212
222
  if (!options.skipFormat) {
213
223
  await (0, devkit_1.formatFiles)(tree);
214
224
  }
225
+ (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.app.json', {
226
+ jsx: 'react-jsx',
227
+ module: 'esnext',
228
+ moduleResolution: 'bundler',
229
+ }, options.linter === 'eslint'
230
+ ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
231
+ : undefined, '.');
215
232
  tasks.push(() => {
216
233
  (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
217
234
  });
@@ -14,10 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@remix-run/dev": "<%= remixVersion %>",
16
16
  "@types/react": "<%= typesReactVersion %>",
17
- "@types/react-dom": "<%= typesReactDomVersion %>",
18
- "eslint": "<%= eslintVersion %>",
19
- "typescript": "<%= typescriptVersion %>",
20
- "vite": "<%= viteVersion %>",
17
+ "@types/react-dom": "<%= typesReactDomVersion %>"
21
18
  },
22
19
  "engines": {
23
20
  "node": ">=20"
@@ -0,0 +1,32 @@
1
+ {
2
+ "private": true,
3
+ "name": "<%= projectName %>",
4
+ "scripts": {},
5
+ "type": "module",
6
+ "dependencies": {
7
+ "@remix-run/node": "<%= remixVersion %>",
8
+ "@remix-run/react": "<%= remixVersion %>",
9
+ "@remix-run/serve": "<%= remixVersion %>",
10
+ "isbot": "<%= isbotVersion %>",
11
+ "react": "<%= reactVersion %>",
12
+ "react-dom": "<%= reactDomVersion %>"
13
+ },
14
+ "devDependencies": {
15
+ "@remix-run/dev": "<%= remixVersion %>",
16
+ "@types/react": "<%= typesReactVersion %>",
17
+ "@types/react-dom": "<%= typesReactDomVersion %>"
18
+ },
19
+ "engines": {
20
+ "node": ">=20"
21
+ },
22
+ "sideEffects": false<% if (isUsingTsSolution) { %>,
23
+ "nx": {
24
+ <%_ if (name !== projectName) { _%>
25
+ "name": "<%= name %>",<%_ } _%>
26
+ "projectType": "application",
27
+ "sourceRoot": "<%- projectRoot %>",
28
+ <%_ if (parsedTags?.length) { _%>
29
+ "tags": <%- JSON.stringify(parsedTags) %>
30
+ <%_ } _%>
31
+ }<% } %>
32
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "lib": ["DOM", "DOM.Iterable", "ES2019"],
6
+ "types": ["@remix-run/node", "vite/client"],
7
+ "isolatedModules": true,
8
+ "esModuleInterop": true,
9
+ "jsx": "react-jsx",
10
+ "module": "ESNext",
11
+ "moduleResolution": "Bundler",
12
+ "resolveJsonModule": true,
13
+ "target": "ES2022",
14
+ "strict": true,
15
+ "allowJs": true,
16
+ "skipLibCheck": true,
17
+ "forceConsistentCasingInFileNames": true
18
+ },
19
+ "include": [
20
+ "app/**/*.ts",
21
+ "app/**/*.tsx",
22
+ "app/**/*.js",
23
+ "app/**/*.jsx",
24
+ "**/.server/**/*.ts",
25
+ "**/.server/**/*.tsx",
26
+ "**/.client/**/*.ts",
27
+ "**/.client/**/*.tsx"
28
+ ],
29
+ "exclude": [
30
+ "tests/**/*.spec.ts",
31
+ "tests/**/*.test.ts",
32
+ "tests/**/*.spec.tsx",
33
+ "tests/**/*.test.tsx",
34
+ "tests/**/*.spec.js",
35
+ "tests/**/*.test.js",
36
+ "tests/**/*.spec.jsx",
37
+ "tests/**/*.test.jsx"
38
+ ]
39
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
+ "include": [],
4
+ "files": [],
5
+ "references": [
6
+ {
7
+ "path": "./tsconfig.app.json"
8
+ }
9
+ ]
10
+ }
@@ -6,6 +6,7 @@ const versions_1 = require("../../../utils/versions");
6
6
  const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
7
7
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
8
8
  const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
9
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
9
10
  async function addE2E(tree, options) {
10
11
  const hasRemixPlugin = (0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
11
12
  ? p === '@nx/remix/plugin'
@@ -13,14 +14,28 @@ async function addE2E(tree, options) {
13
14
  let e2eWebsServerInfo = await getRemixE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.projectRoot, 'remix.config.js'), options.addPlugin ?? Boolean(hasRemixPlugin));
14
15
  if (options.e2eTestRunner === 'cypress') {
15
16
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
16
- (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
17
- projectType: 'application',
18
- root: options.e2eProjectRoot,
19
- sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
20
- targets: {},
21
- tags: [],
22
- implicitDependencies: [options.projectName],
23
- });
17
+ if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
18
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
19
+ name: options.e2eProjectName,
20
+ version: '0.0.1',
21
+ private: true,
22
+ nx: {
23
+ projectType: 'application',
24
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
25
+ implicitDependencies: [options.projectName],
26
+ },
27
+ });
28
+ }
29
+ else {
30
+ (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
31
+ projectType: 'application',
32
+ root: options.e2eProjectRoot,
33
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
34
+ targets: {},
35
+ tags: [],
36
+ implicitDependencies: [options.projectName],
37
+ });
38
+ }
24
39
  const e2eTask = await configurationGenerator(tree, {
25
40
  project: options.e2eProjectName,
26
41
  directory: 'src',
@@ -56,14 +71,28 @@ async function addE2E(tree, options) {
56
71
  }
57
72
  else if (options.e2eTestRunner === 'playwright') {
58
73
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', (0, versions_1.getPackageVersion)(tree, 'nx'));
59
- (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
60
- projectType: 'application',
61
- root: options.e2eProjectRoot,
62
- sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
63
- targets: {},
64
- tags: [],
65
- implicitDependencies: [options.projectName],
66
- });
74
+ if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
75
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
76
+ name: options.e2eProjectName,
77
+ version: '0.0.1',
78
+ private: true,
79
+ nx: {
80
+ projectType: 'application',
81
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
82
+ implicitDependencies: [options.projectName],
83
+ },
84
+ });
85
+ }
86
+ else {
87
+ (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
88
+ projectType: 'application',
89
+ root: options.e2eProjectRoot,
90
+ sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
91
+ targets: {},
92
+ tags: [],
93
+ implicitDependencies: [options.projectName],
94
+ });
95
+ }
67
96
  const e2eTask = await configurationGenerator(tree, {
68
97
  project: options.e2eProjectName,
69
98
  skipFormat: true,
@@ -8,7 +8,10 @@ export interface NxRemixGeneratorSchema {
8
8
  unitTestRunner?: 'vitest' | 'jest' | 'none';
9
9
  e2eTestRunner?: 'cypress' | 'playwright' | 'none';
10
10
  skipFormat?: boolean;
11
+ // Internal options
11
12
  rootProject?: boolean;
12
13
  addPlugin?: boolean;
13
14
  nxCloudToken?: string;
15
+ useTsSolution?: boolean;
16
+ formatter?: 'prettier' | 'none';
14
17
  }
@@ -24,19 +24,22 @@
24
24
  "description": "The tool to use for running lint checks.",
25
25
  "type": "string",
26
26
  "enum": ["eslint", "none"],
27
- "default": "eslint"
27
+ "default": "none",
28
+ "x-prompt": "Which linter would you like to use?",
29
+ "x-priority": "important"
28
30
  },
29
31
  "unitTestRunner": {
30
32
  "type": "string",
31
33
  "enum": ["vitest", "jest", "none"],
32
- "default": "vitest",
34
+ "default": "none",
33
35
  "description": "Test runner to use for unit tests.",
34
- "x-prompt": "What unit test runner should be used?"
36
+ "x-prompt": "What unit test runner should be used?",
37
+ "x-priority": "important"
35
38
  },
36
39
  "e2eTestRunner": {
37
40
  "type": "string",
38
41
  "enum": ["playwright", "cypress", "none"],
39
- "default": "playwright",
42
+ "default": "none",
40
43
  "description": "Test runner to use for e2e tests",
41
44
  "x-prompt": "Which E2E test runner would you like to use?"
42
45
  },
@@ -1,7 +1,4 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface ErrorBoundarySchema {
4
2
  path: string;
5
3
  skipFormat?: false;
6
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
7
4
  }
@@ -15,11 +15,6 @@
15
15
  "type": "string",
16
16
  "description": "The path to route file relative to the project root."
17
17
  },
18
- "nameAndDirectoryFormat": {
19
- "description": "Whether to generate the error boundary in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
20
- "type": "string",
21
- "enum": ["as-provided", "derived"]
22
- },
23
18
  "skipFormat": {
24
19
  "type": "boolean",
25
20
  "description": "Skip formatting files after generation.",
@@ -1,4 +1,4 @@
1
- import { type Tree, GeneratorCallback } from '@nx/devkit';
1
+ import { GeneratorCallback, type Tree } from '@nx/devkit';
2
2
  import { type Schema } from './schema';
3
3
  export declare function remixInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
4
4
  export declare function remixInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
@@ -4,14 +4,12 @@ exports.remixInitGenerator = remixInitGenerator;
4
4
  exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
7
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
7
  const plugin_1 = require("../../plugins/plugin");
9
8
  const versions_1 = require("../../utils/versions");
10
9
  function remixInitGenerator(tree, options) {
11
10
  return remixInitGeneratorInternal(tree, { addPlugin: false, ...options });
12
11
  }
13
12
  async function remixInitGeneratorInternal(tree, options) {
14
- (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'init');
15
13
  const tasks = [];
16
14
  if (!options.skipPackageJson) {
17
15
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
@@ -3,17 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.remixLibraryGenerator = remixLibraryGenerator;
4
4
  exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
- const eslint_1 = require("@nx/eslint");
7
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
+ const js_1 = require("@nx/js");
8
7
  const react_1 = require("@nx/react");
9
8
  const lib_1 = require("./lib");
9
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
10
  async function remixLibraryGenerator(tree, schema) {
11
11
  return remixLibraryGeneratorInternal(tree, { addPlugin: false, ...schema });
12
12
  }
13
13
  async function remixLibraryGeneratorInternal(tree, schema) {
14
- (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'library');
15
14
  const tasks = [];
16
15
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
16
+ const jsInitTask = await (0, js_1.initGenerator)(tree, {
17
+ js: options.js,
18
+ skipFormat: true,
19
+ });
20
+ tasks.push(jsInitTask);
17
21
  const libGenTask = await (0, react_1.libraryGenerator)(tree, {
18
22
  name: options.projectName,
19
23
  style: options.style,
@@ -23,9 +27,10 @@ async function remixLibraryGeneratorInternal(tree, schema) {
23
27
  directory: options.projectRoot,
24
28
  skipFormat: true,
25
29
  skipTsConfig: false,
26
- linter: eslint_1.Linter.EsLint,
30
+ linter: options.linter,
27
31
  component: true,
28
32
  buildable: options.buildable,
33
+ bundler: options.bundler,
29
34
  addPlugin: options.addPlugin,
30
35
  });
31
36
  tasks.push(libGenTask);
@@ -34,9 +39,16 @@ async function remixLibraryGeneratorInternal(tree, schema) {
34
39
  tasks.push(pkgInstallTask);
35
40
  }
36
41
  (0, lib_1.addTsconfigEntryPoints)(tree, options);
37
- if (options.buildable) {
42
+ if (options.bundler === 'rollup' || options.buildable) {
38
43
  (0, lib_1.updateBuildableConfig)(tree, options.projectName);
39
44
  }
45
+ (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.lib.json', {
46
+ jsx: 'react-jsx',
47
+ module: 'esnext',
48
+ moduleResolution: 'bundler',
49
+ }, options.linter === 'eslint'
50
+ ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
51
+ : undefined);
40
52
  if (!options.skipFormat) {
41
53
  await (0, devkit_1.formatFiles)(tree);
42
54
  }
@@ -6,7 +6,10 @@ export interface NxRemixGeneratorSchema {
6
6
  style: SupportedStyles;
7
7
  tags?: string;
8
8
  importPath?: string;
9
+ /** @deprecated Use bundler instead. */
9
10
  buildable?: boolean;
11
+ bundler?: 'none' | 'vite' | 'rollup';
12
+ linter?: 'none' | 'eslint';
10
13
  unitTestRunner?: 'jest' | 'vitest' | 'none';
11
14
  js?: boolean;
12
15
  skipFormat?: boolean;
@@ -37,17 +37,29 @@
37
37
  "enum": ["none", "css"],
38
38
  "default": "css"
39
39
  },
40
- "buildable": {
41
- "type": "boolean",
42
- "description": "Should the library be buildable?",
43
- "default": false
40
+ "bundler": {
41
+ "type": "string",
42
+ "description": "The bundler to use. Choosing 'none' means this library is not buildable.",
43
+ "enum": ["none", "vite", "rollup"],
44
+ "default": "none",
45
+ "x-prompt": "Which bundler would you like to use to build the library? Choose 'none' to skip build setup.",
46
+ "x-priority": "important"
47
+ },
48
+ "linter": {
49
+ "description": "The tool to use for running lint checks.",
50
+ "type": "string",
51
+ "enum": ["eslint", "none"],
52
+ "default": "none",
53
+ "x-prompt": "Which linter would you like to use?",
54
+ "x-priority": "important"
44
55
  },
45
56
  "unitTestRunner": {
46
57
  "type": "string",
47
58
  "enum": ["vitest", "jest", "none"],
48
59
  "description": "Test Runner to use for Unit Tests",
49
60
  "x-prompt": "What test runner should be used?",
50
- "default": "vitest"
61
+ "default": "none",
62
+ "x-priority": "important"
51
63
  },
52
64
  "importPath": {
53
65
  "type": "string",
@@ -63,6 +75,12 @@
63
75
  "description": "Skip formatting files after generator runs",
64
76
  "default": false,
65
77
  "x-priority": "internal"
78
+ },
79
+ "buildable": {
80
+ "type": "boolean",
81
+ "default": false,
82
+ "description": "Generate a buildable library that uses rollup to bundle.",
83
+ "x-deprecated": "Use the `bundler` option for greater control (none, vite, rollup)."
66
84
  }
67
85
  },
68
86
  "required": ["directory"]
@@ -1,6 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface LoaderSchema {
4
2
  path: string;
5
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
6
3
  }
@@ -12,11 +12,6 @@
12
12
  "index": 0
13
13
  },
14
14
  "x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
15
- },
16
- "nameAndDirectoryFormat": {
17
- "description": "Whether to generate the loader in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
18
- "type": "string",
19
- "enum": ["as-provided", "derived"]
20
15
  }
21
16
  },
22
17
  "required": ["path"]
@@ -1,6 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface MetaSchema {
4
2
  path: string;
5
- nameAndDirectoryFormat?: NameAndDirectoryFormat;
6
3
  }
@@ -12,11 +12,6 @@
12
12
  "index": 0
13
13
  },
14
14
  "x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
15
- },
16
- "nameAndDirectoryFormat": {
17
- "description": "Whether to generate the meta function in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
18
- "type": "string",
19
- "enum": ["as-provided", "derived"]
20
15
  }
21
16
  },
22
17
  "required": ["path"]
@@ -1,5 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[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.]`;
3
+ exports[`resource route should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[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.]`;
4
4
 
5
- exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[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.]`;
5
+ exports[`resource route should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[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.]`;
@@ -22,13 +22,11 @@ async function default_1(tree, options) {
22
22
  if (options.loader) {
23
23
  await (0, loader_impl_1.default)(tree, {
24
24
  path: routeFilePath,
25
- nameAndDirectoryFormat: 'as-provided',
26
25
  });
27
26
  }
28
27
  if (options.action) {
29
28
  await (0, action_impl_1.default)(tree, {
30
29
  path: routeFilePath,
31
- nameAndDirectoryFormat: 'as-provided',
32
30
  });
33
31
  }
34
32
  await (0, devkit_1.formatFiles)(tree);
@@ -1,5 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface RemixRouteSchema {
4
2
  path: string;
5
3
  action: boolean;
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should add route component 1`] = `
3
+ exports[`route should add route component 1`] = `
4
4
  "import { useLoaderData, useActionData } from '@remix-run/react';
5
5
  import { json } from '@remix-run/node';
6
6
  import type {
@@ -41,8 +41,8 @@ export default function Example() {
41
41
  "
42
42
  `;
43
43
 
44
- exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[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.]`;
44
+ exports[`route should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[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.]`;
45
45
 
46
- exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 2`] = `[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.]`;
46
+ exports[`route should error if it detects a possible missing route param because of un-escaped dollar sign 2`] = `[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.]`;
47
47
 
48
- exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[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.]`;
48
+ exports[`route should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[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.]`;
@@ -44,19 +44,16 @@ async function default_1(tree, options) {
44
44
  if (options.loader) {
45
45
  await (0, loader_impl_1.default)(tree, {
46
46
  path: routeFilePath,
47
- nameAndDirectoryFormat: 'as-provided',
48
47
  });
49
48
  }
50
49
  if (options.meta) {
51
50
  await (0, meta_impl_1.default)(tree, {
52
51
  path: routeFilePath,
53
- nameAndDirectoryFormat: 'as-provided',
54
52
  });
55
53
  }
56
54
  if (options.action) {
57
55
  await (0, action_impl_1.default)(tree, {
58
56
  path: routeFilePath,
59
- nameAndDirectoryFormat: 'as-provided',
60
57
  });
61
58
  }
62
59
  if (options.style === 'css') {
@@ -1,5 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface RemixRouteSchema {
4
2
  path: string;
5
3
  style: 'css' | 'none';
@@ -1,5 +1,3 @@
1
- import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
-
3
1
  export interface RemixStyleSchema {
4
2
  path: string;
5
3
  }