@nx/remix 20.0.0-beta.4 → 20.0.0-beta.6
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 +5 -6
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +21 -21
- package/src/generators/application/application.impl.js +2 -0
- package/src/generators/application/lib/normalize-options.js +2 -3
- package/src/generators/application/schema.d.ts +2 -4
- package/src/generators/application/schema.json +11 -15
- package/src/generators/init/init.js +2 -0
- package/src/generators/library/__snapshots__/library.impl.spec.ts.snap +6 -6
- package/src/generators/library/lib/normalize-options.js +2 -3
- package/src/generators/library/library.impl.js +2 -1
- package/src/generators/library/schema.d.ts +2 -4
- package/src/generators/library/schema.json +9 -14
- package/src/generators/preset/preset.impl.js +1 -0
- package/src/generators/resource-route/resource-route.impl.js +1 -2
- package/src/generators/resource-route/schema.d.ts +0 -1
- package/src/generators/resource-route/schema.json +0 -5
- package/src/generators/route/__snapshots__/route.impl.spec.ts.snap +4 -4
- package/src/generators/route/route.impl.js +1 -3
- package/src/generators/route/schema.d.ts +0 -1
- package/src/generators/route/schema.json +1 -6
- package/src/generators/style/schema.d.ts +0 -1
- package/src/generators/style/schema.json +0 -5
- package/src/generators/style/style.impl.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "20.0.0-beta.
|
|
3
|
+
"version": "20.0.0-beta.6",
|
|
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,11 @@
|
|
|
29
29
|
"migrations": "./migrations.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nx/devkit": "20.0.0-beta.
|
|
33
|
-
"@nx/js": "20.0.0-beta.
|
|
34
|
-
"@nx/react": "20.0.0-beta.
|
|
32
|
+
"@nx/devkit": "20.0.0-beta.6",
|
|
33
|
+
"@nx/js": "20.0.0-beta.6",
|
|
34
|
+
"@nx/react": "20.0.0-beta.6",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
|
-
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
37
|
-
"@nrwl/remix": "20.0.0-beta.4"
|
|
36
|
+
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
38
37
|
},
|
|
39
38
|
"peerDependencies": {},
|
|
40
39
|
"publishConfig": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Remix Application Integrated Repo --
|
|
3
|
+
exports[`Remix Application Integrated Repo --directory should create the application correctly 1`] = `
|
|
4
4
|
"import { createWatchPaths } from '@nx/remix';
|
|
5
5
|
import { dirname } from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
"
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
exports[`Remix Application Integrated Repo --
|
|
24
|
+
exports[`Remix Application Integrated Repo --directory should create the application correctly 2`] = `
|
|
25
25
|
"import type { MetaFunction } from '@remix-run/node';
|
|
26
26
|
import {
|
|
27
27
|
Links,
|
|
@@ -59,7 +59,7 @@ export default function App() {
|
|
|
59
59
|
"
|
|
60
60
|
`;
|
|
61
61
|
|
|
62
|
-
exports[`Remix Application Integrated Repo --
|
|
62
|
+
exports[`Remix Application Integrated Repo --directory should create the application correctly 3`] = `
|
|
63
63
|
"import NxWelcome from '../nx-welcome';
|
|
64
64
|
|
|
65
65
|
export default function Index() {
|
|
@@ -72,7 +72,7 @@ export default function Index() {
|
|
|
72
72
|
"
|
|
73
73
|
`;
|
|
74
74
|
|
|
75
|
-
exports[`Remix Application Integrated Repo --
|
|
75
|
+
exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 1`] = `
|
|
76
76
|
"import { createWatchPaths } from '@nx/remix';
|
|
77
77
|
import { dirname } from 'path';
|
|
78
78
|
import { fileURLToPath } from 'url';
|
|
@@ -93,7 +93,7 @@ export default {
|
|
|
93
93
|
"
|
|
94
94
|
`;
|
|
95
95
|
|
|
96
|
-
exports[`Remix Application Integrated Repo --
|
|
96
|
+
exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 2`] = `
|
|
97
97
|
"import type { MetaFunction } from '@remix-run/node';
|
|
98
98
|
import {
|
|
99
99
|
Links,
|
|
@@ -131,7 +131,7 @@ export default function App() {
|
|
|
131
131
|
"
|
|
132
132
|
`;
|
|
133
133
|
|
|
134
|
-
exports[`Remix Application Integrated Repo --
|
|
134
|
+
exports[`Remix Application Integrated Repo --directory should extract the layout directory from the directory options if it exists 3`] = `
|
|
135
135
|
"import NxWelcome from '../nx-welcome';
|
|
136
136
|
|
|
137
137
|
export default function Index() {
|
|
@@ -144,7 +144,7 @@ export default function Index() {
|
|
|
144
144
|
"
|
|
145
145
|
`;
|
|
146
146
|
|
|
147
|
-
exports[`Remix Application Integrated Repo --
|
|
147
|
+
exports[`Remix Application Integrated Repo --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
148
148
|
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
149
149
|
|
|
150
150
|
import { defineConfig } from 'cypress';
|
|
@@ -166,7 +166,7 @@ export default defineConfig({
|
|
|
166
166
|
"
|
|
167
167
|
`;
|
|
168
168
|
|
|
169
|
-
exports[`Remix Application Integrated Repo --
|
|
169
|
+
exports[`Remix Application Integrated Repo --e2eTestRunner should generate a playwright e2e application for the app 1`] = `
|
|
170
170
|
"import { defineConfig, devices } from '@playwright/test';
|
|
171
171
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
172
172
|
|
|
@@ -239,7 +239,7 @@ export default defineConfig({
|
|
|
239
239
|
"
|
|
240
240
|
`;
|
|
241
241
|
|
|
242
|
-
exports[`Remix Application Integrated Repo --
|
|
242
|
+
exports[`Remix Application Integrated Repo --js should create the application correctly 1`] = `
|
|
243
243
|
"import { createWatchPaths } from '@nx/remix';
|
|
244
244
|
import { dirname } from 'path';
|
|
245
245
|
import { fileURLToPath } from 'url';
|
|
@@ -260,7 +260,7 @@ export default {
|
|
|
260
260
|
"
|
|
261
261
|
`;
|
|
262
262
|
|
|
263
|
-
exports[`Remix Application Integrated Repo --
|
|
263
|
+
exports[`Remix Application Integrated Repo --js should create the application correctly 2`] = `
|
|
264
264
|
"import {
|
|
265
265
|
Links,
|
|
266
266
|
LiveReload,
|
|
@@ -295,7 +295,7 @@ export default function App() {
|
|
|
295
295
|
"
|
|
296
296
|
`;
|
|
297
297
|
|
|
298
|
-
exports[`Remix Application Integrated Repo --
|
|
298
|
+
exports[`Remix Application Integrated Repo --js should create the application correctly 3`] = `
|
|
299
299
|
"import NxWelcome from '../nx-welcome';
|
|
300
300
|
export default function Index() {
|
|
301
301
|
return (
|
|
@@ -307,7 +307,7 @@ export default function Index() {
|
|
|
307
307
|
"
|
|
308
308
|
`;
|
|
309
309
|
|
|
310
|
-
exports[`Remix Application Integrated Repo --
|
|
310
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 1`] = `
|
|
311
311
|
"import { createWatchPaths } from '@nx/remix';
|
|
312
312
|
import { dirname } from 'path';
|
|
313
313
|
import { fileURLToPath } from 'url';
|
|
@@ -328,7 +328,7 @@ export default {
|
|
|
328
328
|
"
|
|
329
329
|
`;
|
|
330
330
|
|
|
331
|
-
exports[`Remix Application Integrated Repo --
|
|
331
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 2`] = `
|
|
332
332
|
"export default {
|
|
333
333
|
displayName: 'test',
|
|
334
334
|
preset: '../jest.preset.js',
|
|
@@ -341,14 +341,14 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
|
|
|
341
341
|
"
|
|
342
342
|
`;
|
|
343
343
|
|
|
344
|
-
exports[`Remix Application Integrated Repo --
|
|
344
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using jest 3`] = `
|
|
345
345
|
"import { installGlobals } from '@remix-run/node';
|
|
346
346
|
import '@testing-library/jest-dom/matchers';
|
|
347
347
|
installGlobals();
|
|
348
348
|
"
|
|
349
349
|
`;
|
|
350
350
|
|
|
351
|
-
exports[`Remix Application Integrated Repo --
|
|
351
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 1`] = `
|
|
352
352
|
"import { createWatchPaths } from '@nx/remix';
|
|
353
353
|
import { dirname } from 'path';
|
|
354
354
|
import { fileURLToPath } from 'url';
|
|
@@ -369,7 +369,7 @@ export default {
|
|
|
369
369
|
"
|
|
370
370
|
`;
|
|
371
371
|
|
|
372
|
-
exports[`Remix Application Integrated Repo --
|
|
372
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 2`] = `
|
|
373
373
|
"/// <reference types='vitest' />
|
|
374
374
|
import { defineConfig } from 'vite';
|
|
375
375
|
import react from '@vitejs/plugin-react';
|
|
@@ -400,14 +400,14 @@ export default defineConfig({
|
|
|
400
400
|
"
|
|
401
401
|
`;
|
|
402
402
|
|
|
403
|
-
exports[`Remix Application Integrated Repo --
|
|
403
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 3`] = `
|
|
404
404
|
"import { installGlobals } from '@remix-run/node';
|
|
405
405
|
import '@testing-library/jest-dom/matchers';
|
|
406
406
|
installGlobals();
|
|
407
407
|
"
|
|
408
408
|
`;
|
|
409
409
|
|
|
410
|
-
exports[`Remix Application Integrated Repo --
|
|
410
|
+
exports[`Remix Application Integrated Repo --unitTestRunner should generate the correct files for testing using vitest 4`] = `
|
|
411
411
|
"{
|
|
412
412
|
"extends": "./tsconfig.json",
|
|
413
413
|
"compilerOptions": {
|
|
@@ -440,7 +440,7 @@ exports[`Remix Application Integrated Repo --projectNameAndRootFormat=as-provide
|
|
|
440
440
|
"
|
|
441
441
|
`;
|
|
442
442
|
|
|
443
|
-
exports[`Remix Application Integrated Repo
|
|
443
|
+
exports[`Remix Application Integrated Repo should create the application correctly 1`] = `
|
|
444
444
|
"import { createWatchPaths } from '@nx/remix';
|
|
445
445
|
import { dirname } from 'path';
|
|
446
446
|
import { fileURLToPath } from 'url';
|
|
@@ -461,7 +461,7 @@ export default {
|
|
|
461
461
|
"
|
|
462
462
|
`;
|
|
463
463
|
|
|
464
|
-
exports[`Remix Application Integrated Repo
|
|
464
|
+
exports[`Remix Application Integrated Repo should create the application correctly 2`] = `
|
|
465
465
|
"import type { MetaFunction } from '@remix-run/node';
|
|
466
466
|
import {
|
|
467
467
|
Links,
|
|
@@ -499,7 +499,7 @@ export default function App() {
|
|
|
499
499
|
"
|
|
500
500
|
`;
|
|
501
501
|
|
|
502
|
-
exports[`Remix Application Integrated Repo
|
|
502
|
+
exports[`Remix Application Integrated Repo should create the application correctly 3`] = `
|
|
503
503
|
"import NxWelcome from '../nx-welcome';
|
|
504
504
|
|
|
505
505
|
export default function Index() {
|
|
@@ -7,6 +7,7 @@ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaul
|
|
|
7
7
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
8
8
|
const js_1 = require("@nx/js");
|
|
9
9
|
const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
10
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
10
11
|
const node_path_1 = require("node:path");
|
|
11
12
|
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
12
13
|
const testing_config_utils_1 = require("../../utils/testing-config-utils");
|
|
@@ -21,6 +22,7 @@ function remixApplicationGenerator(tree, options) {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
async function remixApplicationGeneratorInternal(tree, _options) {
|
|
25
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'application');
|
|
24
26
|
const options = await (0, lib_1.normalizeOptions)(tree, _options);
|
|
25
27
|
const tasks = [
|
|
26
28
|
await (0, init_1.default)(tree, {
|
|
@@ -5,15 +5,14 @@ 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
|
async function normalizeOptions(tree, options) {
|
|
8
|
-
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
|
|
9
|
+
const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
10
|
name: options.name,
|
|
10
11
|
projectType: 'application',
|
|
11
12
|
directory: options.directory,
|
|
12
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
13
|
rootProject: options.rootProject,
|
|
14
14
|
});
|
|
15
15
|
options.rootProject = projectRoot === '.';
|
|
16
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
17
16
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
18
17
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
19
18
|
nxJson.useInferencePlugins !== false;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface NxRemixGeneratorSchema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
tags?: string;
|
|
7
7
|
js?: boolean;
|
|
8
|
-
directory?: string;
|
|
9
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
10
8
|
linter?: Linter | LinterType;
|
|
11
9
|
unitTestRunner?: 'vitest' | 'jest' | 'none';
|
|
12
10
|
e2eTestRunner?: 'cypress' | 'playwright' | 'none';
|
|
@@ -5,31 +5,26 @@
|
|
|
5
5
|
"description": "Generate a new Remix application.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
|
-
"
|
|
8
|
+
"directory": {
|
|
9
9
|
"type": "string",
|
|
10
|
-
"description": "",
|
|
10
|
+
"description": "A directory where the app is placed.",
|
|
11
|
+
"alias": "dir",
|
|
11
12
|
"$default": {
|
|
12
13
|
"$source": "argv",
|
|
13
14
|
"index": 0
|
|
14
15
|
},
|
|
15
|
-
"x-prompt": "
|
|
16
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
17
|
+
},
|
|
18
|
+
"name": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "The name of the application.",
|
|
21
|
+
"x-priority": "important"
|
|
16
22
|
},
|
|
17
23
|
"js": {
|
|
18
24
|
"type": "boolean",
|
|
19
25
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
20
26
|
"default": false
|
|
21
27
|
},
|
|
22
|
-
"directory": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"description": "A directory where the app is placed.",
|
|
25
|
-
"alias": "dir",
|
|
26
|
-
"x-priority": "important"
|
|
27
|
-
},
|
|
28
|
-
"projectNameAndRootFormat": {
|
|
29
|
-
"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`).",
|
|
30
|
-
"type": "string",
|
|
31
|
-
"enum": ["as-provided", "derived"]
|
|
32
|
-
},
|
|
33
28
|
"linter": {
|
|
34
29
|
"description": "The tool to use for running lint checks.",
|
|
35
30
|
"type": "string",
|
|
@@ -65,5 +60,6 @@
|
|
|
65
60
|
"x-priority": "internal",
|
|
66
61
|
"default": false
|
|
67
62
|
}
|
|
68
|
-
}
|
|
63
|
+
},
|
|
64
|
+
"required": ["directory"]
|
|
69
65
|
}
|
|
@@ -4,12 +4,14 @@ exports.remixInitGenerator = remixInitGenerator;
|
|
|
4
4
|
exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
8
|
const plugin_1 = require("../../plugins/plugin");
|
|
8
9
|
const versions_1 = require("../../utils/versions");
|
|
9
10
|
function remixInitGenerator(tree, options) {
|
|
10
11
|
return remixInitGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
11
12
|
}
|
|
12
13
|
async function remixInitGeneratorInternal(tree, options) {
|
|
14
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'init');
|
|
13
15
|
const tasks = [];
|
|
14
16
|
if (!options.skipPackageJson) {
|
|
15
17
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Remix Library Generator
|
|
3
|
+
exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with jest 1`] = `
|
|
4
4
|
"export default {
|
|
5
5
|
setupFilesAfterEnv: ['./src/test-setup.ts'],
|
|
6
6
|
displayName: 'test',
|
|
@@ -15,14 +15,14 @@ exports[`Remix Library Generator -projectNameAndRootFormat=as-provided --unitTes
|
|
|
15
15
|
"
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
|
-
exports[`Remix Library Generator
|
|
18
|
+
exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with jest 2`] = `
|
|
19
19
|
"import { installGlobals } from '@remix-run/node';
|
|
20
20
|
import '@testing-library/jest-dom/matchers';
|
|
21
21
|
installGlobals();
|
|
22
22
|
"
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
exports[`Remix Library Generator
|
|
25
|
+
exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with vitest 1`] = `
|
|
26
26
|
"import { defineConfig } from 'vite';
|
|
27
27
|
import react from '@vitejs/plugin-react';
|
|
28
28
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
@@ -49,14 +49,14 @@ export default defineConfig({
|
|
|
49
49
|
"
|
|
50
50
|
`;
|
|
51
51
|
|
|
52
|
-
exports[`Remix Library Generator
|
|
52
|
+
exports[`Remix Library Generator --unitTestRunner should create the correct config files for testing with vitest 2`] = `
|
|
53
53
|
"import { installGlobals } from '@remix-run/node';
|
|
54
54
|
import '@testing-library/jest-dom/matchers';
|
|
55
55
|
installGlobals();
|
|
56
56
|
"
|
|
57
57
|
`;
|
|
58
58
|
|
|
59
|
-
exports[`Remix Library Generator
|
|
59
|
+
exports[`Remix Library Generator should generate a library correctly 1`] = `
|
|
60
60
|
[
|
|
61
61
|
"test.module.css",
|
|
62
62
|
"test.spec.tsx",
|
|
@@ -64,7 +64,7 @@ exports[`Remix Library Generator -projectNameAndRootFormat=as-provided should ge
|
|
|
64
64
|
]
|
|
65
65
|
`;
|
|
66
66
|
|
|
67
|
-
exports[`Remix Library Generator
|
|
67
|
+
exports[`Remix Library Generator should generate a library correctly 2`] = `
|
|
68
68
|
{
|
|
69
69
|
"@proj/test": [
|
|
70
70
|
"test/src/index.ts",
|
|
@@ -5,11 +5,11 @@ 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 get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
7
|
async function normalizeOptions(tree, options) {
|
|
8
|
-
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
|
|
9
|
+
const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
9
10
|
name: options.name,
|
|
10
11
|
projectType: 'library',
|
|
11
12
|
directory: options.directory,
|
|
12
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
13
|
});
|
|
14
14
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
15
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -22,6 +22,5 @@ async function normalizeOptions(tree, options) {
|
|
|
22
22
|
importPath,
|
|
23
23
|
projectName,
|
|
24
24
|
projectRoot,
|
|
25
|
-
projectNameAndRootFormat,
|
|
26
25
|
};
|
|
27
26
|
}
|
|
@@ -4,12 +4,14 @@ exports.remixLibraryGenerator = remixLibraryGenerator;
|
|
|
4
4
|
exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
8
|
const react_1 = require("@nx/react");
|
|
8
9
|
const lib_1 = require("./lib");
|
|
9
10
|
async function remixLibraryGenerator(tree, schema) {
|
|
10
11
|
return remixLibraryGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
11
12
|
}
|
|
12
13
|
async function remixLibraryGeneratorInternal(tree, schema) {
|
|
14
|
+
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'remix', 'library');
|
|
13
15
|
const tasks = [];
|
|
14
16
|
const options = await (0, lib_1.normalizeOptions)(tree, schema);
|
|
15
17
|
const libGenTask = await (0, react_1.libraryGenerator)(tree, {
|
|
@@ -19,7 +21,6 @@ async function remixLibraryGeneratorInternal(tree, schema) {
|
|
|
19
21
|
tags: options.tags,
|
|
20
22
|
importPath: options.importPath,
|
|
21
23
|
directory: options.projectRoot,
|
|
22
|
-
projectNameAndRootFormat: 'as-provided',
|
|
23
24
|
skipFormat: true,
|
|
24
25
|
skipTsConfig: false,
|
|
25
26
|
linter: eslint_1.Linter.EsLint,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import { SupportedStyles } from '@nx/react';
|
|
3
2
|
|
|
4
3
|
export interface NxRemixGeneratorSchema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
style: SupportedStyles;
|
|
7
|
-
directory?: string;
|
|
8
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
9
7
|
tags?: string;
|
|
10
8
|
importPath?: string;
|
|
11
9
|
buildable?: boolean;
|
|
@@ -11,27 +11,22 @@
|
|
|
11
11
|
}
|
|
12
12
|
],
|
|
13
13
|
"properties": {
|
|
14
|
-
"
|
|
14
|
+
"directory": {
|
|
15
15
|
"type": "string",
|
|
16
|
-
"description": "
|
|
16
|
+
"description": "A directory where the lib is placed.",
|
|
17
|
+
"alias": "dir",
|
|
17
18
|
"$default": {
|
|
18
19
|
"$source": "argv",
|
|
19
20
|
"index": 0
|
|
20
21
|
},
|
|
21
|
-
"x-prompt": "
|
|
22
|
-
"pattern": "^[a-zA-Z].*$"
|
|
22
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
23
23
|
},
|
|
24
|
-
"
|
|
24
|
+
"name": {
|
|
25
25
|
"type": "string",
|
|
26
|
-
"description": "
|
|
27
|
-
"
|
|
26
|
+
"description": "Library name",
|
|
27
|
+
"pattern": "^[a-zA-Z].*$",
|
|
28
28
|
"x-priority": "important"
|
|
29
29
|
},
|
|
30
|
-
"projectNameAndRootFormat": {
|
|
31
|
-
"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`).",
|
|
32
|
-
"type": "string",
|
|
33
|
-
"enum": ["as-provided", "derived"]
|
|
34
|
-
},
|
|
35
30
|
"tags": {
|
|
36
31
|
"type": "string",
|
|
37
32
|
"description": "Add tags to the library (used for linting)"
|
|
@@ -49,7 +44,7 @@
|
|
|
49
44
|
},
|
|
50
45
|
"unitTestRunner": {
|
|
51
46
|
"type": "string",
|
|
52
|
-
"enum": ["
|
|
47
|
+
"enum": ["vitest", "jest", "none"],
|
|
53
48
|
"description": "Test Runner to use for Unit Tests",
|
|
54
49
|
"x-prompt": "What test runner should be used?",
|
|
55
50
|
"default": "vitest"
|
|
@@ -70,5 +65,5 @@
|
|
|
70
65
|
"x-priority": "internal"
|
|
71
66
|
}
|
|
72
67
|
},
|
|
73
|
-
"required": ["
|
|
68
|
+
"required": ["directory"]
|
|
74
69
|
}
|
|
@@ -16,6 +16,7 @@ async function default_1(tree, _options) {
|
|
|
16
16
|
nxJson.useInferencePlugins !== false;
|
|
17
17
|
const appGenTask = await (0, application_impl_1.default)(tree, {
|
|
18
18
|
name: options.appName,
|
|
19
|
+
directory: '.',
|
|
19
20
|
tags: options.tags,
|
|
20
21
|
skipFormat: true,
|
|
21
22
|
rootProject: true,
|
|
@@ -8,8 +8,7 @@ const action_impl_1 = require("../action/action.impl");
|
|
|
8
8
|
const loader_impl_1 = require("../loader/loader.impl");
|
|
9
9
|
async function default_1(tree, options) {
|
|
10
10
|
const { artifactName: name, directory } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
11
|
-
|
|
12
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
11
|
+
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
13
12
|
});
|
|
14
13
|
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
15
14
|
throw new Error(`Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.`);
|
|
@@ -20,11 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar')"
|
|
22
22
|
},
|
|
23
|
-
"nameAndDirectoryFormat": {
|
|
24
|
-
"description": "Whether to generate the styles in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
25
|
-
"type": "string",
|
|
26
|
-
"enum": ["as-provided", "derived"]
|
|
27
|
-
},
|
|
28
23
|
"action": {
|
|
29
24
|
"type": "boolean",
|
|
30
25
|
"description": "Generate an action function",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`route --nameAndDirectoryFormat=
|
|
3
|
+
exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should add route component 1`] = `
|
|
4
4
|
"import { useLoaderData, useActionData } from '@remix-run/react';
|
|
5
5
|
import { json } from '@remix-run/node';
|
|
6
6
|
import type {
|
|
@@ -41,8 +41,8 @@ export default function Example() {
|
|
|
41
41
|
"
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
|
-
exports[`route --nameAndDirectoryFormat=
|
|
44
|
+
exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
45
45
|
|
|
46
|
-
exports[`route --nameAndDirectoryFormat=
|
|
46
|
+
exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 2`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
47
47
|
|
|
48
|
-
exports[`route --nameAndDirectoryFormat=
|
|
48
|
+
exports[`route --nameAndDirectoryFormat=apps/demo/app/routes/path/to/example should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
@@ -11,8 +11,7 @@ const meta_impl_1 = require("../meta/meta.impl");
|
|
|
11
11
|
const style_impl_1 = require("../style/style.impl");
|
|
12
12
|
async function default_1(tree, options) {
|
|
13
13
|
const { artifactName: name, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
14
|
-
|
|
15
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
14
|
+
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
16
15
|
});
|
|
17
16
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
18
17
|
if (!project)
|
|
@@ -63,7 +62,6 @@ async function default_1(tree, options) {
|
|
|
63
62
|
if (options.style === 'css') {
|
|
64
63
|
await (0, style_impl_1.default)(tree, {
|
|
65
64
|
path: routeFilePath,
|
|
66
|
-
nameAndDirectoryFormat: 'as-provided',
|
|
67
65
|
});
|
|
68
66
|
}
|
|
69
67
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -13,18 +13,13 @@
|
|
|
13
13
|
"properties": {
|
|
14
14
|
"path": {
|
|
15
15
|
"type": "string",
|
|
16
|
-
"description": "The route path or path to the filename of the route.
|
|
16
|
+
"description": "The route path or path to the filename of the route.",
|
|
17
17
|
"$default": {
|
|
18
18
|
"$source": "argv",
|
|
19
19
|
"index": 0
|
|
20
20
|
},
|
|
21
21
|
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar')"
|
|
22
22
|
},
|
|
23
|
-
"nameAndDirectoryFormat": {
|
|
24
|
-
"description": "Whether to generate the route in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and path relative to the workspace root (`derived`).",
|
|
25
|
-
"type": "string",
|
|
26
|
-
"enum": ["as-provided", "derived"]
|
|
27
|
-
},
|
|
28
23
|
"style": {
|
|
29
24
|
"type": "string",
|
|
30
25
|
"description": "Generate a stylesheet",
|
|
@@ -19,11 +19,6 @@
|
|
|
19
19
|
"index": 0
|
|
20
20
|
},
|
|
21
21
|
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
|
|
22
|
-
},
|
|
23
|
-
"nameAndDirectoryFormat": {
|
|
24
|
-
"description": "Whether to generate the styles in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
25
|
-
"type": "string",
|
|
26
|
-
"enum": ["as-provided", "derived"]
|
|
27
22
|
}
|
|
28
23
|
},
|
|
29
24
|
"required": ["path"]
|
|
@@ -9,8 +9,7 @@ const insert_statement_after_imports_1 = require("../../utils/insert-statement-a
|
|
|
9
9
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
10
10
|
async function default_1(tree, options) {
|
|
11
11
|
const { project: projectName, artifactName: name } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
12
|
-
|
|
13
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat ?? 'as-provided',
|
|
12
|
+
path: options.path,
|
|
14
13
|
});
|
|
15
14
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
16
15
|
if (!project)
|