@nx/remix 18.0.0-beta.1 → 18.0.0-beta.3

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/generators.d.ts +14 -15
  2. package/generators.js +29 -16
  3. package/generators.json +5 -10
  4. package/package.json +5 -5
  5. package/src/generators/application/application.impl.d.ts +3 -1
  6. package/src/generators/application/application.impl.js +54 -31
  7. package/src/generators/application/files/common/app/nx-welcome.tsx__tmpl__ +19 -0
  8. package/src/generators/application/lib/normalize-options.js +1 -0
  9. package/src/generators/application/schema.d.ts +1 -0
  10. package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.d.ts +3 -1
  11. package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js +12 -1
  12. package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
  13. package/src/generators/init/init.d.ts +1 -0
  14. package/src/generators/init/init.js +8 -4
  15. package/src/generators/init/schema.d.ts +1 -0
  16. package/src/generators/library/lib/normalize-options.js +1 -0
  17. package/src/generators/library/library.impl.d.ts +3 -1
  18. package/src/generators/library/library.impl.js +9 -2
  19. package/src/generators/library/schema.d.ts +1 -0
  20. package/src/generators/preset/preset.impl.js +1 -0
  21. package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +3 -3
  22. package/src/generators/storybook-configuration/schema.d.ts +1 -0
  23. package/src/generators/storybook-configuration/storybook-configuration.impl.d.ts +2 -1
  24. package/src/generators/storybook-configuration/storybook-configuration.impl.js +11 -2
  25. package/src/plugins/__snapshots__/plugin.spec.ts.snap +1 -1
  26. package/src/plugins/plugin.js +13 -22
  27. package/src/generators/cypress/cypress.impl.d.ts +0 -3
  28. package/src/generators/cypress/cypress.impl.js +0 -77
  29. package/src/generators/cypress/schema.d.ts +0 -14
  30. package/src/generators/cypress/schema.json +0 -61
package/generators.d.ts CHANGED
@@ -1,15 +1,14 @@
1
- export * from './src/generators/action/action.impl';
2
- export * from './src/generators/application/application.impl';
3
- export * from './src/generators/cypress-component-configuration/cypress-component-configuration.impl';
4
- export * from './src/generators/cypress/cypress.impl';
5
- export * from './src/generators/error-boundary/error-boundary.impl';
6
- export * from './src/generators/library/library.impl';
7
- export * from './src/generators/loader/loader.impl';
8
- export * from './src/generators/meta/meta.impl';
9
- export * from './src/generators/preset/preset.impl';
10
- export * from './src/generators/resource-route/resource-route.impl';
11
- export * from './src/generators/route/route.impl';
12
- export * from './src/generators/setup-tailwind/setup-tailwind.impl';
13
- export * from './src/generators/storybook-configuration/storybook-configuration.impl';
14
- export * from './src/generators/style/style.impl';
15
- export * from './src/generators/init/init';
1
+ export { default as actionGenerator } from './src/generators/action/action.impl';
2
+ export { default as applicationGenerator } from './src/generators/application/application.impl';
3
+ export { default as cypressComponentConfigurationGenerator } from './src/generators/cypress-component-configuration/cypress-component-configuration.impl';
4
+ export { default as errorBoundaryGenerator } from './src/generators/error-boundary/error-boundary.impl';
5
+ export { default as libraryGenerator } from './src/generators/library/library.impl';
6
+ export { default as loaderGenerator } from './src/generators/loader/loader.impl';
7
+ export { default as metaGenerator } from './src/generators/meta/meta.impl';
8
+ export { default as presetGenerator } from './src/generators/preset/preset.impl';
9
+ export { default as resourceRouteGenerator } from './src/generators/resource-route/resource-route.impl';
10
+ export { default as routeGenerator } from './src/generators/route/route.impl';
11
+ export { default as setupTailwindGenerator } from './src/generators/setup-tailwind/setup-tailwind.impl';
12
+ export { default as storybookConfigurationGenerator } from './src/generators/storybook-configuration/storybook-configuration.impl';
13
+ export { default as styleGenerator } from './src/generators/style/style.impl';
14
+ export { default as initGenerator } from './src/generators/init/init';
package/generators.js CHANGED
@@ -1,18 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./src/generators/action/action.impl"), exports);
5
- tslib_1.__exportStar(require("./src/generators/application/application.impl"), exports);
6
- tslib_1.__exportStar(require("./src/generators/cypress-component-configuration/cypress-component-configuration.impl"), exports);
7
- tslib_1.__exportStar(require("./src/generators/cypress/cypress.impl"), exports);
8
- tslib_1.__exportStar(require("./src/generators/error-boundary/error-boundary.impl"), exports);
9
- tslib_1.__exportStar(require("./src/generators/library/library.impl"), exports);
10
- tslib_1.__exportStar(require("./src/generators/loader/loader.impl"), exports);
11
- tslib_1.__exportStar(require("./src/generators/meta/meta.impl"), exports);
12
- tslib_1.__exportStar(require("./src/generators/preset/preset.impl"), exports);
13
- tslib_1.__exportStar(require("./src/generators/resource-route/resource-route.impl"), exports);
14
- tslib_1.__exportStar(require("./src/generators/route/route.impl"), exports);
15
- tslib_1.__exportStar(require("./src/generators/setup-tailwind/setup-tailwind.impl"), exports);
16
- tslib_1.__exportStar(require("./src/generators/storybook-configuration/storybook-configuration.impl"), exports);
17
- tslib_1.__exportStar(require("./src/generators/style/style.impl"), exports);
18
- tslib_1.__exportStar(require("./src/generators/init/init"), exports);
3
+ exports.initGenerator = exports.styleGenerator = exports.storybookConfigurationGenerator = exports.setupTailwindGenerator = exports.routeGenerator = exports.resourceRouteGenerator = exports.presetGenerator = exports.metaGenerator = exports.loaderGenerator = exports.libraryGenerator = exports.errorBoundaryGenerator = exports.cypressComponentConfigurationGenerator = exports.applicationGenerator = exports.actionGenerator = void 0;
4
+ var action_impl_1 = require("./src/generators/action/action.impl");
5
+ Object.defineProperty(exports, "actionGenerator", { enumerable: true, get: function () { return action_impl_1.default; } });
6
+ var application_impl_1 = require("./src/generators/application/application.impl");
7
+ Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_impl_1.default; } });
8
+ var cypress_component_configuration_impl_1 = require("./src/generators/cypress-component-configuration/cypress-component-configuration.impl");
9
+ Object.defineProperty(exports, "cypressComponentConfigurationGenerator", { enumerable: true, get: function () { return cypress_component_configuration_impl_1.default; } });
10
+ var error_boundary_impl_1 = require("./src/generators/error-boundary/error-boundary.impl");
11
+ Object.defineProperty(exports, "errorBoundaryGenerator", { enumerable: true, get: function () { return error_boundary_impl_1.default; } });
12
+ var library_impl_1 = require("./src/generators/library/library.impl");
13
+ Object.defineProperty(exports, "libraryGenerator", { enumerable: true, get: function () { return library_impl_1.default; } });
14
+ var loader_impl_1 = require("./src/generators/loader/loader.impl");
15
+ Object.defineProperty(exports, "loaderGenerator", { enumerable: true, get: function () { return loader_impl_1.default; } });
16
+ var meta_impl_1 = require("./src/generators/meta/meta.impl");
17
+ Object.defineProperty(exports, "metaGenerator", { enumerable: true, get: function () { return meta_impl_1.default; } });
18
+ var preset_impl_1 = require("./src/generators/preset/preset.impl");
19
+ Object.defineProperty(exports, "presetGenerator", { enumerable: true, get: function () { return preset_impl_1.default; } });
20
+ var resource_route_impl_1 = require("./src/generators/resource-route/resource-route.impl");
21
+ Object.defineProperty(exports, "resourceRouteGenerator", { enumerable: true, get: function () { return resource_route_impl_1.default; } });
22
+ var route_impl_1 = require("./src/generators/route/route.impl");
23
+ Object.defineProperty(exports, "routeGenerator", { enumerable: true, get: function () { return route_impl_1.default; } });
24
+ var setup_tailwind_impl_1 = require("./src/generators/setup-tailwind/setup-tailwind.impl");
25
+ Object.defineProperty(exports, "setupTailwindGenerator", { enumerable: true, get: function () { return setup_tailwind_impl_1.default; } });
26
+ var storybook_configuration_impl_1 = require("./src/generators/storybook-configuration/storybook-configuration.impl");
27
+ Object.defineProperty(exports, "storybookConfigurationGenerator", { enumerable: true, get: function () { return storybook_configuration_impl_1.default; } });
28
+ var style_impl_1 = require("./src/generators/style/style.impl");
29
+ Object.defineProperty(exports, "styleGenerator", { enumerable: true, get: function () { return style_impl_1.default; } });
30
+ var init_1 = require("./src/generators/init/init");
31
+ Object.defineProperty(exports, "initGenerator", { enumerable: true, get: function () { return init_1.default; } });
package/generators.json CHANGED
@@ -17,26 +17,26 @@
17
17
  "hidden": true
18
18
  },
19
19
  "application": {
20
- "implementation": "./src/generators/application/application.impl",
20
+ "implementation": "./src/generators/application/application.impl#remixApplicationGeneratorInternal",
21
21
  "schema": "./src/generators/application/schema.json",
22
22
  "description": "Generate a new Remix application",
23
23
  "aliases": ["app"],
24
24
  "x-type": "application"
25
25
  },
26
26
  "cypress-component-configuration": {
27
- "implementation": "./src/generators/cypress-component-configuration/cypress-component-configuration.impl",
27
+ "implementation": "./src/generators/cypress-component-configuration/cypress-component-configuration.impl#cypressComponentConfigurationGeneratorInternal",
28
28
  "schema": "./src/generators/cypress-component-configuration/schema.json",
29
29
  "description": "Generate a Cypress Component Testing configuration for a Remix project"
30
30
  },
31
31
  "library": {
32
- "implementation": "./src/generators/library/library.impl",
32
+ "implementation": "./src/generators/library/library.impl#remixLibraryGeneratorInternal",
33
33
  "schema": "./src/generators/library/schema.json",
34
34
  "description": "Generate a new library",
35
35
  "aliases": ["lib"],
36
36
  "x-type": "library"
37
37
  },
38
38
  "init": {
39
- "implementation": "./src/generators/init/init",
39
+ "implementation": "./src/generators/init/init#remixInitGeneratorInternal",
40
40
  "schema": "./src/generators/init/schema.json",
41
41
  "description": "Initialize the `@nx/remix` plugin.",
42
42
  "hidden": true
@@ -72,7 +72,7 @@
72
72
  "description": "Generates a TailwindCSS configuration for the Remix application"
73
73
  },
74
74
  "storybook-configuration": {
75
- "implementation": "./src/generators/storybook-configuration/storybook-configuration.impl",
75
+ "implementation": "./src/generators/storybook-configuration/storybook-configuration.impl#remixStorybookConfiguration",
76
76
  "schema": "./src/generators/storybook-configuration/schema.json",
77
77
  "description": "Generates a Storybook configuration for a Remix application"
78
78
  },
@@ -85,11 +85,6 @@
85
85
  "implementation": "./src/generators/error-boundary/error-boundary.impl",
86
86
  "schema": "./src/generators/error-boundary/schema.json",
87
87
  "description": "Add an ErrorBoundary to an existing route"
88
- },
89
- "cypress": {
90
- "implementation": "./src/generators/cypress/cypress.impl",
91
- "schema": "./src/generators/cypress/schema.json",
92
- "description": "Generate a project for testing Remix apps using Cypress"
93
88
  }
94
89
  }
95
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "18.0.0-beta.1",
3
+ "version": "18.0.0-beta.3",
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, 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",
@@ -28,12 +28,12 @@
28
28
  "migrations": "./migrations.json"
29
29
  },
30
30
  "dependencies": {
31
- "@nx/devkit": "18.0.0-beta.1",
32
- "@nx/js": "18.0.0-beta.1",
33
- "@nx/react": "18.0.0-beta.1",
31
+ "@nx/devkit": "18.0.0-beta.3",
32
+ "@nx/js": "18.0.0-beta.3",
33
+ "@nx/react": "18.0.0-beta.3",
34
34
  "tslib": "^2.3.1",
35
35
  "@phenomnomnominal/tsquery": "~5.0.1",
36
- "@nrwl/remix": "18.0.0-beta.1"
36
+ "@nrwl/remix": "18.0.0-beta.3"
37
37
  },
38
38
  "peerDependencies": {},
39
39
  "publishConfig": {
@@ -1,3 +1,5 @@
1
1
  import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { NxRemixGeneratorSchema } from './schema';
3
- export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
3
+ export declare function remixApplicationGenerator(tree: Tree, options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
4
+ export declare function remixApplicationGeneratorInternal(tree: Tree, _options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
5
+ export default remixApplicationGenerator;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remixApplicationGeneratorInternal = exports.remixApplicationGenerator = void 0;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
5
6
  const versions_1 = require("../../utils/versions");
@@ -9,10 +10,20 @@ const init_1 = require("../init/init");
9
10
  const js_1 = require("@nx/js");
10
11
  const add_build_target_defaults_1 = require("@nx/devkit/src/generators/add-build-target-defaults");
11
12
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
12
- async function default_1(tree, _options) {
13
+ function remixApplicationGenerator(tree, options) {
14
+ return remixApplicationGeneratorInternal(tree, {
15
+ addPlugin: false,
16
+ ...options,
17
+ });
18
+ }
19
+ exports.remixApplicationGenerator = remixApplicationGenerator;
20
+ async function remixApplicationGeneratorInternal(tree, _options) {
13
21
  const options = await (0, lib_1.normalizeOptions)(tree, _options);
14
22
  const tasks = [
15
- await (0, init_1.default)(tree, { skipFormat: true }),
23
+ await (0, init_1.default)(tree, {
24
+ skipFormat: true,
25
+ addPlugin: options.addPlugin,
26
+ }),
16
27
  await (0, js_1.initGenerator)(tree, { skipFormat: true }),
17
28
  ];
18
29
  (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, '@nx/remix:build');
@@ -21,36 +32,38 @@ async function default_1(tree, _options) {
21
32
  sourceRoot: `${options.projectRoot}`,
22
33
  projectType: 'application',
23
34
  tags: options.parsedTags,
24
- targets: {
25
- build: {
26
- executor: '@nx/remix:build',
27
- outputs: ['{options.outputPath}'],
28
- options: {
29
- outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
35
+ targets: !options.addPlugin
36
+ ? {
37
+ build: {
38
+ executor: '@nx/remix:build',
39
+ outputs: ['{options.outputPath}'],
40
+ options: {
41
+ outputPath: (0, devkit_1.joinPathFragments)('dist', options.projectRoot),
42
+ },
30
43
  },
31
- },
32
- serve: {
33
- executor: `@nx/remix:serve`,
34
- options: {
35
- command: `${(0, devkit_1.getPackageManagerCommand)().exec} remix-serve build/index.js`,
36
- manual: true,
37
- port: 4200,
44
+ serve: {
45
+ executor: `@nx/remix:serve`,
46
+ options: {
47
+ command: `${(0, devkit_1.getPackageManagerCommand)().exec} remix-serve build/index.js`,
48
+ manual: true,
49
+ port: 4200,
50
+ },
38
51
  },
39
- },
40
- start: {
41
- dependsOn: ['build'],
42
- command: `remix-serve build/index.js`,
43
- options: {
44
- cwd: options.projectRoot,
52
+ start: {
53
+ dependsOn: ['build'],
54
+ command: `remix-serve build/index.js`,
55
+ options: {
56
+ cwd: options.projectRoot,
57
+ },
45
58
  },
46
- },
47
- typecheck: {
48
- command: `tsc --project tsconfig.app.json`,
49
- options: {
50
- cwd: options.projectRoot,
59
+ typecheck: {
60
+ command: `tsc --project tsconfig.app.json`,
61
+ options: {
62
+ cwd: options.projectRoot,
63
+ },
51
64
  },
52
- },
53
- },
65
+ }
66
+ : {},
54
67
  });
55
68
  const installTask = (0, update_dependencies_1.updateDependencies)(tree);
56
69
  tasks.push(installTask);
@@ -86,6 +99,7 @@ async function default_1(tree, _options) {
86
99
  skipFormat: true,
87
100
  testEnvironment: 'jsdom',
88
101
  skipViteConfig: true,
102
+ addPlugin: options.addPlugin,
89
103
  });
90
104
  createOrEditViteConfig(tree, {
91
105
  project: options.projectName,
@@ -106,10 +120,13 @@ async function default_1(tree, _options) {
106
120
  skipSerializers: false,
107
121
  skipPackageJson: false,
108
122
  skipFormat: true,
123
+ addPlugin: options.addPlugin,
109
124
  });
110
125
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
111
- projectConfig.targets['test'].options.passWithNoTests = true;
112
- (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
126
+ if (projectConfig.targets['test']?.options) {
127
+ projectConfig.targets['test'].options.passWithNoTests = true;
128
+ (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
129
+ }
113
130
  tasks.push(jestTask);
114
131
  }
115
132
  const pkgInstallTask = (0, lib_1.updateUnitTestConfig)(tree, options.projectRoot, options.unitTestRunner);
@@ -129,8 +146,11 @@ async function default_1(tree, _options) {
129
146
  unitTestRunner: options.unitTestRunner,
130
147
  skipFormat: true,
131
148
  rootProject: options.rootProject,
149
+ addPlugin: options.addPlugin,
132
150
  });
133
151
  tasks.push(eslintTask);
152
+ tree.write((0, devkit_1.joinPathFragments)(options.projectRoot, '.eslintignore'), (0, devkit_1.stripIndents) `build
153
+ public/build`);
134
154
  }
135
155
  if (options.js) {
136
156
  (0, devkit_1.toJS)(tree);
@@ -165,6 +185,7 @@ async function default_1(tree, _options) {
165
185
  // Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
166
186
  (0, create_ts_config_1.extractTsConfigBase)(tree);
167
187
  }
188
+ // TODO(@columferry): add support for playwright?
168
189
  if (options.e2eTestRunner === 'cypress') {
169
190
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
170
191
  addFileServerTarget(tree, options, 'serve-static');
@@ -182,6 +203,7 @@ async function default_1(tree, _options) {
182
203
  skipFormat: true,
183
204
  devServerTarget: `${options.projectName}:serve:development`,
184
205
  baseUrl: 'http://localhost:4200',
206
+ addPlugin: options.addPlugin,
185
207
  }));
186
208
  }
187
209
  if (!options.skipFormat) {
@@ -192,7 +214,7 @@ async function default_1(tree, _options) {
192
214
  });
193
215
  return (0, devkit_1.runTasksInSerial)(...tasks);
194
216
  }
195
- exports.default = default_1;
217
+ exports.remixApplicationGeneratorInternal = remixApplicationGeneratorInternal;
196
218
  function addFileServerTarget(tree, options, targetName) {
197
219
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
198
220
  projectConfig.targets[targetName] = {
@@ -204,3 +226,4 @@ function addFileServerTarget(tree, options, targetName) {
204
226
  };
205
227
  (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
206
228
  }
229
+ exports.default = remixApplicationGenerator;
@@ -795,6 +795,25 @@ export function NxWelcome({ title }: { title: string }) {
795
795
  nx g @nx/react:component ui/src/lib/button
796
796
  </pre>
797
797
  </details>
798
+ <details>
799
+ <summary>
800
+ <svg
801
+ fill="none"
802
+ stroke="currentColor"
803
+ viewBox="0 0 24 24"
804
+ xmlns="http://www.w3.org/2000/svg"
805
+ >
806
+ <path
807
+ strokeLinecap="round"
808
+ strokeLinejoin="round"
809
+ strokeWidth="2"
810
+ d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
811
+ />
812
+ </svg>
813
+ View project details
814
+ </summary>
815
+ <pre>nx show project { title } --web</pre>
816
+ </details>
798
817
  <details>
799
818
  <summary>
800
819
  <svg
@@ -14,6 +14,7 @@ async function normalizeOptions(tree, options) {
14
14
  });
15
15
  options.rootProject = projectRoot === '.';
16
16
  options.projectNameAndRootFormat = projectNameAndRootFormat;
17
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
17
18
  const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
18
19
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
19
20
  const parsedTags = options.tags
@@ -12,4 +12,5 @@ export interface NxRemixGeneratorSchema {
12
12
  e2eTestRunner?: 'cypress' | 'none';
13
13
  skipFormat?: boolean;
14
14
  rootProject?: boolean;
15
+ addPlugin?: boolean;
15
16
  }
@@ -1,3 +1,5 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import { type CypressComponentConfigurationSchema } from './schema';
3
- export default function cypressComponentConfigurationGenerator(tree: Tree, options: CypressComponentConfigurationSchema): Promise<void>;
3
+ export declare function cypressComponentConfigurationGenerator(tree: Tree, options: CypressComponentConfigurationSchema): Promise<void>;
4
+ export declare function cypressComponentConfigurationGeneratorInternal(tree: Tree, options: CypressComponentConfigurationSchema): Promise<void>;
5
+ export default cypressComponentConfigurationGenerator;
@@ -1,15 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cypressComponentConfigurationGeneratorInternal = exports.cypressComponentConfigurationGenerator = void 0;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const path_1 = require("path");
5
6
  const react_1 = require("@nx/react");
6
- async function cypressComponentConfigurationGenerator(tree, options) {
7
+ function cypressComponentConfigurationGenerator(tree, options) {
8
+ return cypressComponentConfigurationGeneratorInternal(tree, {
9
+ addPlugin: false,
10
+ ...options,
11
+ });
12
+ }
13
+ exports.cypressComponentConfigurationGenerator = cypressComponentConfigurationGenerator;
14
+ async function cypressComponentConfigurationGeneratorInternal(tree, options) {
15
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
7
16
  await (0, react_1.cypressComponentConfigGenerator)(tree, {
8
17
  project: options.project,
9
18
  generateTests: options.generateTests,
10
19
  skipFormat: true,
11
20
  bundler: 'vite',
12
21
  buildTarget: '',
22
+ addPlugin: options.addPlugin,
13
23
  });
14
24
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
15
25
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), project.root, { tmpl: '' });
@@ -17,4 +27,5 @@ async function cypressComponentConfigurationGenerator(tree, options) {
17
27
  await (0, devkit_1.formatFiles)(tree);
18
28
  }
19
29
  }
30
+ exports.cypressComponentConfigurationGeneratorInternal = cypressComponentConfigurationGeneratorInternal;
20
31
  exports.default = cypressComponentConfigurationGenerator;
@@ -2,4 +2,5 @@ export interface CypressComponentConfigurationSchema {
2
2
  project: string;
3
3
  generateTests?: boolean;
4
4
  skipFormat?: boolean;
5
+ addPlugin?: boolean;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import { type Tree, GeneratorCallback } from '@nx/devkit';
2
2
  import { type Schema } from './schema';
3
3
  export declare function remixInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
4
+ export declare function remixInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
4
5
  export default remixInitGenerator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.remixInitGenerator = void 0;
3
+ exports.remixInitGeneratorInternal = exports.remixInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
6
6
  const plugin_1 = require("../../plugins/plugin");
@@ -26,7 +26,11 @@ function addPlugin(tree) {
26
26
  });
27
27
  (0, devkit_1.updateNxJson)(tree, nxJson);
28
28
  }
29
- async function remixInitGenerator(tree, options) {
29
+ function remixInitGenerator(tree, options) {
30
+ return remixInitGeneratorInternal(tree, { addPlugin: false, ...options });
31
+ }
32
+ exports.remixInitGenerator = remixInitGenerator;
33
+ async function remixInitGeneratorInternal(tree, options) {
30
34
  const tasks = [];
31
35
  if (!options.skipPackageJson) {
32
36
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
@@ -37,7 +41,7 @@ async function remixInitGenerator(tree, options) {
37
41
  }, undefined, options.keepExistingVersions);
38
42
  tasks.push(installTask);
39
43
  }
40
- if (process.env.NX_PCV3 === 'true') {
44
+ if (options.addPlugin) {
41
45
  addPlugin(tree);
42
46
  }
43
47
  if (options.updatePackageScripts) {
@@ -48,5 +52,5 @@ async function remixInitGenerator(tree, options) {
48
52
  }
49
53
  return (0, devkit_1.runTasksInSerial)(...tasks);
50
54
  }
51
- exports.remixInitGenerator = remixInitGenerator;
55
+ exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
52
56
  exports.default = remixInitGenerator;
@@ -3,4 +3,5 @@ export interface Schema {
3
3
  skipPackageJson?: boolean;
4
4
  keepExistingVersions?: boolean;
5
5
  updatePackageScripts?: boolean;
6
+ addPlugin?: boolean;
6
7
  }
@@ -11,6 +11,7 @@ async function normalizeOptions(tree, options) {
11
11
  projectNameAndRootFormat: options.projectNameAndRootFormat,
12
12
  callingGenerator: '@nx/remix:library',
13
13
  });
14
+ options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
14
15
  const importPath = options.importPath ?? (0, get_import_path_1.getImportPath)(tree, projectRoot);
15
16
  return {
16
17
  ...options,
@@ -1,4 +1,6 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import { GeneratorCallback } from '@nx/devkit';
3
3
  import type { NxRemixGeneratorSchema } from './schema';
4
- export default function (tree: Tree, schema: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
4
+ export declare function remixLibraryGenerator(tree: Tree, schema: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
5
+ export declare function remixLibraryGeneratorInternal(tree: Tree, schema: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
6
+ export default remixLibraryGenerator;
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remixLibraryGeneratorInternal = exports.remixLibraryGenerator = void 0;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const eslint_1 = require("@nx/eslint");
5
6
  const react_1 = require("@nx/react");
6
7
  const lib_1 = require("./lib");
7
- async function default_1(tree, schema) {
8
+ async function remixLibraryGenerator(tree, schema) {
9
+ return remixLibraryGeneratorInternal(tree, { addPlugin: false, ...schema });
10
+ }
11
+ exports.remixLibraryGenerator = remixLibraryGenerator;
12
+ async function remixLibraryGeneratorInternal(tree, schema) {
8
13
  const tasks = [];
9
14
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
10
15
  const libGenTask = await (0, react_1.libraryGenerator)(tree, {
@@ -20,6 +25,7 @@ async function default_1(tree, schema) {
20
25
  linter: eslint_1.Linter.EsLint,
21
26
  component: true,
22
27
  buildable: options.buildable,
28
+ addPlugin: options.addPlugin,
23
29
  });
24
30
  tasks.push(libGenTask);
25
31
  if (options.unitTestRunner && options.unitTestRunner !== 'none') {
@@ -35,4 +41,5 @@ async function default_1(tree, schema) {
35
41
  }
36
42
  return (0, devkit_1.runTasksInSerial)(...tasks);
37
43
  }
38
- exports.default = default_1;
44
+ exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal;
45
+ exports.default = remixLibraryGenerator;
@@ -12,4 +12,5 @@ export interface NxRemixGeneratorSchema {
12
12
  unitTestRunner?: 'jest' | 'vitest' | 'none';
13
13
  js?: boolean;
14
14
  skipFormat?: boolean;
15
+ addPlugin?: boolean;
15
16
  }
@@ -18,6 +18,7 @@ async function default_1(tree, _options) {
18
18
  unitTestRunner: options.unitTestRunner ?? 'vitest',
19
19
  e2eTestRunner: options.e2eTestRunner ?? 'cypress',
20
20
  js: options.js ?? false,
21
+ addPlugin: process.env.NX_ADD_PLUGINS !== 'false',
21
22
  });
22
23
  tasks.push(appGenTask);
23
24
  tree.delete('apps');
@@ -10,7 +10,7 @@ const config: StorybookConfig = {
10
10
  name: '@storybook/react-vite',
11
11
  options: {
12
12
  builder: {
13
- viteConfigPath: 'libs/storybook-test/vite.config.ts',
13
+ viteConfigPath: 'vite.config.ts',
14
14
  },
15
15
  },
16
16
  },
@@ -34,7 +34,7 @@ const config: StorybookConfig = {
34
34
  name: '@storybook/react-vite',
35
35
  options: {
36
36
  builder: {
37
- viteConfigPath: 'libs/storybook-test/vite.config.ts',
37
+ viteConfigPath: 'vite.config.ts',
38
38
  },
39
39
  },
40
40
  },
@@ -58,7 +58,7 @@ const config: StorybookConfig = {
58
58
  name: '@storybook/react-vite',
59
59
  options: {
60
60
  builder: {
61
- viteConfigPath: 'libs/storybook-test/vite.config.ts',
61
+ viteConfigPath: 'vite.config.ts',
62
62
  },
63
63
  },
64
64
  },
@@ -12,4 +12,5 @@ export interface StorybookConfigurationSchema {
12
12
  ignorePaths?: string[];
13
13
  configureTestRunner?: boolean;
14
14
  configureStaticServe?: boolean;
15
+ addPlugin?: boolean;
15
16
  }
@@ -1,3 +1,4 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import type { StorybookConfigurationSchema } from './schema';
3
- export default function remixStorybookConfiguration(tree: Tree, schema: StorybookConfigurationSchema): Promise<import("@nx/devkit").GeneratorCallback>;
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,9 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remixStorybookConfiguration = void 0;
3
4
  const devkit_1 = require("@nx/devkit");
4
5
  const path_1 = require("path");
5
6
  const react_1 = require("@nx/react");
6
- async function remixStorybookConfiguration(tree, schema) {
7
+ function remixStorybookConfiguration(tree, schema) {
8
+ return remixStorybookConfigurationInternal(tree, {
9
+ addPlugin: false,
10
+ ...schema,
11
+ });
12
+ }
13
+ exports.remixStorybookConfiguration = remixStorybookConfiguration;
14
+ async function remixStorybookConfigurationInternal(tree, schema) {
15
+ schema.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
7
16
  const { root } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
8
17
  if (!tree.exists((0, devkit_1.joinPathFragments)(root, 'vite.config.ts'))) {
9
18
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), root, { tpl: '' });
@@ -11,4 +20,4 @@ async function remixStorybookConfiguration(tree, schema) {
11
20
  const task = await (0, react_1.storybookConfigurationGenerator)(tree, schema);
12
21
  return task;
13
22
  }
14
- exports.default = remixStorybookConfiguration;
23
+ exports.default = remixStorybookConfigurationInternal;
@@ -17,7 +17,7 @@ exports[`@nx/remix/plugin non-root project should create nodes 1`] = `
17
17
  "^production",
18
18
  ],
19
19
  "options": {
20
- "outputPath": "{workspaceRoot}/dist",
20
+ "outputPath": "{workspaceRoot}/dist/my-app",
21
21
  },
22
22
  "outputs": [
23
23
  "{options.outputPath}",
@@ -8,6 +8,7 @@ const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
8
8
  const js_1 = require("@nx/js");
9
9
  const path_1 = require("path");
10
10
  const fs_1 = require("fs");
11
+ const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
11
12
  const cachePath = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'remix.hash');
12
13
  const targetsCache = (0, fs_1.existsSync)(cachePath) ? readTargetsCache() : {};
13
14
  const calculatedTargets = {};
@@ -39,7 +40,7 @@ exports.createNodes = [
39
40
  ]);
40
41
  const targets = targetsCache[hash]
41
42
  ? targetsCache[hash]
42
- : await buildRemixTargets(configFilePath, projectRoot, options, context);
43
+ : await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles);
43
44
  calculatedTargets[hash] = targets;
44
45
  return {
45
46
  projects: {
@@ -51,17 +52,18 @@ exports.createNodes = [
51
52
  };
52
53
  },
53
54
  ];
54
- async function buildRemixTargets(configFilePath, projectRoot, options, context) {
55
+ async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles) {
55
56
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
56
57
  const serverBuildPath = await getServerBuildPath(configFilePath, context.workspaceRoot);
57
58
  const targets = {};
58
- targets[options.buildTargetName] = buildTarget(options.buildTargetName, namedInputs);
59
+ targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, namedInputs);
59
60
  targets[options.serveTargetName] = serveTarget(serverBuildPath);
60
61
  targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName);
61
- targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs);
62
+ targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
62
63
  return targets;
63
64
  }
64
- function buildTarget(buildTargetName, namedInputs) {
65
+ function buildTarget(buildTargetName, projectRoot, namedInputs) {
66
+ const pathToOutput = projectRoot === '.' ? '' : `/${projectRoot}`;
65
67
  return {
66
68
  cache: true,
67
69
  dependsOn: [`^${buildTargetName}`],
@@ -73,7 +75,7 @@ function buildTarget(buildTargetName, namedInputs) {
73
75
  outputs: ['{options.outputPath}'],
74
76
  executor: '@nx/remix:build',
75
77
  options: {
76
- outputPath: '{workspaceRoot}/dist',
78
+ outputPath: `{workspaceRoot}/dist${pathToOutput}`,
77
79
  },
78
80
  };
79
81
  }
@@ -94,15 +96,17 @@ function startTarget(projectRoot, serverBuildPath, buildTargetName) {
94
96
  },
95
97
  };
96
98
  }
97
- function typecheckTarget(projectRoot, namedInputs) {
99
+ function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
100
+ const hasTsConfigAppJson = siblingFiles.includes('tsconfig.app.json');
101
+ const command = `tsc${hasTsConfigAppJson ? ` --project tsconfig.app.json` : ``}`;
98
102
  return {
103
+ command,
99
104
  cache: true,
100
105
  inputs: [
101
106
  ...('production' in namedInputs
102
107
  ? ['production', '^production']
103
108
  : ['default', '^default']),
104
109
  ],
105
- command: 'tsc',
106
110
  options: {
107
111
  cwd: projectRoot,
108
112
  },
@@ -110,20 +114,7 @@ function typecheckTarget(projectRoot, namedInputs) {
110
114
  }
111
115
  async function getServerBuildPath(configFilePath, workspaceRoot) {
112
116
  const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
113
- let appConfig = {};
114
- try {
115
- let appConfigModule;
116
- try {
117
- appConfigModule = await Function(`return import("${configPath}?t=${Date.now()}")`)();
118
- }
119
- catch {
120
- appConfigModule = require(configPath);
121
- }
122
- appConfig = appConfigModule?.default || appConfigModule;
123
- }
124
- catch (error) {
125
- throw new Error(`Error loading Remix config at ${configFilePath}\n${String(error)}`);
126
- }
117
+ let appConfig = await (0, config_utils_1.loadConfigFile)(configPath);
127
118
  return appConfig.serverBuildPath ?? 'build/index.js';
128
119
  }
129
120
  function normalizeOptions(options) {
@@ -1,3 +0,0 @@
1
- import { GeneratorCallback, Tree } from '@nx/devkit';
2
- import { CypressGeneratorSchema } from './schema';
3
- export default function (tree: Tree, options: CypressGeneratorSchema): Promise<GeneratorCallback>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
- const cypress_1 = require("@nx/cypress");
5
- const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
- const versions_1 = require("../../utils/versions");
7
- async function default_1(tree, options) {
8
- const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
9
- name: options.name,
10
- projectType: 'application',
11
- directory: options.directory,
12
- projectNameAndRootFormat: options.projectNameAndRootFormat,
13
- callingGenerator: '@nx/remix:cypress',
14
- });
15
- const rootProject = e2eProjectRoot === '.';
16
- let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
17
- options.baseUrl ??= `http://localhost:${projectConfig.targets['serve'].options.port}`;
18
- addFileServerTarget(tree, options, 'serve-static');
19
- (0, devkit_1.addProjectConfiguration)(tree, e2eProjectName, {
20
- projectType: 'application',
21
- root: e2eProjectRoot,
22
- sourceRoot: (0, devkit_1.joinPathFragments)(e2eProjectRoot, 'src'),
23
- targets: {},
24
- tags: [],
25
- implicitDependencies: [options.name],
26
- });
27
- const installTask = await (0, cypress_1.configurationGenerator)(tree, {
28
- project: e2eProjectName,
29
- directory: 'src',
30
- linter: options.linter,
31
- skipPackageJson: false,
32
- skipFormat: true,
33
- devServerTarget: `${options.project}:serve:development`,
34
- baseUrl: options.baseUrl,
35
- rootProject,
36
- });
37
- projectConfig = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
38
- tree.delete((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'app.po.ts'));
39
- tree.write((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'e2e', 'app.cy.ts'), `describe('webapp', () => {
40
- beforeEach(() => cy.visit('/'));
41
-
42
- it('should display welcome message', () => {
43
- cy.get('h1').contains('Welcome to Remix');
44
- });
45
- });`);
46
- const supportFilePath = (0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'e2e.ts');
47
- const supportContent = tree.read(supportFilePath, 'utf-8');
48
- tree.write(supportFilePath, `${supportContent}
49
-
50
- // from https://github.com/remix-run/indie-stack
51
- Cypress.on("uncaught:exception", (err) => {
52
- // Cypress and React Hydrating the document don't get along
53
- // for some unknown reason. Hopefully we figure out why eventually
54
- // so we can remove this.
55
- if (
56
- /hydrat/i.test(err.message) ||
57
- /Minified React error #418/.test(err.message) ||
58
- /Minified React error #423/.test(err.message)
59
- ) {
60
- return false;
61
- }
62
- });`);
63
- return (0, devkit_1.runTasksInSerial)(installTask);
64
- }
65
- exports.default = default_1;
66
- function addFileServerTarget(tree, options, targetName) {
67
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
68
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
69
- projectConfig.targets[targetName] = {
70
- executor: '@nx/web:file-server',
71
- options: {
72
- buildTarget: `${options.project}:build`,
73
- port: projectConfig.targets['serve'].options.port,
74
- },
75
- };
76
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
77
- }
@@ -1,14 +0,0 @@
1
- import { type ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
- import { Linter } from '@nx/eslint';
3
-
4
- export interface CypressGeneratorSchema {
5
- project: string;
6
- name: string;
7
- baseUrl?: string;
8
- directory?: string;
9
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
10
- linter?: Linter;
11
- js?: boolean;
12
- skipFormat?: boolean;
13
- setParserOptionsProject?: boolean;
14
- }
@@ -1,61 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "NxRemixCypress",
4
- "title": "",
5
- "type": "object",
6
- "description": "Generate a Cypress e2e project for a given application.",
7
- "properties": {
8
- "project": {
9
- "type": "string",
10
- "description": "The name of the frontend project to test.",
11
- "$default": {
12
- "$source": "projectName"
13
- }
14
- },
15
- "projectNameAndRootFormat": {
16
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
17
- "type": "string",
18
- "enum": ["as-provided", "derived"]
19
- },
20
- "baseUrl": {
21
- "type": "string",
22
- "description": "URL to access the application on",
23
- "default": "http://localhost:3000"
24
- },
25
- "name": {
26
- "type": "string",
27
- "description": "Name of the E2E Project",
28
- "$default": {
29
- "$source": "argv",
30
- "index": 0
31
- },
32
- "x-prompt": "What name would you like to use for the e2e project?"
33
- },
34
- "directory": {
35
- "type": "string",
36
- "description": "A directory where the project is placed"
37
- },
38
- "linter": {
39
- "description": "The tool to use for running lint checks.",
40
- "type": "string",
41
- "enum": ["eslint", "none"],
42
- "default": "eslint"
43
- },
44
- "js": {
45
- "description": "Generate JavaScript files rather than TypeScript files",
46
- "type": "boolean",
47
- "default": false
48
- },
49
- "skipFormat": {
50
- "description": "Skip formatting files",
51
- "type": "boolean",
52
- "default": false
53
- },
54
- "setParserOptionsProject": {
55
- "type": "boolean",
56
- "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
57
- "default": false
58
- }
59
- },
60
- "required": ["name"]
61
- }