@nx/remix 23.3.0 → 24.0.0-beta.1
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/README.md +10 -7
- package/dist/generators.d.ts +1 -13
- package/dist/generators.js +3 -28
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -2
- package/dist/plugins/component-testing/index.d.ts +1 -0
- package/dist/plugins/component-testing/index.js +1 -0
- package/dist/readme-template.md +10 -4
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +2 -0
- package/dist/src/migrations/update-24-0-0/convert-to-inferred.d.ts +2 -0
- package/dist/src/migrations/update-24-0-0/convert-to-inferred.js +26 -0
- package/dist/src/migrations/update-24-0-0/migrate-to-react-router.md +50 -0
- package/dist/src/plugins/plugin.d.ts +5 -3
- package/dist/src/plugins/plugin.js +8 -7
- package/dist/src/utils/create-watch-paths.d.ts +1 -0
- package/dist/src/utils/create-watch-paths.js +1 -0
- package/dist/src/utils/deprecation.d.ts +2 -4
- package/dist/src/utils/deprecation.js +11 -13
- package/dist/src/utils/versions.d.ts +1 -19
- package/dist/src/utils/versions.js +1 -28
- package/generators.json +2 -79
- package/migrations.json +10 -0
- package/package.json +8 -19
- package/readme-template.md +10 -4
- package/dist/src/executors/build/build.impl.d.ts +0 -5
- package/dist/src/executors/build/build.impl.js +0 -121
- package/dist/src/executors/build/schema.d.ts +0 -8
- package/dist/src/executors/build/schema.json +0 -47
- package/dist/src/executors/serve/schema.d.ts +0 -9
- package/dist/src/executors/serve/schema.json +0 -43
- package/dist/src/executors/serve/serve.impl.d.ts +0 -6
- package/dist/src/executors/serve/serve.impl.js +0 -79
- package/dist/src/generators/action/action.impl.d.ts +0 -3
- package/dist/src/generators/action/action.impl.js +0 -37
- package/dist/src/generators/action/schema.d.ts +0 -3
- package/dist/src/generators/action/schema.json +0 -18
- package/dist/src/generators/application/application.impl.d.ts +0 -5
- package/dist/src/generators/application/application.impl.js +0 -239
- package/dist/src/generators/application/files/common/app/entry.client.tsx__tmpl__ +0 -18
- package/dist/src/generators/application/files/common/app/entry.server.tsx__tmpl__ +0 -139
- package/dist/src/generators/application/files/common/app/root.tsx__tmpl__ +0 -47
- package/dist/src/generators/application/files/common/app/routes/_index.tsx__tmpl__ +0 -9
- package/dist/src/generators/application/files/common/public/favicon.ico +0 -0
- package/dist/src/generators/application/files/common/tests/routes/_index.spec.tsx__tmpl__ +0 -17
- package/dist/src/generators/application/files/common/tsconfig.app.json__tmpl__ +0 -25
- package/dist/src/generators/application/files/common/tsconfig.json__tmpl__ +0 -27
- package/dist/src/generators/application/files/common/vite.config.mts__tmpl__ +0 -25
- package/dist/src/generators/application/files/non-root/.gitignore__tmpl__ +0 -4
- package/dist/src/generators/application/files/non-root/package.json__tmpl__ +0 -20
- package/dist/src/generators/application/files/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +0 -868
- package/dist/src/generators/application/files/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +0 -868
- package/dist/src/generators/application/files/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +0 -866
- package/dist/src/generators/application/files/ts-solution/package.json__tmpl__ +0 -20
- package/dist/src/generators/application/files/ts-solution/tsconfig.app.json__tmpl__ +0 -41
- package/dist/src/generators/application/files/ts-solution/tsconfig.json__tmpl__ +0 -10
- package/dist/src/generators/application/lib/add-e2e.d.ts +0 -3
- package/dist/src/generators/application/lib/add-e2e.js +0 -117
- package/dist/src/generators/application/lib/ignore-vite-temp-files.d.ts +0 -2
- package/dist/src/generators/application/lib/ignore-vite-temp-files.js +0 -50
- package/dist/src/generators/application/lib/index.d.ts +0 -4
- package/dist/src/generators/application/lib/index.js +0 -7
- package/dist/src/generators/application/lib/normalize-options.d.ts +0 -12
- package/dist/src/generators/application/lib/normalize-options.js +0 -40
- package/dist/src/generators/application/lib/update-unit-test-config.d.ts +0 -2
- package/dist/src/generators/application/lib/update-unit-test-config.js +0 -57
- package/dist/src/generators/application/schema.d.ts +0 -18
- package/dist/src/generators/application/schema.json +0 -70
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.impl.d.ts +0 -5
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.impl.js +0 -35
- package/dist/src/generators/cypress-component-configuration/files/cypress.config.ts__tmpl__ +0 -6
- package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -6
- package/dist/src/generators/cypress-component-configuration/schema.json +0 -41
- package/dist/src/generators/error-boundary/error-boundary.impl.d.ts +0 -3
- package/dist/src/generators/error-boundary/error-boundary.impl.js +0 -14
- package/dist/src/generators/error-boundary/lib/add-v2-error-boundary.d.ts +0 -3
- package/dist/src/generators/error-boundary/lib/add-v2-error-boundary.js +0 -37
- package/dist/src/generators/error-boundary/lib/index.d.ts +0 -2
- package/dist/src/generators/error-boundary/lib/index.js +0 -5
- package/dist/src/generators/error-boundary/lib/normalize-options.d.ts +0 -3
- package/dist/src/generators/error-boundary/lib/normalize-options.js +0 -13
- package/dist/src/generators/error-boundary/schema.d.ts +0 -4
- package/dist/src/generators/error-boundary/schema.json +0 -26
- package/dist/src/generators/init/init.d.ts +0 -5
- package/dist/src/generators/init/init.js +0 -67
- package/dist/src/generators/init/schema.d.ts +0 -7
- package/dist/src/generators/init/schema.json +0 -33
- package/dist/src/generators/library/lib/add-tsconfig-entry-points.d.ts +0 -3
- package/dist/src/generators/library/lib/add-tsconfig-entry-points.js +0 -20
- package/dist/src/generators/library/lib/add-unit-testing.d.ts +0 -3
- package/dist/src/generators/library/lib/add-unit-testing.js +0 -31
- package/dist/src/generators/library/lib/index.d.ts +0 -4
- package/dist/src/generators/library/lib/index.js +0 -7
- package/dist/src/generators/library/lib/normalize-options.d.ts +0 -8
- package/dist/src/generators/library/lib/normalize-options.js +0 -31
- package/dist/src/generators/library/lib/update-buildable-config.d.ts +0 -3
- package/dist/src/generators/library/lib/update-buildable-config.js +0 -23
- package/dist/src/generators/library/library.impl.d.ts +0 -6
- package/dist/src/generators/library/library.impl.js +0 -78
- package/dist/src/generators/library/schema.d.ts +0 -19
- package/dist/src/generators/library/schema.json +0 -89
- package/dist/src/generators/loader/loader.impl.d.ts +0 -3
- package/dist/src/generators/loader/loader.impl.js +0 -37
- package/dist/src/generators/loader/schema.d.ts +0 -3
- package/dist/src/generators/loader/schema.json +0 -18
- package/dist/src/generators/meta/lib/v2.impl.d.ts +0 -3
- package/dist/src/generators/meta/lib/v2.impl.js +0 -24
- package/dist/src/generators/meta/meta.impl.d.ts +0 -3
- package/dist/src/generators/meta/meta.impl.js +0 -9
- package/dist/src/generators/meta/schema.d.ts +0 -3
- package/dist/src/generators/meta/schema.json +0 -18
- package/dist/src/generators/preset/lib/normalize-options.d.ts +0 -10
- package/dist/src/generators/preset/lib/normalize-options.js +0 -19
- package/dist/src/generators/preset/preset.impl.d.ts +0 -3
- package/dist/src/generators/preset/preset.impl.js +0 -34
- package/dist/src/generators/preset/schema.d.ts +0 -4
- package/dist/src/generators/preset/schema.json +0 -14
- package/dist/src/generators/resource-route/resource-route.impl.d.ts +0 -3
- package/dist/src/generators/resource-route/resource-route.impl.js +0 -37
- package/dist/src/generators/resource-route/schema.d.ts +0 -6
- package/dist/src/generators/resource-route/schema.json +0 -44
- package/dist/src/generators/route/route.impl.d.ts +0 -3
- package/dist/src/generators/route/route.impl.js +0 -62
- package/dist/src/generators/route/schema.d.ts +0 -8
- package/dist/src/generators/route/schema.json +0 -55
- package/dist/src/generators/setup/schema.json +0 -14
- package/dist/src/generators/setup/setup.impl.d.ts +0 -2
- package/dist/src/generators/setup/setup.impl.js +0 -38
- package/dist/src/generators/storybook-configuration/files/vite.config.mts__tpl__ +0 -15
- package/dist/src/generators/storybook-configuration/schema.d.ts +0 -14
- package/dist/src/generators/storybook-configuration/schema.json +0 -78
- package/dist/src/generators/storybook-configuration/storybook-configuration.impl.d.ts +0 -4
- package/dist/src/generators/storybook-configuration/storybook-configuration.impl.js +0 -33
- package/dist/src/generators/style/schema.d.ts +0 -3
- package/dist/src/generators/style/schema.json +0 -25
- package/dist/src/generators/style/style.impl.d.ts +0 -3
- package/dist/src/generators/style/style.impl.js +0 -55
- package/dist/src/generators/utils/update-dependencies.d.ts +0 -2
- package/dist/src/generators/utils/update-dependencies.js +0 -32
- package/dist/src/utils/assert-and-pin-remix-typescript.d.ts +0 -21
- package/dist/src/utils/assert-and-pin-remix-typescript.js +0 -36
- package/dist/src/utils/get-default-export-name.d.ts +0 -2
- package/dist/src/utils/get-default-export-name.js +0 -7
- package/dist/src/utils/get-default-export.d.ts +0 -2
- package/dist/src/utils/get-default-export.js +0 -14
- package/dist/src/utils/insert-import.d.ts +0 -4
- package/dist/src/utils/insert-import.js +0 -53
- package/dist/src/utils/insert-statement-after-imports.d.ts +0 -5
- package/dist/src/utils/insert-statement-after-imports.js +0 -27
- package/dist/src/utils/insert-statement-in-default-function.d.ts +0 -2
- package/dist/src/utils/insert-statement-in-default-function.js +0 -22
- package/dist/src/utils/remix-config.d.ts +0 -6
- package/dist/src/utils/remix-config.js +0 -75
- package/dist/src/utils/remix-route-utils.d.ts +0 -4
- package/dist/src/utils/remix-route-utils.js +0 -26
- package/dist/src/utils/testing-config-utils.d.ts +0 -5
- package/dist/src/utils/testing-config-utils.js +0 -83
- package/executors.json +0 -14
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "meta",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"description": "Generate a meta function for a given route.",
|
|
6
|
-
"properties": {
|
|
7
|
-
"path": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "The route path or path to the filename of the route.",
|
|
10
|
-
"$default": {
|
|
11
|
-
"$source": "argv",
|
|
12
|
-
"index": 0
|
|
13
|
-
},
|
|
14
|
-
"x-prompt": "What is the path of the route? (e.g. 'apps/demo/app/routes/foo/bar.tsx')"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"required": ["path"]
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
import { RemixGeneratorSchema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends RemixGeneratorSchema {
|
|
4
|
-
appName: string;
|
|
5
|
-
projectRoot: string;
|
|
6
|
-
parsedTags: string[];
|
|
7
|
-
unitTestRunner?: 'jest' | 'none' | 'vitest';
|
|
8
|
-
e2eTestRunner?: 'cypress' | 'none';
|
|
9
|
-
}
|
|
10
|
-
export declare function normalizeOptions(tree: Tree, options: RemixGeneratorSchema): NormalizedSchema;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
function normalizeOptions(tree, options) {
|
|
5
|
-
// There is a bug in Nx core where custom preset args are not passed correctly for boolean values, thus causing the name to be "commit" or "nx-cloud" when not passed.
|
|
6
|
-
// TODO(jack): revert this hack once Nx core is fixed for custom preset args.
|
|
7
|
-
// TODO(philip): presets should probably be using the `appName` flag to name the app, but it's not getting passed down to this generator properly and is always an empty string
|
|
8
|
-
const appName = options.name;
|
|
9
|
-
const projectRoot = `packages/${appName}`;
|
|
10
|
-
const parsedTags = options.tags
|
|
11
|
-
? options.tags.split(',').map((s) => s.trim())
|
|
12
|
-
: [];
|
|
13
|
-
return {
|
|
14
|
-
...options,
|
|
15
|
-
appName,
|
|
16
|
-
projectRoot,
|
|
17
|
-
parsedTags,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const application_impl_1 = tslib_1.__importDefault(require("../application/application.impl"));
|
|
7
|
-
const setup_impl_1 = tslib_1.__importDefault(require("../setup/setup.impl"));
|
|
8
|
-
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
|
-
const versions_1 = require("../../utils/versions");
|
|
10
|
-
async function default_1(tree, _options) {
|
|
11
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
12
|
-
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
13
|
-
const tasks = [];
|
|
14
|
-
const setupGenTask = await (0, setup_impl_1.default)(tree);
|
|
15
|
-
tasks.push(setupGenTask);
|
|
16
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
17
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
18
|
-
nxJson.useInferencePlugins !== false;
|
|
19
|
-
const appGenTask = await (0, application_impl_1.default)(tree, {
|
|
20
|
-
name: options.appName,
|
|
21
|
-
directory: '.',
|
|
22
|
-
tags: options.tags,
|
|
23
|
-
skipFormat: true,
|
|
24
|
-
rootProject: true,
|
|
25
|
-
unitTestRunner: options.unitTestRunner ?? 'vitest',
|
|
26
|
-
e2eTestRunner: options.e2eTestRunner ?? 'cypress',
|
|
27
|
-
addPlugin: addPluginDefault,
|
|
28
|
-
});
|
|
29
|
-
tasks.push(appGenTask);
|
|
30
|
-
tree.delete('apps');
|
|
31
|
-
tree.delete('libs');
|
|
32
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
33
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
34
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "Remix",
|
|
4
|
-
"title": "",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "Generate a Remix application in a standalone workspace. Can be used with `create-nx-workspace --preset=@nx/remix`.",
|
|
7
|
-
"properties": {
|
|
8
|
-
"tags": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Add tags to the app (used for linting).",
|
|
11
|
-
"alias": "t"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
-
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
8
|
-
const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
|
|
9
|
-
const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
|
|
10
|
-
const versions_1 = require("../../utils/versions");
|
|
11
|
-
async function default_1(tree, options) {
|
|
12
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
13
|
-
const { filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
14
|
-
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
15
|
-
allowedFileExtensions: ['ts', 'tsx'],
|
|
16
|
-
fileExtension: 'tsx',
|
|
17
|
-
});
|
|
18
|
-
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
19
|
-
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
|
-
}
|
|
21
|
-
if (tree.exists(routeFilePath))
|
|
22
|
-
throw new Error(`Path already exists: ${options.path}`);
|
|
23
|
-
if (!options.loader && !options.action)
|
|
24
|
-
throw new Error('The resource route generator requires either `loader` or `action` to be true');
|
|
25
|
-
tree.write(routeFilePath, '');
|
|
26
|
-
if (options.loader) {
|
|
27
|
-
await (0, loader_impl_1.default)(tree, {
|
|
28
|
-
path: routeFilePath,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
if (options.action) {
|
|
32
|
-
await (0, action_impl_1.default)(tree, {
|
|
33
|
-
path: routeFilePath,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
37
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixResourceRoute",
|
|
4
|
-
"title": "Create a Resource Route",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "Generate a resource route.",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a resource route at `myapp/app/routes/foo.ts`",
|
|
10
|
-
"command": "nx g resource-route myapp/app/routes/foo.ts"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"description": "Generate a resource route without providing the file extension at `myapp/app/routes/foo.tsx`",
|
|
14
|
-
"command": "nx g resource-route myapp/app/routes/foo"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"properties": {
|
|
18
|
-
"path": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The file path to the route. Relative to the current working directory.",
|
|
21
|
-
"$default": {
|
|
22
|
-
"$source": "argv",
|
|
23
|
-
"index": 0
|
|
24
|
-
},
|
|
25
|
-
"x-prompt": "What is the route file path?"
|
|
26
|
-
},
|
|
27
|
-
"action": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"description": "Generate an action function",
|
|
30
|
-
"default": false
|
|
31
|
-
},
|
|
32
|
-
"loader": {
|
|
33
|
-
"type": "boolean",
|
|
34
|
-
"description": "Generate a loader function",
|
|
35
|
-
"default": true
|
|
36
|
-
},
|
|
37
|
-
"skipChecks": {
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"description": "Skip route error detection",
|
|
40
|
-
"default": false
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"required": ["path"]
|
|
44
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
9
|
-
const action_impl_1 = tslib_1.__importDefault(require("../action/action.impl"));
|
|
10
|
-
const loader_impl_1 = tslib_1.__importDefault(require("../loader/loader.impl"));
|
|
11
|
-
const meta_impl_1 = tslib_1.__importDefault(require("../meta/meta.impl"));
|
|
12
|
-
const style_impl_1 = tslib_1.__importDefault(require("../style/style.impl"));
|
|
13
|
-
const versions_1 = require("../../utils/versions");
|
|
14
|
-
async function default_1(tree, options) {
|
|
15
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
16
|
-
const { artifactName: name, filePath: routeFilePath } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
17
|
-
path: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
18
|
-
allowedFileExtensions: ['ts', 'tsx'],
|
|
19
|
-
fileExtension: 'tsx',
|
|
20
|
-
});
|
|
21
|
-
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
22
|
-
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.`);
|
|
23
|
-
}
|
|
24
|
-
const { className: componentName } = (0, devkit_1.names)(name === '.' || name === '' ? (0, path_1.basename)((0, path_1.dirname)(routeFilePath)) : name);
|
|
25
|
-
if (tree.exists(routeFilePath))
|
|
26
|
-
throw new Error(`Path already exists: ${routeFilePath}`);
|
|
27
|
-
tree.write(routeFilePath, (0, devkit_1.stripIndents) `
|
|
28
|
-
|
|
29
|
-
export default function ${componentName}() {
|
|
30
|
-
${options.loader
|
|
31
|
-
? `
|
|
32
|
-
return (
|
|
33
|
-
<p>
|
|
34
|
-
Message: {data.message}
|
|
35
|
-
</p>
|
|
36
|
-
);
|
|
37
|
-
`
|
|
38
|
-
: `return (<p>${componentName} works!</p>)`}
|
|
39
|
-
}
|
|
40
|
-
`);
|
|
41
|
-
if (options.loader) {
|
|
42
|
-
await (0, loader_impl_1.default)(tree, {
|
|
43
|
-
path: routeFilePath,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (options.meta) {
|
|
47
|
-
await (0, meta_impl_1.default)(tree, {
|
|
48
|
-
path: routeFilePath,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (options.action) {
|
|
52
|
-
await (0, action_impl_1.default)(tree, {
|
|
53
|
-
path: routeFilePath,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (options.style === 'css') {
|
|
57
|
-
await (0, style_impl_1.default)(tree, {
|
|
58
|
-
path: routeFilePath,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
62
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixRoute",
|
|
4
|
-
"title": "Create a Route",
|
|
5
|
-
"description": "Generate a route.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a route at `myapp/app/routes/foo.tsx`",
|
|
10
|
-
"command": "nx g resource-route myapp/app/routes/foo.tsx"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"description": "Generate a route without providing the file extension at `myapp/app/routes/foo.tsx`",
|
|
14
|
-
"command": "nx g resource-route myapp/app/routes/foo"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"properties": {
|
|
18
|
-
"path": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The file path to the route. Relative to the current working directory.",
|
|
21
|
-
"$default": {
|
|
22
|
-
"$source": "argv",
|
|
23
|
-
"index": 0
|
|
24
|
-
},
|
|
25
|
-
"x-prompt": "What is the route file path?"
|
|
26
|
-
},
|
|
27
|
-
"style": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Generate a stylesheet",
|
|
30
|
-
"enum": ["none", "css"],
|
|
31
|
-
"default": "css"
|
|
32
|
-
},
|
|
33
|
-
"meta": {
|
|
34
|
-
"type": "boolean",
|
|
35
|
-
"description": "Generate a meta function",
|
|
36
|
-
"default": false
|
|
37
|
-
},
|
|
38
|
-
"action": {
|
|
39
|
-
"type": "boolean",
|
|
40
|
-
"description": "Generate an action function",
|
|
41
|
-
"default": false
|
|
42
|
-
},
|
|
43
|
-
"loader": {
|
|
44
|
-
"type": "boolean",
|
|
45
|
-
"description": "Generate a loader function",
|
|
46
|
-
"default": false
|
|
47
|
-
},
|
|
48
|
-
"skipChecks": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"description": "Skip route error detection",
|
|
51
|
-
"default": false
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"required": ["path"]
|
|
55
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixSetup",
|
|
4
|
-
"title": "",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "Generate initial files required for Remix to work within the workspace.",
|
|
7
|
-
"properties": {
|
|
8
|
-
"packageManager": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "The package manager to setup for",
|
|
11
|
-
"enum": ["yarn", "npm", "pnpm"]
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const js_1 = require("@nx/js");
|
|
6
|
-
const assert_and_pin_remix_typescript_1 = require("../../utils/assert-and-pin-remix-typescript");
|
|
7
|
-
const versions_1 = require("../../utils/versions");
|
|
8
|
-
async function default_1(tree) {
|
|
9
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
10
|
-
const tasks = [];
|
|
11
|
-
tasks.push((0, assert_and_pin_remix_typescript_1.assertAndPinRemixTypescript)(tree));
|
|
12
|
-
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
13
|
-
skipFormat: true,
|
|
14
|
-
});
|
|
15
|
-
tasks.push(jsInitTask);
|
|
16
|
-
// Ignore nested project files
|
|
17
|
-
let ignoreFile = tree.read('.gitignore').toString();
|
|
18
|
-
if (ignoreFile.indexOf('/dist') !== -1) {
|
|
19
|
-
ignoreFile = ignoreFile.replace('/dist', 'dist');
|
|
20
|
-
}
|
|
21
|
-
if (ignoreFile.indexOf('/node_modules') !== -1) {
|
|
22
|
-
ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
|
|
23
|
-
}
|
|
24
|
-
if (ignoreFile.indexOf('# Remix files') === -1) {
|
|
25
|
-
ignoreFile = `${ignoreFile}
|
|
26
|
-
# Remix files
|
|
27
|
-
apps/**/build
|
|
28
|
-
apps/**/.cache
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
31
|
-
tree.write('.gitignore', ignoreFile);
|
|
32
|
-
(0, devkit_1.updateJson)(tree, `package.json`, (json) => {
|
|
33
|
-
json.type = 'module';
|
|
34
|
-
return json;
|
|
35
|
-
});
|
|
36
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
37
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
38
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import {defineConfig} from 'vite';
|
|
3
|
-
import react from '@vitejs/plugin-react';
|
|
4
|
-
import viteTsConfigPaths from 'vite-tsconfig-paths';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
cacheDir: '<%= cacheDir %>',
|
|
8
|
-
|
|
9
|
-
plugins: [
|
|
10
|
-
react(),
|
|
11
|
-
viteTsConfigPaths({
|
|
12
|
-
root: '../../../',
|
|
13
|
-
}),
|
|
14
|
-
],
|
|
15
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LinterType } from '@nx/js';
|
|
2
|
-
|
|
3
|
-
export interface StorybookConfigurationSchema {
|
|
4
|
-
project: string;
|
|
5
|
-
interactionTests?: boolean;
|
|
6
|
-
generateStories?: boolean;
|
|
7
|
-
js?: boolean;
|
|
8
|
-
tsConfiguration?: boolean;
|
|
9
|
-
linter?: LinterType;
|
|
10
|
-
ignorePaths?: string[];
|
|
11
|
-
configureTestRunner?: boolean;
|
|
12
|
-
configureStaticServe?: boolean;
|
|
13
|
-
addPlugin?: boolean;
|
|
14
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"cli": "nx",
|
|
4
|
-
"$id": "NxRemixStorybookConfigure",
|
|
5
|
-
"title": "Remix Storybook Configuration",
|
|
6
|
-
"description": "Set up Storybook for a Remix library.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"project": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"aliases": ["name", "projectName"],
|
|
12
|
-
"description": "Project for which to generate Storybook configuration.",
|
|
13
|
-
"$default": {
|
|
14
|
-
"$source": "argv",
|
|
15
|
-
"index": 0
|
|
16
|
-
},
|
|
17
|
-
"x-prompt": "For which project do you want to generate Storybook configuration?",
|
|
18
|
-
"x-dropdown": "projects",
|
|
19
|
-
"x-priority": "important"
|
|
20
|
-
},
|
|
21
|
-
"interactionTests": {
|
|
22
|
-
"type": "boolean",
|
|
23
|
-
"description": "Set up Storybook interaction tests.",
|
|
24
|
-
"x-prompt": "Do you want to set up Storybook interaction tests?",
|
|
25
|
-
"x-priority": "important",
|
|
26
|
-
"alias": ["configureTestRunner"],
|
|
27
|
-
"default": true
|
|
28
|
-
},
|
|
29
|
-
"generateStories": {
|
|
30
|
-
"type": "boolean",
|
|
31
|
-
"description": "Automatically generate `*.stories.ts` files for components declared in this project?",
|
|
32
|
-
"x-prompt": "Automatically generate *.stories.ts files for components declared in this project?",
|
|
33
|
-
"default": true,
|
|
34
|
-
"x-priority": "important"
|
|
35
|
-
},
|
|
36
|
-
"configureStaticServe": {
|
|
37
|
-
"type": "boolean",
|
|
38
|
-
"description": "Specifies whether to configure a static file server target for serving storybook. Helpful for speeding up CI build/test times.",
|
|
39
|
-
"x-prompt": "Configure a static file server for the storybook instance?",
|
|
40
|
-
"default": true,
|
|
41
|
-
"x-priority": "important"
|
|
42
|
-
},
|
|
43
|
-
"js": {
|
|
44
|
-
"type": "boolean",
|
|
45
|
-
"description": "Generate JavaScript story files rather than TypeScript story files.",
|
|
46
|
-
"default": false
|
|
47
|
-
},
|
|
48
|
-
"tsConfiguration": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"description": "Configure your project with TypeScript. Generate main.ts and preview.ts files, instead of main.js and preview.js.",
|
|
51
|
-
"default": false
|
|
52
|
-
},
|
|
53
|
-
"linter": {
|
|
54
|
-
"description": "The tool to use for running lint checks.",
|
|
55
|
-
"type": "string",
|
|
56
|
-
"enum": ["eslint", "oxlint"]
|
|
57
|
-
},
|
|
58
|
-
"ignorePaths": {
|
|
59
|
-
"type": "array",
|
|
60
|
-
"description": "Paths to ignore when looking for components.",
|
|
61
|
-
"items": {
|
|
62
|
-
"type": "string",
|
|
63
|
-
"description": "Path to ignore."
|
|
64
|
-
},
|
|
65
|
-
"examples": [
|
|
66
|
-
"**/**/src/**/not-stories/**",
|
|
67
|
-
"libs/my-lib/**/*.something.ts",
|
|
68
|
-
"**/**/src/**/*.other.*",
|
|
69
|
-
"libs/my-lib/src/not-stories/**,**/**/src/**/*.other.*,apps/my-app/**/*.something.ts"
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
"configureTestRunner": {
|
|
73
|
-
"type": "boolean",
|
|
74
|
-
"description": "Add a Storybook Test-Runner target."
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"required": ["project"]
|
|
78
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import type { StorybookConfigurationSchema } from './schema';
|
|
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,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remixStorybookConfiguration = remixStorybookConfiguration;
|
|
4
|
-
exports.default = remixStorybookConfigurationInternal;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const react_1 = require("@nx/react");
|
|
8
|
-
const versions_1 = require("../../utils/versions");
|
|
9
|
-
async function remixStorybookConfiguration(tree, schema) {
|
|
10
|
-
return remixStorybookConfigurationInternal(tree, {
|
|
11
|
-
addPlugin: false,
|
|
12
|
-
...schema,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function normalizedJoinPaths(...paths) {
|
|
16
|
-
const path = (0, devkit_1.joinPathFragments)(...paths);
|
|
17
|
-
return path.startsWith('.') ? path : `./${path}`;
|
|
18
|
-
}
|
|
19
|
-
async function remixStorybookConfigurationInternal(tree, schema) {
|
|
20
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
21
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
22
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
23
|
-
nxJson.useInferencePlugins !== false;
|
|
24
|
-
schema.addPlugin ??= addPluginDefault;
|
|
25
|
-
const { root } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
26
|
-
if (!tree.exists((0, devkit_1.joinPathFragments)(root, 'vite.config.mts')) &&
|
|
27
|
-
!tree.exists((0, devkit_1.joinPathFragments)(root, 'vite.config.ts'))) {
|
|
28
|
-
const cacheDir = normalizedJoinPaths((0, devkit_1.offsetFromRoot)(root), 'node_modules', '.vite', 'storybook', root === '.' ? schema.project : root);
|
|
29
|
-
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, 'files'), root, { cacheDir, tpl: '' });
|
|
30
|
-
}
|
|
31
|
-
const task = await (0, react_1.storybookConfigurationGenerator)(tree, schema);
|
|
32
|
-
return task;
|
|
33
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixRouteStyle",
|
|
4
|
-
"title": "Add style import to a route",
|
|
5
|
-
"description": "Generate a style import and file for a given route.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"description": "Generate a stylesheet at `myapp/app/styles/foo.css`",
|
|
10
|
-
"command": "nx g style myapp/app/routes/foo.tsx"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"properties": {
|
|
14
|
-
"path": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "The file path to the route. Relative to the current working directory.",
|
|
17
|
-
"$default": {
|
|
18
|
-
"$source": "argv",
|
|
19
|
-
"index": 0
|
|
20
|
-
},
|
|
21
|
-
"x-prompt": "What is the route file path?"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"required": ["path"]
|
|
25
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const versions_1 = require("../../utils/versions");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const insert_import_1 = require("../../utils/insert-import");
|
|
9
|
-
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
10
|
-
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
11
|
-
async function default_1(tree, options) {
|
|
12
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
13
|
-
const { project: projectName, directory, fileName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
14
|
-
path: options.path,
|
|
15
|
-
});
|
|
16
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
17
|
-
if (!project)
|
|
18
|
-
throw new Error(`Project does not exist: ${projectName}`);
|
|
19
|
-
const appDir = await (0, remix_route_utils_1.resolveRemixAppDirectory)(tree, project.name);
|
|
20
|
-
const normalizedRoutePath = `${(0, remix_route_utils_1.normalizeRoutePath)((0, devkit_1.joinPathFragments)(directory, fileName)).replace(/^\//, '')}.css`;
|
|
21
|
-
const stylesheetPath = (0, devkit_1.joinPathFragments)(appDir, 'styles', normalizedRoutePath);
|
|
22
|
-
tree.write(stylesheetPath, (0, devkit_1.stripIndents) `
|
|
23
|
-
:root {
|
|
24
|
-
--color-foreground: #fff;
|
|
25
|
-
--color-background: #143157;
|
|
26
|
-
--color-links: hsl(214, 73%, 69%);
|
|
27
|
-
--color-border: #275da8;
|
|
28
|
-
--font-body: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
29
|
-
Liberation Mono, Courier New, monospace;
|
|
30
|
-
}
|
|
31
|
-
`);
|
|
32
|
-
const routeFilePath = options.path;
|
|
33
|
-
(0, insert_import_1.insertImport)(tree, routeFilePath, 'LinksFunction', '@remix-run/node', {
|
|
34
|
-
typeOnly: true,
|
|
35
|
-
});
|
|
36
|
-
if (project.root === '.') {
|
|
37
|
-
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
38
|
-
import stylesUrl from '~/styles/${normalizedRoutePath}'
|
|
39
|
-
|
|
40
|
-
export const links: LinksFunction = () => {
|
|
41
|
-
return [{ rel: 'stylesheet', href: stylesUrl }];
|
|
42
|
-
};
|
|
43
|
-
`);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
47
|
-
import stylesUrl from '${(0, path_1.relative)((0, path_1.dirname)(routeFilePath), stylesheetPath)}';
|
|
48
|
-
|
|
49
|
-
export const links: LinksFunction = () => {
|
|
50
|
-
return [{ rel: 'stylesheet', href: stylesUrl }];
|
|
51
|
-
};
|
|
52
|
-
`);
|
|
53
|
-
}
|
|
54
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
55
|
-
}
|