@nx/next 23.0.0-beta.23 → 23.0.0-beta.25
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/dist/babel.d.ts +1 -0
- package/{babel.js → dist/babel.js} +2 -0
- package/{index.d.ts → dist/index.d.ts} +0 -1
- package/{plugin.d.ts → dist/plugin.d.ts} +0 -1
- package/{plugins → dist/plugins}/component-testing.d.ts +0 -1
- package/{plugins → dist/plugins}/component-testing.js +16 -10
- package/{plugins → dist/plugins}/with-less.d.ts +0 -1
- package/{plugins → dist/plugins}/with-nx.d.ts +0 -1
- package/{plugins → dist/plugins}/with-nx.js +1 -34
- package/{src → dist/src}/executors/build/build.impl.d.ts +0 -1
- package/{src → dist/src}/executors/build/lib/check-project.d.ts +0 -1
- package/{src → dist/src}/executors/build/lib/create-next-config-file.d.ts +0 -1
- package/{src → dist/src}/executors/build/lib/update-package-json.d.ts +0 -1
- package/{src → dist/src}/executors/server/custom-server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/server/server.impl.d.ts +0 -1
- package/{src → dist/src}/executors/server/server.impl.js +2 -2
- package/{src → dist/src}/generators/application/application.d.ts +0 -1
- package/{src → dist/src}/generators/application/application.js +14 -12
- package/{src → dist/src}/generators/application/lib/add-e2e.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/add-jest.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/add-linting.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/add-linting.js +4 -4
- package/{src → dist/src}/generators/application/lib/add-plugin.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/add-project.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-application-files.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/create-application-files.helpers.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/normalize-options.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/normalize-options.js +2 -2
- package/{src → dist/src}/generators/application/lib/set-defaults.d.ts +0 -1
- package/{src → dist/src}/generators/application/lib/update-cypress-tsconfig.d.ts +0 -1
- package/{src → dist/src}/generators/component/component.d.ts +0 -1
- package/{src → dist/src}/generators/component/component.js +2 -0
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/convert-to-inferred.js +2 -0
- package/{src → dist/src}/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/serve-post-target-tranformer.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/update-next-config.d.ts +0 -1
- package/{src → dist/src}/generators/convert-to-inferred/lib/utils.d.ts +0 -1
- package/{src → dist/src}/generators/custom-server/custom-server.d.ts +0 -1
- package/{src → dist/src}/generators/custom-server/custom-server.js +2 -0
- package/{src → dist/src}/generators/cypress-component-configuration/cypress-component-configuration.d.ts +0 -1
- package/{src → dist/src}/generators/cypress-component-configuration/cypress-component-configuration.js +7 -38
- package/{src → dist/src}/generators/init/init.d.ts +0 -1
- package/{src → dist/src}/generators/init/init.js +8 -39
- package/{src → dist/src}/generators/init/schema.json +1 -1
- package/{src → dist/src}/generators/library/lib/normalize-options.d.ts +0 -1
- package/{src → dist/src}/generators/library/lib/update-vite-config.d.ts +0 -1
- package/{src → dist/src}/generators/library/library.d.ts +0 -1
- package/{src → dist/src}/generators/library/library.js +18 -16
- package/{src → dist/src}/generators/page/page.d.ts +0 -1
- package/{src → dist/src}/generators/page/page.js +2 -0
- package/{src → dist/src}/migrations/update-22-0-0/add-svgr-to-next-config.d.ts +0 -1
- package/dist/src/migrations/update-22-2-0/ai-instructions-for-next-16.md +845 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.d.ts +9 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.js +134 -0
- package/dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md +25 -0
- package/{src → dist/src}/plugins/plugin.d.ts +0 -1
- package/{src → dist/src}/plugins/plugin.js +4 -2
- package/{src → dist/src}/utils/add-gitignore-entry.d.ts +0 -1
- package/{src → dist/src}/utils/add-swc-to-custom-server.d.ts +0 -1
- package/{src → dist/src}/utils/add-swc-to-custom-server.js +1 -1
- package/dist/src/utils/assert-supported-next-version.d.ts +2 -0
- package/dist/src/utils/assert-supported-next-version.js +8 -0
- package/{src → dist/src}/utils/compose-plugins.d.ts +0 -1
- package/dist/src/utils/config-invalid-function.fixture.d.ts +1 -0
- package/dist/src/utils/config-invalid-function.fixture.js +3 -0
- package/dist/src/utils/config-not-a-function.fixture.d.ts +1 -0
- package/dist/src/utils/config-not-a-function.fixture.js +3 -0
- package/{src → dist/src}/utils/config.d.ts +0 -1
- package/{src → dist/src}/utils/constants.d.ts +0 -1
- package/{src → dist/src}/utils/create-cli-options.d.ts +0 -1
- package/{src → dist/src}/utils/create-copy-plugin.d.ts +0 -1
- package/{src → dist/src}/utils/deprecation.d.ts +0 -1
- package/{src → dist/src}/utils/jest-config-util.d.ts +0 -1
- package/{src → dist/src}/utils/runtime-version-utils.d.ts +0 -1
- package/{src → dist/src}/utils/styles.d.ts +0 -1
- package/{src → dist/src}/utils/styles.js +1 -1
- package/{src → dist/src}/utils/types.d.ts +0 -1
- package/{src → dist/src}/utils/version-utils.d.ts +0 -1
- package/{src → dist/src}/utils/versions.d.ts +5 -5
- package/{src → dist/src}/utils/versions.js +8 -6
- package/{tailwind.d.ts → dist/tailwind.d.ts} +0 -1
- package/dist/typings/image.d.ts +12 -0
- package/executors.json +4 -4
- package/generators.json +16 -16
- package/migrations.json +8 -35
- package/package.json +94 -14
- package/babel.d.ts +0 -1
- package/babel.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/plugin.d.ts.map +0 -1
- package/plugins/component-testing.d.ts.map +0 -1
- package/plugins/with-less.d.ts.map +0 -1
- package/plugins/with-nx.d.ts.map +0 -1
- package/src/executors/build/build.impl.d.ts.map +0 -1
- package/src/executors/build/lib/check-project.d.ts.map +0 -1
- package/src/executors/build/lib/create-next-config-file.d.ts.map +0 -1
- package/src/executors/build/lib/update-package-json.d.ts.map +0 -1
- package/src/executors/server/custom-server.impl.d.ts.map +0 -1
- package/src/executors/server/server.impl.d.ts.map +0 -1
- package/src/generators/application/application.d.ts.map +0 -1
- package/src/generators/application/lib/add-e2e.d.ts.map +0 -1
- package/src/generators/application/lib/add-jest.d.ts.map +0 -1
- package/src/generators/application/lib/add-linting.d.ts.map +0 -1
- package/src/generators/application/lib/add-plugin.d.ts.map +0 -1
- package/src/generators/application/lib/add-project.d.ts.map +0 -1
- package/src/generators/application/lib/create-application-files.d.ts.map +0 -1
- package/src/generators/application/lib/create-application-files.helpers.d.ts.map +0 -1
- package/src/generators/application/lib/normalize-options.d.ts.map +0 -1
- package/src/generators/application/lib/set-defaults.d.ts.map +0 -1
- package/src/generators/application/lib/update-cypress-tsconfig.d.ts.map +0 -1
- package/src/generators/component/component.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/serve-post-target-tranformer.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/update-next-config.d.ts.map +0 -1
- package/src/generators/convert-to-inferred/lib/utils.d.ts.map +0 -1
- package/src/generators/custom-server/custom-server.d.ts.map +0 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +0 -1
- package/src/generators/init/init.d.ts.map +0 -1
- package/src/generators/library/lib/normalize-options.d.ts.map +0 -1
- package/src/generators/library/lib/update-vite-config.d.ts.map +0 -1
- package/src/generators/library/library.d.ts.map +0 -1
- package/src/generators/page/page.d.ts.map +0 -1
- package/src/migrations/update-22-0-0/add-svgr-to-next-config.d.ts.map +0 -1
- package/src/plugins/plugin.d.ts.map +0 -1
- package/src/utils/add-gitignore-entry.d.ts.map +0 -1
- package/src/utils/add-swc-to-custom-server.d.ts.map +0 -1
- package/src/utils/compose-plugins.d.ts.map +0 -1
- package/src/utils/config-invalid-function.fixture.d.ts +0 -1
- package/src/utils/config-invalid-function.fixture.d.ts.map +0 -1
- package/src/utils/config-invalid-function.fixture.js +0 -1
- package/src/utils/config-not-a-function.fixture.d.ts +0 -1
- package/src/utils/config-not-a-function.fixture.d.ts.map +0 -1
- package/src/utils/config-not-a-function.fixture.js +0 -1
- package/src/utils/config.d.ts.map +0 -1
- package/src/utils/constants.d.ts.map +0 -1
- package/src/utils/create-cli-options.d.ts.map +0 -1
- package/src/utils/create-copy-plugin.d.ts.map +0 -1
- package/src/utils/deprecation.d.ts.map +0 -1
- package/src/utils/jest-config-util.d.ts.map +0 -1
- package/src/utils/runtime-version-utils.d.ts.map +0 -1
- package/src/utils/styles.d.ts.map +0 -1
- package/src/utils/types.d.ts.map +0 -1
- package/src/utils/version-utils.d.ts.map +0 -1
- package/src/utils/versions.d.ts.map +0 -1
- package/tailwind.d.ts.map +0 -1
- /package/{LICENSE → dist/LICENSE} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{plugin.js → dist/plugin.js} +0 -0
- /package/{plugins → dist/plugins}/with-less.js +0 -0
- /package/{src → dist/src}/executors/build/build.impl.js +0 -0
- /package/{src → dist/src}/executors/build/lib/check-project.js +0 -0
- /package/{src → dist/src}/executors/build/lib/create-next-config-file.js +0 -0
- /package/{src → dist/src}/executors/build/lib/update-package-json.js +0 -0
- /package/{src → dist/src}/executors/build/schema.json +0 -0
- /package/{src → dist/src}/executors/server/custom-server.impl.js +0 -0
- /package/{src → dist/src}/executors/server/schema.json +0 -0
- /package/{src → dist/src}/generators/application/files/app/api/hello/route.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/app/global.__stylesExt____tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/app/page.module.__style__ +0 -0
- /package/{src → dist/src}/generators/application/files/app/page.tsx__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/app-default-layout/layout.tsx__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/__dot__babelrc +0 -0
- /package/{src → dist/src}/generators/application/files/common/index.d.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/next-env.d.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/next.config.js__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/public/.gitkeep +0 -0
- /package/{src → dist/src}/generators/application/files/common/public/favicon.ico +0 -0
- /package/{src → dist/src}/generators/application/files/common/specs/__fileName__.spec.tsx__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/common/tsconfig.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/pages/__fileName__.module.__style__ +0 -0
- /package/{src → dist/src}/generators/application/files/pages/__fileName__.tsx__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/pages/_app.tsx__tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/files/pages/styles.__stylesExt____tmpl__ +0 -0
- /package/{src → dist/src}/generators/application/lib/add-e2e.js +0 -0
- /package/{src → dist/src}/generators/application/lib/add-jest.js +0 -0
- /package/{src → dist/src}/generators/application/lib/add-plugin.js +0 -0
- /package/{src → dist/src}/generators/application/lib/add-project.js +0 -0
- /package/{src → dist/src}/generators/application/lib/create-application-files.helpers.js +0 -0
- /package/{src → dist/src}/generators/application/lib/create-application-files.js +0 -0
- /package/{src → dist/src}/generators/application/lib/set-defaults.js +0 -0
- /package/{src → dist/src}/generators/application/lib/update-cypress-tsconfig.js +0 -0
- /package/{src → dist/src}/generators/application/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/application/schema.json +0 -0
- /package/{src → dist/src}/generators/component/schema.json +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/build-post-target-transformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/serve-post-target-tranformer.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/update-next-config.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/lib/utils.js +0 -0
- /package/{src → dist/src}/generators/convert-to-inferred/schema.json +0 -0
- /package/{src → dist/src}/generators/custom-server/files/server/main.ts__tmpl__ +0 -0
- /package/{src → dist/src}/generators/custom-server/files/tsconfig.server.json__tmpl__ +0 -0
- /package/{src → dist/src}/generators/custom-server/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/custom-server/schema.json +0 -0
- /package/{src → dist/src}/generators/cypress-component-configuration/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/cypress-component-configuration/schema.json +0 -0
- /package/{src → dist/src}/generators/init/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/library/lib/normalize-options.js +0 -0
- /package/{src → dist/src}/generators/library/lib/update-vite-config.js +0 -0
- /package/{src → dist/src}/generators/library/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/library/schema.json +0 -0
- /package/{src → dist/src}/generators/page/schema.d.ts +0 -0
- /package/{src → dist/src}/generators/page/schema.json +0 -0
- /package/{src → dist/src}/migrations/update-22-0-0/add-svgr-to-next-config.js +0 -0
- /package/{src → dist/src}/utils/add-gitignore-entry.js +0 -0
- /package/{src → dist/src}/utils/compose-plugins.js +0 -0
- /package/{src → dist/src}/utils/config.js +0 -0
- /package/{src → dist/src}/utils/constants.js +0 -0
- /package/{src → dist/src}/utils/create-cli-options.js +0 -0
- /package/{src → dist/src}/utils/create-copy-plugin.js +0 -0
- /package/{src → dist/src}/utils/deprecation.js +0 -0
- /package/{src → dist/src}/utils/jest-config-util.js +0 -0
- /package/{src → dist/src}/utils/runtime-version-utils.js +0 -0
- /package/{src → dist/src}/utils/types.js +0 -0
- /package/{src → dist/src}/utils/version-utils.js +0 -0
- /package/{tailwind.js → dist/tailwind.js} +0 -0
|
@@ -1,70 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.nextInitGenerator = nextInitGenerator;
|
|
37
4
|
exports.nextInitGeneratorInternal = nextInitGeneratorInternal;
|
|
38
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
39
6
|
const devkit_1 = require("@nx/devkit");
|
|
40
|
-
const
|
|
7
|
+
const internal_2 = require("@nx/react/internal");
|
|
41
8
|
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
42
9
|
const versions_1 = require("../../utils/versions");
|
|
43
|
-
const
|
|
10
|
+
const version_utils_1 = require("../../utils/version-utils");
|
|
11
|
+
const assert_supported_next_version_1 = require("../../utils/assert-supported-next-version");
|
|
44
12
|
async function updateDependencies(host, schema) {
|
|
45
13
|
const tasks = [];
|
|
46
14
|
tasks.push((0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/next'], []));
|
|
47
|
-
const versions = await (0,
|
|
48
|
-
const reactVersions = await (0,
|
|
15
|
+
const versions = await (0, version_utils_1.getNextDependenciesVersionsToInstall)(host, await (0, internal_2.isReact18)(host));
|
|
16
|
+
const reactVersions = await (0, internal_2.getReactDependenciesVersionsToInstall)(host);
|
|
49
17
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
50
18
|
next: versions.next,
|
|
51
19
|
react: reactVersions.react,
|
|
52
20
|
'react-dom': reactVersions['react-dom'],
|
|
53
21
|
}, {
|
|
54
22
|
'@nx/next': versions_1.nxVersion,
|
|
55
|
-
}, undefined, schema.keepExistingVersions));
|
|
23
|
+
}, undefined, schema.keepExistingVersions ?? true));
|
|
56
24
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
57
25
|
}
|
|
58
26
|
function nextInitGenerator(tree, schema) {
|
|
59
27
|
return nextInitGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
60
28
|
}
|
|
61
29
|
async function nextInitGeneratorInternal(host, schema) {
|
|
30
|
+
(0, assert_supported_next_version_1.assertSupportedNextVersion)(host);
|
|
62
31
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
63
32
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
64
33
|
nxJson.useInferencePlugins !== false;
|
|
65
34
|
schema.addPlugin ??= addPluginDefault;
|
|
66
35
|
if (schema.addPlugin) {
|
|
67
|
-
const { createNodesV2 } =
|
|
36
|
+
const { createNodesV2, } = require('../../plugins/plugin');
|
|
68
37
|
await (0, internal_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/next/plugin', createNodesV2, {
|
|
69
38
|
startTargetName: ['start', 'next:start', 'next-start'],
|
|
70
39
|
buildTargetName: ['build', 'next:build', 'next-build'],
|
|
@@ -3,4 +3,3 @@ import { Schema } from './schema';
|
|
|
3
3
|
export declare function libraryGenerator(host: Tree, rawOptions: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export declare function libraryGeneratorInternal(host: Tree, rawOptions: Schema): Promise<GeneratorCallback>;
|
|
5
5
|
export default libraryGenerator;
|
|
6
|
-
//# sourceMappingURL=library.d.ts.map
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const react_1 = require("@nx/react");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
8
|
+
const internal_1 = require("@nx/react/internal");
|
|
9
9
|
const init_1 = require("../init/init");
|
|
10
|
+
const assert_supported_next_version_1 = require("../../utils/assert-supported-next-version");
|
|
10
11
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
12
|
const update_vite_config_1 = require("./lib/update-vite-config");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
13
|
+
const versions_1 = require("../../utils/versions");
|
|
14
|
+
const internal_2 = require("@nx/js/internal");
|
|
14
15
|
async function libraryGenerator(host, rawOptions) {
|
|
15
16
|
return await libraryGeneratorInternal(host, {
|
|
16
17
|
addPlugin: false,
|
|
@@ -19,8 +20,9 @@ async function libraryGenerator(host, rawOptions) {
|
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
async function libraryGeneratorInternal(host, rawOptions) {
|
|
23
|
+
(0, assert_supported_next_version_1.assertSupportedNextVersion)(host);
|
|
22
24
|
const tasks = [];
|
|
23
|
-
const addTsPlugin = (0,
|
|
25
|
+
const addTsPlugin = (0, internal_2.shouldConfigureTsSolutionSetup)(host, rawOptions.addPlugin);
|
|
24
26
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
25
27
|
js: rawOptions.js,
|
|
26
28
|
addTsPlugin,
|
|
@@ -34,7 +36,7 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
34
36
|
skipFormat: true,
|
|
35
37
|
});
|
|
36
38
|
tasks.push(initTask);
|
|
37
|
-
const libTask = await (0,
|
|
39
|
+
const libTask = await (0, react_1.libraryGenerator)(host, {
|
|
38
40
|
...options,
|
|
39
41
|
skipFormat: true,
|
|
40
42
|
});
|
|
@@ -42,14 +44,14 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
42
44
|
if (!options.skipPackageJson) {
|
|
43
45
|
const devDependencies = {};
|
|
44
46
|
if (options.linter === 'eslint') {
|
|
45
|
-
devDependencies['eslint-config-next'] =
|
|
46
|
-
devDependencies['@next/eslint-plugin-next'] =
|
|
47
|
+
devDependencies['eslint-config-next'] = versions_1.eslintConfigNextVersion;
|
|
48
|
+
devDependencies['@next/eslint-plugin-next'] = versions_1.eslintConfigNextVersion;
|
|
47
49
|
}
|
|
48
50
|
if (options.unitTestRunner && options.unitTestRunner !== 'none') {
|
|
49
|
-
devDependencies['@testing-library/react'] =
|
|
50
|
-
devDependencies['@testing-library/dom'] =
|
|
51
|
+
devDependencies['@testing-library/react'] = internal_1.testingLibraryReactVersion;
|
|
52
|
+
devDependencies['@testing-library/dom'] = internal_1.testingLibraryDomVersion;
|
|
51
53
|
}
|
|
52
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { tslib:
|
|
54
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { tslib: versions_1.tsLibVersion }, devDependencies, undefined, true));
|
|
53
55
|
}
|
|
54
56
|
const indexPath = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', `index.${options.js ? 'js' : 'ts'}`);
|
|
55
57
|
const indexContent = host.read(indexPath, 'utf-8');
|
|
@@ -65,7 +67,7 @@ export async function HelloServer() {
|
|
|
65
67
|
return <h1>Hello Server</h1>;
|
|
66
68
|
}
|
|
67
69
|
`);
|
|
68
|
-
const isTsSolutionSetup = (0,
|
|
70
|
+
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)(host);
|
|
69
71
|
if (!options.skipTsConfig && !isTsSolutionSetup) {
|
|
70
72
|
(0, js_1.addTsConfigPath)(host, `${options.importPath}/server`, [serverEntryPath]);
|
|
71
73
|
}
|
|
@@ -85,7 +87,7 @@ export async function HelloServer() {
|
|
|
85
87
|
const serverExport = {};
|
|
86
88
|
// For TS Solution setups, include development condition
|
|
87
89
|
if (isTsSolutionSetup) {
|
|
88
|
-
const customConditionName = (0,
|
|
90
|
+
const customConditionName = (0, internal_2.getDefinedCustomConditionName)(host);
|
|
89
91
|
serverExport[customConditionName] = './src/server.ts';
|
|
90
92
|
}
|
|
91
93
|
serverExport.types = './dist/server.d.ts';
|
|
@@ -112,7 +114,7 @@ export async function HelloServer() {
|
|
|
112
114
|
];
|
|
113
115
|
return json;
|
|
114
116
|
});
|
|
115
|
-
(0,
|
|
117
|
+
(0, internal_2.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
116
118
|
jsx: 'react-jsx',
|
|
117
119
|
module: 'esnext',
|
|
118
120
|
moduleResolution: 'bundler',
|
|
@@ -120,9 +122,9 @@ export async function HelloServer() {
|
|
|
120
122
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
121
123
|
: undefined);
|
|
122
124
|
if (options.isUsingTsSolutionConfig) {
|
|
123
|
-
await (0,
|
|
125
|
+
await (0, internal_2.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
124
126
|
}
|
|
125
|
-
(0,
|
|
127
|
+
(0, internal_2.sortPackageJsonFields)(host, options.projectRoot);
|
|
126
128
|
if (!options.skipFormat) {
|
|
127
129
|
await (0, devkit_1.formatFiles)(host);
|
|
128
130
|
}
|
|
@@ -5,12 +5,14 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
5
5
|
const react_1 = require("@nx/react");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const styles_1 = require("../../utils/styles");
|
|
8
|
+
const assert_supported_next_version_1 = require("../../utils/assert-supported-next-version");
|
|
8
9
|
/*
|
|
9
10
|
* This schematic is basically the React component one, but for Next we need
|
|
10
11
|
* extra dependencies for css, sass, less style options, and make sure
|
|
11
12
|
* it is under `pages` folder.
|
|
12
13
|
*/
|
|
13
14
|
async function pageGenerator(host, schema) {
|
|
15
|
+
(0, assert_supported_next_version_1.assertSupportedNextVersion)(host);
|
|
14
16
|
const options = await normalizeOptions(host, schema);
|
|
15
17
|
const componentTask = await (0, react_1.componentGenerator)(host, {
|
|
16
18
|
...options,
|