@nx/remix 18.0.0-beta.1 → 18.0.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 +6 -6
- package/package.json +5 -5
- package/src/generators/application/application.impl.d.ts +3 -1
- package/src/generators/application/application.impl.js +25 -5
- package/src/generators/application/files/common/app/nx-welcome.tsx__tmpl__ +19 -0
- package/src/generators/application/lib/normalize-options.js +1 -0
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/cypress/cypress.impl.d.ts +3 -1
- package/src/generators/cypress/cypress.impl.js +11 -2
- package/src/generators/cypress/schema.d.ts +1 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.d.ts +3 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js +12 -1
- package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
- package/src/generators/init/init.d.ts +1 -0
- package/src/generators/init/init.js +8 -4
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/library/lib/normalize-options.js +1 -0
- package/src/generators/library/library.impl.d.ts +3 -1
- package/src/generators/library/library.impl.js +9 -2
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/preset/preset.impl.js +1 -0
- package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +3 -3
- package/src/generators/storybook-configuration/schema.d.ts +1 -0
- package/src/generators/storybook-configuration/storybook-configuration.impl.d.ts +2 -1
- package/src/generators/storybook-configuration/storybook-configuration.impl.js +11 -2
- package/src/plugins/plugin.js +2 -14
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
|
},
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"description": "Add an ErrorBoundary to an existing route"
|
|
88
88
|
},
|
|
89
89
|
"cypress": {
|
|
90
|
-
"implementation": "./src/generators/cypress/cypress.impl",
|
|
90
|
+
"implementation": "./src/generators/cypress/cypress.impl#cypressGeneratorInternal",
|
|
91
91
|
"schema": "./src/generators/cypress/schema.json",
|
|
92
92
|
"description": "Generate a project for testing Remix apps using Cypress"
|
|
93
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "18.0.0-beta.
|
|
3
|
+
"version": "18.0.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, 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.
|
|
32
|
-
"@nx/js": "18.0.0-beta.
|
|
33
|
-
"@nx/react": "18.0.0-beta.
|
|
31
|
+
"@nx/devkit": "18.0.0-beta.2",
|
|
32
|
+
"@nx/js": "18.0.0-beta.2",
|
|
33
|
+
"@nx/react": "18.0.0-beta.2",
|
|
34
34
|
"tslib": "^2.3.1",
|
|
35
35
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
36
|
-
"@nrwl/remix": "18.0.0-beta.
|
|
36
|
+
"@nrwl/remix": "18.0.0-beta.2"
|
|
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
|
|
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,21 @@ 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
|
-
|
|
13
|
+
function remixApplicationGenerator(tree, options) {
|
|
14
|
+
return remixApplicationGeneratorInternal(tree, {
|
|
15
|
+
addPlugin: false,
|
|
16
|
+
...options,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.remixApplicationGenerator = remixApplicationGenerator;
|
|
20
|
+
// TODO(@columferry): update this to use crystal?
|
|
21
|
+
async function remixApplicationGeneratorInternal(tree, _options) {
|
|
13
22
|
const options = await (0, lib_1.normalizeOptions)(tree, _options);
|
|
14
23
|
const tasks = [
|
|
15
|
-
await (0, init_1.default)(tree, {
|
|
24
|
+
await (0, init_1.default)(tree, {
|
|
25
|
+
skipFormat: true,
|
|
26
|
+
addPlugin: options.addPlugin,
|
|
27
|
+
}),
|
|
16
28
|
await (0, js_1.initGenerator)(tree, { skipFormat: true }),
|
|
17
29
|
];
|
|
18
30
|
(0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, '@nx/remix:build');
|
|
@@ -86,6 +98,7 @@ async function default_1(tree, _options) {
|
|
|
86
98
|
skipFormat: true,
|
|
87
99
|
testEnvironment: 'jsdom',
|
|
88
100
|
skipViteConfig: true,
|
|
101
|
+
addPlugin: options.addPlugin,
|
|
89
102
|
});
|
|
90
103
|
createOrEditViteConfig(tree, {
|
|
91
104
|
project: options.projectName,
|
|
@@ -106,10 +119,13 @@ async function default_1(tree, _options) {
|
|
|
106
119
|
skipSerializers: false,
|
|
107
120
|
skipPackageJson: false,
|
|
108
121
|
skipFormat: true,
|
|
122
|
+
addPlugin: options.addPlugin,
|
|
109
123
|
});
|
|
110
124
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
111
|
-
projectConfig.targets['test']
|
|
112
|
-
|
|
125
|
+
if (projectConfig.targets['test']?.options) {
|
|
126
|
+
projectConfig.targets['test'].options.passWithNoTests = true;
|
|
127
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
128
|
+
}
|
|
113
129
|
tasks.push(jestTask);
|
|
114
130
|
}
|
|
115
131
|
const pkgInstallTask = (0, lib_1.updateUnitTestConfig)(tree, options.projectRoot, options.unitTestRunner);
|
|
@@ -129,6 +145,7 @@ async function default_1(tree, _options) {
|
|
|
129
145
|
unitTestRunner: options.unitTestRunner,
|
|
130
146
|
skipFormat: true,
|
|
131
147
|
rootProject: options.rootProject,
|
|
148
|
+
addPlugin: options.addPlugin,
|
|
132
149
|
});
|
|
133
150
|
tasks.push(eslintTask);
|
|
134
151
|
}
|
|
@@ -165,6 +182,7 @@ async function default_1(tree, _options) {
|
|
|
165
182
|
// Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
|
|
166
183
|
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
167
184
|
}
|
|
185
|
+
// TODO(@columferry): add support for playwright?
|
|
168
186
|
if (options.e2eTestRunner === 'cypress') {
|
|
169
187
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
|
|
170
188
|
addFileServerTarget(tree, options, 'serve-static');
|
|
@@ -182,6 +200,7 @@ async function default_1(tree, _options) {
|
|
|
182
200
|
skipFormat: true,
|
|
183
201
|
devServerTarget: `${options.projectName}:serve:development`,
|
|
184
202
|
baseUrl: 'http://localhost:4200',
|
|
203
|
+
addPlugin: options.addPlugin,
|
|
185
204
|
}));
|
|
186
205
|
}
|
|
187
206
|
if (!options.skipFormat) {
|
|
@@ -192,7 +211,7 @@ async function default_1(tree, _options) {
|
|
|
192
211
|
});
|
|
193
212
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
194
213
|
}
|
|
195
|
-
exports.
|
|
214
|
+
exports.remixApplicationGeneratorInternal = remixApplicationGeneratorInternal;
|
|
196
215
|
function addFileServerTarget(tree, options, targetName) {
|
|
197
216
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
198
217
|
projectConfig.targets[targetName] = {
|
|
@@ -204,3 +223,4 @@ function addFileServerTarget(tree, options, targetName) {
|
|
|
204
223
|
};
|
|
205
224
|
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
206
225
|
}
|
|
226
|
+
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
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { CypressGeneratorSchema } from './schema';
|
|
3
|
-
export
|
|
3
|
+
export declare function cypressGenerator(tree: Tree, options: CypressGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
+
export declare function cypressGeneratorInternal(tree: Tree, options: CypressGeneratorSchema): Promise<GeneratorCallback>;
|
|
5
|
+
export default cypressGenerator;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cypressGeneratorInternal = exports.cypressGenerator = void 0;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const cypress_1 = require("@nx/cypress");
|
|
5
6
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
7
|
const versions_1 = require("../../utils/versions");
|
|
7
|
-
|
|
8
|
+
// TODO(@columferry): Does anything use this?
|
|
9
|
+
function cypressGenerator(tree, options) {
|
|
10
|
+
return cypressGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
11
|
+
}
|
|
12
|
+
exports.cypressGenerator = cypressGenerator;
|
|
13
|
+
async function cypressGeneratorInternal(tree, options) {
|
|
8
14
|
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
15
|
name: options.name,
|
|
10
16
|
projectType: 'application',
|
|
@@ -12,6 +18,7 @@ async function default_1(tree, options) {
|
|
|
12
18
|
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
19
|
callingGenerator: '@nx/remix:cypress',
|
|
14
20
|
});
|
|
21
|
+
options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
|
|
15
22
|
const rootProject = e2eProjectRoot === '.';
|
|
16
23
|
let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
17
24
|
options.baseUrl ??= `http://localhost:${projectConfig.targets['serve'].options.port}`;
|
|
@@ -33,6 +40,7 @@ async function default_1(tree, options) {
|
|
|
33
40
|
devServerTarget: `${options.project}:serve:development`,
|
|
34
41
|
baseUrl: options.baseUrl,
|
|
35
42
|
rootProject,
|
|
43
|
+
addPlugin: options.addPlugin,
|
|
36
44
|
});
|
|
37
45
|
projectConfig = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
|
|
38
46
|
tree.delete((0, devkit_1.joinPathFragments)(projectConfig.sourceRoot, 'support', 'app.po.ts'));
|
|
@@ -62,7 +70,7 @@ Cypress.on("uncaught:exception", (err) => {
|
|
|
62
70
|
});`);
|
|
63
71
|
return (0, devkit_1.runTasksInSerial)(installTask);
|
|
64
72
|
}
|
|
65
|
-
exports.
|
|
73
|
+
exports.cypressGeneratorInternal = cypressGeneratorInternal;
|
|
66
74
|
function addFileServerTarget(tree, options, targetName) {
|
|
67
75
|
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
|
|
68
76
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
@@ -75,3 +83,4 @@ function addFileServerTarget(tree, options, targetName) {
|
|
|
75
83
|
};
|
|
76
84
|
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
77
85
|
}
|
|
86
|
+
exports.default = cypressGenerator;
|
package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
2
|
import { type CypressComponentConfigurationSchema } from './schema';
|
|
3
|
-
export
|
|
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;
|
package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -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
|
-
|
|
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 (
|
|
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.
|
|
55
|
+
exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
|
|
52
56
|
exports.default = remixInitGenerator;
|
|
@@ -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
|
|
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
|
|
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.
|
|
44
|
+
exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal;
|
|
45
|
+
exports.default = remixLibraryGenerator;
|
|
@@ -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: '
|
|
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: '
|
|
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: '
|
|
61
|
+
viteConfigPath: 'vite.config.ts',
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
2
|
import type { StorybookConfigurationSchema } from './schema';
|
|
3
|
-
export
|
|
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
|
-
|
|
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 =
|
|
23
|
+
exports.default = remixStorybookConfigurationInternal;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -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 = {};
|
|
@@ -110,20 +111,7 @@ function typecheckTarget(projectRoot, namedInputs) {
|
|
|
110
111
|
}
|
|
111
112
|
async function getServerBuildPath(configFilePath, workspaceRoot) {
|
|
112
113
|
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
|
-
}
|
|
114
|
+
let appConfig = await (0, config_utils_1.loadConfigFile)(configPath);
|
|
127
115
|
return appConfig.serverBuildPath ?? 'build/index.js';
|
|
128
116
|
}
|
|
129
117
|
function normalizeOptions(options) {
|