@nx/next 16.4.0-beta.1 → 16.4.0-beta.13

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/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.1",
3
+ "version": "16.4.0-beta.13",
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.1",
39
- "@nx/devkit": "16.4.0-beta.1",
40
- "@nx/js": "16.4.0-beta.1",
41
- "@nx/linter": "16.4.0-beta.1",
42
- "@nx/react": "16.4.0-beta.1",
43
- "@nx/web": "16.4.0-beta.1",
44
- "@nx/workspace": "16.4.0-beta.1",
38
+ "@nrwl/next": "16.4.0-beta.13",
39
+ "@nx/devkit": "16.4.0-beta.13",
40
+ "@nx/js": "16.4.0-beta.13",
41
+ "@nx/linter": "16.4.0-beta.13",
42
+ "@nx/react": "16.4.0-beta.13",
43
+ "@nx/web": "16.4.0-beta.13",
44
+ "@nx/workspace": "16.4.0-beta.13",
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": "1c4fb934b607f0d93bb23bff2cf0f39b31a8fa43"
64
+ "gitHead": "d81afedfcc8d07db8cdb9b0e9286de0321ee184e"
65
65
  }
@@ -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) {
@@ -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))
@@ -71,5 +71,6 @@
71
71
  "description": "Only build 'app' routes"
72
72
  }
73
73
  },
74
- "required": ["outputPath"]
74
+ "required": ["outputPath"],
75
+ "examplesFile": "../../../docs/build-next-executor-examples.md"
75
76
  }
@@ -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
  });
@@ -30,22 +29,17 @@ function runCustomServer(root, options, context) {
30
29
  watch: options.dev ? true : false,
31
30
  }, context));
32
31
  try {
33
- for (var _d = true, customServerBuild_1 = tslib_1.__asyncValues(customServerBuild), customServerBuild_1_1; customServerBuild_1_1 = yield tslib_1.__await(customServerBuild_1.next()), _a = customServerBuild_1_1.done, !_a;) {
32
+ for (var _d = true, customServerBuild_1 = tslib_1.__asyncValues(customServerBuild), customServerBuild_1_1; customServerBuild_1_1 = yield tslib_1.__await(customServerBuild_1.next()), _a = customServerBuild_1_1.done, !_a; _d = true) {
34
33
  _c = customServerBuild_1_1.value;
35
34
  _d = false;
36
- try {
37
- const result = _c;
38
- if (!result.success) {
39
- return yield tslib_1.__await(result);
40
- }
41
- yield yield tslib_1.__await({
42
- success: true,
43
- baseUrl,
44
- });
45
- }
46
- finally {
47
- _d = true;
35
+ const result = _c;
36
+ if (!result.success) {
37
+ return yield tslib_1.__await(result);
48
38
  }
39
+ yield yield tslib_1.__await({
40
+ success: true,
41
+ baseUrl,
42
+ });
49
43
  }
50
44
  }
51
45
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -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
  }
@@ -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, skipBabelConfig: 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);
@@ -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) {
@@ -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",
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<void>;
@@ -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;
@@ -11,7 +11,7 @@ function createWebpackConfig(workspaceRoot, projectRoot, fileReplacements = [],
11
11
  const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
12
12
  let tsConfigPath = (0, path_1.join)(workspaceRoot, projectRoot, 'tsconfig.json');
13
13
  if (dependencies.length > 0) {
14
- tsConfigPath = (0, buildable_libs_utils_1.createTmpTsConfig)((0, path_1.join)(workspaceRoot, tsConfigPath), workspaceRoot, projectRoot, dependencies);
14
+ tsConfigPath = (0, buildable_libs_utils_1.createTmpTsConfig)(tsConfigPath, workspaceRoot, projectRoot, dependencies);
15
15
  }
16
16
  config.resolve.plugins = [
17
17
  new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
@@ -41,7 +41,6 @@ export interface NextServeBuilderOptions {
41
41
  buildTarget: string;
42
42
  customServerTarget?: string;
43
43
  hostname?: string;
44
- proxyConfig?: string;
45
44
  buildLibsFromSource?: boolean;
46
45
  keepAliveTimeout?: number;
47
46
  turbo?: boolean;