@nx/remix 16.8.2 → 17.0.4
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/LICENSE +1 -1
- package/README.md +32 -89
- package/executors.json +0 -12
- package/generators.d.ts +14 -0
- package/generators.js +31 -0
- package/generators.json +14 -19
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/migrations.json +68 -86
- package/package.json +44 -12
- package/plugin.d.ts +1 -0
- package/plugin.js +6 -0
- package/plugins/component-testing/index.js +11 -6
- package/src/executors/build/build.impl.js +64 -74
- package/src/executors/build/schema.json +1 -1
- package/src/executors/serve/serve.impl.js +43 -43
- package/src/generators/action/action.impl.js +24 -26
- package/src/generators/action/schema.d.ts +7 -1
- package/src/generators/action/schema.json +11 -8
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +1121 -307
- package/src/generators/application/application.impl.d.ts +3 -1
- package/src/generators/application/application.impl.js +171 -110
- package/src/generators/application/files/common/app/nx-welcome.tsx__tmpl__ +886 -0
- package/src/generators/application/files/common/app/root.tsx__tmpl__ +3 -3
- package/src/generators/application/files/common/app/routes/_index.tsx__tmpl__ +9 -0
- package/src/generators/application/files/common/remix.config.js__tmpl__ +13 -7
- package/src/generators/application/files/common/tests/routes/_index.spec.tsx__tmpl__ +16 -0
- package/src/generators/application/files/common/tsconfig.app.json__tmpl__ +20 -0
- package/src/generators/application/files/common/tsconfig.json__tmpl__ +20 -14
- package/src/generators/application/files/integrated/package.json__tmpl__ +1 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +68 -0
- package/src/generators/application/lib/index.d.ts +1 -0
- package/src/generators/application/lib/index.js +1 -1
- package/src/generators/application/lib/normalize-options.d.ts +8 -3
- package/src/generators/application/lib/normalize-options.js +52 -14
- package/src/generators/application/lib/update-unit-test-config.d.ts +1 -1
- package/src/generators/application/lib/update-unit-test-config.js +32 -7
- package/src/generators/application/schema.d.ts +7 -1
- package/src/generators/application/schema.json +17 -11
- 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 +26 -17
- package/src/generators/cypress-component-configuration/schema.d.ts +1 -0
- package/src/generators/error-boundary/__snapshots__/error-boundary.impl.spec.ts.snap +39 -27
- package/src/generators/error-boundary/error-boundary.impl.js +6 -15
- package/src/generators/error-boundary/lib/add-v2-error-boundary.js +11 -16
- package/src/generators/error-boundary/lib/index.d.ts +0 -1
- package/src/generators/error-boundary/lib/index.js +0 -2
- package/src/generators/error-boundary/lib/normalize-options.d.ts +1 -1
- package/src/generators/error-boundary/lib/normalize-options.js +9 -5
- package/src/generators/error-boundary/schema.d.ts +7 -2
- package/src/generators/error-boundary/schema.json +14 -16
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +60 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +33 -0
- package/src/generators/library/__snapshots__/library.impl.spec.ts.snap +157 -0
- package/src/generators/library/lib/add-tsconfig-entry-points.js +0 -1
- package/src/generators/library/lib/add-unit-testing.js +5 -7
- package/src/generators/library/lib/index.js +0 -1
- package/src/generators/library/lib/normalize-options.d.ts +3 -2
- package/src/generators/library/lib/normalize-options.js +21 -12
- package/src/generators/library/lib/update-buildable-config.js +5 -2
- package/src/generators/library/library.impl.d.ts +3 -1
- package/src/generators/library/library.impl.js +38 -34
- package/src/generators/library/schema.d.ts +3 -0
- package/src/generators/library/schema.json +7 -1
- package/src/generators/loader/loader.impl.js +24 -26
- package/src/generators/loader/schema.d.ts +7 -1
- package/src/generators/loader/schema.json +11 -8
- package/src/generators/meta/lib/v2.impl.js +14 -16
- package/src/generators/meta/meta.impl.js +2 -17
- package/src/generators/meta/schema.d.ts +7 -2
- package/src/generators/meta/schema.json +11 -12
- package/src/generators/preset/lib/normalize-options.js +5 -3
- package/src/generators/preset/preset.impl.js +22 -23
- package/src/generators/preset/schema.json +2 -1
- package/src/generators/resource-route/__snapshots__/resource-route.impl.spec.ts.snap +21 -0
- package/src/generators/resource-route/resource-route.impl.js +32 -26
- package/src/generators/resource-route/schema.d.ts +7 -1
- package/src/generators/resource-route/schema.json +11 -8
- package/src/generators/route/__snapshots__/route.impl.spec.ts.snap +62 -9
- package/src/generators/route/route.impl.js +56 -43
- package/src/generators/route/schema.d.ts +7 -1
- package/src/generators/route/schema.json +12 -9
- package/src/generators/setup/schema.json +2 -1
- package/src/generators/setup/setup.impl.js +23 -23
- package/src/generators/setup-tailwind/__snapshots__/setup-tailwind.impl.spec.ts.snap +51 -33
- package/src/generators/setup-tailwind/lib/index.js +0 -1
- package/src/generators/setup-tailwind/lib/update-remix-config.js +3 -7
- package/src/generators/setup-tailwind/schema.json +2 -1
- package/src/generators/setup-tailwind/setup-tailwind.impl.js +25 -29
- package/src/generators/storybook-configuration/__snapshots__/storybook-configuration.impl.spec.ts.snap +15 -27
- package/src/generators/storybook-configuration/schema.d.ts +3 -2
- package/src/generators/storybook-configuration/schema.json +5 -12
- package/src/generators/storybook-configuration/storybook-configuration.impl.d.ts +2 -1
- package/src/generators/storybook-configuration/storybook-configuration.impl.js +19 -12
- package/src/generators/style/schema.d.ts +7 -1
- package/src/generators/style/schema.json +13 -10
- package/src/generators/style/style.impl.js +32 -24
- package/src/generators/utils/update-dependencies.d.ts +2 -0
- package/src/generators/utils/update-dependencies.js +21 -0
- package/src/plugins/__snapshots__/plugin.spec.ts.snap +113 -0
- package/src/plugins/plugin.d.ts +9 -0
- package/src/plugins/plugin.js +134 -0
- package/src/utils/create-watch-paths.js +8 -13
- package/src/utils/get-default-export-name.js +1 -3
- package/src/utils/get-default-export.js +0 -1
- package/src/utils/insert-import.js +0 -1
- package/src/utils/insert-statement-after-imports.js +0 -1
- package/src/utils/insert-statement-in-default-function.js +0 -1
- package/src/utils/remix-config.d.ts +2 -2
- package/src/utils/remix-config.js +34 -11
- package/src/utils/remix-route-utils.d.ts +2 -2
- package/src/utils/remix-route-utils.js +23 -17
- package/src/utils/testing-config-utils.d.ts +3 -2
- package/src/utils/testing-config-utils.js +24 -10
- package/src/utils/upsert-links-function.js +0 -1
- package/src/utils/versions.d.ts +10 -9
- package/src/utils/versions.js +15 -15
- package/plugins/component-testing/index.js.map +0 -1
- package/src/executors/build/build.impl.js.map +0 -1
- package/src/executors/build/compat.d.ts +0 -2
- package/src/executors/build/compat.js +0 -6
- package/src/executors/build/compat.js.map +0 -1
- package/src/executors/serve/compat.d.ts +0 -2
- package/src/executors/serve/compat.js +0 -6
- package/src/executors/serve/compat.js.map +0 -1
- package/src/executors/serve/serve.impl.js.map +0 -1
- package/src/generators/action/action.impl.js.map +0 -1
- package/src/generators/application/application.impl.js.map +0 -1
- package/src/generators/application/files/common/app/routes/index.tsx__tmpl__ +0 -32
- package/src/generators/application/lib/index.js.map +0 -1
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/lib/update-unit-test-config.js.map +0 -1
- package/src/generators/cypress/cypress.impl.d.ts +0 -3
- package/src/generators/cypress/cypress.impl.js +0 -67
- package/src/generators/cypress/cypress.impl.js.map +0 -1
- package/src/generators/cypress/schema.d.ts +0 -10
- package/src/generators/cypress/schema.json +0 -55
- package/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js.map +0 -1
- package/src/generators/error-boundary/error-boundary.impl.js.map +0 -1
- package/src/generators/error-boundary/lib/add-v1-error-boundary.d.ts +0 -3
- package/src/generators/error-boundary/lib/add-v1-error-boundary.js +0 -21
- package/src/generators/error-boundary/lib/add-v1-error-boundary.js.map +0 -1
- package/src/generators/error-boundary/lib/add-v2-error-boundary.js.map +0 -1
- package/src/generators/error-boundary/lib/index.js.map +0 -1
- package/src/generators/error-boundary/lib/normalize-options.js.map +0 -1
- package/src/generators/library/lib/add-tsconfig-entry-points.js.map +0 -1
- package/src/generators/library/lib/add-unit-testing.js.map +0 -1
- package/src/generators/library/lib/index.js.map +0 -1
- package/src/generators/library/lib/normalize-options.js.map +0 -1
- package/src/generators/library/lib/update-buildable-config.js.map +0 -1
- package/src/generators/library/library.impl.js.map +0 -1
- package/src/generators/loader/loader.impl.js.map +0 -1
- package/src/generators/meta/lib/normalize-options.d.ts +0 -3
- package/src/generators/meta/lib/normalize-options.js +0 -15
- package/src/generators/meta/lib/normalize-options.js.map +0 -1
- package/src/generators/meta/lib/v1.impl.d.ts +0 -3
- package/src/generators/meta/lib/v1.impl.js +0 -30
- package/src/generators/meta/lib/v1.impl.js.map +0 -1
- package/src/generators/meta/lib/v2.impl.js.map +0 -1
- package/src/generators/meta/meta.impl.js.map +0 -1
- package/src/generators/preset/lib/normalize-options.js.map +0 -1
- package/src/generators/preset/preset.impl.js.map +0 -1
- package/src/generators/resource-route/resource-route.impl.js.map +0 -1
- package/src/generators/route/route.impl.js.map +0 -1
- package/src/generators/setup/setup.impl.js.map +0 -1
- package/src/generators/setup-tailwind/lib/index.js.map +0 -1
- package/src/generators/setup-tailwind/lib/update-remix-config.js.map +0 -1
- package/src/generators/setup-tailwind/setup-tailwind.impl.js.map +0 -1
- package/src/generators/storybook-configuration/storybook-configuration.impl.js.map +0 -1
- package/src/generators/style/style.impl.js.map +0 -1
- package/src/index.d.ts +0 -15
- package/src/index.js +0 -21
- package/src/index.js.map +0 -1
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +0 -6
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +0 -45
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +0 -1
- package/src/migrations/update-15-8-6/update-remix-env-d.d.ts +0 -6
- package/src/migrations/update-15-8-6/update-remix-env-d.js +0 -27
- package/src/migrations/update-15-8-6/update-remix-env-d.js.map +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -13
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +0 -1
- package/src/utils/create-watch-paths.js.map +0 -1
- package/src/utils/get-default-export-name.js.map +0 -1
- package/src/utils/get-default-export.js.map +0 -1
- package/src/utils/get-remix-projects.d.ts +0 -2
- package/src/utils/get-remix-projects.js +0 -15
- package/src/utils/get-remix-projects.js.map +0 -1
- package/src/utils/insert-import.js.map +0 -1
- package/src/utils/insert-statement-after-imports.js.map +0 -1
- package/src/utils/insert-statement-in-default-function.js.map +0 -1
- package/src/utils/project.d.ts +0 -2
- package/src/utils/project.js +0 -15
- package/src/utils/project.js.map +0 -1
- package/src/utils/remix-config.js.map +0 -1
- package/src/utils/remix-route-utils.js.map +0 -1
- package/src/utils/testing-config-utils.js.map +0 -1
- package/src/utils/upsert-links-function.js.map +0 -1
- package/src/utils/versions.js.map +0 -1
|
@@ -1,65 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
5
|
+
const path_1 = require("path");
|
|
5
6
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
6
7
|
const action_impl_1 = require("../action/action.impl");
|
|
7
8
|
const loader_impl_1 = require("../loader/loader.impl");
|
|
8
9
|
const meta_impl_1 = require("../meta/meta.impl");
|
|
9
10
|
const style_impl_1 = require("../style/style.impl");
|
|
10
|
-
function default_1(tree, options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
async function default_1(tree, options) {
|
|
12
|
+
const { artifactName: name, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
13
|
+
artifactType: 'route',
|
|
14
|
+
callingGenerator: '@nx/remix:route',
|
|
15
|
+
name: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
16
|
+
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
17
|
+
project: options.project,
|
|
18
|
+
});
|
|
19
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
20
|
+
if (!project)
|
|
21
|
+
throw new Error(`Project does not exist: ${projectName}`);
|
|
22
|
+
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
23
|
+
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.`);
|
|
24
|
+
}
|
|
25
|
+
const routeFilePath = await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, options.nameAndDirectoryFormat === 'as-provided'
|
|
26
|
+
? (0, devkit_1.joinPathFragments)(directory, name)
|
|
27
|
+
: options.path, options.nameAndDirectoryFormat === 'as-provided' ? undefined : projectName, '.tsx');
|
|
28
|
+
const nameToUseForComponent = options.nameAndDirectoryFormat === 'as-provided'
|
|
29
|
+
? name.replace('.tsx', '')
|
|
30
|
+
: options.path.replace(/^\//, '').replace(/\/$/, '').replace('.tsx', '');
|
|
31
|
+
const { className: componentName } = (0, devkit_1.names)(nameToUseForComponent === '.' || nameToUseForComponent === ''
|
|
32
|
+
? (0, path_1.basename)((0, path_1.dirname)(routeFilePath))
|
|
33
|
+
: nameToUseForComponent);
|
|
34
|
+
if (tree.exists(routeFilePath))
|
|
35
|
+
throw new Error(`Path already exists: ${routeFilePath}`);
|
|
36
|
+
tree.write(routeFilePath, (0, devkit_1.stripIndents) `
|
|
23
37
|
|
|
24
38
|
|
|
25
39
|
export default function ${componentName}() {
|
|
26
40
|
${options.loader
|
|
27
|
-
|
|
41
|
+
? `
|
|
28
42
|
return (
|
|
29
43
|
<p>
|
|
30
44
|
Message: {data.message}
|
|
31
45
|
</p>
|
|
32
46
|
);
|
|
33
47
|
`
|
|
34
|
-
|
|
48
|
+
: `return (<p>${componentName} works!</p>)`}
|
|
35
49
|
}
|
|
36
50
|
`);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
if (options.loader) {
|
|
52
|
+
await (0, loader_impl_1.default)(tree, {
|
|
53
|
+
path: routeFilePath,
|
|
54
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (options.meta) {
|
|
58
|
+
await (0, meta_impl_1.default)(tree, {
|
|
59
|
+
path: routeFilePath,
|
|
60
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (options.action) {
|
|
64
|
+
await (0, action_impl_1.default)(tree, {
|
|
65
|
+
path: routeFilePath,
|
|
66
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (options.style === 'css') {
|
|
70
|
+
await (0, style_impl_1.default)(tree, {
|
|
71
|
+
project: projectName,
|
|
72
|
+
path: routeFilePath,
|
|
73
|
+
nameAndDirectoryFormat: 'as-provided',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
63
77
|
}
|
|
64
78
|
exports.default = default_1;
|
|
65
|
-
//# sourceMappingURL=route.impl.js.map
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
|
|
2
|
+
|
|
1
3
|
export interface RemixRouteSchema {
|
|
2
|
-
project: string;
|
|
3
4
|
path: string;
|
|
5
|
+
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
4
6
|
style: 'css' | 'none';
|
|
5
7
|
action: boolean;
|
|
6
8
|
meta: boolean;
|
|
7
9
|
loader: boolean;
|
|
8
10
|
skipChecks: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v19.
|
|
13
|
+
*/
|
|
14
|
+
project?: string;
|
|
9
15
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "NxRemixRoute",
|
|
4
4
|
"title": "Create a Route",
|
|
5
|
+
"description": "Generate a route.",
|
|
5
6
|
"type": "object",
|
|
6
7
|
"examples": [
|
|
7
8
|
{
|
|
@@ -12,21 +13,23 @@
|
|
|
12
13
|
"properties": {
|
|
13
14
|
"path": {
|
|
14
15
|
"type": "string",
|
|
15
|
-
"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. When `--nameAndDirectoryFormat=as-provided`, it will be relative to the current working directory. Otherwise, it will be relative to the workspace root.",
|
|
16
17
|
"$default": {
|
|
17
18
|
"$source": "argv",
|
|
18
19
|
"index": 0
|
|
19
20
|
},
|
|
20
|
-
"x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
|
|
21
|
+
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar')"
|
|
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"]
|
|
21
27
|
},
|
|
22
28
|
"project": {
|
|
23
29
|
"type": "string",
|
|
24
30
|
"description": "The name of the project.",
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
"x-prompt": "What project is this route for?",
|
|
29
|
-
"pattern": "^[a-zA-Z].*$"
|
|
31
|
+
"pattern": "^[a-zA-Z].*$",
|
|
32
|
+
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v19."
|
|
30
33
|
},
|
|
31
34
|
"style": {
|
|
32
35
|
"type": "string",
|
|
@@ -55,5 +58,5 @@
|
|
|
55
58
|
"default": false
|
|
56
59
|
}
|
|
57
60
|
},
|
|
58
|
-
"required": ["
|
|
61
|
+
"required": ["path"]
|
|
59
62
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "NxRemixSetup",
|
|
4
4
|
"title": "",
|
|
5
5
|
"type": "object",
|
|
6
|
+
"description": "Generate initial files required for Remix to work within the workspace.",
|
|
6
7
|
"properties": {
|
|
7
8
|
"packageManager": {
|
|
8
9
|
"type": "string",
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const js_1 = require("@nx/js");
|
|
6
|
-
function default_1(tree) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
ignoreFile = `${ignoreFile}
|
|
5
|
+
async function default_1(tree) {
|
|
6
|
+
const tasks = [];
|
|
7
|
+
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
8
|
+
skipFormat: true,
|
|
9
|
+
});
|
|
10
|
+
tasks.push(jsInitTask);
|
|
11
|
+
// Ignore nested project files
|
|
12
|
+
let ignoreFile = tree.read('.gitignore').toString();
|
|
13
|
+
if (ignoreFile.indexOf('/dist') !== -1) {
|
|
14
|
+
ignoreFile = ignoreFile.replace('/dist', 'dist');
|
|
15
|
+
}
|
|
16
|
+
if (ignoreFile.indexOf('/node_modules') !== -1) {
|
|
17
|
+
ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
|
|
18
|
+
}
|
|
19
|
+
if (ignoreFile.indexOf('# Remix files') === -1) {
|
|
20
|
+
ignoreFile = `${ignoreFile}
|
|
23
21
|
# Remix files
|
|
24
22
|
apps/**/build
|
|
25
23
|
apps/**/.cache
|
|
26
24
|
`;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
}
|
|
26
|
+
tree.write('.gitignore', ignoreFile);
|
|
27
|
+
(0, devkit_1.updateJson)(tree, `package.json`, (json) => {
|
|
28
|
+
json.type = 'module';
|
|
29
|
+
return json;
|
|
31
30
|
});
|
|
31
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
32
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
32
33
|
}
|
|
33
34
|
exports.default = default_1;
|
|
34
|
-
//# sourceMappingURL=setup.impl.js.map
|
|
@@ -31,16 +31,18 @@ exports[`setup-tailwind generator should add a js tailwind config to an applicat
|
|
|
31
31
|
Scripts,
|
|
32
32
|
ScrollRestoration,
|
|
33
33
|
} from '@remix-run/react';
|
|
34
|
-
import
|
|
35
|
-
export const links = () => [{ rel: 'stylesheet', href:
|
|
36
|
-
export const meta = () =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
import twStyles from './tailwind.css';
|
|
35
|
+
export const links = () => [{ rel: 'stylesheet', href: twStyles }];
|
|
36
|
+
export const meta = () => [
|
|
37
|
+
{
|
|
38
|
+
charset: 'utf-8',
|
|
39
|
+
title: 'New Remix App',
|
|
40
|
+
viewport: 'width=device-width,initial-scale=1',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
41
43
|
export default function App() {
|
|
42
44
|
return (
|
|
43
|
-
<html lang
|
|
45
|
+
<html lang="en">
|
|
44
46
|
<head>
|
|
45
47
|
<Meta />
|
|
46
48
|
<Links />
|
|
@@ -58,28 +60,34 @@ export default function App() {
|
|
|
58
60
|
`;
|
|
59
61
|
|
|
60
62
|
exports[`setup-tailwind generator should add a js tailwind config to an application correctly 4`] = `
|
|
61
|
-
"
|
|
63
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
64
|
+
import { dirname } from 'path';
|
|
65
|
+
import { fileURLToPath } from 'url';
|
|
66
|
+
|
|
67
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
68
|
+
|
|
69
|
+
/**
|
|
62
70
|
* @type {import('@remix-run/dev').AppConfig}
|
|
63
71
|
*/
|
|
64
|
-
|
|
72
|
+
export default {
|
|
65
73
|
tailwind: true,
|
|
66
74
|
ignoredRouteFiles: ['**/.*'],
|
|
67
|
-
// appDirectory:
|
|
68
|
-
// assetsBuildDirectory:
|
|
69
|
-
// serverBuildPath:
|
|
70
|
-
// publicPath:
|
|
71
|
-
watchPaths: () =>
|
|
75
|
+
// appDirectory: "app",
|
|
76
|
+
// assetsBuildDirectory: "public/build",
|
|
77
|
+
// serverBuildPath: "build/index.js",
|
|
78
|
+
// publicPath: "/build/",
|
|
79
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
72
80
|
};
|
|
73
81
|
"
|
|
74
82
|
`;
|
|
75
83
|
|
|
76
84
|
exports[`setup-tailwind generator should add a tailwind config to an application correctly 1`] = `
|
|
77
|
-
"import type { Config } from
|
|
85
|
+
"import type { Config } from "tailwindcss";
|
|
78
86
|
import { createGlobPatternsForDependencies } from '@nx/react/tailwind';
|
|
79
87
|
|
|
80
88
|
export default {
|
|
81
89
|
content: [
|
|
82
|
-
|
|
90
|
+
"./app/**/*.{js,jsx,ts,tsx}",
|
|
83
91
|
...createGlobPatternsForDependencies(__dirname)
|
|
84
92
|
],
|
|
85
93
|
theme: {
|
|
@@ -98,7 +106,7 @@ exports[`setup-tailwind generator should add a tailwind config to an application
|
|
|
98
106
|
`;
|
|
99
107
|
|
|
100
108
|
exports[`setup-tailwind generator should add a tailwind config to an application correctly 3`] = `
|
|
101
|
-
"import type {
|
|
109
|
+
"import type { MetaFunction, LinksFunction } from '@remix-run/node';
|
|
102
110
|
import {
|
|
103
111
|
Links,
|
|
104
112
|
LiveReload,
|
|
@@ -107,18 +115,22 @@ import {
|
|
|
107
115
|
Scripts,
|
|
108
116
|
ScrollRestoration,
|
|
109
117
|
} from '@remix-run/react';
|
|
110
|
-
import
|
|
111
|
-
export const links: LinksFunction = () => [
|
|
118
|
+
import twStyles from './tailwind.css';
|
|
119
|
+
export const links: LinksFunction = () => [
|
|
120
|
+
{ rel: 'stylesheet', href: twStyles },
|
|
121
|
+
];
|
|
112
122
|
|
|
113
|
-
export const meta: MetaFunction = () =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
export const meta: MetaFunction = () => [
|
|
124
|
+
{
|
|
125
|
+
charset: 'utf-8',
|
|
126
|
+
title: 'New Remix App',
|
|
127
|
+
viewport: 'width=device-width,initial-scale=1',
|
|
128
|
+
},
|
|
129
|
+
];
|
|
118
130
|
|
|
119
131
|
export default function App() {
|
|
120
132
|
return (
|
|
121
|
-
<html lang
|
|
133
|
+
<html lang="en">
|
|
122
134
|
<head>
|
|
123
135
|
<Meta />
|
|
124
136
|
<Links />
|
|
@@ -136,17 +148,23 @@ export default function App() {
|
|
|
136
148
|
`;
|
|
137
149
|
|
|
138
150
|
exports[`setup-tailwind generator should add a tailwind config to an application correctly 4`] = `
|
|
139
|
-
"
|
|
151
|
+
"import { createWatchPaths } from '@nx/remix';
|
|
152
|
+
import { dirname } from 'path';
|
|
153
|
+
import { fileURLToPath } from 'url';
|
|
154
|
+
|
|
155
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
156
|
+
|
|
157
|
+
/**
|
|
140
158
|
* @type {import('@remix-run/dev').AppConfig}
|
|
141
159
|
*/
|
|
142
|
-
|
|
160
|
+
export default {
|
|
143
161
|
tailwind: true,
|
|
144
162
|
ignoredRouteFiles: ['**/.*'],
|
|
145
|
-
// appDirectory:
|
|
146
|
-
// assetsBuildDirectory:
|
|
147
|
-
// serverBuildPath:
|
|
148
|
-
// publicPath:
|
|
149
|
-
watchPaths: () =>
|
|
163
|
+
// appDirectory: "app",
|
|
164
|
+
// assetsBuildDirectory: "public/build",
|
|
165
|
+
// serverBuildPath: "build/index.js",
|
|
166
|
+
// publicPath: "/build/",
|
|
167
|
+
watchPaths: () => createWatchPaths(__dirname),
|
|
150
168
|
};
|
|
151
169
|
"
|
|
152
170
|
`;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateRemixConfig = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
|
+
const remix_config_1 = require("../../../utils/remix-config");
|
|
6
6
|
function updateRemixConfig(tree, projectRoot) {
|
|
7
|
-
const pathToRemixConfig = (0,
|
|
8
|
-
if (!tree.exists(pathToRemixConfig)) {
|
|
9
|
-
throw new Error(`Could not find "${pathToRemixConfig}". Please ensure a "remix.config.js" exists at the root of your project.`);
|
|
10
|
-
}
|
|
7
|
+
const pathToRemixConfig = (0, remix_config_1.getRemixConfigPathFromProjectRoot)(tree, projectRoot);
|
|
11
8
|
const fileContents = tree.read(pathToRemixConfig, 'utf-8');
|
|
12
|
-
const REMIX_CONFIG_OBJECT_SELECTOR = '
|
|
9
|
+
const REMIX_CONFIG_OBJECT_SELECTOR = 'ObjectLiteralExpression';
|
|
13
10
|
const ast = tsquery_1.tsquery.ast(fileContents);
|
|
14
11
|
const nodes = (0, tsquery_1.tsquery)(ast, REMIX_CONFIG_OBJECT_SELECTOR, {
|
|
15
12
|
visitAllChildren: true,
|
|
@@ -36,4 +33,3 @@ function updateRemixConfig(tree, projectRoot) {
|
|
|
36
33
|
tree.write(pathToRemixConfig, updatedFileContents);
|
|
37
34
|
}
|
|
38
35
|
exports.updateRemixConfig = updateRemixConfig;
|
|
39
|
-
//# sourceMappingURL=update-remix-config.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"$id": "NxRemixTailwind",
|
|
4
4
|
"title": "Add TailwindCSS to a Remix App",
|
|
5
|
+
"description": "Setup tailwindcss for a given project.",
|
|
5
6
|
"type": "object",
|
|
6
7
|
"examples": [
|
|
7
8
|
{
|
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const upsert_links_function_1 = require("../../utils/upsert-links-function");
|
|
6
5
|
const versions_1 = require("../../utils/versions");
|
|
7
6
|
const lib_1 = require("./lib");
|
|
8
|
-
function setupTailwind(tree, options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
tpl: '',
|
|
17
|
-
});
|
|
18
|
-
if (options.js) {
|
|
19
|
-
tree.rename((0, devkit_1.joinPathFragments)(project.root, 'app/root.js'), (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx'));
|
|
20
|
-
}
|
|
21
|
-
const pathToRoot = (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx');
|
|
22
|
-
(0, upsert_links_function_1.upsertLinksFunction)(tree, pathToRoot, 'styles', './tailwind.css', `{ rel: "stylesheet", href: styles }`);
|
|
23
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
24
|
-
tailwindcss: versions_1.tailwindVersion,
|
|
25
|
-
}, {});
|
|
26
|
-
if (options.js) {
|
|
27
|
-
(0, devkit_1.toJS)(tree);
|
|
28
|
-
}
|
|
29
|
-
if (!options.skipFormat) {
|
|
30
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
31
|
-
}
|
|
32
|
-
return () => {
|
|
33
|
-
(0, devkit_1.installPackagesTask)(tree);
|
|
34
|
-
};
|
|
7
|
+
async function setupTailwind(tree, options) {
|
|
8
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
9
|
+
if (project.projectType !== 'application') {
|
|
10
|
+
throw new Error(`Project "${options.project}" is not an application. Please ensure the project is an application.`);
|
|
11
|
+
}
|
|
12
|
+
(0, lib_1.updateRemixConfig)(tree, project.root);
|
|
13
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), project.root, {
|
|
14
|
+
tpl: '',
|
|
35
15
|
});
|
|
16
|
+
if (options.js) {
|
|
17
|
+
tree.rename((0, devkit_1.joinPathFragments)(project.root, 'app/root.js'), (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx'));
|
|
18
|
+
}
|
|
19
|
+
const pathToRoot = (0, devkit_1.joinPathFragments)(project.root, 'app/root.tsx');
|
|
20
|
+
(0, upsert_links_function_1.upsertLinksFunction)(tree, pathToRoot, 'twStyles', './tailwind.css', `{ rel: "stylesheet", href: twStyles }`);
|
|
21
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
22
|
+
tailwindcss: versions_1.tailwindVersion,
|
|
23
|
+
}, {});
|
|
24
|
+
if (options.js) {
|
|
25
|
+
(0, devkit_1.toJS)(tree);
|
|
26
|
+
}
|
|
27
|
+
if (!options.skipFormat) {
|
|
28
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
32
|
+
};
|
|
36
33
|
}
|
|
37
34
|
exports.default = setupTailwind;
|
|
38
|
-
//# sourceMappingURL=setup-tailwind.impl.js.map
|
|
@@ -3,21 +3,17 @@
|
|
|
3
3
|
exports[`Storybook Configuration it should create a storybook configuration and use react-vite framework with testing framework jest 1`] = `
|
|
4
4
|
"import type { StorybookConfig } from '@storybook/react-vite';
|
|
5
5
|
|
|
6
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
7
|
-
import { mergeConfig } from 'vite';
|
|
8
|
-
|
|
9
6
|
const config: StorybookConfig = {
|
|
10
7
|
stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
|
11
8
|
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
|
|
12
9
|
framework: {
|
|
13
10
|
name: '@storybook/react-vite',
|
|
14
|
-
options: {
|
|
11
|
+
options: {
|
|
12
|
+
builder: {
|
|
13
|
+
viteConfigPath: 'vite.config.ts',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
15
16
|
},
|
|
16
|
-
|
|
17
|
-
viteFinal: async (config) =>
|
|
18
|
-
mergeConfig(config, {
|
|
19
|
-
plugins: [nxViteTsPaths()],
|
|
20
|
-
}),
|
|
21
17
|
};
|
|
22
18
|
|
|
23
19
|
export default config;
|
|
@@ -31,21 +27,17 @@ export default config;
|
|
|
31
27
|
exports[`Storybook Configuration it should create a storybook configuration and use react-vite framework with testing framework none 1`] = `
|
|
32
28
|
"import type { StorybookConfig } from '@storybook/react-vite';
|
|
33
29
|
|
|
34
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
35
|
-
import { mergeConfig } from 'vite';
|
|
36
|
-
|
|
37
30
|
const config: StorybookConfig = {
|
|
38
31
|
stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
|
39
32
|
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
|
|
40
33
|
framework: {
|
|
41
34
|
name: '@storybook/react-vite',
|
|
42
|
-
options: {
|
|
35
|
+
options: {
|
|
36
|
+
builder: {
|
|
37
|
+
viteConfigPath: 'vite.config.ts',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
43
40
|
},
|
|
44
|
-
|
|
45
|
-
viteFinal: async (config) =>
|
|
46
|
-
mergeConfig(config, {
|
|
47
|
-
plugins: [nxViteTsPaths()],
|
|
48
|
-
}),
|
|
49
41
|
};
|
|
50
42
|
|
|
51
43
|
export default config;
|
|
@@ -59,21 +51,17 @@ export default config;
|
|
|
59
51
|
exports[`Storybook Configuration it should create a storybook configuration and use react-vite framework with testing framework vitest 1`] = `
|
|
60
52
|
"import type { StorybookConfig } from '@storybook/react-vite';
|
|
61
53
|
|
|
62
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
63
|
-
import { mergeConfig } from 'vite';
|
|
64
|
-
|
|
65
54
|
const config: StorybookConfig = {
|
|
66
55
|
stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
|
67
56
|
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
|
|
68
57
|
framework: {
|
|
69
58
|
name: '@storybook/react-vite',
|
|
70
|
-
options: {
|
|
59
|
+
options: {
|
|
60
|
+
builder: {
|
|
61
|
+
viteConfigPath: 'vite.config.ts',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
71
64
|
},
|
|
72
|
-
|
|
73
|
-
viteFinal: async (config) =>
|
|
74
|
-
mergeConfig(config, {
|
|
75
|
-
plugins: [nxViteTsPaths()],
|
|
76
|
-
}),
|
|
77
65
|
};
|
|
78
66
|
|
|
79
67
|
export default config;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Linter } from '@nx/
|
|
1
|
+
import { Linter } from '@nx/eslint';
|
|
2
2
|
|
|
3
3
|
export interface StorybookConfigurationSchema {
|
|
4
|
-
|
|
4
|
+
project: string;
|
|
5
5
|
configureCypress: boolean;
|
|
6
6
|
generateStories?: boolean;
|
|
7
7
|
generateCypressSpecs?: boolean;
|
|
@@ -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,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxRemixStorybookConfigure",
|
|
5
5
|
"title": "Remix Storybook Configuration",
|
|
6
6
|
"description": "Set up Storybook for a Remix library.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
9
|
+
"project": {
|
|
10
10
|
"type": "string",
|
|
11
|
-
"aliases": [
|
|
12
|
-
"project",
|
|
13
|
-
"projectName"
|
|
14
|
-
],
|
|
11
|
+
"aliases": ["name", "projectName"],
|
|
15
12
|
"description": "Project for which to generate Storybook configuration.",
|
|
16
13
|
"$default": {
|
|
17
14
|
"$source": "argv",
|
|
@@ -66,9 +63,7 @@
|
|
|
66
63
|
"linter": {
|
|
67
64
|
"description": "The tool to use for running lint checks.",
|
|
68
65
|
"type": "string",
|
|
69
|
-
"enum": [
|
|
70
|
-
"eslint"
|
|
71
|
-
],
|
|
66
|
+
"enum": ["eslint"],
|
|
72
67
|
"default": "eslint"
|
|
73
68
|
},
|
|
74
69
|
"ignorePaths": {
|
|
@@ -90,7 +85,5 @@
|
|
|
90
85
|
"description": "Add a Storybook Test-Runner target."
|
|
91
86
|
}
|
|
92
87
|
},
|
|
93
|
-
"required": [
|
|
94
|
-
"name"
|
|
95
|
-
]
|
|
88
|
+
"required": ["project"]
|
|
96
89
|
}
|
|
@@ -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>;
|