@nrwl/next 14.5.1 → 14.5.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/CHANGELOG.md +1 -1
- package/generators.json +10 -0
- package/migrations.json +21 -0
- package/package.json +10 -9
- package/src/executors/server/schema.json +6 -1
- package/src/executors/server/server.impl.d.ts +1 -1
- package/src/executors/server/server.impl.js +60 -18
- package/src/executors/server/server.impl.js.map +1 -1
- package/src/generators/application/files/next.config.js__tmpl__ +0 -6
- package/src/generators/application/lib/add-project.js +1 -1
- package/src/generators/application/lib/add-project.js.map +1 -1
- package/src/generators/custom-server/custom-server.d.ts +4 -0
- package/src/generators/custom-server/custom-server.js +79 -0
- package/src/generators/custom-server/custom-server.js.map +1 -0
- package/src/generators/custom-server/files/server/main.ts__tmpl__ +56 -0
- package/src/generators/custom-server/files/tsconfig.server.json__tmpl__ +15 -0
- package/src/generators/custom-server/schema.d.ts +4 -0
- package/src/generators/custom-server/schema.json +34 -0
- package/src/generators/init/init.js +2 -0
- package/src/generators/init/init.js.map +1 -1
- package/src/migrations/update-14-5-3/add-gitignore-entry.d.ts +3 -0
- package/src/migrations/update-14-5-3/add-gitignore-entry.js +15 -0
- package/src/migrations/update-14-5-3/add-gitignore-entry.js.map +1 -0
- package/src/migrations/update-14-5-3/update-dev-output-path.d.ts +3 -0
- package/src/migrations/update-14-5-3/update-dev-output-path.js +29 -0
- package/src/migrations/update-14-5-3/update-dev-output-path.js.map +1 -0
- package/src/utils/add-gitignore-entry.d.ts +2 -0
- package/src/utils/add-gitignore-entry.js +18 -0
- package/src/utils/add-gitignore-entry.js.map +1 -0
- package/src/utils/types.d.ts +5 -0
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/src/utils/versions.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [14.5.
|
|
6
|
+
## [14.5.4](https://github.com/nrwl/nx/compare/14.5.3...14.5.4) (2022-08-04)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/next
|
package/generators.json
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"factory": "./src/generators/component/component#componentSchematic",
|
|
26
26
|
"schema": "./src/generators/component/schema.json",
|
|
27
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."
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
"generators": {
|
|
@@ -57,6 +62,11 @@
|
|
|
57
62
|
"aliases": ["lib"],
|
|
58
63
|
"x-type": "library",
|
|
59
64
|
"description": "Create a library."
|
|
65
|
+
},
|
|
66
|
+
"custom-server": {
|
|
67
|
+
"factory": "./src/generators/custom-server/custom-server#customServerGenerator",
|
|
68
|
+
"schema": "./src/generators/custom-server/schema.json",
|
|
69
|
+
"description": "Set up a custom server."
|
|
60
70
|
}
|
|
61
71
|
}
|
|
62
72
|
}
|
package/migrations.json
CHANGED
|
@@ -90,6 +90,18 @@
|
|
|
90
90
|
"version": "14.4.3-beta.0",
|
|
91
91
|
"description": "Add a development outputPath to avoid conflict with the production build.",
|
|
92
92
|
"factory": "./src/migrations/update-14-4-3/add-dev-output-path"
|
|
93
|
+
},
|
|
94
|
+
"add-gitignore-entry": {
|
|
95
|
+
"cli": "nx",
|
|
96
|
+
"version": "14.5.3-beta.0",
|
|
97
|
+
"description": "Add .next folder to gitignore.",
|
|
98
|
+
"factory": "./src/migrations/update-14-5-3/add-gitignore-entry"
|
|
99
|
+
},
|
|
100
|
+
"update-dev-output-path": {
|
|
101
|
+
"cli": "nx",
|
|
102
|
+
"version": "14.5.3-beta.0",
|
|
103
|
+
"description": "Update development outputPath to the project root.",
|
|
104
|
+
"factory": "./src/migrations/update-14-5-3/update-dev-output-path"
|
|
93
105
|
}
|
|
94
106
|
},
|
|
95
107
|
"packageJsonUpdates": {
|
|
@@ -321,6 +333,15 @@
|
|
|
321
333
|
"alwaysAddToPackageJson": false
|
|
322
334
|
}
|
|
323
335
|
}
|
|
336
|
+
},
|
|
337
|
+
"14.5.3": {
|
|
338
|
+
"version": "14.5.3-beta.0",
|
|
339
|
+
"packages": {
|
|
340
|
+
"@emotion/server": {
|
|
341
|
+
"version": "11.10.0",
|
|
342
|
+
"alwaysAddToPackageJson": false
|
|
343
|
+
}
|
|
344
|
+
}
|
|
324
345
|
}
|
|
325
346
|
}
|
|
326
347
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/next",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.4",
|
|
4
4
|
"description": "When 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.\n\nThe Next.js plugin 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.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,22 +34,23 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/plugin-proposal-decorators": "^7.14.5",
|
|
37
|
-
"@nrwl/cypress": "14.5.
|
|
38
|
-
"@nrwl/devkit": "14.5.
|
|
39
|
-
"@nrwl/jest": "14.5.
|
|
40
|
-
"@nrwl/linter": "14.5.
|
|
41
|
-
"@nrwl/react": "14.5.
|
|
42
|
-
"@nrwl/web": "14.5.
|
|
43
|
-
"@nrwl/workspace": "14.5.
|
|
37
|
+
"@nrwl/cypress": "14.5.4",
|
|
38
|
+
"@nrwl/devkit": "14.5.4",
|
|
39
|
+
"@nrwl/jest": "14.5.4",
|
|
40
|
+
"@nrwl/linter": "14.5.4",
|
|
41
|
+
"@nrwl/react": "14.5.4",
|
|
42
|
+
"@nrwl/web": "14.5.4",
|
|
43
|
+
"@nrwl/workspace": "14.5.4",
|
|
44
44
|
"@svgr/webpack": "^6.1.2",
|
|
45
45
|
"chalk": "4.1.0",
|
|
46
46
|
"dotenv": "~10.0.0",
|
|
47
47
|
"eslint-config-next": "^12.1.0",
|
|
48
48
|
"fs-extra": "^10.1.0",
|
|
49
|
+
"ignore": "^5.0.4",
|
|
49
50
|
"ts-node": "~10.8.0",
|
|
50
51
|
"tsconfig-paths": "^3.9.0",
|
|
51
52
|
"url-loader": "^4.1.1",
|
|
52
53
|
"webpack-merge": "^5.8.0"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "bcc00c50e4e74ec991385d686493ff784817638c"
|
|
55
56
|
}
|
|
@@ -28,9 +28,14 @@
|
|
|
28
28
|
"description": "Hide error messages containing server information.",
|
|
29
29
|
"default": false
|
|
30
30
|
},
|
|
31
|
+
"customServerTarget": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Target which builds the custom server."
|
|
34
|
+
},
|
|
31
35
|
"customServerPath": {
|
|
32
36
|
"type": "string",
|
|
33
|
-
"description": "Use a custom server script."
|
|
37
|
+
"description": "Use a custom server script. (Use `customServerTarget` instead)",
|
|
38
|
+
"x-deprecated": true
|
|
34
39
|
},
|
|
35
40
|
"hostname": {
|
|
36
41
|
"type": "string",
|
|
@@ -2,6 +2,6 @@ import 'dotenv/config';
|
|
|
2
2
|
import { ExecutorContext } from '@nrwl/devkit';
|
|
3
3
|
import { NextServeBuilderOptions } from '../../utils/types';
|
|
4
4
|
export default function serveExecutor(options: NextServeBuilderOptions, context: ExecutorContext): AsyncGenerator<{
|
|
5
|
-
baseUrl: string;
|
|
6
5
|
success: boolean;
|
|
6
|
+
baseUrl: string;
|
|
7
7
|
}, void, unknown>;
|
|
@@ -6,16 +6,12 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const devkit_2 = require("@nrwl/devkit");
|
|
10
9
|
const buildable_libs_utils_1 = require("@nrwl/workspace/src/utilities/buildable-libs-utils");
|
|
11
|
-
const devkit_3 = require("@nrwl/devkit");
|
|
12
10
|
const config_1 = require("../../utils/config");
|
|
13
11
|
const custom_server_1 = require("./lib/custom-server");
|
|
14
12
|
const default_server_1 = require("./lib/default-server");
|
|
15
|
-
const buildable_libs_1 = require("../../utils/buildable-libs");
|
|
16
13
|
const constants_1 = require("../../utils/constants");
|
|
17
14
|
const infoPrefix = `[ ${chalk.dim(chalk.cyan('info'))} ] `;
|
|
18
|
-
const readyPrefix = `[ ${chalk.green('ready')} ]`;
|
|
19
15
|
function serveExecutor(options, context) {
|
|
20
16
|
return tslib_1.__asyncGenerator(this, arguments, function* serveExecutor_1() {
|
|
21
17
|
// Cast to any to overwrite NODE_ENV
|
|
@@ -24,19 +20,33 @@ function serveExecutor(options, context) {
|
|
|
24
20
|
: options.dev
|
|
25
21
|
? 'development'
|
|
26
22
|
: 'production';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
23
|
+
// Setting port that the custom server should use.
|
|
24
|
+
process.env.PORT = options.port;
|
|
25
|
+
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget), context);
|
|
31
26
|
const root = (0, path_1.resolve)(context.root, buildOptions.root);
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
27
|
+
const config = yield tslib_1.__await((0, config_1.prepareConfig)(options.dev ? constants_1.PHASE_DEVELOPMENT_SERVER : constants_1.PHASE_PRODUCTION_SERVER, buildOptions, context, getDependencies(options, context), (0, path_1.join)(context.root, (0, devkit_1.workspaceLayout)().libsDir)));
|
|
28
|
+
if (options.customServerTarget) {
|
|
29
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runCustomServer(root, config, options, buildOptions, context))));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(runNextDevServer(root, config, options, buildOptions, context))));
|
|
38
33
|
}
|
|
39
|
-
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.default = serveExecutor;
|
|
37
|
+
function getDependencies(options, context) {
|
|
38
|
+
if (options.buildLibsFromSource) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const result = (0, buildable_libs_utils_1.calculateProjectDependencies)((0, devkit_1.readCachedProjectGraph)(), context.root, context.projectName, 'build', // should be generalized
|
|
43
|
+
context.configurationName);
|
|
44
|
+
return result.dependencies;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function runNextDevServer(root, config, options, buildOptions, context) {
|
|
48
|
+
return tslib_1.__asyncGenerator(this, arguments, function* runNextDevServer_1() {
|
|
49
|
+
const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
|
|
40
50
|
const settings = {
|
|
41
51
|
dev: options.dev,
|
|
42
52
|
dir: root,
|
|
@@ -44,8 +54,10 @@ function serveExecutor(options, context) {
|
|
|
44
54
|
quiet: options.quiet,
|
|
45
55
|
conf: config,
|
|
46
56
|
port: options.port,
|
|
47
|
-
|
|
57
|
+
customServer: !!options.customServerTarget,
|
|
48
58
|
hostname: options.hostname,
|
|
59
|
+
// TOOD(jack): Remove in Nx 15
|
|
60
|
+
path: options.customServerPath,
|
|
49
61
|
};
|
|
50
62
|
const server = options.customServerPath
|
|
51
63
|
? custom_server_1.customServer
|
|
@@ -61,7 +73,7 @@ function serveExecutor(options, context) {
|
|
|
61
73
|
}
|
|
62
74
|
try {
|
|
63
75
|
yield tslib_1.__await(server(settings, proxyConfig));
|
|
64
|
-
devkit_1.logger.info(
|
|
76
|
+
devkit_1.logger.info(`[ ${chalk.green('ready')} ] on ${baseUrl}`);
|
|
65
77
|
yield yield tslib_1.__await({
|
|
66
78
|
baseUrl,
|
|
67
79
|
success: true,
|
|
@@ -79,5 +91,35 @@ function serveExecutor(options, context) {
|
|
|
79
91
|
}
|
|
80
92
|
});
|
|
81
93
|
}
|
|
82
|
-
|
|
94
|
+
function runCustomServer(root, config, options, buildOptions, context) {
|
|
95
|
+
return tslib_1.__asyncGenerator(this, arguments, function* runCustomServer_1() {
|
|
96
|
+
var e_1, _a;
|
|
97
|
+
process.env.NX_NEXT_DIR = root;
|
|
98
|
+
process.env.NX_NEXT_PUBLIC_DIR = (0, path_1.join)(root, 'public');
|
|
99
|
+
const baseUrl = `http://${options.hostname || 'localhost'}:${options.port}`;
|
|
100
|
+
const customServerBuild = yield tslib_1.__await((0, devkit_1.runExecutor)((0, devkit_1.parseTargetString)(options.customServerTarget), {
|
|
101
|
+
watch: true,
|
|
102
|
+
}, context));
|
|
103
|
+
try {
|
|
104
|
+
for (var customServerBuild_1 = tslib_1.__asyncValues(customServerBuild), customServerBuild_1_1; customServerBuild_1_1 = yield tslib_1.__await(customServerBuild_1.next()), !customServerBuild_1_1.done;) {
|
|
105
|
+
const result = customServerBuild_1_1.value;
|
|
106
|
+
if (!result.success) {
|
|
107
|
+
return yield tslib_1.__await(result);
|
|
108
|
+
}
|
|
109
|
+
yield yield tslib_1.__await({
|
|
110
|
+
success: true,
|
|
111
|
+
baseUrl,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
116
|
+
finally {
|
|
117
|
+
try {
|
|
118
|
+
if (customServerBuild_1_1 && !customServerBuild_1_1.done && (_a = customServerBuild_1.return)) yield tslib_1.__await(_a.call(customServerBuild_1));
|
|
119
|
+
}
|
|
120
|
+
finally { if (e_1) throw e_1.error; }
|
|
121
|
+
}
|
|
122
|
+
return yield tslib_1.__await({ success: true });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
83
125
|
//# sourceMappingURL=server.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"server.impl.js","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":";;;AAAA,yBAAuB;AACvB,yCAQsB;AACtB,+BAA+B;AAC/B,2BAAgC;AAChC,+BAAqC;AACrC,6FAAkG;AAElG,+CAAmD;AAQnD,uDAAmD;AACnD,yDAAqD;AACrD,qDAG+B;AAE/B,MAAM,UAAU,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;AAE3D,SAA+B,aAAa,CAC1C,OAAgC,EAChC,OAAwB;;QAExB,oCAAoC;QACnC,OAAO,CAAC,GAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ;YAClD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;YACtB,CAAC,CAAC,OAAO,CAAC,GAAG;gBACb,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,YAAY,CAAC;QAEjB,kDAAkD;QACjD,OAAO,CAAC,GAAW,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAEzC,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,IAAA,0BAAiB,EAAC,OAAO,CAAC,WAAW,CAAC,EACtC,OAAO,CACR,CAAC;QACF,MAAM,IAAI,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,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;SACnD;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,OAAO,CAAC,GAAG,EAAE;gBACf,MAAM,CAAC,CAAC;aACT;iBAAM;gBACL,MAAM,IAAI,KAAK,CACb,4EAA4E,OAAO,CAAC,WAAW,KAAK,CACrG,CAAC;aACH;SACF;IACH,CAAC;CAAA;AAED,SAAgB,eAAe,CAC7B,IAAY,EACZ,MAAwC,EACxC,OAAgC,EAChC,YAAqC,EACrC,OAAwB;;;QAExB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,OAAO,GAAG,UAAU,OAAO,CAAC,QAAQ,IAAI,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAE5E,MAAM,iBAAiB,GAAG,sBAAM,IAAA,oBAAW,EACzC,IAAA,0BAAiB,EAAC,OAAO,CAAC,kBAAkB,CAAC,EAC7C;YACE,KAAK,EAAE,IAAI;SACZ,EACD,OAAO,CACR,CAAA,CAAC;;YAEF,KAA2B,IAAA,sBAAA,sBAAA,iBAAiB,CAAA,uBAAA;gBAAjC,MAAM,MAAM,8BAAA,CAAA;gBACrB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;oBACnB,6BAAO,MAAM,EAAC;iBACf;gBACD,4BAAM;oBACJ,OAAO,EAAE,IAAI;oBACb,OAAO;iBACR,CAAA,CAAC;aACH;;;;;;;;;QAED,6BAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAC;IAC3B,CAAC;CAAA"}
|
|
@@ -15,9 +15,6 @@ const nextConfig = {
|
|
|
15
15
|
// See: https://github.com/gregberge/svgr
|
|
16
16
|
svgr: false,
|
|
17
17
|
},
|
|
18
|
-
// Set this to true if you use CSS modules.
|
|
19
|
-
// See: https://github.com/css-modules/css-modules
|
|
20
|
-
cssModules: false,
|
|
21
18
|
};
|
|
22
19
|
|
|
23
20
|
module.exports = withLess(withNx(nextConfig));
|
|
@@ -33,9 +30,6 @@ const nextConfig = {
|
|
|
33
30
|
// See: https://github.com/gregberge/svgr
|
|
34
31
|
svgr: false,
|
|
35
32
|
},
|
|
36
|
-
// Set this to true if you use CSS modules.
|
|
37
|
-
// See: https://github.com/css-modules/css-modules
|
|
38
|
-
cssModules: false,
|
|
39
33
|
};
|
|
40
34
|
|
|
41
35
|
module.exports = withStylus(withNx(nextConfig));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AAEtB,SAAgB,UAAU,CAAC,IAAU,EAAE,OAAyB;IAC9D,MAAM,OAAO,GAAwB,EAAE,CAAC;IAExC,OAAO,CAAC,KAAK,GAAG;QACd,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,CAAC,sBAAsB,CAAC;QACjC,oBAAoB,EAAE,YAAY;QAClC,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,cAAc;YAC5B,UAAU,EAAE,IAAA,0BAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC;SAC9D;QACD,cAAc,EAAE;YACd,WAAW,EAAE;gBACX,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AAEtB,SAAgB,UAAU,CAAC,IAAU,EAAE,OAAyB;IAC9D,MAAM,OAAO,GAAwB,EAAE,CAAC;IAExC,OAAO,CAAC,KAAK,GAAG;QACd,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,CAAC,sBAAsB,CAAC;QACjC,oBAAoB,EAAE,YAAY;QAClC,OAAO,EAAE;YACP,IAAI,EAAE,OAAO,CAAC,cAAc;YAC5B,UAAU,EAAE,IAAA,0BAAi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
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
import { CustomServerSchema } from './schema';
|
|
3
|
+
export declare function customServerGenerator(host: Tree, options: CustomServerSchema): Promise<void>;
|
|
4
|
+
export declare const customServerSchematic: (generatorOptions: CustomServerSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customServerSchematic = exports.customServerGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
function customServerGenerator(host, options) {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
|
|
10
|
+
if (((_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/next:build') {
|
|
11
|
+
devkit_1.logger.error(`Project ${options.project} is not a Next.js project. Did you generate it with "nx g @nrwl/next:app"?`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const outputPath = (_e = (_d = (_c = project.targets) === null || _c === void 0 ? void 0 : _c.build) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.outputPath;
|
|
15
|
+
const root = (_h = (_g = (_f = project.targets) === null || _f === void 0 ? void 0 : _f.build) === null || _g === void 0 ? void 0 : _g.options) === null || _h === void 0 ? void 0 : _h.root;
|
|
16
|
+
if (!root ||
|
|
17
|
+
!outputPath ||
|
|
18
|
+
!((_l = (_k = (_j = project.targets) === null || _j === void 0 ? void 0 : _j.build) === null || _k === void 0 ? void 0 : _k.configurations) === null || _l === void 0 ? void 0 : _l.development) ||
|
|
19
|
+
!((_p = (_o = (_m = project.targets) === null || _m === void 0 ? void 0 : _m.build) === null || _o === void 0 ? void 0 : _o.configurations) === null || _p === void 0 ? void 0 : _p.production)) {
|
|
20
|
+
devkit_1.logger.error(`Project ${options.project} has invalid config. Did you generate it with "nx g @nrwl/next:app"?`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (((_q = project.targets) === null || _q === void 0 ? void 0 : _q['build-custom-server']) ||
|
|
24
|
+
((_r = project.targets) === null || _r === void 0 ? void 0 : _r['serve-custom-server'])) {
|
|
25
|
+
devkit_1.logger.warn(`Project ${options.project} has custom server targets already: build-custom-server, serve-custom-server. Remove these targets from project and try again.`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, 'files'), project.root, Object.assign(Object.assign({}, options), { offsetFromRoot: (0, devkit_1.offsetFromRoot)(project.root), projectRoot: project.root, tmpl: '' }));
|
|
29
|
+
project.targets.build.dependsOn = ['build-custom-server'];
|
|
30
|
+
project.targets.serve.options.customServerTarget = `${options.project}:serve-custom-server`;
|
|
31
|
+
project.targets.serve.configurations.development.customServerTarget = `${options.project}:serve-custom-server:development`;
|
|
32
|
+
project.targets.serve.configurations.production.customServerTarget = `${options.project}:serve-custom-server:production`;
|
|
33
|
+
project.targets['build-custom-server'] = {
|
|
34
|
+
executor: '@nrwl/js:tsc',
|
|
35
|
+
defaultConfiguration: 'production',
|
|
36
|
+
options: {
|
|
37
|
+
outputPath,
|
|
38
|
+
main: `${root}/server/main.ts`,
|
|
39
|
+
tsConfig: `${root}/tsconfig.server.json`,
|
|
40
|
+
clean: false,
|
|
41
|
+
assets: [],
|
|
42
|
+
},
|
|
43
|
+
configurations: {
|
|
44
|
+
development: {},
|
|
45
|
+
production: {},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
project.targets['serve-custom-server'] = {
|
|
49
|
+
executor: '@nrwl/js:node',
|
|
50
|
+
defaultConfiguration: 'development',
|
|
51
|
+
options: {
|
|
52
|
+
buildTarget: `${options.project}:build-custom-server`,
|
|
53
|
+
},
|
|
54
|
+
configurations: {
|
|
55
|
+
development: {
|
|
56
|
+
buildTarget: `${options.project}:build-custom-server:development`,
|
|
57
|
+
},
|
|
58
|
+
production: {
|
|
59
|
+
buildTarget: `${options.project}:build-custom-server:production`,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
(0, devkit_1.updateProjectConfiguration)(host, options.project, project);
|
|
64
|
+
(0, devkit_1.updateJson)(host, 'nx.json', (json) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
var _c;
|
|
67
|
+
(_a = json.tasksRunnerOptions) !== null && _a !== void 0 ? _a : (json.tasksRunnerOptions = {});
|
|
68
|
+
(_b = (_c = json.tasksRunnerOptions).default) !== null && _b !== void 0 ? _b : (_c.default = { options: {} });
|
|
69
|
+
json.tasksRunnerOptions.default.options.cacheableOperations = [
|
|
70
|
+
...json.tasksRunnerOptions.default.options.cacheableOperations,
|
|
71
|
+
'build-custom-server',
|
|
72
|
+
];
|
|
73
|
+
return json;
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.customServerGenerator = customServerGenerator;
|
|
78
|
+
exports.customServerSchematic = (0, devkit_1.convertNxGenerator)(customServerGenerator);
|
|
79
|
+
//# sourceMappingURL=custom-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-server.js","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/custom-server/custom-server.ts"],"names":[],"mappings":";;;;AACA,yCASsB;AAGtB,SAAsB,qBAAqB,CACzC,IAAU,EACV,OAA2B;;;QAE3B,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAI,CAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;YAC3D,e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AAC;YAC/B,YAAA,IAAI,CAAC,kBAAkB,EAAC,OAAO,uCAAP,OAAO,GAAK,EAAE,OAAO,EAAE,EAAE,EAAE,EAAC;YACpD,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,GAAG;gBAC5D,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB;gBAC9D,qBAAqB;aACtB,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;;CACJ;AA7FD,sDA6FC;AAEY,QAAA,qBAAqB,GAAG,IAAA,2BAAkB,EAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is only a minimal custom server to get started.
|
|
3
|
+
* You should customize this server with CORS and other security features.
|
|
4
|
+
*/
|
|
5
|
+
import express from 'express';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import next from 'next';
|
|
8
|
+
|
|
9
|
+
// Next.js server options:
|
|
10
|
+
// - The environment variable is set by `@nrwl/next:server` when running the dev server.
|
|
11
|
+
// - The fallback `__dirname` is for production builds.
|
|
12
|
+
// - Feel free to change this to suit your needs.
|
|
13
|
+
const dir = process.env.NX_NEXT_DIR || path.join(__dirname, '..');
|
|
14
|
+
const publicDir = process.env.NX_NEXT_PUBLIC_DIR || path.join(__dirname, '../public');
|
|
15
|
+
const dev = process.env.NODE_ENV === 'development';
|
|
16
|
+
|
|
17
|
+
// Express server options:
|
|
18
|
+
// - Feel free to change this to suit your needs.
|
|
19
|
+
const hostname = process.env.HOST || 'localhost';
|
|
20
|
+
const port = process.env.PORT ? parseInt(process.env.PORT) : 4200;
|
|
21
|
+
|
|
22
|
+
async function main() {
|
|
23
|
+
const nextApp = next({ dev, dir });
|
|
24
|
+
const handle = nextApp.getRequestHandler();
|
|
25
|
+
|
|
26
|
+
await nextApp.prepare();
|
|
27
|
+
|
|
28
|
+
const expressApp = express();
|
|
29
|
+
|
|
30
|
+
expressApp.get('/api', (req, res) => {
|
|
31
|
+
res.send({ message: 'Welcome!' });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Serve static files from public folder.
|
|
35
|
+
expressApp.use(express.static(publicDir));
|
|
36
|
+
|
|
37
|
+
// Redirect requests to Next.js app.
|
|
38
|
+
expressApp.all('*', (req, res) => {
|
|
39
|
+
console.log('Forwarding request to Next.js: ', req.url);
|
|
40
|
+
handle(req, res)
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return new Promise<void>((resolve, reject) => {
|
|
44
|
+
expressApp.on('error', (err) => reject(err));
|
|
45
|
+
expressApp.listen(port, () => {
|
|
46
|
+
console.log(`[ ready ] on http://${hostname}:${port}`)
|
|
47
|
+
resolve();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main().catch((err) => {
|
|
53
|
+
console.error(err);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
|
56
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"noEmit": false,
|
|
6
|
+
"incremental": true,
|
|
7
|
+
"tsBuildInfoFile": "<%= offsetFromRoot %>/tmp/buildcache/<%= projectRoot %>/server",
|
|
8
|
+
"types": [
|
|
9
|
+
"node"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"server/**/*.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxNextCustomServer",
|
|
5
|
+
"title": "Add custom server",
|
|
6
|
+
"description": "Add a custom server to existing Next.js application.",
|
|
7
|
+
"examples": [
|
|
8
|
+
{
|
|
9
|
+
"command": "nx g custom-server my-app",
|
|
10
|
+
"description": "Add a custom server to existing Next.js app."
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The name of the project.",
|
|
18
|
+
"alias": "p",
|
|
19
|
+
"$default": {
|
|
20
|
+
"$source": "argv",
|
|
21
|
+
"index": 0
|
|
22
|
+
},
|
|
23
|
+
"x-dropdown": "project",
|
|
24
|
+
"x-prompt": "What is the name of the project to set up a custom server for?"
|
|
25
|
+
},
|
|
26
|
+
"compiler": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["tsc", "swc"],
|
|
29
|
+
"default": "tsc",
|
|
30
|
+
"description": "The compiler used to build the custom server."
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["project"]
|
|
34
|
+
}
|
|
@@ -8,6 +8,7 @@ const jest_1 = require("@nrwl/jest");
|
|
|
8
8
|
const cypress_1 = require("@nrwl/cypress");
|
|
9
9
|
const react_1 = require("@nrwl/react");
|
|
10
10
|
const versions_1 = require("../../utils/versions");
|
|
11
|
+
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
11
12
|
function updateDependencies(host) {
|
|
12
13
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {
|
|
13
14
|
'@nrwl/next': versions_1.nxVersion,
|
|
@@ -34,6 +35,7 @@ function nextInitGenerator(host, schema) {
|
|
|
34
35
|
tasks.push(reactTask);
|
|
35
36
|
const installTask = updateDependencies(host);
|
|
36
37
|
tasks.push(installTask);
|
|
38
|
+
(0, add_gitignore_entry_1.addGitIgnoreEntry)(host);
|
|
37
39
|
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
38
40
|
});
|
|
39
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AACtB,2FAAqF;AACrF,qCAA+C;AAC/C,2CAAqD;AACrD,uCAAgF;AAEhF,mDAK8B;AAE9B,yEAAoE;AAEpE,SAAS,kBAAkB,CAAC,IAAU;IACpC,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,YAAY,EAAE,oBAAS;QACvB,IAAI,EAAE,sBAAW;QACjB,KAAK,EAAE,oBAAY;QACnB,WAAW,EAAE,uBAAe;QAC5B,KAAK,EAAE,uBAAY;KACpB,EACD;QACE,oBAAoB,EAAE,kCAAuB;KAC9C,CACF,CAAC;AACJ,CAAC;AAED,SAAsB,iBAAiB,CAAC,IAAU,EAAE,MAAkB;;QACpE,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,EAAE;YAC9D,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE;YAC/D,MAAM,WAAW,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACzB;QAED,MAAM,SAAS,GAAG,MAAM,IAAA,0BAAkB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEtB,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAA,uCAAiB,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AArBD,8CAqBC;AAED,kBAAe,iBAAiB,CAAC;AACpB,QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
7
|
+
function update(tree) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
(0, add_gitignore_entry_1.addGitIgnoreEntry)(tree);
|
|
10
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.update = update;
|
|
14
|
+
exports.default = update;
|
|
15
|
+
//# sourceMappingURL=add-gitignore-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-gitignore-entry.js","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-14-5-3/add-gitignore-entry.ts"],"names":[],"mappings":";;;;AAAA,yCAAiD;AACjD,yEAAoE;AAEpE,SAAsB,MAAM,CAAC,IAAU;;QACrC,IAAA,uCAAiB,EAAC,IAAI,CAAC,CAAC;QACxB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAHD,wBAGC;AAED,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.update = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
function update(tree) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
projects.forEach((config, name) => {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
var _e, _f;
|
|
12
|
+
if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/next:build') {
|
|
13
|
+
(_c = (_e = config.targets.build).configurations) !== null && _c !== void 0 ? _c : (_e.configurations = {});
|
|
14
|
+
(_d = (_f = config.targets.build.configurations).development) !== null && _d !== void 0 ? _d : (_f.development = {});
|
|
15
|
+
if (!config.targets.build.configurations.development.outputPath ||
|
|
16
|
+
config.targets.build.configurations.development.outputPath ===
|
|
17
|
+
(0, devkit_1.joinPathFragments)('tmp', config.root)) {
|
|
18
|
+
config.targets.build.configurations.development.outputPath =
|
|
19
|
+
config.root;
|
|
20
|
+
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.update = update;
|
|
28
|
+
exports.default = update;
|
|
29
|
+
//# sourceMappingURL=update-dev-output-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-dev-output-path.js","sourceRoot":"","sources":["../../../../../../packages/next/src/migrations/update-14-5-3/update-dev-output-path.ts"],"names":[],"mappings":";;;;AAAA,yCAMsB;AAEtB,SAAsB,MAAM,CAAC,IAAU;;QACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;;;YAChC,IAAI,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;gBAC1D,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,EAAC,cAAc,uCAAd,cAAc,GAAK,EAAE,EAAC;gBAC3C,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAC,WAAW,uCAAX,WAAW,GAAK,EAAE,EAAC;gBACvD,IACE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,UAAU;oBAC3D,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,UAAU;wBACxD,IAAA,0BAAiB,EAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,EACvC;oBACA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,UAAU;wBACxD,MAAM,CAAC,IAAI,CAAC;oBACd,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;iBAChD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AApBD,wBAoBC;AAED,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addGitIgnoreEntry = void 0;
|
|
4
|
+
const ignore_1 = require("ignore");
|
|
5
|
+
function addGitIgnoreEntry(host) {
|
|
6
|
+
if (!host.exists('.gitignore')) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
let content = host.read('.gitignore', 'utf-8').trimEnd();
|
|
10
|
+
const ig = (0, ignore_1.default)();
|
|
11
|
+
ig.add(host.read('.gitignore', 'utf-8'));
|
|
12
|
+
if (!ig.ignores('apps/example/.next')) {
|
|
13
|
+
content = `${content}\n\n# Next.js\n.next\n`;
|
|
14
|
+
}
|
|
15
|
+
host.write('.gitignore', content);
|
|
16
|
+
}
|
|
17
|
+
exports.addGitIgnoreEntry = addGitIgnoreEntry;
|
|
18
|
+
//# sourceMappingURL=add-gitignore-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-gitignore-entry.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/add-gitignore-entry.ts"],"names":[],"mappings":";;;AACA,mCAA4B;AAE5B,SAAgB,iBAAiB,CAAC,IAAU;IAC1C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC9B,OAAO;KACR;IAED,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;IAEzD,MAAM,EAAE,GAAG,IAAA,gBAAM,GAAE,CAAC;IACpB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IAEzC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;QACrC,OAAO,GAAG,GAAG,OAAO,wBAAwB,CAAC;KAC9C;IAED,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAfD,8CAeC"}
|
package/src/utils/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface NextServerOptions {
|
|
|
16
16
|
port: number;
|
|
17
17
|
path: string;
|
|
18
18
|
hostname: string;
|
|
19
|
+
customServer?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export interface FileReplacement {
|
|
21
22
|
replace: string;
|
|
@@ -28,6 +29,7 @@ export interface NextBuildBuilderOptions {
|
|
|
28
29
|
assets?: any[];
|
|
29
30
|
nextConfig?: string;
|
|
30
31
|
buildLibsFromSource?: boolean;
|
|
32
|
+
watch?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface NextServeBuilderOptions {
|
|
33
35
|
dev: boolean;
|
|
@@ -35,6 +37,9 @@ export interface NextServeBuilderOptions {
|
|
|
35
37
|
staticMarkup: boolean;
|
|
36
38
|
quiet: boolean;
|
|
37
39
|
buildTarget: string;
|
|
40
|
+
customServerTarget?: string;
|
|
41
|
+
/** @deprecated Use customServerTarget
|
|
42
|
+
*/
|
|
38
43
|
customServerPath?: string;
|
|
39
44
|
hostname?: string;
|
|
40
45
|
proxyConfig?: string;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare const eslintConfigNextVersion = "12.2.3";
|
|
|
4
4
|
export declare const sassVersion = "1.54.0";
|
|
5
5
|
export declare const lessLoader = "11.0.0";
|
|
6
6
|
export declare const stylusLoader = "7.0.0";
|
|
7
|
-
export declare const emotionServerVersion = "11.
|
|
7
|
+
export declare const emotionServerVersion = "11.10.0";
|
|
8
8
|
export declare const babelPluginStyledComponentsVersion = "1.10.7";
|
|
9
9
|
export declare const tsLibVersion = "^2.3.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.eslintConfigNextVersion = '12.2.3';
|
|
|
7
7
|
exports.sassVersion = '1.54.0';
|
|
8
8
|
exports.lessLoader = '11.0.0';
|
|
9
9
|
exports.stylusLoader = '7.0.0';
|
|
10
|
-
exports.emotionServerVersion = '11.
|
|
10
|
+
exports.emotionServerVersion = '11.10.0';
|
|
11
11
|
exports.babelPluginStyledComponentsVersion = '1.10.7';
|
|
12
12
|
exports.tsLibVersion = '^2.3.0';
|
|
13
13
|
//# sourceMappingURL=versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAElD,QAAA,WAAW,GAAG,QAAQ,CAAC;AACvB,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AACnC,QAAA,WAAW,GAAG,QAAQ,CAAC;AACvB,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAElD,QAAA,WAAW,GAAG,QAAQ,CAAC;AACvB,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AACnC,QAAA,WAAW,GAAG,QAAQ,CAAC;AACvB,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,oBAAoB,GAAG,SAAS,CAAC;AACjC,QAAA,kCAAkC,GAAG,QAAQ,CAAC;AAC9C,QAAA,YAAY,GAAG,QAAQ,CAAC"}
|