@nx/next 16.4.0-beta.0 → 16.4.0-beta.10
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/babel.js +0 -1
- package/index.js +0 -1
- package/migrations.json +15 -0
- package/package.json +9 -9
- package/plugins/component-testing.js +0 -1
- package/plugins/with-less.js +0 -1
- package/plugins/with-nx.js +0 -1
- package/plugins/with-stylus.js +0 -1
- package/src/executors/build/build.impl.js +4 -1
- package/src/executors/build/compat.js +0 -1
- package/src/executors/build/lib/check-project.js +0 -1
- package/src/executors/build/lib/create-next-config-file.js +1 -2
- package/src/executors/build/lib/test-fixtures/ensure-exts/baz.json +0 -0
- package/src/executors/build/lib/update-package-json.js +0 -1
- package/src/executors/build/schema.json +2 -1
- package/src/executors/export/compat.js +0 -1
- package/src/executors/export/export.impl.js +0 -1
- package/src/executors/server/compat.js +0 -1
- package/src/executors/server/custom-server.impl.js +0 -2
- package/src/executors/server/lib/default-server.js +0 -1
- package/src/executors/server/lib/tsnode-register.js +0 -1
- package/src/executors/server/schema.json +2 -7
- package/src/executors/server/server.impl.js +0 -1
- package/src/generators/application/application.js +0 -1
- package/src/generators/application/lib/add-cypress.js +0 -1
- package/src/generators/application/lib/add-jest.js +0 -1
- package/src/generators/application/lib/add-linting.js +0 -1
- package/src/generators/application/lib/add-project.js +0 -1
- package/src/generators/application/lib/create-application-files.helpers.js +0 -1
- package/src/generators/application/lib/create-application-files.js +0 -1
- package/src/generators/application/lib/normalize-options.js +0 -1
- package/src/generators/application/lib/set-defaults.js +0 -1
- package/src/generators/application/lib/show-possible-warnings.js +0 -1
- package/src/generators/application/lib/update-cypress-tsconfig.js +0 -1
- package/src/generators/application/lib/update-jest-config.js +0 -1
- package/src/generators/component/component.js +0 -1
- package/src/generators/custom-server/custom-server.js +0 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -1
- package/src/generators/init/init.js +2 -3
- package/src/generators/library/lib/normalize-options.js +0 -1
- package/src/generators/library/library.js +9 -26
- package/src/generators/library/schema.json +2 -3
- package/src/generators/page/page.d.ts +1 -1
- package/src/generators/page/page.js +15 -6
- package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js +0 -1
- package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js +0 -1
- package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -1
- package/src/migrations/update-13-0-0/update-to-webpack-5.js +0 -1
- package/src/migrations/update-13-0-3/fix-less.js +0 -1
- package/src/migrations/update-13-1-1/enable-swc.js +0 -1
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -1
- package/src/migrations/update-14-4-3/add-dev-output-path.js +0 -1
- package/src/migrations/update-14-5-3/add-gitignore-entry.js +0 -1
- package/src/migrations/update-14-5-3/update-dev-output-path.js +0 -1
- package/src/migrations/update-14-5-7/update-next-eslint.js +0 -1
- package/src/migrations/update-15-8-8/add-style-packages.js +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -1
- package/src/migrations/update-16-3-0/remove-root-build-option.js +0 -1
- package/src/migrations/update-16-4-0/update-nx-next-dependency.d.ts +2 -0
- package/src/migrations/update-16-4-0/update-nx-next-dependency.js +20 -0
- package/src/utils/add-gitignore-entry.js +0 -1
- package/src/utils/compose-plugins.js +0 -1
- package/src/utils/config-invalid-function.fixture.js +0 -1
- package/src/utils/config-not-a-function.fixture.js +0 -1
- package/src/utils/config.fixture.js +0 -1
- package/src/utils/config.js +1 -2
- package/src/utils/constants.js +0 -1
- package/src/utils/create-cli-options.js +0 -1
- package/src/utils/create-copy-plugin.js +0 -1
- package/src/utils/generate-globs.js +0 -1
- package/src/utils/styles.js +0 -1
- package/src/utils/types.d.ts +0 -1
- package/src/utils/types.js +0 -1
- package/src/utils/versions.js +0 -1
- package/tailwind.js +0 -1
- package/babel.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/component-testing.js.map +0 -1
- package/plugins/with-less.js.map +0 -1
- package/plugins/with-nx.js.map +0 -1
- package/plugins/with-stylus.js.map +0 -1
- package/src/executors/build/build.impl.js.map +0 -1
- package/src/executors/build/compat.js.map +0 -1
- package/src/executors/build/lib/check-project.js.map +0 -1
- package/src/executors/build/lib/create-next-config-file.js.map +0 -1
- package/src/executors/build/lib/update-package-json.js.map +0 -1
- package/src/executors/export/compat.js.map +0 -1
- package/src/executors/export/export.impl.js.map +0 -1
- package/src/executors/server/compat.js.map +0 -1
- package/src/executors/server/custom-server.impl.js.map +0 -1
- package/src/executors/server/lib/default-server.js.map +0 -1
- package/src/executors/server/lib/tsnode-register.js.map +0 -1
- package/src/executors/server/server.impl.js.map +0 -1
- package/src/generators/application/application.js.map +0 -1
- package/src/generators/application/lib/add-cypress.js.map +0 -1
- package/src/generators/application/lib/add-jest.js.map +0 -1
- package/src/generators/application/lib/add-linting.js.map +0 -1
- package/src/generators/application/lib/add-project.js.map +0 -1
- package/src/generators/application/lib/create-application-files.helpers.js.map +0 -1
- package/src/generators/application/lib/create-application-files.js.map +0 -1
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/lib/set-defaults.js.map +0 -1
- package/src/generators/application/lib/show-possible-warnings.js.map +0 -1
- package/src/generators/application/lib/update-cypress-tsconfig.js.map +0 -1
- package/src/generators/application/lib/update-jest-config.js.map +0 -1
- package/src/generators/component/component.js.map +0 -1
- package/src/generators/custom-server/custom-server.js.map +0 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +0 -1
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/library/lib/normalize-options.js.map +0 -1
- package/src/generators/library/library.js.map +0 -1
- package/src/generators/page/page.js.map +0 -1
- package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js.map +0 -1
- package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js.map +0 -1
- package/src/migrations/update-13-0-0/update-emotion-setup.js.map +0 -1
- package/src/migrations/update-13-0-0/update-to-webpack-5.js.map +0 -1
- package/src/migrations/update-13-0-3/fix-less.js.map +0 -1
- package/src/migrations/update-13-1-1/enable-swc.js.map +0 -1
- package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +0 -1
- package/src/migrations/update-14-4-3/add-dev-output-path.js.map +0 -1
- package/src/migrations/update-14-5-3/add-gitignore-entry.js.map +0 -1
- package/src/migrations/update-14-5-3/update-dev-output-path.js.map +0 -1
- package/src/migrations/update-14-5-7/update-next-eslint.js.map +0 -1
- package/src/migrations/update-15-8-8/add-style-packages.js.map +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +0 -1
- package/src/migrations/update-16-3-0/remove-root-build-option.js.map +0 -1
- package/src/utils/add-gitignore-entry.js.map +0 -1
- package/src/utils/compose-plugins.js.map +0 -1
- package/src/utils/config-invalid-function.fixture.js.map +0 -1
- package/src/utils/config-not-a-function.fixture.js.map +0 -1
- package/src/utils/config.fixture.js.map +0 -1
- package/src/utils/config.js.map +0 -1
- package/src/utils/constants.js.map +0 -1
- package/src/utils/create-cli-options.js.map +0 -1
- package/src/utils/create-copy-plugin.js.map +0 -1
- package/src/utils/generate-globs.js.map +0 -1
- package/src/utils/styles.js.map +0 -1
- package/src/utils/types.js.map +0 -1
- package/src/utils/versions.js.map +0 -1
- package/tailwind.js.map +0 -1
package/babel.js
CHANGED
package/index.js
CHANGED
|
@@ -17,4 +17,3 @@ var with_nx_1 = require("./plugins/with-nx");
|
|
|
17
17
|
Object.defineProperty(exports, "withNx", { enumerable: true, get: function () { return with_nx_1.withNx; } });
|
|
18
18
|
var compose_plugins_1 = require("./src/utils/compose-plugins");
|
|
19
19
|
Object.defineProperty(exports, "composePlugins", { enumerable: true, get: function () { return compose_plugins_1.composePlugins; } });
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/migrations.json
CHANGED
|
@@ -71,6 +71,12 @@
|
|
|
71
71
|
"version": "16.3.0-beta.9",
|
|
72
72
|
"description": "Remove root build option from project configurations since it is not needed.",
|
|
73
73
|
"implementation": "./src/migrations/update-16-3-0/remove-root-build-option"
|
|
74
|
+
},
|
|
75
|
+
"update-16-4-0-update-next-dependency": {
|
|
76
|
+
"cli": "nx",
|
|
77
|
+
"version": "16.4.0-beta.3",
|
|
78
|
+
"description": "Update package.json moving @nx/next from dependency to devDependency",
|
|
79
|
+
"implementation": "./src/migrations/update-16-4-0/update-nx-next-dependency"
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
"packageJsonUpdates": {
|
|
@@ -322,6 +328,15 @@
|
|
|
322
328
|
"alwaysAddToPackageJson": false
|
|
323
329
|
}
|
|
324
330
|
}
|
|
331
|
+
},
|
|
332
|
+
"16.4.0-beta.4": {
|
|
333
|
+
"version": "16.4.0-beta.4",
|
|
334
|
+
"packages": {
|
|
335
|
+
"stylus": {
|
|
336
|
+
"version": "^0.59.0",
|
|
337
|
+
"alwaysAddToPackageJson": false
|
|
338
|
+
}
|
|
339
|
+
}
|
|
325
340
|
}
|
|
326
341
|
}
|
|
327
342
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "16.4.0-beta.
|
|
3
|
+
"version": "16.4.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/plugin-proposal-decorators": "^7.14.5",
|
|
38
|
-
"@nrwl/next": "16.4.0-beta.
|
|
39
|
-
"@nx/devkit": "16.4.0-beta.
|
|
40
|
-
"@nx/js": "16.4.0-beta.
|
|
41
|
-
"@nx/linter": "16.4.0-beta.
|
|
42
|
-
"@nx/react": "16.4.0-beta.
|
|
43
|
-
"@nx/web": "16.4.0-beta.
|
|
44
|
-
"@nx/workspace": "16.4.0-beta.
|
|
38
|
+
"@nrwl/next": "16.4.0-beta.10",
|
|
39
|
+
"@nx/devkit": "16.4.0-beta.10",
|
|
40
|
+
"@nx/js": "16.4.0-beta.10",
|
|
41
|
+
"@nx/linter": "16.4.0-beta.10",
|
|
42
|
+
"@nx/react": "16.4.0-beta.10",
|
|
43
|
+
"@nx/web": "16.4.0-beta.10",
|
|
44
|
+
"@nx/workspace": "16.4.0-beta.10",
|
|
45
45
|
"@svgr/webpack": "^8.0.1",
|
|
46
46
|
"chalk": "^4.1.0",
|
|
47
47
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"types": "./index.d.ts",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d2bde0605c692a023bc9c28686f3a3037bbd56d3"
|
|
65
65
|
}
|
|
@@ -66,4 +66,3 @@ Able to find CT project, ${!!ctProjectConfig}.`);
|
|
|
66
66
|
return Object.assign(Object.assign({}, (0, cypress_preset_1.nxBaseCypressPreset)(__filename)), { specPattern: '**/*.cy.{js,jsx,ts,tsx}', devServer: Object.assign(Object.assign({}, { framework: 'react', bundler: 'webpack' }), { webpackConfig }) });
|
|
67
67
|
}
|
|
68
68
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
69
|
-
//# sourceMappingURL=component-testing.js.map
|
package/plugins/with-less.js
CHANGED
package/plugins/with-nx.js
CHANGED
package/plugins/with-stylus.js
CHANGED
|
@@ -58,6 +58,10 @@ function buildExecutor(options, context) {
|
|
|
58
58
|
root: context.root,
|
|
59
59
|
isProduction: !options.includeDevDependenciesInPackageJson, // By default we remove devDependencies since this is a production build.
|
|
60
60
|
});
|
|
61
|
+
// Update `package.json` to reflect how users should run the build artifacts
|
|
62
|
+
builtPackageJson.scripts = {
|
|
63
|
+
start: 'next start',
|
|
64
|
+
};
|
|
61
65
|
(0, update_package_json_1.updatePackageJson)(builtPackageJson, context);
|
|
62
66
|
(0, devkit_1.writeJsonFile)(`${options.outputPath}/package.json`, builtPackageJson);
|
|
63
67
|
if (options.generateLockfile) {
|
|
@@ -74,4 +78,3 @@ function buildExecutor(options, context) {
|
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
exports.default = buildExecutor;
|
|
77
|
-
//# sourceMappingURL=build.impl.js.map
|
|
@@ -139,7 +139,7 @@ function stripOuterQuotes(str) {
|
|
|
139
139
|
}
|
|
140
140
|
// Exported for testing
|
|
141
141
|
function ensureFileExtensions(files, absoluteDir) {
|
|
142
|
-
const extensions = ['.js', '.cjs', '.mjs'];
|
|
142
|
+
const extensions = ['.js', '.cjs', '.mjs', '.json'];
|
|
143
143
|
return files.map((file) => {
|
|
144
144
|
const providedExt = (0, path_1.extname)(file);
|
|
145
145
|
if (providedExt && extensions.includes(providedExt))
|
|
@@ -154,4 +154,3 @@ function ensureFileExtensions(files, absoluteDir) {
|
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
exports.ensureFileExtensions = ensureFileExtensions;
|
|
157
|
-
//# sourceMappingURL=create-next-config-file.js.map
|
|
File without changes
|
|
@@ -14,7 +14,6 @@ function serveExecutor(options, context) {
|
|
|
14
14
|
: 'production';
|
|
15
15
|
// Setting port that the custom server should use.
|
|
16
16
|
process.env.PORT = options.port;
|
|
17
|
-
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph), context);
|
|
18
17
|
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
19
18
|
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runCustomServer(projectRoot, options, context))));
|
|
20
19
|
});
|
|
@@ -58,4 +57,3 @@ function runCustomServer(root, options, context) {
|
|
|
58
57
|
return yield tslib_1.__await({ success: true });
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
//# sourceMappingURL=custom-server.impl.js.map
|
|
@@ -40,12 +40,6 @@
|
|
|
40
40
|
"type": "string",
|
|
41
41
|
"description": "Hostname on which the application is served."
|
|
42
42
|
},
|
|
43
|
-
"proxyConfig": {
|
|
44
|
-
"type": "string",
|
|
45
|
-
"description": "Path to the proxy configuration file.",
|
|
46
|
-
"x-completion-type": "file",
|
|
47
|
-
"x-deprecated": "Use the built-in rewrite feature from Next.js. See: https://nextjs.org/docs/api-reference/next.config.js/rewrites"
|
|
48
|
-
},
|
|
49
43
|
"buildLibsFromSource": {
|
|
50
44
|
"type": "boolean",
|
|
51
45
|
"description": "Read buildable libraries from source instead of building them separately.",
|
|
@@ -60,5 +54,6 @@
|
|
|
60
54
|
"description": "Activate the incremental bundler for Next.js, which is implemented in Rust. Please note, this feature is exclusively available in development mode."
|
|
61
55
|
}
|
|
62
56
|
},
|
|
63
|
-
"required": ["buildTarget"]
|
|
57
|
+
"required": ["buildTarget"],
|
|
58
|
+
"examplesFile": "../../../docs/server-next-executor-examples.md"
|
|
64
59
|
}
|
|
@@ -38,4 +38,3 @@ function normalizeOptions(host, options) {
|
|
|
38
38
|
parsedTags, projectName: appProjectName, style: options.style || 'css', styledModule, unitTestRunner: options.unitTestRunner || 'jest' });
|
|
39
39
|
}
|
|
40
40
|
exports.normalizeOptions = normalizeOptions;
|
|
41
|
-
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -10,12 +10,12 @@ const versions_2 = require("../../utils/versions");
|
|
|
10
10
|
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
11
11
|
function updateDependencies(host) {
|
|
12
12
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
13
|
-
'@nx/next': versions_2.nxVersion,
|
|
14
13
|
next: versions_2.nextVersion,
|
|
15
14
|
react: versions_1.reactVersion,
|
|
16
15
|
'react-dom': versions_1.reactDomVersion,
|
|
17
16
|
tslib: versions_2.tsLibVersion,
|
|
18
17
|
}, {
|
|
18
|
+
'@nx/next': versions_2.nxVersion,
|
|
19
19
|
'eslint-config-next': versions_2.eslintConfigNextVersion,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -33,7 +33,7 @@ function nextInitGenerator(host, schema) {
|
|
|
33
33
|
const cypressTask = yield cypressInitGenerator(host, {});
|
|
34
34
|
tasks.push(cypressTask);
|
|
35
35
|
}
|
|
36
|
-
const reactTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, schema), { skipFormat: true
|
|
36
|
+
const reactTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, schema), { skipFormat: true }));
|
|
37
37
|
tasks.push(reactTask);
|
|
38
38
|
if (!schema.skipPackageJson) {
|
|
39
39
|
const installTask = updateDependencies(host);
|
|
@@ -46,4 +46,3 @@ function nextInitGenerator(host, schema) {
|
|
|
46
46
|
exports.nextInitGenerator = nextInitGenerator;
|
|
47
47
|
exports.default = nextInitGenerator;
|
|
48
48
|
exports.nextInitSchematic = (0, devkit_1.convertNxGenerator)(nextInitGenerator);
|
|
49
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -14,4 +14,3 @@ function normalizeOptions(host, options) {
|
|
|
14
14
|
return Object.assign(Object.assign({}, options), { importPath: (_a = options.importPath) !== null && _a !== void 0 ? _a : (0, get_import_path_1.getImportPath)(host, projectDirectory), projectRoot });
|
|
15
15
|
}
|
|
16
16
|
exports.normalizeOptions = normalizeOptions;
|
|
17
|
-
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -30,31 +30,6 @@ function libraryGenerator(host, rawOptions) {
|
|
|
30
30
|
}
|
|
31
31
|
`);
|
|
32
32
|
(0, js_1.addTsConfigPath)(host, `${options.importPath}/server`, [serverEntryPath]);
|
|
33
|
-
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, '.babelrc'), (json) => {
|
|
34
|
-
if (options.style === '@emotion/styled') {
|
|
35
|
-
json.presets = [
|
|
36
|
-
[
|
|
37
|
-
'@nx/next/babel',
|
|
38
|
-
{
|
|
39
|
-
'preset-react': {
|
|
40
|
-
runtime: 'automatic',
|
|
41
|
-
importSource: '@emotion/react',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
else if (options.style === 'styled-jsx') {
|
|
48
|
-
// next.js doesn't require the `styled-jsx/babel' plugin as it is already
|
|
49
|
-
// built-into the `next/babel` preset
|
|
50
|
-
json.presets = ['@nx/next/babel'];
|
|
51
|
-
json.plugins = (json.plugins || []).filter((x) => x !== 'styled-jsx/babel');
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
json.presets = ['@nx/next/babel'];
|
|
55
|
-
}
|
|
56
|
-
return json;
|
|
57
|
-
});
|
|
58
33
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), (json) => {
|
|
59
34
|
if (options.style === '@emotion/styled') {
|
|
60
35
|
json.compilerOptions.jsxImportSource = '@emotion/react';
|
|
@@ -71,6 +46,15 @@ function libraryGenerator(host, rawOptions) {
|
|
|
71
46
|
}
|
|
72
47
|
return path;
|
|
73
48
|
});
|
|
49
|
+
if (!json.compilerOptions) {
|
|
50
|
+
json.compilerOptions = {
|
|
51
|
+
types: [],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (!json.compilerOptions.types) {
|
|
55
|
+
json.compilerOptions.types = [];
|
|
56
|
+
}
|
|
57
|
+
json.compilerOptions.types.push('next');
|
|
74
58
|
return json;
|
|
75
59
|
});
|
|
76
60
|
if (!options.skipFormat) {
|
|
@@ -82,4 +66,3 @@ function libraryGenerator(host, rawOptions) {
|
|
|
82
66
|
exports.libraryGenerator = libraryGenerator;
|
|
83
67
|
exports.default = libraryGenerator;
|
|
84
68
|
exports.librarySchematic = (0, devkit_1.convertNxGenerator)(libraryGenerator);
|
|
85
|
-
//# sourceMappingURL=library.js.map
|
|
@@ -72,9 +72,8 @@
|
|
|
72
72
|
},
|
|
73
73
|
"unitTestRunner": {
|
|
74
74
|
"type": "string",
|
|
75
|
-
"enum": ["jest", "none"],
|
|
76
|
-
"description": "Test runner to use for unit tests."
|
|
77
|
-
"default": "jest"
|
|
75
|
+
"enum": ["jest", "vitest", "none"],
|
|
76
|
+
"description": "Test runner to use for unit tests."
|
|
78
77
|
},
|
|
79
78
|
"tags": {
|
|
80
79
|
"type": "string",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
|
-
export declare function pageGenerator(host: Tree,
|
|
3
|
+
export declare function pageGenerator(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
4
|
export default pageGenerator;
|
|
5
5
|
export declare const pageSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -10,14 +10,13 @@ const styles_1 = require("../../utils/styles");
|
|
|
10
10
|
* extra dependencies for css, sass, less, styl style options, and make sure
|
|
11
11
|
* it is under `pages` folder.
|
|
12
12
|
*/
|
|
13
|
-
function pageGenerator(host,
|
|
13
|
+
function pageGenerator(host, schema) {
|
|
14
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const componentTask = yield (0, react_1.componentGenerator)(host, Object.assign(Object.assign({}, options), { directory, pascalCaseFiles: false, export: false, classComponent: false, routing: false, skipTests: !options.withTests, flat: !!options.flat, fileName: !options.flat ? 'index' : undefined, skipFormat: true }));
|
|
15
|
+
const options = normalizeOptions(host, schema);
|
|
16
|
+
const componentTask = yield (0, react_1.componentGenerator)(host, Object.assign(Object.assign({}, options), { project: schema.project, pascalCaseFiles: false, export: false, classComponent: false, routing: false, skipTests: !options.withTests, flat: !!options.flat, skipFormat: true }));
|
|
18
17
|
const styledTask = (0, styles_1.addStyleDependencies)(host, {
|
|
19
18
|
style: options.style,
|
|
20
|
-
swc: !host.exists((0, devkit_1.joinPathFragments)(project.root, '.babelrc')),
|
|
19
|
+
swc: !host.exists((0, devkit_1.joinPathFragments)(options.project.root, '.babelrc')),
|
|
21
20
|
});
|
|
22
21
|
if (!options.skipFormat) {
|
|
23
22
|
yield (0, devkit_1.formatFiles)(host);
|
|
@@ -26,6 +25,16 @@ function pageGenerator(host, options) {
|
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
exports.pageGenerator = pageGenerator;
|
|
28
|
+
function normalizeOptions(host, options) {
|
|
29
|
+
const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
30
|
+
// app/ is a reserved folder in nextjs so it is safe to check it's existence
|
|
31
|
+
const isAppRouter = host.exists(`${project.root}/app`);
|
|
32
|
+
const routerDirectory = isAppRouter ? 'app' : 'pages';
|
|
33
|
+
const directory = options.directory
|
|
34
|
+
? `${routerDirectory}/${options.directory}`
|
|
35
|
+
: `${routerDirectory}`;
|
|
36
|
+
const fileName = isAppRouter ? 'page' : !options.flat ? 'index' : undefined;
|
|
37
|
+
return Object.assign(Object.assign({}, options), { project, directory, fileName });
|
|
38
|
+
}
|
|
29
39
|
exports.default = pageGenerator;
|
|
30
40
|
exports.pageSchematic = (0, devkit_1.convertNxGenerator)(pageGenerator);
|
|
31
|
-
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function update(tree) {
|
|
6
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
7
|
+
if (tree.exists('./package.json')) {
|
|
8
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (packageJson) => {
|
|
9
|
+
if (packageJson.dependencies['@nx/next']) {
|
|
10
|
+
packageJson.devDependencies['@nx/next'] =
|
|
11
|
+
packageJson.dependencies['@nx/next'];
|
|
12
|
+
delete packageJson.dependencies['@nx/next'];
|
|
13
|
+
}
|
|
14
|
+
return packageJson;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.default = update;
|