@nx/next 17.0.0-beta.2 → 17.0.0-beta.4
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/executors.json +0 -18
- package/generators.json +0 -30
- package/package.json +10 -10
- package/plugins/with-nx.js +3 -0
- package/plugins/with-stylus.js +2 -68
- package/src/generators/application/application.d.ts +0 -1
- package/src/generators/application/application.js +1 -2
- package/src/generators/application/files/common/index.d.ts__tmpl__ +0 -5
- package/src/generators/application/files/common/next.config.js__tmpl__ +0 -21
- package/src/generators/application/lib/create-application-files.js +1 -3
- package/src/generators/application/lib/normalize-options.js +1 -1
- package/src/generators/application/schema.json +0 -4
- package/src/generators/component/component.d.ts +0 -1
- package/src/generators/component/component.js +2 -3
- package/src/generators/component/schema.json +0 -4
- package/src/generators/custom-server/custom-server.d.ts +0 -1
- package/src/generators/custom-server/custom-server.js +1 -2
- package/src/generators/init/init.d.ts +0 -1
- package/src/generators/init/init.js +1 -2
- package/src/generators/library/library.d.ts +0 -1
- package/src/generators/library/library.js +2 -2
- package/src/generators/library/schema.json +0 -4
- package/src/generators/page/page.d.ts +0 -1
- package/src/generators/page/page.js +2 -3
- package/src/generators/page/schema.json +0 -4
- package/src/utils/styles.d.ts +0 -14
- package/src/utils/styles.js +3 -20
- package/src/utils/versions.d.ts +0 -1
- package/src/utils/versions.js +1 -2
- package/src/executors/build/compat.d.ts +0 -2
- package/src/executors/build/compat.js +0 -5
- package/src/executors/export/compat.d.ts +0 -2
- package/src/executors/export/compat.js +0 -5
- package/src/executors/server/compat.d.ts +0 -2
- package/src/executors/server/compat.js +0 -5
package/executors.json
CHANGED
|
@@ -16,23 +16,5 @@
|
|
|
16
16
|
"description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.",
|
|
17
17
|
"x-deprecated": "Use static exports in next.config.js instead. See: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports."
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
"builders": {
|
|
21
|
-
"build": {
|
|
22
|
-
"implementation": "./src/executors/build/compat",
|
|
23
|
-
"schema": "./src/executors/build/schema.json",
|
|
24
|
-
"description": "Build a Next.js application."
|
|
25
|
-
},
|
|
26
|
-
"server": {
|
|
27
|
-
"implementation": "./src/executors/server/compat",
|
|
28
|
-
"schema": "./src/executors/server/schema.json",
|
|
29
|
-
"description": "Serve a Next.js application."
|
|
30
|
-
},
|
|
31
|
-
"export": {
|
|
32
|
-
"implementation": "./src/executors/export/compat",
|
|
33
|
-
"schema": "./src/executors/export/schema.json",
|
|
34
|
-
"description": "Export a Next.js application. The exported application is located at `dist/$outputPath/exported`.",
|
|
35
|
-
"x-deprecated": "Use static exports in next.config.js instead. See: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports."
|
|
36
|
-
}
|
|
37
19
|
}
|
|
38
20
|
}
|
package/generators.json
CHANGED
|
@@ -2,36 +2,6 @@
|
|
|
2
2
|
"name": "nx/next",
|
|
3
3
|
"version": "0.1",
|
|
4
4
|
"extends": ["@nx/react"],
|
|
5
|
-
"schematics": {
|
|
6
|
-
"init": {
|
|
7
|
-
"factory": "./src/generators/init/init#nextInitSchematic",
|
|
8
|
-
"schema": "./src/generators/init/schema.json",
|
|
9
|
-
"description": "Initialize the `@nrwl/next` plugin.",
|
|
10
|
-
"hidden": true
|
|
11
|
-
},
|
|
12
|
-
"application": {
|
|
13
|
-
"factory": "./src/generators/application/application#applicationSchematic",
|
|
14
|
-
"schema": "./src/generators/application/schema.json",
|
|
15
|
-
"aliases": ["app"],
|
|
16
|
-
"x-type": "application",
|
|
17
|
-
"description": "Create a Next.js application."
|
|
18
|
-
},
|
|
19
|
-
"page": {
|
|
20
|
-
"factory": "./src/generators/page/page#pageSchematic",
|
|
21
|
-
"schema": "./src/generators/page/schema.json",
|
|
22
|
-
"description": "Create a Next.js page component."
|
|
23
|
-
},
|
|
24
|
-
"component": {
|
|
25
|
-
"factory": "./src/generators/component/component#componentSchematic",
|
|
26
|
-
"schema": "./src/generators/component/schema.json",
|
|
27
|
-
"description": "Create a React component."
|
|
28
|
-
},
|
|
29
|
-
"custom-server": {
|
|
30
|
-
"factory": "./src/generators/custom-server/custom-server#customServerSchematic",
|
|
31
|
-
"schema": "./src/generators/custom-server/schema.json",
|
|
32
|
-
"description": "Set up a custom server."
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
5
|
"generators": {
|
|
36
6
|
"init": {
|
|
37
7
|
"factory": "./src/generators/init/init#nextInitGenerator",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "17.0.0-beta.
|
|
3
|
+
"version": "17.0.0-beta.4",
|
|
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": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/nrwl/nx/issues"
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://nx.dev",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
27
|
+
"generators": "./generators.json",
|
|
28
|
+
"executors": "./executors.json",
|
|
29
29
|
"ng-update": {
|
|
30
30
|
"requirements": {},
|
|
31
31
|
"migrations": "./migrations.json"
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"url-loader": "^4.1.1",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/devkit": "17.0.0-beta.
|
|
48
|
-
"@nx/js": "17.0.0-beta.
|
|
49
|
-
"@nx/linter": "17.0.0-beta.
|
|
50
|
-
"@nx/react": "17.0.0-beta.
|
|
51
|
-
"@nx/web": "17.0.0-beta.
|
|
52
|
-
"@nx/workspace": "17.0.0-beta.
|
|
53
|
-
"@nrwl/next": "17.0.0-beta.
|
|
47
|
+
"@nx/devkit": "17.0.0-beta.4",
|
|
48
|
+
"@nx/js": "17.0.0-beta.4",
|
|
49
|
+
"@nx/linter": "17.0.0-beta.4",
|
|
50
|
+
"@nx/react": "17.0.0-beta.4",
|
|
51
|
+
"@nx/web": "17.0.0-beta.4",
|
|
52
|
+
"@nx/workspace": "17.0.0-beta.4",
|
|
53
|
+
"@nrwl/next": "17.0.0-beta.4"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
package/plugins/with-nx.js
CHANGED
package/plugins/with-stylus.js
CHANGED
|
@@ -1,76 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withStylus = void 0;
|
|
4
|
-
//
|
|
5
|
-
const webpack_merge_1 = require("webpack-merge");
|
|
6
|
-
const addStylusToRegExp = (rx) => new RegExp(rx.source.replace('|sass', '|sass|styl'), rx.flags);
|
|
4
|
+
// TODO(v18): Remove file, it is here until users migrate over to SASS manually.
|
|
7
5
|
function withStylus(configOrFn) {
|
|
8
6
|
return async (phase) => {
|
|
9
|
-
|
|
10
|
-
const { stylusLoaderOptions = {}, ...nextConfig } = baseConfig;
|
|
11
|
-
return Object.assign({}, nextConfig, {
|
|
12
|
-
webpack(config, opts) {
|
|
13
|
-
// there are 2 relevant sass rules in next.js - css modules and global css
|
|
14
|
-
let sassModuleRule;
|
|
15
|
-
// global sass rule (does not exist in server builds)
|
|
16
|
-
let sassGlobalRule;
|
|
17
|
-
const cssRule = config.module.rules.find((rule) => rule.oneOf?.find((r) => r?.[Symbol.for('__next_css_remove')]));
|
|
18
|
-
const addStylusRuleToTest = (test) => {
|
|
19
|
-
if (Array.isArray(test)) {
|
|
20
|
-
return test.map((rx) => addStylusToRegExp(rx));
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return addStylusToRegExp(test);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
cssRule.oneOf.forEach((rule) => {
|
|
27
|
-
if (rule.options?.__next_css_remove)
|
|
28
|
-
return;
|
|
29
|
-
if (rule.use?.loader === 'error-loader') {
|
|
30
|
-
rule.test = addStylusRuleToTest(rule.test);
|
|
31
|
-
}
|
|
32
|
-
else if (rule.use?.loader?.includes('file-loader')) {
|
|
33
|
-
rule.issuer = addStylusRuleToTest(rule.issuer);
|
|
34
|
-
}
|
|
35
|
-
else if (rule.use?.includes?.('ignore-loader')) {
|
|
36
|
-
rule.test = addStylusRuleToTest(rule.test);
|
|
37
|
-
}
|
|
38
|
-
else if (rule.test?.source === '\\.module\\.(scss|sass)$') {
|
|
39
|
-
sassModuleRule = rule;
|
|
40
|
-
}
|
|
41
|
-
else if (rule.test?.source === '(?<!\\.module)\\.(scss|sass)$') {
|
|
42
|
-
sassGlobalRule = rule;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const stylusLoader = {
|
|
46
|
-
loader: 'stylus-loader',
|
|
47
|
-
options: {
|
|
48
|
-
...stylusLoaderOptions,
|
|
49
|
-
stylusOptions: {
|
|
50
|
-
javascriptEnabled: true,
|
|
51
|
-
...stylusLoaderOptions.stylusOptions,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
let stylusModuleRule = (0, webpack_merge_1.merge)({}, sassModuleRule);
|
|
56
|
-
const configureStylusRule = (rule) => {
|
|
57
|
-
rule.test = new RegExp(rule.test.source.replace('(scss|sass)', 'styl'));
|
|
58
|
-
// replace sass-loader (last entry) with stylus-loader
|
|
59
|
-
rule.use.splice(-1, 1, stylusLoader);
|
|
60
|
-
};
|
|
61
|
-
configureStylusRule(stylusModuleRule);
|
|
62
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassModuleRule) + 1, 0, stylusModuleRule);
|
|
63
|
-
if (sassGlobalRule) {
|
|
64
|
-
let stylusGlobalRule = (0, webpack_merge_1.merge)({}, sassGlobalRule);
|
|
65
|
-
configureStylusRule(stylusGlobalRule);
|
|
66
|
-
cssRule.oneOf.splice(cssRule.oneOf.indexOf(sassGlobalRule) + 1, 0, stylusGlobalRule);
|
|
67
|
-
}
|
|
68
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
69
|
-
return nextConfig.webpack(config, opts);
|
|
70
|
-
}
|
|
71
|
-
return config;
|
|
72
|
-
},
|
|
73
|
-
});
|
|
7
|
+
throw new Error(`Stylus support has been removed and you should use the built-in SASS support. Remove the "withStylus" plugin from your Next.js config, and rename your files from .styl to .scss.`);
|
|
74
8
|
};
|
|
75
9
|
}
|
|
76
10
|
exports.withStylus = withStylus;
|
|
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function applicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export declare function applicationGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
|
-
export declare const applicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.applicationGeneratorInternal = exports.applicationGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
6
6
|
const add_e2e_1 = require("./lib/add-e2e");
|
|
@@ -59,4 +59,3 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
59
59
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
60
60
|
}
|
|
61
61
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
62
|
-
exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
|
|
@@ -10,9 +10,4 @@ declare module '*.module.less' {
|
|
|
10
10
|
const classes: { readonly [key: string]: string };
|
|
11
11
|
export default classes;
|
|
12
12
|
}
|
|
13
|
-
<% } else if (style === 'styl') { %>
|
|
14
|
-
declare module '*.module.styl' {
|
|
15
|
-
const classes: { readonly [key: string]: string };
|
|
16
|
-
export default classes;
|
|
17
|
-
}
|
|
18
13
|
<% } %>
|
|
@@ -25,27 +25,6 @@ const plugins = [
|
|
|
25
25
|
withNx,
|
|
26
26
|
];
|
|
27
27
|
|
|
28
|
-
module.exports = composePlugins(...plugins)(nextConfig);
|
|
29
|
-
<% } else if (style === 'styl') { %>
|
|
30
|
-
const { withStylus } = require('@nx/next/plugins/with-stylus');
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
|
|
34
|
-
**/
|
|
35
|
-
const nextConfig = {
|
|
36
|
-
nx: {
|
|
37
|
-
// Set this to true if you would like to to use SVGR
|
|
38
|
-
// See: https://github.com/gregberge/svgr
|
|
39
|
-
svgr: false,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const plugins = [
|
|
44
|
-
// Add more Next.js plugins to this list if needed.
|
|
45
|
-
withStylus,
|
|
46
|
-
withNx,
|
|
47
|
-
];
|
|
48
|
-
|
|
49
28
|
module.exports = composePlugins(...plugins)(nextConfig);
|
|
50
29
|
<% } else if (
|
|
51
30
|
style === 'styled-components'
|
|
@@ -21,9 +21,7 @@ function createApplicationFiles(host, options) {
|
|
|
21
21
|
appContent: (0, create_application_files_helpers_1.createAppJsx)(options.projectName),
|
|
22
22
|
styleContent: (0, create_application_files_helpers_1.createStyleRules)(),
|
|
23
23
|
pageStyleContent: `.page {}`,
|
|
24
|
-
stylesExt: options.style === 'less'
|
|
25
|
-
? options.style
|
|
26
|
-
: 'css',
|
|
24
|
+
stylesExt: options.style === 'less' ? options.style : 'css',
|
|
27
25
|
};
|
|
28
26
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/common'), options.appProjectRoot, templateVariables);
|
|
29
27
|
if (options.appDir) {
|
|
@@ -25,7 +25,7 @@ async function normalizeOptions(host, options) {
|
|
|
25
25
|
: [];
|
|
26
26
|
const fileName = 'index';
|
|
27
27
|
const appDir = options.appDir ?? true;
|
|
28
|
-
const styledModule = /^(css|scss|less
|
|
28
|
+
const styledModule = /^(css|scss|less)$/.test(options.style)
|
|
29
29
|
? null
|
|
30
30
|
: options.style;
|
|
31
31
|
(0, assertion_1.assertValidStyle)(options.style);
|
|
@@ -12,4 +12,3 @@ interface Schema {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function componentGenerator(host: Tree, options: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
14
14
|
export default componentGenerator;
|
|
15
|
-
export declare const componentSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.componentGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const react_1 = require("@nx/react");
|
|
6
6
|
const styles_1 = require("../../utils/styles");
|
|
@@ -15,7 +15,7 @@ function getDirectory(host, options) {
|
|
|
15
15
|
}
|
|
16
16
|
/*
|
|
17
17
|
* This schematic is basically the React one, but for Next we need
|
|
18
|
-
* extra dependencies for css, sass, less
|
|
18
|
+
* extra dependencies for css, sass, less style options.
|
|
19
19
|
*/
|
|
20
20
|
async function componentGenerator(host, options) {
|
|
21
21
|
const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
@@ -37,4 +37,3 @@ async function componentGenerator(host, options) {
|
|
|
37
37
|
}
|
|
38
38
|
exports.componentGenerator = componentGenerator;
|
|
39
39
|
exports.default = componentGenerator;
|
|
40
|
-
exports.componentSchematic = (0, devkit_1.convertNxGenerator)(componentGenerator);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
|
2
2
|
import { CustomServerSchema } from './schema';
|
|
3
3
|
export declare function customServerGenerator(host: Tree, options: CustomServerSchema): Promise<void>;
|
|
4
|
-
export declare const customServerSchematic: (generatorOptions: CustomServerSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.customServerGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
async function customServerGenerator(host, options) {
|
|
@@ -77,4 +77,3 @@ async function customServerGenerator(host, options) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
exports.customServerGenerator = customServerGenerator;
|
|
80
|
-
exports.customServerSchematic = (0, devkit_1.convertNxGenerator)(customServerGenerator);
|
|
@@ -2,4 +2,3 @@ import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
|
2
2
|
import { InitSchema } from './schema';
|
|
3
3
|
export declare function nextInitGenerator(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
|
|
4
4
|
export default nextInitGenerator;
|
|
5
|
-
export declare const nextInitSchematic: (generatorOptions: InitSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.nextInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
6
6
|
const init_1 = require("@nx/react/src/generators/init/init");
|
|
@@ -58,4 +58,3 @@ async function nextInitGenerator(host, schema) {
|
|
|
58
58
|
}
|
|
59
59
|
exports.nextInitGenerator = nextInitGenerator;
|
|
60
60
|
exports.default = nextInitGenerator;
|
|
61
|
-
exports.nextInitSchematic = (0, devkit_1.convertNxGenerator)(nextInitGenerator);
|
|
@@ -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
|
-
export declare const librarySchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.libraryGeneratorInternal = exports.libraryGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const library_1 = require("@nx/react/src/generators/library/library");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
@@ -18,6 +18,7 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
18
18
|
const tasks = [];
|
|
19
19
|
const initTask = await (0, init_1.nextInitGenerator)(host, {
|
|
20
20
|
...options,
|
|
21
|
+
e2eTestRunner: 'none',
|
|
21
22
|
skipFormat: true,
|
|
22
23
|
});
|
|
23
24
|
tasks.push(initTask);
|
|
@@ -71,4 +72,3 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
71
72
|
}
|
|
72
73
|
exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
73
74
|
exports.default = libraryGenerator;
|
|
74
|
-
exports.librarySchematic = (0, devkit_1.convertNxGenerator)(libraryGenerator);
|
|
@@ -2,4 +2,3 @@ import { Tree } from '@nx/devkit';
|
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function pageGenerator(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
4
|
export default pageGenerator;
|
|
5
|
-
export declare const pageSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.pageGenerator = void 0;
|
|
4
4
|
const react_1 = require("@nx/react");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const styles_1 = require("../../utils/styles");
|
|
7
7
|
/*
|
|
8
8
|
* This schematic is basically the React component one, but for Next we need
|
|
9
|
-
* extra dependencies for css, sass, less
|
|
9
|
+
* extra dependencies for css, sass, less style options, and make sure
|
|
10
10
|
* it is under `pages` folder.
|
|
11
11
|
*/
|
|
12
12
|
async function pageGenerator(host, schema) {
|
|
@@ -44,4 +44,3 @@ function normalizeOptions(host, options) {
|
|
|
44
44
|
return { ...options, project, directory, fileName };
|
|
45
45
|
}
|
|
46
46
|
exports.default = pageGenerator;
|
|
47
|
-
exports.pageSchematic = (0, devkit_1.convertNxGenerator)(pageGenerator);
|
package/src/utils/styles.d.ts
CHANGED
|
@@ -29,13 +29,6 @@ export declare const nextSpecificStyleDependenciesBabel: {
|
|
|
29
29
|
'less-loader': string;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
styl: {
|
|
33
|
-
dependencies: {
|
|
34
|
-
stylus: string;
|
|
35
|
-
'stylus-loader': string;
|
|
36
|
-
};
|
|
37
|
-
devDependencies: {};
|
|
38
|
-
};
|
|
39
32
|
};
|
|
40
33
|
export declare const nextSpecificStyleDependenciesSwc: {
|
|
41
34
|
'styled-components': {
|
|
@@ -67,13 +60,6 @@ export declare const nextSpecificStyleDependenciesSwc: {
|
|
|
67
60
|
'less-loader': string;
|
|
68
61
|
};
|
|
69
62
|
};
|
|
70
|
-
styl: {
|
|
71
|
-
dependencies: {
|
|
72
|
-
stylus: string;
|
|
73
|
-
'stylus-loader': string;
|
|
74
|
-
};
|
|
75
|
-
devDependencies: {};
|
|
76
|
-
};
|
|
77
63
|
};
|
|
78
64
|
export declare function addStyleDependencies(host: Tree, options: {
|
|
79
65
|
style?: string;
|
package/src/utils/styles.js
CHANGED
|
@@ -21,13 +21,6 @@ const nextSpecificStyleDependenciesCommon = {
|
|
|
21
21
|
'less-loader': versions_2.lessLoader,
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
-
styl: {
|
|
25
|
-
dependencies: {
|
|
26
|
-
stylus: versions_1.stylusVersion,
|
|
27
|
-
'stylus-loader': versions_2.stylusLoader,
|
|
28
|
-
},
|
|
29
|
-
devDependencies: {},
|
|
30
|
-
},
|
|
31
24
|
};
|
|
32
25
|
exports.nextSpecificStyleDependenciesBabel = {
|
|
33
26
|
...nextSpecificStyleDependenciesCommon,
|
|
@@ -67,18 +60,8 @@ function addStyleDependencies(host, options) {
|
|
|
67
60
|
const extraDependencies = options.swc
|
|
68
61
|
? exports.nextSpecificStyleDependenciesSwc[options.style]
|
|
69
62
|
: exports.nextSpecificStyleDependenciesBabel[options.style];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// @zeit/next-less & @zeit/next-stylus internal configuration is working only
|
|
74
|
-
// for specific CSS loader version, causing PNPM resolution to fail.
|
|
75
|
-
if (host.exists('pnpm-lock.yaml') &&
|
|
76
|
-
(options.style === 'less' || options.style === 'styl')) {
|
|
77
|
-
(0, devkit_1.updateJson)(host, `package.json`, (json) => {
|
|
78
|
-
json.resolutions = { ...json.resolutions, 'css-loader': '1.0.1' };
|
|
79
|
-
return json;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return installTask;
|
|
63
|
+
return extraDependencies
|
|
64
|
+
? (0, devkit_1.addDependenciesToPackageJson)(host, extraDependencies.dependencies, extraDependencies.devDependencies)
|
|
65
|
+
: () => { };
|
|
83
66
|
}
|
|
84
67
|
exports.addStyleDependencies = addStyleDependencies;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare const nextVersion = "13.4.1";
|
|
|
3
3
|
export declare const eslintConfigNextVersion = "13.4.1";
|
|
4
4
|
export declare const sassVersion = "1.62.1";
|
|
5
5
|
export declare const lessLoader = "11.1.0";
|
|
6
|
-
export declare const stylusLoader = "7.1.0";
|
|
7
6
|
export declare const emotionServerVersion = "11.11.0";
|
|
8
7
|
export declare const babelPluginStyledComponentsVersion = "1.10.7";
|
|
9
8
|
export declare const tsLibVersion = "^2.3.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.
|
|
3
|
+
exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.nextVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
exports.nextVersion = '13.4.1';
|
|
6
6
|
exports.eslintConfigNextVersion = '13.4.1';
|
|
7
7
|
exports.sassVersion = '1.62.1';
|
|
8
8
|
exports.lessLoader = '11.1.0';
|
|
9
|
-
exports.stylusLoader = '7.1.0';
|
|
10
9
|
exports.emotionServerVersion = '11.11.0';
|
|
11
10
|
exports.babelPluginStyledComponentsVersion = '1.10.7';
|
|
12
11
|
exports.tsLibVersion = '^2.3.0';
|