@nx/remix 23.3.0 → 24.0.0-beta.0
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,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateDependencies = updateDependencies;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const versions_1 = require("../../utils/versions");
|
|
7
|
-
function updateDependencies(tree) {
|
|
8
|
-
// Vite depends on esbuild, whose install script only validates the prebuilt
|
|
9
|
-
// binary that ships as an optional dependency.
|
|
10
|
-
(0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
|
|
11
|
-
esbuild: false,
|
|
12
|
-
});
|
|
13
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
14
|
-
'@remix-run/node': versions_1.remixVersion,
|
|
15
|
-
'@remix-run/react': versions_1.remixVersion,
|
|
16
|
-
isbot: versions_1.isbotVersion,
|
|
17
|
-
react: versions_1.reactVersion,
|
|
18
|
-
'react-dom': versions_1.reactDomVersion,
|
|
19
|
-
}, {
|
|
20
|
-
'@types/react': versions_1.typesReactVersion,
|
|
21
|
-
'@types/react-dom': versions_1.typesReactDomVersion,
|
|
22
|
-
eslint: versions_1.eslintVersion,
|
|
23
|
-
typescript: versions_1.typescriptVersion,
|
|
24
|
-
vite: versions_1.viteVersion,
|
|
25
|
-
'@nx/vite': versions_1.nxVersion,
|
|
26
|
-
'@nx/vitest': versions_1.nxVersion,
|
|
27
|
-
}, undefined,
|
|
28
|
-
// Don't overwrite a user's installed versions (e.g. React 19 from @nx/react).
|
|
29
|
-
// Remix v2's fresh-install defaults are React 18 / Vite 6, but an existing
|
|
30
|
-
// pin is respected.
|
|
31
|
-
true);
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type GeneratorCallback, type Tree } from '@nx/devkit';
|
|
2
|
-
/**
|
|
3
|
-
* Remix has no TypeScript 6-capable release, so Remix generators must keep the
|
|
4
|
-
* workspace on TS 5.x. It keys off the DECLARED `typescript` version, consulting
|
|
5
|
-
* the installed version only when it satisfies that declared range, and:
|
|
6
|
-
* - throws a hard, actionable error when the workspace resolves to TS >= 6 (the
|
|
7
|
-
* declared floor is >= 6, or an open range like `>=5.9.0` is satisfied by an
|
|
8
|
-
* installed >= 6);
|
|
9
|
-
* - pins TS to Remix's own `~5.9.2` only when `typescript` is absent, never
|
|
10
|
-
* overwriting an existing (5.x) pin. A typescript present only transitively
|
|
11
|
-
* (hoisted, no direct declaration) is treated as absent and gets the pin.
|
|
12
|
-
*
|
|
13
|
-
* Dist-tags (`latest`/`next`) and unparseable ranges have no resolvable floor,
|
|
14
|
-
* so the throw is skipped for them, consistent with devkit's
|
|
15
|
-
* `assertSupportedPackageVersion`.
|
|
16
|
-
*
|
|
17
|
-
* Call before any dependency install in Remix generators that install deps;
|
|
18
|
-
* generators that delegate to the init generator (e.g. application) inherit
|
|
19
|
-
* the guard from it.
|
|
20
|
-
*/
|
|
21
|
-
export declare function assertAndPinRemixTypescript(tree: Tree): GeneratorCallback;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertAndPinRemixTypescript = assertAndPinRemixTypescript;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
const versions_1 = require("./versions");
|
|
7
|
-
/**
|
|
8
|
-
* Remix has no TypeScript 6-capable release, so Remix generators must keep the
|
|
9
|
-
* workspace on TS 5.x. It keys off the DECLARED `typescript` version, consulting
|
|
10
|
-
* the installed version only when it satisfies that declared range, and:
|
|
11
|
-
* - throws a hard, actionable error when the workspace resolves to TS >= 6 (the
|
|
12
|
-
* declared floor is >= 6, or an open range like `>=5.9.0` is satisfied by an
|
|
13
|
-
* installed >= 6);
|
|
14
|
-
* - pins TS to Remix's own `~5.9.2` only when `typescript` is absent, never
|
|
15
|
-
* overwriting an existing (5.x) pin. A typescript present only transitively
|
|
16
|
-
* (hoisted, no direct declaration) is treated as absent and gets the pin.
|
|
17
|
-
*
|
|
18
|
-
* Dist-tags (`latest`/`next`) and unparseable ranges have no resolvable floor,
|
|
19
|
-
* so the throw is skipped for them, consistent with devkit's
|
|
20
|
-
* `assertSupportedPackageVersion`.
|
|
21
|
-
*
|
|
22
|
-
* Call before any dependency install in Remix generators that install deps;
|
|
23
|
-
* generators that delegate to the init generator (e.g. application) inherit
|
|
24
|
-
* the guard from it.
|
|
25
|
-
*/
|
|
26
|
-
function assertAndPinRemixTypescript(tree) {
|
|
27
|
-
const declared = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'typescript');
|
|
28
|
-
const minimum = declared ? (0, internal_1.getRangeMinimum)(declared) : undefined;
|
|
29
|
-
if (minimum && (0, internal_1.isTypescriptVersionAtLeast)(tree, '6.0.0')) {
|
|
30
|
-
throw new Error(`Remix does not support TypeScript 6 (detected \`typescript@${declared}\`).\n\n` +
|
|
31
|
-
`Keep \`typescript\` on a 5.x version to continue using Remix, or migrate to ` +
|
|
32
|
-
`React Router v7 by generating an application with the @nx/react generator: ` +
|
|
33
|
-
`\`nx g @nx/react:application <name> --routing --useReactRouter\`.`);
|
|
34
|
-
}
|
|
35
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { typescript: versions_1.typescriptVersion }, undefined, true);
|
|
36
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultExportName = getDefaultExportName;
|
|
4
|
-
const get_default_export_1 = require("./get-default-export");
|
|
5
|
-
function getDefaultExportName(tree, path) {
|
|
6
|
-
return (0, get_default_export_1.getDefaultExport)(tree, path)?.name.text ?? 'Unknown';
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultExport = getDefaultExport;
|
|
4
|
-
const typescript_1 = require("typescript");
|
|
5
|
-
function getDefaultExport(tree, path) {
|
|
6
|
-
const contents = tree.read(path, 'utf-8');
|
|
7
|
-
const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
|
|
8
|
-
const functionDeclarations = sourceFile.statements.filter(typescript_1.isFunctionDeclaration);
|
|
9
|
-
return functionDeclarations.find((functionDeclaration) => {
|
|
10
|
-
const isDefault = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.DefaultKeyword);
|
|
11
|
-
const isExport = functionDeclaration.modifiers.find((mod) => mod.kind === typescript_1.SyntaxKind.ExportKeyword);
|
|
12
|
-
return isDefault && isExport;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertImport = insertImport;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const typescript_1 = require("typescript");
|
|
6
|
-
const insert_statement_after_imports_1 = require("./insert-statement-after-imports");
|
|
7
|
-
function insertImport(tree, path, name, modulePath, options = { typeOnly: false }) {
|
|
8
|
-
if (!tree.exists(path))
|
|
9
|
-
throw Error(`Could not insert import ${name} from ${modulePath} in ${path}: path not found`);
|
|
10
|
-
const contents = tree.read(path, 'utf-8');
|
|
11
|
-
const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
|
|
12
|
-
let importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
|
|
13
|
-
if (options.typeOnly) {
|
|
14
|
-
importStatements = importStatements.filter((node) => node.importClause.isTypeOnly);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
importStatements = importStatements.filter((node) => !node.importClause.isTypeOnly);
|
|
18
|
-
}
|
|
19
|
-
const existingImport = importStatements.find((statement) => (0, typescript_1.isStringLiteral)(statement.moduleSpecifier) &&
|
|
20
|
-
statement.moduleSpecifier
|
|
21
|
-
.getText(sourceFile)
|
|
22
|
-
.replace(/['"`]/g, '')
|
|
23
|
-
.trim() === modulePath &&
|
|
24
|
-
statement.importClause.namedBindings &&
|
|
25
|
-
(0, typescript_1.isNamedImports)(statement.importClause.namedBindings));
|
|
26
|
-
if (!existingImport) {
|
|
27
|
-
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, path, options.typeOnly
|
|
28
|
-
? `import type { ${name} } from '${modulePath}';`
|
|
29
|
-
: `import { ${name} } from '${modulePath}';`);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const namedImports = existingImport.importClause
|
|
33
|
-
.namedBindings;
|
|
34
|
-
const alreadyImported = namedImports.elements.find((element) => element.name.escapedText === name) !== undefined;
|
|
35
|
-
if (!alreadyImported) {
|
|
36
|
-
const index = namedImports.getEnd() - 1;
|
|
37
|
-
let text;
|
|
38
|
-
if (namedImports.elements.hasTrailingComma) {
|
|
39
|
-
text = `${name},`;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
text = `,${name}`;
|
|
43
|
-
}
|
|
44
|
-
const newContents = (0, devkit_1.applyChangesToString)(contents, [
|
|
45
|
-
{
|
|
46
|
-
type: devkit_1.ChangeType.Insert,
|
|
47
|
-
index,
|
|
48
|
-
text,
|
|
49
|
-
},
|
|
50
|
-
]);
|
|
51
|
-
tree.write(path, newContents);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertStatementAfterImports = insertStatementAfterImports;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const typescript_1 = require("typescript");
|
|
6
|
-
/**
|
|
7
|
-
* Insert a statement after the last import statement in a file
|
|
8
|
-
*/
|
|
9
|
-
function insertStatementAfterImports(tree, path, statement) {
|
|
10
|
-
const contents = tree.read(path, 'utf-8');
|
|
11
|
-
const sourceFile = (0, typescript_1.createSourceFile)(path, contents, typescript_1.ScriptTarget.ESNext);
|
|
12
|
-
const importStatements = sourceFile.statements.filter(typescript_1.isImportDeclaration);
|
|
13
|
-
const index = importStatements.length > 0
|
|
14
|
-
? importStatements[importStatements.length - 1].getEnd()
|
|
15
|
-
: 0;
|
|
16
|
-
if (importStatements.length > 0) {
|
|
17
|
-
statement = `\n${statement}`;
|
|
18
|
-
}
|
|
19
|
-
const newContents = (0, devkit_1.applyChangesToString)(contents, [
|
|
20
|
-
{
|
|
21
|
-
type: devkit_1.ChangeType.Insert,
|
|
22
|
-
index,
|
|
23
|
-
text: statement,
|
|
24
|
-
},
|
|
25
|
-
]);
|
|
26
|
-
tree.write(path, newContents);
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertStatementInDefaultFunction = insertStatementInDefaultFunction;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const get_default_export_1 = require("./get-default-export");
|
|
6
|
-
function insertStatementInDefaultFunction(tree, path, statement) {
|
|
7
|
-
const defaultExport = (0, get_default_export_1.getDefaultExport)(tree, path);
|
|
8
|
-
if (!defaultExport) {
|
|
9
|
-
throw Error('No default export found!');
|
|
10
|
-
}
|
|
11
|
-
const index = defaultExport.body.statements.length > 0
|
|
12
|
-
? defaultExport.body.statements[0].pos
|
|
13
|
-
: 0;
|
|
14
|
-
const newContents = (0, devkit_1.applyChangesToString)(tree.read(path, 'utf-8'), [
|
|
15
|
-
{
|
|
16
|
-
type: devkit_1.ChangeType.Insert,
|
|
17
|
-
index,
|
|
18
|
-
text: statement,
|
|
19
|
-
},
|
|
20
|
-
]);
|
|
21
|
-
tree.write(path, newContents);
|
|
22
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
import type { AppConfig } from '@remix-run/dev';
|
|
3
|
-
export declare function getRemixConfigPathDetails(tree: Tree, projectName: string): string[];
|
|
4
|
-
export declare function getRemixConfigPath(tree: Tree, projectName: string): string;
|
|
5
|
-
export declare function getRemixConfigPathFromProjectRoot(tree: Tree, projectRoot: string): string;
|
|
6
|
-
export declare function getRemixConfigValues(tree: Tree, projectName: string): Promise<AppConfig>;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRemixConfigPathDetails = getRemixConfigPathDetails;
|
|
4
|
-
exports.getRemixConfigPath = getRemixConfigPath;
|
|
5
|
-
exports.getRemixConfigPathFromProjectRoot = getRemixConfigPathFromProjectRoot;
|
|
6
|
-
exports.getRemixConfigValues = getRemixConfigValues;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const executor_utils_1 = require("./executor-utils");
|
|
9
|
-
function getRemixConfigPathDetails(tree, projectName) {
|
|
10
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
11
|
-
if (!project)
|
|
12
|
-
throw new Error(`Project does not exist: ${projectName}`);
|
|
13
|
-
for (const ext of ['.mjs', '.cjs', '.js', '.mts', '.cts', '.ts']) {
|
|
14
|
-
const configPath = (0, devkit_1.joinPathFragments)(project.root, `vite.config${ext}`);
|
|
15
|
-
if (tree.exists(configPath)) {
|
|
16
|
-
return [configPath, 'vite'];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
for (const ext of ['.mjs', '.cjs', '.js']) {
|
|
20
|
-
const configPath = (0, devkit_1.joinPathFragments)(project.root, `remix.config${ext}`);
|
|
21
|
-
if (tree.exists(configPath)) {
|
|
22
|
-
return [configPath, 'classic'];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function getRemixConfigPath(tree, projectName) {
|
|
27
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
28
|
-
if (!project)
|
|
29
|
-
throw new Error(`Project does not exist: ${projectName}`);
|
|
30
|
-
for (const ext of ['.mjs', '.cjs', '.js']) {
|
|
31
|
-
const configPath = (0, devkit_1.joinPathFragments)(project.root, `remix.config${ext}`);
|
|
32
|
-
if (tree.exists(configPath)) {
|
|
33
|
-
return configPath;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function getRemixConfigPathFromProjectRoot(tree, projectRoot) {
|
|
38
|
-
let pathToRemixConfig;
|
|
39
|
-
for (const ext of ['.js', '.mjs', '.cjs']) {
|
|
40
|
-
pathToRemixConfig = (0, devkit_1.joinPathFragments)(projectRoot, `remix.config${ext}`);
|
|
41
|
-
if (tree.exists(pathToRemixConfig)) {
|
|
42
|
-
return pathToRemixConfig;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
throw new Error(`Could not find a Remix Config File. Please ensure a "remix.config.js" file exists at the root of your project.`);
|
|
46
|
-
}
|
|
47
|
-
const _remixConfigCache = {};
|
|
48
|
-
async function getRemixConfigValues(tree, projectName) {
|
|
49
|
-
const [configPath, configType] = getRemixConfigPathDetails(tree, projectName);
|
|
50
|
-
const remixConfigPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, configPath);
|
|
51
|
-
const cacheKey = `${projectName}/${remixConfigPath}`;
|
|
52
|
-
let appConfig = _remixConfigCache[cacheKey];
|
|
53
|
-
let resolvedConfig;
|
|
54
|
-
if (!appConfig) {
|
|
55
|
-
if (configType === 'vite') {
|
|
56
|
-
const { resolveConfig } = await (0, executor_utils_1.loadViteDynamicImport)();
|
|
57
|
-
const viteBuildConfig = (await resolveConfig({
|
|
58
|
-
configFile: configPath,
|
|
59
|
-
mode: 'development',
|
|
60
|
-
}, 'build'));
|
|
61
|
-
appConfig = viteBuildConfig.__remixPluginContext?.remixConfig;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
try {
|
|
65
|
-
const importedConfig = await Function(`return import("${remixConfigPath}?t=${Date.now()}")`)();
|
|
66
|
-
appConfig = (importedConfig?.default || importedConfig);
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
appConfig = require(remixConfigPath);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
_remixConfigCache[cacheKey] = appConfig;
|
|
73
|
-
}
|
|
74
|
-
return appConfig;
|
|
75
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function normalizeRoutePath(path: string): string;
|
|
3
|
-
export declare function checkRoutePathForErrors(path: string): RegExpMatchArray;
|
|
4
|
-
export declare function resolveRemixAppDirectory(tree: Tree, projectName: string): Promise<string>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeRoutePath = normalizeRoutePath;
|
|
4
|
-
exports.checkRoutePathForErrors = checkRoutePathForErrors;
|
|
5
|
-
exports.resolveRemixAppDirectory = resolveRemixAppDirectory;
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const remix_config_1 = require("./remix-config");
|
|
9
|
-
function normalizeRoutePath(path) {
|
|
10
|
-
return path.indexOf('/routes/') > -1
|
|
11
|
-
? path.substring(path.indexOf('/routes/') + 8)
|
|
12
|
-
: path;
|
|
13
|
-
}
|
|
14
|
-
function checkRoutePathForErrors(path) {
|
|
15
|
-
return (path.match(/\w\.\.\w/) || // route.$withParams.tsx => route..tsx
|
|
16
|
-
path.match(/\w\/\/\w/) || // route/$withParams/index.tsx => route//index.tsx
|
|
17
|
-
path.match(/\w\/\.\w/) // route/$withParams.tsx => route/.tsx
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
async function resolveRemixAppDirectory(tree, projectName) {
|
|
21
|
-
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
22
|
-
const remixConfig = await (0, remix_config_1.getRemixConfigValues)(tree, projectName);
|
|
23
|
-
return (0, devkit_1.joinPathFragments)(project.root, remixConfig.appDirectory
|
|
24
|
-
? (0, path_1.relative)(project.root, remixConfig.appDirectory)
|
|
25
|
-
: 'app');
|
|
26
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type Tree } from '@nx/devkit';
|
|
2
|
-
export declare function updateVitestTestSetup(tree: Tree, pathToVitestConfig: string, pathToTestSetup: string): void;
|
|
3
|
-
export declare function updateJestTestSetup(tree: Tree, pathToJestConfig: string, pathToTestSetup: string): void;
|
|
4
|
-
export declare function updateJestTestMatch(tree: Tree, pathToJestConfig: string, includesString: string): void;
|
|
5
|
-
export declare function updateVitestTestIncludes(tree: Tree, pathToVitestConfig: string, includesString: string): void;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateVitestTestSetup = updateVitestTestSetup;
|
|
4
|
-
exports.updateJestTestSetup = updateJestTestSetup;
|
|
5
|
-
exports.updateJestTestMatch = updateJestTestMatch;
|
|
6
|
-
exports.updateVitestTestIncludes = updateVitestTestIncludes;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
const internal_1 = require("@nx/js/internal");
|
|
9
|
-
let tsModule;
|
|
10
|
-
function updateVitestTestSetup(tree, pathToVitestConfig, pathToTestSetup) {
|
|
11
|
-
if (!tsModule) {
|
|
12
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
13
|
-
}
|
|
14
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
15
|
-
const fileContents = tree.read(pathToVitestConfig, 'utf-8');
|
|
16
|
-
const sourceFile = ast(fileContents);
|
|
17
|
-
const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=setupFiles])';
|
|
18
|
-
const nodes = query(sourceFile, TEST_SETUPFILES_SELECTOR);
|
|
19
|
-
let updatedFileContents = fileContents;
|
|
20
|
-
if (nodes.length === 0) {
|
|
21
|
-
const TEST_CONFIG_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) > ObjectLiteralExpression';
|
|
22
|
-
const testConfigNodes = query(sourceFile, TEST_CONFIG_SELECTOR);
|
|
23
|
-
updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, testConfigNodes[0].getStart() + 1)}setupFiles: ['${pathToTestSetup}'],${fileContents.slice(testConfigNodes[0].getStart() + 1)}`;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const arrayNodes = query(nodes[0], 'ArrayLiteralExpression');
|
|
27
|
-
if (arrayNodes.length !== 0) {
|
|
28
|
-
updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
tree.write(pathToVitestConfig, updatedFileContents);
|
|
32
|
-
}
|
|
33
|
-
function updateJestTestSetup(tree, pathToJestConfig, pathToTestSetup) {
|
|
34
|
-
if (!tsModule) {
|
|
35
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
36
|
-
}
|
|
37
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
38
|
-
const fileContents = tree.read(pathToJestConfig, 'utf-8');
|
|
39
|
-
const sourceFile = ast(fileContents);
|
|
40
|
-
const TEST_SETUPFILES_SELECTOR = 'PropertyAssignment:has(Identifier[name=setupFilesAfterEnv])';
|
|
41
|
-
const nodes = query(sourceFile, TEST_SETUPFILES_SELECTOR);
|
|
42
|
-
if (nodes.length === 0) {
|
|
43
|
-
const CONFIG_SELECTOR = 'ObjectLiteralExpression';
|
|
44
|
-
const nodes = query(sourceFile, CONFIG_SELECTOR);
|
|
45
|
-
const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart() + 1)}setupFilesAfterEnv: ['${pathToTestSetup}'],${fileContents.slice(nodes[0].getStart() + 1)}`;
|
|
46
|
-
tree.write(pathToJestConfig, updatedFileContents);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const arrayNodes = query(nodes[0], 'ArrayLiteralExpression');
|
|
50
|
-
if (arrayNodes.length !== 0) {
|
|
51
|
-
const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, arrayNodes[0].getStart() + 1)}'${pathToTestSetup}',${fileContents.slice(arrayNodes[0].getStart() + 1)}`;
|
|
52
|
-
tree.write(pathToJestConfig, updatedFileContents);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function updateJestTestMatch(tree, pathToJestConfig, includesString) {
|
|
57
|
-
if (!tsModule) {
|
|
58
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
59
|
-
}
|
|
60
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
61
|
-
const fileContents = tree.read(pathToJestConfig, 'utf-8');
|
|
62
|
-
const sourceFile = ast(fileContents);
|
|
63
|
-
const TEST_MATCH_SELECTOR = 'PropertyAssignment:has(Identifier[name=testMatch])';
|
|
64
|
-
const nodes = query(sourceFile, TEST_MATCH_SELECTOR);
|
|
65
|
-
if (nodes.length !== 0) {
|
|
66
|
-
const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}testMatch: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
|
|
67
|
-
tree.write(pathToJestConfig, updatedFileContents);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function updateVitestTestIncludes(tree, pathToVitestConfig, includesString) {
|
|
71
|
-
if (!tsModule) {
|
|
72
|
-
tsModule = (0, internal_1.ensureTypescript)();
|
|
73
|
-
}
|
|
74
|
-
const { ast, query } = require('@phenomnomnominal/tsquery');
|
|
75
|
-
const fileContents = tree.read(pathToVitestConfig, 'utf-8');
|
|
76
|
-
const sourceFile = ast(fileContents);
|
|
77
|
-
const TEST_INCLUDE_SELECTOR = 'PropertyAssignment:has(Identifier[name=test]) PropertyAssignment:has(Identifier[name=include])';
|
|
78
|
-
const nodes = query(sourceFile, TEST_INCLUDE_SELECTOR);
|
|
79
|
-
if (nodes.length !== 0) {
|
|
80
|
-
const updatedFileContents = (0, devkit_1.stripIndents) `${fileContents.slice(0, nodes[0].getStart())}include: ["${includesString}"]${fileContents.slice(nodes[0].getEnd())}`;
|
|
81
|
-
tree.write(pathToVitestConfig, updatedFileContents);
|
|
82
|
-
}
|
|
83
|
-
}
|
package/executors.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"executors": {
|
|
3
|
-
"serve": {
|
|
4
|
-
"implementation": "./dist/src/executors/serve/serve.impl",
|
|
5
|
-
"schema": "./dist/src/executors/serve/schema.json",
|
|
6
|
-
"description": "Serve a Remix application."
|
|
7
|
-
},
|
|
8
|
-
"build": {
|
|
9
|
-
"implementation": "./dist/src/executors/build/build.impl",
|
|
10
|
-
"schema": "./dist/src/executors/build/schema.json",
|
|
11
|
-
"description": "Build a Remix application."
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|