@nrwl/next 15.9.2 → 16.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/package.json +7 -7
- package/src/generators/application/files/app/api/hello/route.ts__tmpl__ +4 -0
- package/src/generators/application/files/app/favicon.ico +0 -0
- package/src/generators/application/files/app/global.__stylesExt____tmpl__ +1 -0
- package/src/generators/application/files/app/layout.tsx__tmpl__ +22 -0
- package/src/generators/application/files/app/page.module.__style__ +1 -0
- package/src/generators/application/files/app/page.tsx__tmpl__ +28 -0
- package/src/generators/application/files/{next.config.js__tmpl__ → common/next.config.js__tmpl__} +20 -0
- package/src/generators/application/files/pages/favicon.ico +0 -0
- package/src/generators/application/lib/create-application-files.js +7 -1
- package/src/generators/application/lib/create-application-files.js.map +1 -1
- package/src/generators/application/lib/normalize-options.js +3 -1
- package/src/generators/application/lib/normalize-options.js.map +1 -1
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +6 -0
- /package/src/generators/application/files/{.babelrc__tmpl__ → common/.babelrc__tmpl__} +0 -0
- /package/src/generators/application/files/{index.d.ts__tmpl__ → common/index.d.ts__tmpl__} +0 -0
- /package/src/generators/application/files/{next-env.d.ts__tmpl__ → common/next-env.d.ts__tmpl__} +0 -0
- /package/src/generators/application/files/{public → common/public}/.gitkeep +0 -0
- /package/src/generators/application/files/{specs → common/specs}/__fileName__.spec.tsx__tmpl__ +0 -0
- /package/src/generators/application/files/{tsconfig.json__tmpl__ → common/tsconfig.json__tmpl__} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0-beta.0",
|
|
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,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/plugin-proposal-decorators": "^7.14.5",
|
|
38
|
-
"@nrwl/devkit": "
|
|
39
|
-
"@nrwl/js": "
|
|
40
|
-
"@nrwl/linter": "
|
|
41
|
-
"@nrwl/react": "
|
|
42
|
-
"@nrwl/workspace": "
|
|
38
|
+
"@nrwl/devkit": "16.0.0-beta.0",
|
|
39
|
+
"@nrwl/js": "16.0.0-beta.0",
|
|
40
|
+
"@nrwl/linter": "16.0.0-beta.0",
|
|
41
|
+
"@nrwl/react": "16.0.0-beta.0",
|
|
42
|
+
"@nrwl/workspace": "16.0.0-beta.0",
|
|
43
43
|
"@svgr/webpack": "^6.1.2",
|
|
44
44
|
"chalk": "^4.1.0",
|
|
45
45
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"types": "./index.d.ts",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1e31d4726f2c623ede0c515429aa842e943dba47"
|
|
63
63
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%- styleContent %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Head from 'next/head';
|
|
2
|
+
import './global.<%= stylesExt %>';
|
|
3
|
+
|
|
4
|
+
export const metadata = {
|
|
5
|
+
title: 'Nx Next App',
|
|
6
|
+
description: 'Generated by create-nx-workspace',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({
|
|
10
|
+
children,
|
|
11
|
+
}: {
|
|
12
|
+
children: React.ReactNode
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<Head>
|
|
17
|
+
<title>Welcome to <%= name %>!</title>
|
|
18
|
+
</Head>
|
|
19
|
+
<body>{children}</body>
|
|
20
|
+
</html>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%- pageStyleContent %>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<% if (styledModule && styledModule !== 'styled-jsx') {
|
|
2
|
+
var wrapper = 'StyledPage';
|
|
3
|
+
%>import styled from '<%= styledModule %>';<% } else {
|
|
4
|
+
var wrapper = 'div';
|
|
5
|
+
%>
|
|
6
|
+
<%- style !== 'styled-jsx' ? `import styles from './page.module.${style}';` : '' %>
|
|
7
|
+
<% }
|
|
8
|
+
%>
|
|
9
|
+
|
|
10
|
+
<% if (styledModule && styledModule !== 'styled-jsx') { %>
|
|
11
|
+
const StyledPage = styled.div`<%- pageStyleContent %>`;
|
|
12
|
+
<% }%>
|
|
13
|
+
|
|
14
|
+
export async function Index() {
|
|
15
|
+
/*
|
|
16
|
+
* Replace the elements below with your own.
|
|
17
|
+
*
|
|
18
|
+
* Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
|
|
19
|
+
*/
|
|
20
|
+
return (
|
|
21
|
+
<<%= wrapper %><% if (!styledModule) {%> className={styles.page}<% } %>>
|
|
22
|
+
<%- styledModule === 'styled-jsx' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
|
|
23
|
+
<%- appContent %>
|
|
24
|
+
</<%= wrapper %>>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default Index;
|
package/src/generators/application/files/{next.config.js__tmpl__ → common/next.config.js__tmpl__}
RENAMED
|
@@ -17,6 +17,11 @@ const nextConfig = {
|
|
|
17
17
|
// See: https://github.com/gregberge/svgr
|
|
18
18
|
svgr: false,
|
|
19
19
|
},
|
|
20
|
+
<% if(appDir) { %>
|
|
21
|
+
experimental: {
|
|
22
|
+
appDir: true
|
|
23
|
+
},
|
|
24
|
+
<% } %>
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
module.exports = withLess(withNx(nextConfig));
|
|
@@ -32,6 +37,11 @@ const nextConfig = {
|
|
|
32
37
|
// See: https://github.com/gregberge/svgr
|
|
33
38
|
svgr: false,
|
|
34
39
|
},
|
|
40
|
+
<% if(appDir) { %>
|
|
41
|
+
experimental: {
|
|
42
|
+
appDir: true
|
|
43
|
+
},
|
|
44
|
+
<% } %>
|
|
35
45
|
};
|
|
36
46
|
|
|
37
47
|
module.exports = withStylus(withNx(nextConfig));
|
|
@@ -50,6 +60,11 @@ const nextConfig = {
|
|
|
50
60
|
// See: https://github.com/gregberge/svgr
|
|
51
61
|
svgr: false,
|
|
52
62
|
},
|
|
63
|
+
<% if(appDir) { %>
|
|
64
|
+
experimental: {
|
|
65
|
+
appDir: true
|
|
66
|
+
},
|
|
67
|
+
<% } %>
|
|
53
68
|
};
|
|
54
69
|
|
|
55
70
|
module.exports = withNx(nextConfig);
|
|
@@ -64,6 +79,11 @@ const nextConfig = {
|
|
|
64
79
|
// See: https://github.com/gregberge/svgr
|
|
65
80
|
svgr: false,
|
|
66
81
|
},
|
|
82
|
+
<% if(appDir) { %>
|
|
83
|
+
experimental: {
|
|
84
|
+
appDir: true
|
|
85
|
+
},
|
|
86
|
+
<% } %>
|
|
67
87
|
};
|
|
68
88
|
|
|
69
89
|
module.exports = withNx(nextConfig);
|
|
Binary file
|
|
@@ -9,7 +9,13 @@ function createApplicationFiles(host, options) {
|
|
|
9
9
|
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '', rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.appProjectRoot), appContent: (0, create_application_files_helpers_1.createAppJsx)(options.name), styleContent: (0, create_application_files_helpers_1.createStyleRules)(), pageStyleContent: `.page {}`, stylesExt: options.style === 'less' || options.style === 'styl'
|
|
10
10
|
? options.style
|
|
11
11
|
: 'css' });
|
|
12
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files'), options.appProjectRoot, templateVariables);
|
|
12
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/common'), options.appProjectRoot, templateVariables);
|
|
13
|
+
if (options.appDir) {
|
|
14
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), (0, path_1.join)(options.appProjectRoot, 'app'), templateVariables);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/pages'), (0, path_1.join)(options.appProjectRoot, 'pages'), templateVariables);
|
|
18
|
+
}
|
|
13
19
|
if (options.unitTestRunner === 'none') {
|
|
14
20
|
host.delete(`${options.appProjectRoot}/specs/${options.fileName}.spec.tsx`);
|
|
15
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application-files.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,yCAAgE;AAChE,iCAAyD;AAGzD,yFAG4C;AAE5C,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAyB;IAC1E,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,EACR,gBAAgB,EAAE,IAAA,kCAA6B,EAC7C,IAAI,EACJ,OAAO,CAAC,cAAc,CACvB,EACD,UAAU,EAAE,IAAA,+CAAY,EAAC,OAAO,CAAC,IAAI,CAAC,EACtC,YAAY,EAAE,IAAA,mDAAgB,GAAE,EAChC,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EACP,OAAO,CAAC,KAAK,KAAK,MAAM,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM;YAClD,CAAC,CAAC,OAAO,CAAC,KAAK;YACf,CAAC,CAAC,KAAK,GACZ,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"create-application-files.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,yCAAgE;AAChE,iCAAyD;AAGzD,yFAG4C;AAE5C,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAyB;IAC1E,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,EACR,gBAAgB,EAAE,IAAA,kCAA6B,EAC7C,IAAI,EACJ,OAAO,CAAC,cAAc,CACvB,EACD,UAAU,EAAE,IAAA,+CAAY,EAAC,OAAO,CAAC,IAAI,CAAC,EACtC,YAAY,EAAE,IAAA,mDAAgB,GAAE,EAChC,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EACP,OAAO,CAAC,KAAK,KAAK,MAAM,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM;YAClD,CAAC,CAAC,OAAO,CAAC,KAAK;YACf,CAAC,CAAC,KAAK,GACZ,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAClC,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAC/B,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,EACnC,iBAAiB,CAClB,CAAC;KACH;SAAM;QACL,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,gBAAgB,CAAC,EACjC,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,EACrC,iBAAiB,CAClB,CAAC;KACH;IAED,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,UAAU,OAAO,CAAC,QAAQ,WAAW,CAAC,CAAC;KAC7E;IAED,sDAAsD;IACtD,qFAAqF;IACrF,IAAI,OAAO,CAAC,GAAG,KAAK,KAAK,EAAE;QACzB,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,WAAW,CAAC,CAAC;KACnD;IAED,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,IAAI,CAAC,MAAM,CACT,GAAG,OAAO,CAAC,cAAc,UAAU,OAAO,CAAC,QAAQ,WAAW,OAAO,CAAC,KAAK,EAAE,CAC9E,CAAC;KACH;IAED,IAAI,OAAO,CAAC,KAAK,KAAK,mBAAmB,EAAE;QACzC,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,sBAAsB,CAAC,CAAC;KAC9D;IAED,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,aAAa,CAAC,CAAC;QACpD,IAAA,aAAI,EAAC,IAAI,CAAC,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,cAAc,gBAAgB,CAAC,CAAC;KACxD;AACH,CAAC;AAlED,wDAkEC"}
|
|
@@ -5,6 +5,7 @@ const assertion_1 = require("@nrwl/react/src/utils/assertion");
|
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const linter_1 = require("@nrwl/linter");
|
|
7
7
|
function normalizeOptions(host, options) {
|
|
8
|
+
var _a;
|
|
8
9
|
const { layoutDirectory, projectDirectory } = (0, devkit_1.extractLayoutDirectory)(options.directory);
|
|
9
10
|
const appDirectory = projectDirectory
|
|
10
11
|
? `${(0, devkit_1.names)(projectDirectory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
|
|
@@ -18,11 +19,12 @@ function normalizeOptions(host, options) {
|
|
|
18
19
|
? options.tags.split(',').map((s) => s.trim())
|
|
19
20
|
: [];
|
|
20
21
|
const fileName = 'index';
|
|
22
|
+
const appDir = (_a = options.appDir) !== null && _a !== void 0 ? _a : false;
|
|
21
23
|
const styledModule = /^(css|scss|less|styl)$/.test(options.style)
|
|
22
24
|
? null
|
|
23
25
|
: options.style;
|
|
24
26
|
(0, assertion_1.assertValidStyle)(options.style);
|
|
25
|
-
return Object.assign(Object.assign({}, options), { name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, linter: options.linter || linter_1.Linter.EsLint, unitTestRunner: options.unitTestRunner || 'jest', e2eTestRunner: options.e2eTestRunner || 'cypress', style: options.style || 'css', appProjectRoot,
|
|
27
|
+
return Object.assign(Object.assign({}, options), { appDir, name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, linter: options.linter || linter_1.Linter.EsLint, unitTestRunner: options.unitTestRunner || 'jest', e2eTestRunner: options.e2eTestRunner || 'cypress', style: options.style || 'css', appProjectRoot,
|
|
26
28
|
e2eProjectRoot,
|
|
27
29
|
e2eProjectName,
|
|
28
30
|
parsedTags,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,+DAAmE;AACnE,yCAMsB;AACtB,yCAAsC;AAetC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,+DAAmE;AACnE,yCAMsB;AACtB,yCAAsC;AAetC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,IAAA,+BAAsB,EAClE,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AC,CAAC;IAEhC,uCACK,OAAO,KACV,MAAM,EACN,IAAI,EAAE,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAClC,WAAW,EAAE,cAAc,EAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,eAAM,CAAC,MAAM,EACvC,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,MAAM,EAChD,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,SAAS,EACjD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK,EAC7B,cAAc;QACd,cAAc;QACd,cAAc;QACd,UAAU;QACV,QAAQ;QACR,YAAY,IACZ;AACJ,CAAC;AAlDD,4CAkDC"}
|
|
@@ -124,6 +124,12 @@
|
|
|
124
124
|
"default": false,
|
|
125
125
|
"description": "Do not add dependencies to `package.json`.",
|
|
126
126
|
"x-priority": "internal"
|
|
127
|
+
},
|
|
128
|
+
"appDir": {
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"default": false,
|
|
131
|
+
"description": "Enable experimental app directory for the project",
|
|
132
|
+
"x-prompt": "Do you want to use experimental app/ in this project?"
|
|
127
133
|
}
|
|
128
134
|
},
|
|
129
135
|
"required": [],
|
|
File without changes
|
|
File without changes
|
/package/src/generators/application/files/{next-env.d.ts__tmpl__ → common/next-env.d.ts__tmpl__}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/generators/application/files/{specs → common/specs}/__fileName__.spec.tsx__tmpl__
RENAMED
|
File without changes
|
/package/src/generators/application/files/{tsconfig.json__tmpl__ → common/tsconfig.json__tmpl__}
RENAMED
|
File without changes
|