@nx/remix 19.4.0-beta.0 → 19.4.0-beta.2

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.
package/generators.json CHANGED
@@ -85,6 +85,11 @@
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
+ "convert-to-inferred": {
90
+ "factory": "./src/generators/convert-to-inferred/convert-to-inferred",
91
+ "schema": "./src/generators/convert-to-inferred/schema.json",
92
+ "description": "Convert existing Remix project(s) using `@nx/remix:*` executors to use `@nx/remix/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target."
88
93
  }
89
94
  }
90
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "19.4.0-beta.0",
3
+ "version": "19.4.0-beta.2",
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,12 +29,12 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "19.4.0-beta.0",
33
- "@nx/js": "19.4.0-beta.0",
34
- "@nx/react": "19.4.0-beta.0",
32
+ "@nx/devkit": "19.4.0-beta.2",
33
+ "@nx/js": "19.4.0-beta.2",
34
+ "@nx/react": "19.4.0-beta.2",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1",
37
- "@nrwl/remix": "19.4.0-beta.0"
37
+ "@nrwl/remix": "19.4.0-beta.2"
38
38
  },
39
39
  "peerDependencies": {},
40
40
  "publishConfig": {
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@remix-run/dev": "<%= remixVersion %>",
18
- "@remix-run/eslint-config": "<%= remixVersion %>",
19
18
  "@types/react": "<%= typesReactVersion %>",
20
19
  "@types/react-dom": "<%= typesReactDomVersion %>",
21
20
  "eslint": "<%= eslintVersion %>",
@@ -0,0 +1,7 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ interface Schema {
3
+ project?: string;
4
+ skipFormat?: boolean;
5
+ }
6
+ export declare function convertToInferred(tree: Tree, options: Schema): Promise<() => void>;
7
+ export default convertToInferred;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToInferred = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
6
+ const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
7
+ const plugin_1 = require("../../plugins/plugin");
8
+ const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
9
+ const serve_post_target_transformer_1 = require("./lib/serve-post-target-transformer");
10
+ async function convertToInferred(tree, options) {
11
+ const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
12
+ const migrationLogs = new aggregate_log_util_1.AggregatedLog();
13
+ const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPluginV1)(tree, projectGraph, '@nx/remix/plugin', plugin_1.createNodes, {
14
+ buildTargetName: 'build',
15
+ devTargetName: 'dev',
16
+ startTargetName: 'start',
17
+ staticServeTargetName: 'static-serve',
18
+ typecheckTargetName: 'typecheck',
19
+ }, [
20
+ {
21
+ executors: ['@nx/remix:build'],
22
+ postTargetTransformer: (0, build_post_target_transformer_1.buildPostTargetTransformer)(migrationLogs),
23
+ targetPluginOptionMapper: (targetName) => ({
24
+ buildTargetName: targetName,
25
+ }),
26
+ },
27
+ {
28
+ executors: ['@nx/remix:serve'],
29
+ postTargetTransformer: (0, serve_post_target_transformer_1.servePostTargetTransformer)(migrationLogs),
30
+ targetPluginOptionMapper: (targetName) => ({
31
+ devTargetName: targetName,
32
+ }),
33
+ },
34
+ ], options.project);
35
+ if (migratedProjects.size === 0) {
36
+ throw new Error('Could not find any targets to migrate.');
37
+ }
38
+ if (!options.skipFormat) {
39
+ await (0, devkit_1.formatFiles)(tree);
40
+ }
41
+ return () => {
42
+ migrationLogs.flushLogs();
43
+ };
44
+ }
45
+ exports.convertToInferred = convertToInferred;
46
+ exports.default = convertToInferred;
@@ -0,0 +1,6 @@
1
+ import { type Tree, type TargetConfiguration } from '@nx/devkit';
2
+ import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
3
+ export declare function buildPostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
+ projectName: string;
5
+ root: string;
6
+ }, inferredTargetConfiguration: TargetConfiguration) => TargetConfiguration<any>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPostTargetTransformer = void 0;
4
+ const utils_1 = require("./utils");
5
+ const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
6
+ function buildPostTargetTransformer(migrationLogs) {
7
+ return (target, tree, projectDetails, inferredTargetConfiguration) => {
8
+ const remixConfigPath = (0, utils_1.getConfigFilePath)(tree, projectDetails.root);
9
+ if (target.options) {
10
+ handlePropertiesFromTargetOptions(tree, target.options, projectDetails.projectName, projectDetails.root, migrationLogs);
11
+ }
12
+ if (target.configurations) {
13
+ for (const configurationName in target.configurations) {
14
+ const configuration = target.configurations[configurationName];
15
+ handlePropertiesFromTargetOptions(tree, configuration, projectDetails.projectName, projectDetails.root, migrationLogs);
16
+ }
17
+ if (Object.keys(target.configurations).length === 0) {
18
+ if ('defaultConfiguration' in target) {
19
+ delete target.defaultConfiguration;
20
+ }
21
+ delete target.configurations;
22
+ }
23
+ if ('defaultConfiguration' in target &&
24
+ !target.configurations[target.defaultConfiguration]) {
25
+ delete target.defaultConfiguration;
26
+ }
27
+ }
28
+ if (target.outputs) {
29
+ target.outputs = target.outputs.filter((out) => !out.includes('options.outputPath'));
30
+ (0, plugin_migration_utils_1.processTargetOutputs)(target, [], inferredTargetConfiguration, {
31
+ projectName: projectDetails.projectName,
32
+ projectRoot: projectDetails.root,
33
+ });
34
+ }
35
+ return target;
36
+ };
37
+ }
38
+ exports.buildPostTargetTransformer = buildPostTargetTransformer;
39
+ function handlePropertiesFromTargetOptions(tree, options, projectName, projectRoot, migrationLogs) {
40
+ if ('outputPath' in options) {
41
+ migrationLogs.addLog({
42
+ project: projectName,
43
+ executorName: '@nx/remix:build',
44
+ log: "Unable to migrate 'outputPath'. The Remix Config will contain the locations the build artifact will be output to.",
45
+ });
46
+ delete options.outputPath;
47
+ }
48
+ if ('includeDevDependenciesInPackageJson' in options) {
49
+ migrationLogs.addLog({
50
+ project: projectName,
51
+ executorName: '@nx/remix:build',
52
+ log: "Unable to migrate `includeDevDependenciesInPackageJson` to Remix Config. Use the `@nx/dependency-checks` ESLint rule to update your project's package.json.",
53
+ });
54
+ delete options.includeDevDependenciesInPackageJson;
55
+ }
56
+ if ('generatePackageJson' in options) {
57
+ migrationLogs.addLog({
58
+ project: projectName,
59
+ executorName: '@nx/remix:build',
60
+ log: "Unable to migrate `generatePackageJson` to Remix Config. Use the `@nx/dependency-checks` ESLint rule to update your project's package.json.",
61
+ });
62
+ delete options.generatePackageJson;
63
+ }
64
+ if ('generateLockfile' in options) {
65
+ migrationLogs.addLog({
66
+ project: projectName,
67
+ executorName: '@nx/remix:build',
68
+ log: 'Unable to migrate `generateLockfile` to Remix Config. This option is not supported.',
69
+ });
70
+ delete options.generateLockfile;
71
+ }
72
+ }
@@ -0,0 +1,6 @@
1
+ import { type Tree, type TargetConfiguration } from '@nx/devkit';
2
+ import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
3
+ export declare function servePostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
+ projectName: string;
5
+ root: string;
6
+ }, inferredTargetConfiguration: TargetConfiguration) => TargetConfiguration<any>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.servePostTargetTransformer = void 0;
4
+ const utils_1 = require("./utils");
5
+ function servePostTargetTransformer(migrationLogs) {
6
+ return (target, tree, projectDetails, inferredTargetConfiguration) => {
7
+ if (target.options) {
8
+ handlePropertiesFromTargetOptions(tree, target.options, projectDetails.projectName, projectDetails.root);
9
+ }
10
+ if (target.configurations) {
11
+ for (const configurationName in target.configurations) {
12
+ const configuration = target.configurations[configurationName];
13
+ handlePropertiesFromTargetOptions(tree, configuration, projectDetails.projectName, projectDetails.root);
14
+ }
15
+ if (Object.keys(target.configurations).length === 0) {
16
+ if ('defaultConfiguration' in target) {
17
+ delete target.defaultConfiguration;
18
+ }
19
+ delete target.configurations;
20
+ }
21
+ if ('defaultConfiguration' in target &&
22
+ !target.configurations[target.defaultConfiguration]) {
23
+ delete target.defaultConfiguration;
24
+ }
25
+ }
26
+ return target;
27
+ };
28
+ }
29
+ exports.servePostTargetTransformer = servePostTargetTransformer;
30
+ function handlePropertiesFromTargetOptions(tree, options, projectName, projectRoot) {
31
+ if ('debug' in options) {
32
+ delete options.debug;
33
+ }
34
+ if ('port' in options) {
35
+ options.env ??= {};
36
+ options.env.PORT = `${options.port}`;
37
+ delete options.port;
38
+ }
39
+ for (const [prevKey, newKey] of Object.entries(utils_1.REMIX_PROPERTY_MAPPINGS)) {
40
+ if (prevKey in options) {
41
+ let prevValue = options[prevKey];
42
+ delete options[prevKey];
43
+ options[newKey] = prevValue;
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,10 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export declare const REMIX_PROPERTY_MAPPINGS: {
3
+ sourcemap: string;
4
+ devServerPort: string;
5
+ command: string;
6
+ manual: string;
7
+ tlsKey: string;
8
+ tlsCert: string;
9
+ };
10
+ export declare function getConfigFilePath(tree: Tree, root: string): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getConfigFilePath = exports.REMIX_PROPERTY_MAPPINGS = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ exports.REMIX_PROPERTY_MAPPINGS = {
6
+ sourcemap: 'sourcemap',
7
+ devServerPort: 'port',
8
+ command: 'command',
9
+ manual: 'manual',
10
+ tlsKey: 'tls-key',
11
+ tlsCert: 'tls-cert',
12
+ };
13
+ function getConfigFilePath(tree, root) {
14
+ return [
15
+ (0, devkit_1.joinPathFragments)(root, `remix.config.js`),
16
+ (0, devkit_1.joinPathFragments)(root, `remix.config.cjs`),
17
+ (0, devkit_1.joinPathFragments)(root, `remix.config.mjs`),
18
+ ].find((f) => tree.exists(f));
19
+ }
20
+ exports.getConfigFilePath = getConfigFilePath;
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "$id": "NxRemixConvertToInferred",
4
+ "description": "Convert existing Remix project(s) using `@nx/remix:*` executors to use `@nx/remix/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target.",
5
+ "title": "Convert Remix project from executor to plugin",
6
+ "type": "object",
7
+ "properties": {
8
+ "project": {
9
+ "type": "string",
10
+ "description": "The project to convert from using the `@nx/remix:*` executors to use `@nx/remix/plugin`.",
11
+ "x-priority": "important"
12
+ },
13
+ "skipFormat": {
14
+ "type": "boolean",
15
+ "description": "Whether to format files at the end of the migration.",
16
+ "default": false
17
+ }
18
+ }
19
+ }
@@ -11,7 +11,6 @@ function updateDependencies(tree) {
11
11
  react: versions_1.reactVersion,
12
12
  'react-dom': versions_1.reactDomVersion,
13
13
  }, {
14
- '@remix-run/eslint-config': versions_1.remixVersion,
15
14
  '@types/react': versions_1.typesReactVersion,
16
15
  '@types/react-dom': versions_1.typesReactDomVersion,
17
16
  eslint: versions_1.eslintVersion,