@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,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
async function normalizeOptions(tree, schema) {
|
|
5
|
-
const pathToRouteFile = schema.path;
|
|
6
|
-
if (!tree.exists(pathToRouteFile)) {
|
|
7
|
-
throw new Error(`Route file specified does not exist "${pathToRouteFile}". Please ensure you pass a correct path to the file.`);
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
...schema,
|
|
11
|
-
path: pathToRouteFile,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixErrorBoundary",
|
|
4
|
-
"title": "Create an ErrorBoundary for a Route",
|
|
5
|
-
"description": "Generate an ErrorBoundary for a given route.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"command": "g error-boundary --routePath=apps/demo/app/routes/my-route.tsx",
|
|
10
|
-
"description": "Generate an ErrorBoundary for my-route.tsx"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"properties": {
|
|
14
|
-
"path": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "The path to route file relative to the project root."
|
|
17
|
-
},
|
|
18
|
-
"skipFormat": {
|
|
19
|
-
"type": "boolean",
|
|
20
|
-
"description": "Skip formatting files after generation.",
|
|
21
|
-
"default": false,
|
|
22
|
-
"x-priority": "internal"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"required": ["path"]
|
|
26
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
-
import { type Schema } from './schema';
|
|
3
|
-
export declare function remixInitGenerator(tree: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function remixInitGeneratorInternal(tree: Tree, options: Schema): Promise<GeneratorCallback>;
|
|
5
|
-
export default remixInitGenerator;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remixInitGenerator = remixInitGenerator;
|
|
4
|
-
exports.remixInitGeneratorInternal = remixInitGeneratorInternal;
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const plugin_1 = require("../../plugins/plugin");
|
|
8
|
-
const assert_and_pin_remix_typescript_1 = require("../../utils/assert-and-pin-remix-typescript");
|
|
9
|
-
const versions_1 = require("../../utils/versions");
|
|
10
|
-
function remixInitGenerator(tree, options) {
|
|
11
|
-
return remixInitGeneratorInternal(tree, { addPlugin: false, ...options });
|
|
12
|
-
}
|
|
13
|
-
async function remixInitGeneratorInternal(tree, options) {
|
|
14
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
15
|
-
const tasks = [];
|
|
16
|
-
tasks.push((0, assert_and_pin_remix_typescript_1.assertAndPinRemixTypescript)(tree));
|
|
17
|
-
if (!options.skipPackageJson) {
|
|
18
|
-
// @remix-run/dev depends on esbuild, whose install script only validates the
|
|
19
|
-
// prebuilt binary that ships as an optional dependency.
|
|
20
|
-
(0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
|
|
21
|
-
esbuild: false,
|
|
22
|
-
});
|
|
23
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
24
|
-
'@remix-run/serve': versions_1.remixVersion,
|
|
25
|
-
}, {
|
|
26
|
-
'@nx/web': versions_1.nxVersion,
|
|
27
|
-
'@remix-run/dev': versions_1.remixVersion,
|
|
28
|
-
}, undefined, options.keepExistingVersions ?? true);
|
|
29
|
-
tasks.push(installTask);
|
|
30
|
-
}
|
|
31
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
32
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
33
|
-
nxJson.useInferencePlugins !== false;
|
|
34
|
-
options.addPlugin ??= addPluginDefault;
|
|
35
|
-
if (options.addPlugin) {
|
|
36
|
-
await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/remix/plugin', plugin_1.createNodesV2, {
|
|
37
|
-
startTargetName: ['start', 'remix:start', 'remix-start'],
|
|
38
|
-
buildTargetName: ['build', 'remix:build', 'remix-build'],
|
|
39
|
-
devTargetName: ['dev', 'remix:dev', 'remix-dev'],
|
|
40
|
-
typecheckTargetName: [
|
|
41
|
-
'typecheck',
|
|
42
|
-
'remix:typecheck',
|
|
43
|
-
'remix-typecheck',
|
|
44
|
-
],
|
|
45
|
-
serveStaticTargetName: [
|
|
46
|
-
'serve-static',
|
|
47
|
-
'remix:serve-static',
|
|
48
|
-
'remix-serve-static',
|
|
49
|
-
],
|
|
50
|
-
buildDepsTargetName: [
|
|
51
|
-
'build-deps',
|
|
52
|
-
'remix:build-deps',
|
|
53
|
-
'remix-build-deps',
|
|
54
|
-
],
|
|
55
|
-
watchDepsTargetName: [
|
|
56
|
-
'watch-deps',
|
|
57
|
-
'remix:watch-deps',
|
|
58
|
-
'remix-watch-deps',
|
|
59
|
-
],
|
|
60
|
-
}, options.updatePackageScripts);
|
|
61
|
-
}
|
|
62
|
-
if (!options.skipFormat) {
|
|
63
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
64
|
-
}
|
|
65
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
66
|
-
}
|
|
67
|
-
exports.default = remixInitGenerator;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixInit",
|
|
4
|
-
"title": "Init Remix Plugin",
|
|
5
|
-
"description": "Initialize the Remix Plugin.",
|
|
6
|
-
"cli": "nx",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"properties": {
|
|
9
|
-
"skipFormat": {
|
|
10
|
-
"description": "Skip formatting files.",
|
|
11
|
-
"type": "boolean",
|
|
12
|
-
"default": false
|
|
13
|
-
},
|
|
14
|
-
"skipPackageJson": {
|
|
15
|
-
"description": "Do not add dependencies to `package.json`.",
|
|
16
|
-
"type": "boolean",
|
|
17
|
-
"default": false
|
|
18
|
-
},
|
|
19
|
-
"keepExistingVersions": {
|
|
20
|
-
"type": "boolean",
|
|
21
|
-
"x-priority": "internal",
|
|
22
|
-
"description": "Keep existing dependencies versions",
|
|
23
|
-
"default": true
|
|
24
|
-
},
|
|
25
|
-
"updatePackageScripts": {
|
|
26
|
-
"type": "boolean",
|
|
27
|
-
"x-priority": "internal",
|
|
28
|
-
"description": "Update `package.json` scripts with inferred targets",
|
|
29
|
-
"default": false
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"required": []
|
|
33
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addTsconfigEntryPoints = addTsconfigEntryPoints;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const js_1 = require("@nx/js");
|
|
6
|
-
const internal_1 = require("@nx/js/internal");
|
|
7
|
-
function addTsconfigEntryPoints(tree, options) {
|
|
8
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
9
|
-
const projectSourceRoot = (0, internal_1.getProjectSourceRoot)(project, tree);
|
|
10
|
-
const serverFilePath = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'server.ts');
|
|
11
|
-
tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
|
|
12
|
-
const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
|
|
13
|
-
(0, devkit_1.updateJson)(tree, baseTsConfig, (json) => {
|
|
14
|
-
if (json.compilerOptions.paths &&
|
|
15
|
-
json.compilerOptions.paths[options.importPath]) {
|
|
16
|
-
json.compilerOptions.paths[(0, devkit_1.joinPathFragments)(options.importPath, 'server')] = [`./${serverFilePath}`];
|
|
17
|
-
}
|
|
18
|
-
return json;
|
|
19
|
-
});
|
|
20
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addUnitTestingSetup = addUnitTestingSetup;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const testing_config_utils_1 = require("../../../utils/testing-config-utils");
|
|
6
|
-
const versions_1 = require("../../../utils/versions");
|
|
7
|
-
function addUnitTestingSetup(tree, options) {
|
|
8
|
-
const pathToTestSetup = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/test-setup.ts');
|
|
9
|
-
let testSetupFileContents = '';
|
|
10
|
-
if (tree.exists(pathToTestSetup)) {
|
|
11
|
-
testSetupFileContents = tree.read(pathToTestSetup, 'utf-8');
|
|
12
|
-
}
|
|
13
|
-
tree.write(pathToTestSetup, (0, devkit_1.stripIndents) `${testSetupFileContents}
|
|
14
|
-
import { installGlobals } from '@remix-run/node';
|
|
15
|
-
import "@testing-library/jest-dom/matchers";
|
|
16
|
-
installGlobals();`);
|
|
17
|
-
if (options.unitTestRunner === 'vitest') {
|
|
18
|
-
const pathToVitestConfig = (0, devkit_1.joinPathFragments)(options.projectRoot, `vite.config.mts`);
|
|
19
|
-
(0, testing_config_utils_1.updateVitestTestSetup)(tree, pathToVitestConfig, './src/test-setup.ts');
|
|
20
|
-
}
|
|
21
|
-
else if (options.unitTestRunner === 'jest') {
|
|
22
|
-
const pathToJestConfig = (0, devkit_1.joinPathFragments)(options.projectRoot, `jest.config.cts`);
|
|
23
|
-
(0, testing_config_utils_1.updateJestTestSetup)(tree, pathToJestConfig, './src/test-setup.ts');
|
|
24
|
-
}
|
|
25
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
26
|
-
'@testing-library/jest-dom': versions_1.testingLibraryJestDomVersion,
|
|
27
|
-
'@testing-library/react': versions_1.testingLibraryReactVersion,
|
|
28
|
-
'@testing-library/user-event': versions_1.testingLibraryUserEventsVersion,
|
|
29
|
-
'@remix-run/node': (0, versions_1.getRemixVersion)(tree),
|
|
30
|
-
}, undefined, true);
|
|
31
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./add-tsconfig-entry-points"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./add-unit-testing"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./update-buildable-config"), exports);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type Tree } from '@nx/devkit';
|
|
2
|
-
import type { NxRemixGeneratorSchema } from '../schema';
|
|
3
|
-
export interface RemixLibraryOptions extends NxRemixGeneratorSchema {
|
|
4
|
-
projectName: string;
|
|
5
|
-
projectRoot: string;
|
|
6
|
-
isUsingTsSolutionConfig: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function normalizeOptions(tree: Tree, options: NxRemixGeneratorSchema): Promise<RemixLibraryOptions>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const internal_2 = require("@nx/js/internal");
|
|
7
|
-
async function normalizeOptions(tree, options) {
|
|
8
|
-
await (0, internal_1.ensureRootProjectName)(options, 'application');
|
|
9
|
-
const { projectName, projectRoot, importPath } = await (0, internal_1.determineProjectNameAndRootOptions)(tree, {
|
|
10
|
-
name: options.name,
|
|
11
|
-
projectType: 'library',
|
|
12
|
-
directory: options.directory,
|
|
13
|
-
});
|
|
14
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
15
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
|
-
nxJson.useInferencePlugins !== false;
|
|
17
|
-
options.addPlugin ??= addPluginDefault;
|
|
18
|
-
const isUsingTsSolutionConfig = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
19
|
-
return {
|
|
20
|
-
...options,
|
|
21
|
-
// Resolved after the spread: the framework's ESLint shaping is guarded on
|
|
22
|
-
// `=== 'eslint'`, and an unresolved `undefined` would skip all of it.
|
|
23
|
-
linter: await (0, internal_2.normalizeLinterOption)(tree, options.linter),
|
|
24
|
-
unitTestRunner: options.unitTestRunner ?? 'vitest',
|
|
25
|
-
projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
|
|
26
|
-
projectRoot,
|
|
27
|
-
importPath,
|
|
28
|
-
isUsingTsSolutionConfig,
|
|
29
|
-
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateBuildableConfig = updateBuildableConfig;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function updateBuildableConfig(tree, options) {
|
|
6
|
-
if (options.isUsingTsSolutionConfig) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
// Nest dist under project root to we can link it
|
|
10
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
11
|
-
project.targets.build.options = {
|
|
12
|
-
...project.targets.build.options,
|
|
13
|
-
format: ['cjs'],
|
|
14
|
-
outputPath: (0, devkit_1.joinPathFragments)(project.root, 'dist'),
|
|
15
|
-
};
|
|
16
|
-
(0, devkit_1.updateProjectConfiguration)(tree, options.projectName, project);
|
|
17
|
-
// Point to nested dist for yarn/npm/pnpm workspaces
|
|
18
|
-
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'), (json) => {
|
|
19
|
-
json.main = './dist/index.cjs.js';
|
|
20
|
-
json.typings = './dist/index.d.ts';
|
|
21
|
-
return json;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Tree } from '@nx/devkit';
|
|
2
|
-
import { GeneratorCallback } from '@nx/devkit';
|
|
3
|
-
import type { NxRemixGeneratorSchema } from './schema';
|
|
4
|
-
export declare function remixLibraryGenerator(tree: Tree, schema: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
|
|
5
|
-
export declare function remixLibraryGeneratorInternal(tree: Tree, schema: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
|
|
6
|
-
export default remixLibraryGenerator;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.remixLibraryGenerator = remixLibraryGenerator;
|
|
4
|
-
exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal;
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const js_1 = require("@nx/js");
|
|
7
|
-
const react_1 = require("@nx/react");
|
|
8
|
-
const lib_1 = require("./lib");
|
|
9
|
-
const internal_1 = require("@nx/js/internal");
|
|
10
|
-
const assert_and_pin_remix_typescript_1 = require("../../utils/assert-and-pin-remix-typescript");
|
|
11
|
-
const update_dependencies_1 = require("../utils/update-dependencies");
|
|
12
|
-
const versions_1 = require("../../utils/versions");
|
|
13
|
-
async function remixLibraryGenerator(tree, schema) {
|
|
14
|
-
return remixLibraryGeneratorInternal(tree, {
|
|
15
|
-
addPlugin: false,
|
|
16
|
-
useProjectJson: true,
|
|
17
|
-
...schema,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async function remixLibraryGeneratorInternal(tree, schema) {
|
|
21
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
22
|
-
const tasks = [];
|
|
23
|
-
tasks.push((0, assert_and_pin_remix_typescript_1.assertAndPinRemixTypescript)(tree));
|
|
24
|
-
const addTsPlugin = (0, internal_1.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin);
|
|
25
|
-
// Detected before `updateDependencies`, which installs eslint unconditionally.
|
|
26
|
-
// Detecting afterwards would just observe what this generator itself added.
|
|
27
|
-
const linter = await (0, internal_1.normalizeLinterOption)(tree, schema.linter);
|
|
28
|
-
const installTask = (0, update_dependencies_1.updateDependencies)(tree);
|
|
29
|
-
tasks.push(installTask);
|
|
30
|
-
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
|
31
|
-
js: schema.js,
|
|
32
|
-
addTsPlugin,
|
|
33
|
-
skipFormat: true,
|
|
34
|
-
});
|
|
35
|
-
tasks.push(jsInitTask);
|
|
36
|
-
const options = await (0, lib_1.normalizeOptions)(tree, { ...schema, linter });
|
|
37
|
-
if (options.isUsingTsSolutionConfig) {
|
|
38
|
-
await (0, internal_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
|
|
39
|
-
}
|
|
40
|
-
const libGenTask = await (0, react_1.libraryGenerator)(tree, {
|
|
41
|
-
directory: options.directory,
|
|
42
|
-
name: options.name,
|
|
43
|
-
style: options.style,
|
|
44
|
-
unitTestRunner: options.unitTestRunner,
|
|
45
|
-
tags: options.tags,
|
|
46
|
-
importPath: options.importPath,
|
|
47
|
-
skipFormat: true,
|
|
48
|
-
skipTsConfig: false,
|
|
49
|
-
linter: options.linter,
|
|
50
|
-
component: true,
|
|
51
|
-
buildable: options.buildable,
|
|
52
|
-
bundler: options.bundler,
|
|
53
|
-
addPlugin: options.addPlugin,
|
|
54
|
-
useProjectJson: options.useProjectJson,
|
|
55
|
-
});
|
|
56
|
-
tasks.push(libGenTask);
|
|
57
|
-
if (options.unitTestRunner && options.unitTestRunner !== 'none') {
|
|
58
|
-
const pkgInstallTask = (0, lib_1.addUnitTestingSetup)(tree, options);
|
|
59
|
-
tasks.push(pkgInstallTask);
|
|
60
|
-
}
|
|
61
|
-
(0, lib_1.addTsconfigEntryPoints)(tree, options);
|
|
62
|
-
if (options.bundler === 'rollup' || options.buildable) {
|
|
63
|
-
(0, lib_1.updateBuildableConfig)(tree, options);
|
|
64
|
-
}
|
|
65
|
-
(0, internal_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.lib.json', {
|
|
66
|
-
jsx: 'react-jsx',
|
|
67
|
-
module: 'esnext',
|
|
68
|
-
moduleResolution: 'bundler',
|
|
69
|
-
}, options.linter === 'eslint'
|
|
70
|
-
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
71
|
-
: undefined);
|
|
72
|
-
(0, internal_1.sortPackageJsonFields)(tree, options.projectRoot);
|
|
73
|
-
if (!options.skipFormat) {
|
|
74
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
75
|
-
}
|
|
76
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
77
|
-
}
|
|
78
|
-
exports.default = remixLibraryGenerator;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { LinterType } from '@nx/js';
|
|
2
|
-
import { SupportedStyles } from '@nx/react';
|
|
3
|
-
|
|
4
|
-
export interface NxRemixGeneratorSchema {
|
|
5
|
-
directory: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
style: SupportedStyles;
|
|
8
|
-
tags?: string;
|
|
9
|
-
importPath?: string;
|
|
10
|
-
/** @deprecated Use bundler instead. */
|
|
11
|
-
buildable?: boolean;
|
|
12
|
-
bundler?: 'none' | 'vite' | 'rollup';
|
|
13
|
-
linter?: LinterType;
|
|
14
|
-
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
15
|
-
js?: boolean;
|
|
16
|
-
skipFormat?: boolean;
|
|
17
|
-
addPlugin?: boolean;
|
|
18
|
-
useProjectJson?: boolean;
|
|
19
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "NxRemixLibrary",
|
|
4
|
-
"title": "Create a Library",
|
|
5
|
-
"description": "Generate a Remix library to help structure workspace and application.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"examples": [
|
|
8
|
-
{
|
|
9
|
-
"command": "g lib mylib --directory=myapp",
|
|
10
|
-
"description": "Generate libs/myapp/mylib"
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"properties": {
|
|
14
|
-
"directory": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "A directory where the lib is placed.",
|
|
17
|
-
"alias": "dir",
|
|
18
|
-
"$default": {
|
|
19
|
-
"$source": "argv",
|
|
20
|
-
"index": 0
|
|
21
|
-
},
|
|
22
|
-
"x-prompt": "Which directory do you want to create the library in?"
|
|
23
|
-
},
|
|
24
|
-
"name": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "Library name",
|
|
27
|
-
"pattern": "^[a-zA-Z].*$",
|
|
28
|
-
"x-priority": "important"
|
|
29
|
-
},
|
|
30
|
-
"tags": {
|
|
31
|
-
"type": "string",
|
|
32
|
-
"description": "Add tags to the library (used for linting)"
|
|
33
|
-
},
|
|
34
|
-
"style": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"description": "Generate a stylesheet",
|
|
37
|
-
"enum": ["none", "css"],
|
|
38
|
-
"default": "css"
|
|
39
|
-
},
|
|
40
|
-
"bundler": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"description": "The bundler to use. Choosing 'none' means this library is not buildable.",
|
|
43
|
-
"enum": ["none", "vite", "rollup"],
|
|
44
|
-
"default": "none",
|
|
45
|
-
"x-prompt": "Which bundler would you like to use to build the library? Choose 'none' to skip build setup.",
|
|
46
|
-
"x-priority": "important"
|
|
47
|
-
},
|
|
48
|
-
"linter": {
|
|
49
|
-
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
50
|
-
"type": "string",
|
|
51
|
-
"enum": ["eslint", "oxlint", "none"],
|
|
52
|
-
"x-priority": "important"
|
|
53
|
-
},
|
|
54
|
-
"unitTestRunner": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"enum": ["vitest", "jest", "none"],
|
|
57
|
-
"description": "Test Runner to use for Unit Tests",
|
|
58
|
-
"x-prompt": "What test runner should be used?",
|
|
59
|
-
"default": "none",
|
|
60
|
-
"x-priority": "important"
|
|
61
|
-
},
|
|
62
|
-
"importPath": {
|
|
63
|
-
"type": "string",
|
|
64
|
-
"description": "The library name used to import it, like @myorg/my-awesome-lib"
|
|
65
|
-
},
|
|
66
|
-
"js": {
|
|
67
|
-
"type": "boolean",
|
|
68
|
-
"description": "Generate JavaScript files rather than TypeScript files",
|
|
69
|
-
"default": false
|
|
70
|
-
},
|
|
71
|
-
"skipFormat": {
|
|
72
|
-
"type": "boolean",
|
|
73
|
-
"description": "Skip formatting files after generator runs",
|
|
74
|
-
"default": false,
|
|
75
|
-
"x-priority": "internal"
|
|
76
|
-
},
|
|
77
|
-
"buildable": {
|
|
78
|
-
"type": "boolean",
|
|
79
|
-
"default": false,
|
|
80
|
-
"description": "Generate a buildable library that uses rollup to bundle.",
|
|
81
|
-
"x-deprecated": "Use the `bundler` option for greater control (none, vite, rollup)."
|
|
82
|
-
},
|
|
83
|
-
"useProjectJson": {
|
|
84
|
-
"type": "boolean",
|
|
85
|
-
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"required": ["directory"]
|
|
89
|
-
}
|
|
@@ -1,37 +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 insert_import_1 = require("../../utils/insert-import");
|
|
6
|
-
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
7
|
-
const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
|
|
8
|
-
const versions_1 = require("../../utils/versions");
|
|
9
|
-
async function default_1(tree, schema) {
|
|
10
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
11
|
-
const routeFilePath = schema.path;
|
|
12
|
-
if (!tree.exists(routeFilePath)) {
|
|
13
|
-
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
14
|
-
}
|
|
15
|
-
(0, insert_import_1.insertImport)(tree, routeFilePath, 'useLoaderData', '@remix-run/react');
|
|
16
|
-
(0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
|
|
17
|
-
(0, insert_import_1.insertImport)(tree, routeFilePath, 'LoaderFunctionArgs', '@remix-run/node', {
|
|
18
|
-
typeOnly: true,
|
|
19
|
-
});
|
|
20
|
-
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
21
|
-
export const loader = async ({request}: LoaderFunctionArgs ) => {
|
|
22
|
-
return json({
|
|
23
|
-
message: 'Hello, world!',
|
|
24
|
-
})
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
`);
|
|
28
|
-
const statement = `\nconst data = useLoaderData<typeof loader>();`;
|
|
29
|
-
try {
|
|
30
|
-
(0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
}
|
|
34
|
-
finally {
|
|
35
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/schema",
|
|
3
|
-
"$id": "data-loader",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"description": "Generate an loader 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,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.v2MetaGenerator = v2MetaGenerator;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const get_default_export_name_1 = require("../../../utils/get-default-export-name");
|
|
6
|
-
const insert_import_1 = require("../../../utils/insert-import");
|
|
7
|
-
const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
|
|
8
|
-
async function v2MetaGenerator(tree, schema) {
|
|
9
|
-
const routeFilePath = schema.path;
|
|
10
|
-
if (!tree.exists(routeFilePath)) {
|
|
11
|
-
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
12
|
-
}
|
|
13
|
-
(0, insert_import_1.insertImport)(tree, routeFilePath, 'MetaFunction', '@remix-run/node', {
|
|
14
|
-
typeOnly: true,
|
|
15
|
-
});
|
|
16
|
-
const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
|
|
17
|
-
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
18
|
-
export const meta: MetaFunction = () => {
|
|
19
|
-
return [{ title: '${defaultExportName} Route' }];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
`);
|
|
23
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const v2_impl_1 = require("./lib/v2.impl");
|
|
5
|
-
const versions_1 = require("../../utils/versions");
|
|
6
|
-
async function default_1(tree, schema) {
|
|
7
|
-
(0, versions_1.assertSupportedRemixVersion)(tree);
|
|
8
|
-
await (0, v2_impl_1.v2MetaGenerator)(tree, schema);
|
|
9
|
-
}
|