@nx/remix 0.0.0-pr-3-ec41644 → 0.0.0-pr-29993-91cbae3
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/package.json +4 -4
- package/src/generators/application/application.impl.js +15 -2
- package/src/generators/application/files/ts-solution/package.json__tmpl__ +2 -5
- package/src/generators/application/lib/add-e2e.js +24 -23
- package/src/generators/application/lib/normalize-options.d.ts +1 -0
- package/src/generators/application/lib/normalize-options.js +9 -9
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +4 -0
- package/src/generators/library/lib/add-tsconfig-entry-points.js +6 -8
- package/src/generators/library/lib/normalize-options.js +5 -6
- package/src/generators/library/lib/update-buildable-config.js +1 -1
- package/src/generators/library/library.impl.js +7 -2
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29993-91cbae3",
|
|
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": "0.0.0-pr-
|
|
33
|
-
"@nx/js": "0.0.0-pr-
|
|
34
|
-
"@nx/react": "0.0.0-pr-
|
|
32
|
+
"@nx/devkit": "0.0.0-pr-29993-91cbae3",
|
|
33
|
+
"@nx/js": "0.0.0-pr-29993-91cbae3",
|
|
34
|
+
"@nx/react": "0.0.0-pr-29993-91cbae3",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
37
37
|
},
|
|
@@ -17,6 +17,7 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
|
17
17
|
function remixApplicationGenerator(tree, options) {
|
|
18
18
|
return remixApplicationGeneratorInternal(tree, {
|
|
19
19
|
addPlugin: true,
|
|
20
|
+
useProjectJson: true,
|
|
20
21
|
...options,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -40,9 +41,9 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
40
41
|
// If we are using the new TS solution
|
|
41
42
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
42
43
|
if (options.isUsingTsSolutionConfig) {
|
|
43
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
44
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
44
45
|
}
|
|
45
|
-
if (
|
|
46
|
+
if (options.useProjectJson) {
|
|
46
47
|
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
47
48
|
root: options.projectRoot,
|
|
48
49
|
sourceRoot: `${options.projectRoot}`,
|
|
@@ -82,6 +83,18 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
82
83
|
if (options.isUsingTsSolutionConfig) {
|
|
83
84
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
|
|
84
85
|
}
|
|
86
|
+
if (!options.useProjectJson) {
|
|
87
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
|
|
88
|
+
if (options.projectName !== options.importPath) {
|
|
89
|
+
json.nx = { name: options.projectName };
|
|
90
|
+
}
|
|
91
|
+
if (options.parsedTags?.length) {
|
|
92
|
+
json.nx ??= {};
|
|
93
|
+
json.nx.tags = options.parsedTags;
|
|
94
|
+
}
|
|
95
|
+
return json;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
85
98
|
if (options.unitTestRunner !== 'none') {
|
|
86
99
|
if (options.unitTestRunner === 'vitest') {
|
|
87
100
|
const { vitestGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": true,
|
|
3
|
-
"name": "<%=
|
|
3
|
+
"name": "<%= importPath %>",
|
|
4
4
|
"scripts": {},
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -19,8 +19,5 @@
|
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
22
|
-
"sideEffects": false
|
|
23
|
-
"nx": {
|
|
24
|
-
"tags": <%- JSON.stringify(parsedTags) %>
|
|
25
|
-
}<% } %>
|
|
22
|
+
"sideEffects": false
|
|
26
23
|
}
|
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
async function addE2E(tree, options) {
|
|
11
10
|
const hasRemixPlugin = (0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
12
11
|
? p === '@nx/remix/plugin'
|
|
@@ -14,17 +13,15 @@ async function addE2E(tree, options) {
|
|
|
14
13
|
let e2eWebsServerInfo = await getRemixE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.projectRoot, 'remix.config.js'), options.addPlugin ?? Boolean(hasRemixPlugin));
|
|
15
14
|
if (options.e2eTestRunner === 'cypress') {
|
|
16
15
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
});
|
|
16
|
+
const packageJson = {
|
|
17
|
+
name: options.e2eProjectName,
|
|
18
|
+
version: '0.0.1',
|
|
19
|
+
private: true,
|
|
20
|
+
};
|
|
21
|
+
if (!options.useProjectJson) {
|
|
22
|
+
packageJson.nx = {
|
|
23
|
+
implicitDependencies: [options.projectName],
|
|
24
|
+
};
|
|
28
25
|
}
|
|
29
26
|
else {
|
|
30
27
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
@@ -36,6 +33,9 @@ async function addE2E(tree, options) {
|
|
|
36
33
|
implicitDependencies: [options.projectName],
|
|
37
34
|
});
|
|
38
35
|
}
|
|
36
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
37
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
38
|
+
}
|
|
39
39
|
const e2eTask = await configurationGenerator(tree, {
|
|
40
40
|
project: options.e2eProjectName,
|
|
41
41
|
directory: 'src',
|
|
@@ -71,17 +71,15 @@ async function addE2E(tree, options) {
|
|
|
71
71
|
}
|
|
72
72
|
else if (options.e2eTestRunner === 'playwright') {
|
|
73
73
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
});
|
|
74
|
+
const packageJson = {
|
|
75
|
+
name: options.e2eProjectName,
|
|
76
|
+
version: '0.0.1',
|
|
77
|
+
private: true,
|
|
78
|
+
};
|
|
79
|
+
if (!options.useProjectJson) {
|
|
80
|
+
packageJson.nx = {
|
|
81
|
+
implicitDependencies: [options.projectName],
|
|
82
|
+
};
|
|
85
83
|
}
|
|
86
84
|
else {
|
|
87
85
|
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
@@ -93,6 +91,9 @@ async function addE2E(tree, options) {
|
|
|
93
91
|
implicitDependencies: [options.projectName],
|
|
94
92
|
});
|
|
95
93
|
}
|
|
94
|
+
if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
|
|
95
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
96
|
+
}
|
|
96
97
|
const e2eTask = await configurationGenerator(tree, {
|
|
97
98
|
project: options.e2eProjectName,
|
|
98
99
|
skipFormat: true,
|
|
@@ -5,10 +5,9 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
7
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
9
8
|
async function normalizeOptions(tree, options) {
|
|
10
|
-
await (0, project_name_and_root_utils_1.
|
|
11
|
-
const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
10
|
+
const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
12
11
|
name: options.name,
|
|
13
12
|
projectType: 'application',
|
|
14
13
|
directory: options.directory,
|
|
@@ -19,23 +18,24 @@ async function normalizeOptions(tree, options) {
|
|
|
19
18
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
20
19
|
nxJson.useInferencePlugins !== false;
|
|
21
20
|
options.addPlugin ??= addPluginDefault;
|
|
22
|
-
const
|
|
21
|
+
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
22
|
+
const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
|
|
23
|
+
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
23
24
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
|
|
24
25
|
const parsedTags = options.tags
|
|
25
26
|
? options.tags.split(',').map((s) => s.trim())
|
|
26
27
|
: [];
|
|
27
|
-
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
|
|
28
28
|
return {
|
|
29
29
|
...options,
|
|
30
30
|
linter: options.linter ?? eslint_1.Linter.EsLint,
|
|
31
|
-
projectName:
|
|
32
|
-
? (0, get_import_path_1.getImportPath)(tree, projectName)
|
|
33
|
-
: projectName,
|
|
31
|
+
projectName: appProjectName,
|
|
34
32
|
projectRoot,
|
|
33
|
+
importPath,
|
|
35
34
|
e2eProjectName,
|
|
36
35
|
e2eProjectRoot,
|
|
37
36
|
parsedTags,
|
|
38
|
-
useTsSolution:
|
|
37
|
+
useTsSolution: isUsingTsSolutionConfig,
|
|
39
38
|
isUsingTsSolutionConfig,
|
|
39
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
"type": "boolean",
|
|
58
58
|
"x-priority": "internal",
|
|
59
59
|
"default": false
|
|
60
|
+
},
|
|
61
|
+
"useProjectJson": {
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
60
64
|
}
|
|
61
65
|
},
|
|
62
66
|
"required": ["directory"]
|
|
@@ -3,19 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addTsconfigEntryPoints = addTsconfigEntryPoints;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
7
|
function addTsconfigEntryPoints(tree, options) {
|
|
8
8
|
const { root: projectRoot, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
9
|
-
const
|
|
9
|
+
const projectSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(tree, sourceRoot, projectRoot);
|
|
10
|
+
const serverFilePath = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'server.ts');
|
|
10
11
|
tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
|
|
11
12
|
const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
|
|
12
|
-
// Use same logic as `determineProjectNameAndRootOptions` to get the import path
|
|
13
|
-
const importPath = (0, project_name_and_root_utils_1.resolveImportPath)(tree, options.name, projectRoot);
|
|
14
13
|
(0, devkit_1.updateJson)(tree, baseTsConfig, (json) => {
|
|
15
|
-
if (json.compilerOptions.paths &&
|
|
16
|
-
json.compilerOptions.paths[
|
|
17
|
-
|
|
18
|
-
];
|
|
14
|
+
if (json.compilerOptions.paths &&
|
|
15
|
+
json.compilerOptions.paths[options.importPath]) {
|
|
16
|
+
json.compilerOptions.paths[(0, devkit_1.joinPathFragments)(options.importPath, 'server')] = [serverFilePath];
|
|
19
17
|
}
|
|
20
18
|
return json;
|
|
21
19
|
});
|
|
@@ -4,10 +4,9 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
-
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
8
7
|
async function normalizeOptions(tree, options) {
|
|
9
|
-
await (0, project_name_and_root_utils_1.
|
|
10
|
-
const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
9
|
+
const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
11
10
|
name: options.name,
|
|
12
11
|
projectType: 'library',
|
|
13
12
|
directory: options.directory,
|
|
@@ -20,10 +19,10 @@ async function normalizeOptions(tree, options) {
|
|
|
20
19
|
return {
|
|
21
20
|
...options,
|
|
22
21
|
unitTestRunner: options.unitTestRunner ?? 'vitest',
|
|
23
|
-
projectName: isUsingTsSolutionConfig
|
|
24
|
-
? (0, get_import_path_1.getImportPath)(tree, projectName)
|
|
25
|
-
: projectName,
|
|
22
|
+
projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
26
23
|
projectRoot,
|
|
24
|
+
importPath,
|
|
27
25
|
isUsingTsSolutionConfig,
|
|
26
|
+
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
28
27
|
};
|
|
29
28
|
}
|
|
@@ -13,7 +13,7 @@ function updateBuildableConfig(tree, options) {
|
|
|
13
13
|
format: ['cjs'],
|
|
14
14
|
outputPath: (0, devkit_1.joinPathFragments)(project.root, 'dist'),
|
|
15
15
|
};
|
|
16
|
-
(0, devkit_1.updateProjectConfiguration)(tree, options.
|
|
16
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, project);
|
|
17
17
|
// Point to nested dist for yarn/npm/pnpm workspaces
|
|
18
18
|
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'), (json) => {
|
|
19
19
|
json.main = './dist/index.cjs.js';
|
|
@@ -9,13 +9,17 @@ const lib_1 = require("./lib");
|
|
|
9
9
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
10
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
11
11
|
async function remixLibraryGenerator(tree, schema) {
|
|
12
|
-
return remixLibraryGeneratorInternal(tree, {
|
|
12
|
+
return remixLibraryGeneratorInternal(tree, {
|
|
13
|
+
addPlugin: false,
|
|
14
|
+
useProjectJson: true,
|
|
15
|
+
...schema,
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
async function remixLibraryGeneratorInternal(tree, schema) {
|
|
15
19
|
const tasks = [];
|
|
16
20
|
const options = await (0, lib_1.normalizeOptions)(tree, schema);
|
|
17
21
|
if (options.isUsingTsSolutionConfig) {
|
|
18
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
22
|
+
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
19
23
|
}
|
|
20
24
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
21
25
|
js: options.js,
|
|
@@ -36,6 +40,7 @@ async function remixLibraryGeneratorInternal(tree, schema) {
|
|
|
36
40
|
buildable: options.buildable,
|
|
37
41
|
bundler: options.bundler,
|
|
38
42
|
addPlugin: options.addPlugin,
|
|
43
|
+
useProjectJson: options.useProjectJson,
|
|
39
44
|
});
|
|
40
45
|
tasks.push(libGenTask);
|
|
41
46
|
if (options.unitTestRunner && options.unitTestRunner !== 'none') {
|
|
@@ -81,6 +81,10 @@
|
|
|
81
81
|
"default": false,
|
|
82
82
|
"description": "Generate a buildable library that uses rollup to bundle.",
|
|
83
83
|
"x-deprecated": "Use the `bundler` option for greater control (none, vite, rollup)."
|
|
84
|
+
},
|
|
85
|
+
"useProjectJson": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
90
|
"required": ["directory"]
|