@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.
Files changed (140) hide show
  1. package/babel.js +0 -1
  2. package/index.js +0 -1
  3. package/migrations.json +15 -0
  4. package/package.json +9 -9
  5. package/plugins/component-testing.js +0 -1
  6. package/plugins/with-less.js +0 -1
  7. package/plugins/with-nx.js +0 -1
  8. package/plugins/with-stylus.js +0 -1
  9. package/src/executors/build/build.impl.js +4 -1
  10. package/src/executors/build/compat.js +0 -1
  11. package/src/executors/build/lib/check-project.js +0 -1
  12. package/src/executors/build/lib/create-next-config-file.js +1 -2
  13. package/src/executors/build/lib/test-fixtures/ensure-exts/baz.json +0 -0
  14. package/src/executors/build/lib/update-package-json.js +0 -1
  15. package/src/executors/build/schema.json +2 -1
  16. package/src/executors/export/compat.js +0 -1
  17. package/src/executors/export/export.impl.js +0 -1
  18. package/src/executors/server/compat.js +0 -1
  19. package/src/executors/server/custom-server.impl.js +0 -2
  20. package/src/executors/server/lib/default-server.js +0 -1
  21. package/src/executors/server/lib/tsnode-register.js +0 -1
  22. package/src/executors/server/schema.json +2 -7
  23. package/src/executors/server/server.impl.js +0 -1
  24. package/src/generators/application/application.js +0 -1
  25. package/src/generators/application/lib/add-cypress.js +0 -1
  26. package/src/generators/application/lib/add-jest.js +0 -1
  27. package/src/generators/application/lib/add-linting.js +0 -1
  28. package/src/generators/application/lib/add-project.js +0 -1
  29. package/src/generators/application/lib/create-application-files.helpers.js +0 -1
  30. package/src/generators/application/lib/create-application-files.js +0 -1
  31. package/src/generators/application/lib/normalize-options.js +0 -1
  32. package/src/generators/application/lib/set-defaults.js +0 -1
  33. package/src/generators/application/lib/show-possible-warnings.js +0 -1
  34. package/src/generators/application/lib/update-cypress-tsconfig.js +0 -1
  35. package/src/generators/application/lib/update-jest-config.js +0 -1
  36. package/src/generators/component/component.js +0 -1
  37. package/src/generators/custom-server/custom-server.js +0 -1
  38. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -1
  39. package/src/generators/init/init.js +2 -3
  40. package/src/generators/library/lib/normalize-options.js +0 -1
  41. package/src/generators/library/library.js +9 -26
  42. package/src/generators/library/schema.json +2 -3
  43. package/src/generators/page/page.d.ts +1 -1
  44. package/src/generators/page/page.js +15 -6
  45. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js +0 -1
  46. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js +0 -1
  47. package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -1
  48. package/src/migrations/update-13-0-0/update-to-webpack-5.js +0 -1
  49. package/src/migrations/update-13-0-3/fix-less.js +0 -1
  50. package/src/migrations/update-13-1-1/enable-swc.js +0 -1
  51. package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -1
  52. package/src/migrations/update-14-4-3/add-dev-output-path.js +0 -1
  53. package/src/migrations/update-14-5-3/add-gitignore-entry.js +0 -1
  54. package/src/migrations/update-14-5-3/update-dev-output-path.js +0 -1
  55. package/src/migrations/update-14-5-7/update-next-eslint.js +0 -1
  56. package/src/migrations/update-15-8-8/add-style-packages.js +0 -1
  57. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -1
  58. package/src/migrations/update-16-3-0/remove-root-build-option.js +0 -1
  59. package/src/migrations/update-16-4-0/update-nx-next-dependency.d.ts +2 -0
  60. package/src/migrations/update-16-4-0/update-nx-next-dependency.js +20 -0
  61. package/src/utils/add-gitignore-entry.js +0 -1
  62. package/src/utils/compose-plugins.js +0 -1
  63. package/src/utils/config-invalid-function.fixture.js +0 -1
  64. package/src/utils/config-not-a-function.fixture.js +0 -1
  65. package/src/utils/config.fixture.js +0 -1
  66. package/src/utils/config.js +1 -2
  67. package/src/utils/constants.js +0 -1
  68. package/src/utils/create-cli-options.js +0 -1
  69. package/src/utils/create-copy-plugin.js +0 -1
  70. package/src/utils/generate-globs.js +0 -1
  71. package/src/utils/styles.js +0 -1
  72. package/src/utils/types.d.ts +0 -1
  73. package/src/utils/types.js +0 -1
  74. package/src/utils/versions.js +0 -1
  75. package/tailwind.js +0 -1
  76. package/babel.js.map +0 -1
  77. package/index.js.map +0 -1
  78. package/plugins/component-testing.js.map +0 -1
  79. package/plugins/with-less.js.map +0 -1
  80. package/plugins/with-nx.js.map +0 -1
  81. package/plugins/with-stylus.js.map +0 -1
  82. package/src/executors/build/build.impl.js.map +0 -1
  83. package/src/executors/build/compat.js.map +0 -1
  84. package/src/executors/build/lib/check-project.js.map +0 -1
  85. package/src/executors/build/lib/create-next-config-file.js.map +0 -1
  86. package/src/executors/build/lib/update-package-json.js.map +0 -1
  87. package/src/executors/export/compat.js.map +0 -1
  88. package/src/executors/export/export.impl.js.map +0 -1
  89. package/src/executors/server/compat.js.map +0 -1
  90. package/src/executors/server/custom-server.impl.js.map +0 -1
  91. package/src/executors/server/lib/default-server.js.map +0 -1
  92. package/src/executors/server/lib/tsnode-register.js.map +0 -1
  93. package/src/executors/server/server.impl.js.map +0 -1
  94. package/src/generators/application/application.js.map +0 -1
  95. package/src/generators/application/lib/add-cypress.js.map +0 -1
  96. package/src/generators/application/lib/add-jest.js.map +0 -1
  97. package/src/generators/application/lib/add-linting.js.map +0 -1
  98. package/src/generators/application/lib/add-project.js.map +0 -1
  99. package/src/generators/application/lib/create-application-files.helpers.js.map +0 -1
  100. package/src/generators/application/lib/create-application-files.js.map +0 -1
  101. package/src/generators/application/lib/normalize-options.js.map +0 -1
  102. package/src/generators/application/lib/set-defaults.js.map +0 -1
  103. package/src/generators/application/lib/show-possible-warnings.js.map +0 -1
  104. package/src/generators/application/lib/update-cypress-tsconfig.js.map +0 -1
  105. package/src/generators/application/lib/update-jest-config.js.map +0 -1
  106. package/src/generators/component/component.js.map +0 -1
  107. package/src/generators/custom-server/custom-server.js.map +0 -1
  108. package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +0 -1
  109. package/src/generators/init/init.js.map +0 -1
  110. package/src/generators/library/lib/normalize-options.js.map +0 -1
  111. package/src/generators/library/library.js.map +0 -1
  112. package/src/generators/page/page.js.map +0 -1
  113. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js.map +0 -1
  114. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js.map +0 -1
  115. package/src/migrations/update-13-0-0/update-emotion-setup.js.map +0 -1
  116. package/src/migrations/update-13-0-0/update-to-webpack-5.js.map +0 -1
  117. package/src/migrations/update-13-0-3/fix-less.js.map +0 -1
  118. package/src/migrations/update-13-1-1/enable-swc.js.map +0 -1
  119. package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +0 -1
  120. package/src/migrations/update-14-4-3/add-dev-output-path.js.map +0 -1
  121. package/src/migrations/update-14-5-3/add-gitignore-entry.js.map +0 -1
  122. package/src/migrations/update-14-5-3/update-dev-output-path.js.map +0 -1
  123. package/src/migrations/update-14-5-7/update-next-eslint.js.map +0 -1
  124. package/src/migrations/update-15-8-8/add-style-packages.js.map +0 -1
  125. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +0 -1
  126. package/src/migrations/update-16-3-0/remove-root-build-option.js.map +0 -1
  127. package/src/utils/add-gitignore-entry.js.map +0 -1
  128. package/src/utils/compose-plugins.js.map +0 -1
  129. package/src/utils/config-invalid-function.fixture.js.map +0 -1
  130. package/src/utils/config-not-a-function.fixture.js.map +0 -1
  131. package/src/utils/config.fixture.js.map +0 -1
  132. package/src/utils/config.js.map +0 -1
  133. package/src/utils/constants.js.map +0 -1
  134. package/src/utils/create-cli-options.js.map +0 -1
  135. package/src/utils/create-copy-plugin.js.map +0 -1
  136. package/src/utils/generate-globs.js.map +0 -1
  137. package/src/utils/styles.js.map +0 -1
  138. package/src/utils/types.js.map +0 -1
  139. package/src/utils/versions.js.map +0 -1
  140. package/tailwind.js.map +0 -1
package/babel.js CHANGED
@@ -10,4 +10,3 @@ module.exports = function (api, options) {
10
10
  ],
11
11
  };
12
12
  };
13
- //# sourceMappingURL=babel.js.map
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.0",
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.0",
39
- "@nx/devkit": "16.4.0-beta.0",
40
- "@nx/js": "16.4.0-beta.0",
41
- "@nx/linter": "16.4.0-beta.0",
42
- "@nx/react": "16.4.0-beta.0",
43
- "@nx/web": "16.4.0-beta.0",
44
- "@nx/workspace": "16.4.0-beta.0",
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": "c2112a07278e9c78cd6f6c194eb4a75115a7d179"
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
@@ -72,4 +72,3 @@ function withLess(configOrFn) {
72
72
  exports.withLess = withLess;
73
73
  module.exports = withLess;
74
74
  module.exports.withLess = withLess;
75
- //# sourceMappingURL=with-less.js.map
@@ -312,4 +312,3 @@ module.exports = withNx;
312
312
  module.exports.withNx = withNx;
313
313
  module.exports.getNextConfig = getNextConfig;
314
314
  module.exports.getAliasForProject = getAliasForProject;
315
- //# sourceMappingURL=with-nx.js.map
@@ -72,4 +72,3 @@ function withStylus(configOrFn) {
72
72
  exports.withStylus = withStylus;
73
73
  module.exports = withStylus;
74
74
  module.exports.withStylus = withStylus;
75
- //# sourceMappingURL=with-stylus.js.map
@@ -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
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const build_impl_1 = require("./build.impl");
5
5
  exports.default = (0, devkit_1.convertNxExecutor)(build_impl_1.default);
6
- //# sourceMappingURL=compat.js.map
@@ -10,4 +10,3 @@ function checkPublicDirectory(root) {
10
10
  }
11
11
  }
12
12
  exports.checkPublicDirectory = checkPublicDirectory;
13
- //# sourceMappingURL=check-project.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
@@ -21,4 +21,3 @@ function updatePackageJson(packageJson, context) {
21
21
  }
22
22
  }
23
23
  exports.updatePackageJson = updatePackageJson;
24
- //# sourceMappingURL=update-package-json.js.map
@@ -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
  }
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const export_impl_1 = require("./export.impl");
5
5
  exports.default = (0, devkit_1.convertNxExecutor)(export_impl_1.default);
6
- //# sourceMappingURL=compat.js.map
@@ -60,4 +60,3 @@ function getBuildTargetCommand(options) {
60
60
  const cmd = ['nx', 'run', options.buildTarget];
61
61
  return cmd;
62
62
  }
63
- //# sourceMappingURL=export.impl.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const server_impl_1 = require("./server.impl");
5
5
  exports.default = (0, devkit_1.convertNxExecutor)(server_impl_1.default);
6
- //# sourceMappingURL=compat.js.map
@@ -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
@@ -28,4 +28,3 @@ function defaultServer(settings, proxyConfig) {
28
28
  });
29
29
  }
30
30
  exports.defaultServer = defaultServer;
31
- //# sourceMappingURL=default-server.js.map
@@ -20,4 +20,3 @@ function tsNodeRegister(file = '', tsConfig) {
20
20
  }
21
21
  }
22
22
  exports.tsNodeRegister = tsNodeRegister;
23
- //# sourceMappingURL=tsnode-register.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
  }
@@ -64,4 +64,3 @@ function serveExecutor(options, context) {
64
64
  });
65
65
  }
66
66
  exports.default = serveExecutor;
67
- //# sourceMappingURL=server.impl.js.map
@@ -47,4 +47,3 @@ function applicationGenerator(host, schema) {
47
47
  }
48
48
  exports.applicationGenerator = applicationGenerator;
49
49
  exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
50
- //# sourceMappingURL=application.js.map
@@ -15,4 +15,3 @@ function addCypress(host, options) {
15
15
  });
16
16
  }
17
17
  exports.addCypress = addCypress;
18
- //# sourceMappingURL=add-cypress.js.map
@@ -33,4 +33,3 @@ function addJest(host, options) {
33
33
  });
34
34
  }
35
35
  exports.addJest = addJest;
36
- //# sourceMappingURL=add-jest.js.map
@@ -64,4 +64,3 @@ function addLinting(host, options) {
64
64
  });
65
65
  }
66
66
  exports.addLinting = addLinting;
67
- //# sourceMappingURL=add-linting.js.map
@@ -52,4 +52,3 @@ function addProject(host, options) {
52
52
  (0, devkit_1.addProjectConfiguration)(host, options.projectName, Object.assign({}, project));
53
53
  }
54
54
  exports.addProject = addProject;
55
- //# sourceMappingURL=add-project.js.map
@@ -782,4 +782,3 @@ function createStyleRules() {
782
782
  `;
783
783
  }
784
784
  exports.createStyleRules = createStyleRules;
785
- //# sourceMappingURL=create-application-files.helpers.js.map
@@ -84,4 +84,3 @@ function createApplicationFiles(host, options) {
84
84
  }
85
85
  }
86
86
  exports.createApplicationFiles = createApplicationFiles;
87
- //# sourceMappingURL=create-application-files.js.map
@@ -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
@@ -14,4 +14,3 @@ function setDefaults(host, options) {
14
14
  (0, devkit_1.updateNxJson)(host, nxJson);
15
15
  }
16
16
  exports.setDefaults = setDefaults;
17
- //# sourceMappingURL=set-defaults.js.map
@@ -8,4 +8,3 @@ function showPossibleWarnings(tree, options) {
8
8
  }
9
9
  }
10
10
  exports.showPossibleWarnings = showPossibleWarnings;
11
- //# sourceMappingURL=show-possible-warnings.js.map
@@ -11,4 +11,3 @@ function updateCypressTsConfig(host, options) {
11
11
  });
12
12
  }
13
13
  exports.updateCypressTsConfig = updateCypressTsConfig;
14
- //# sourceMappingURL=update-cypress-tsconfig.js.map
@@ -13,4 +13,3 @@ function updateJestConfig(host, options) {
13
13
  host.write(configPath, content);
14
14
  }
15
15
  exports.updateJestConfig = updateJestConfig;
16
- //# sourceMappingURL=update-jest-config.js.map
@@ -35,4 +35,3 @@ function componentGenerator(host, options) {
35
35
  exports.componentGenerator = componentGenerator;
36
36
  exports.default = componentGenerator;
37
37
  exports.componentSchematic = (0, devkit_1.convertNxGenerator)(componentGenerator);
38
- //# sourceMappingURL=component.js.map
@@ -77,4 +77,3 @@ function customServerGenerator(host, options) {
77
77
  }
78
78
  exports.customServerGenerator = customServerGenerator;
79
79
  exports.customServerSchematic = (0, devkit_1.convertNxGenerator)(customServerGenerator);
80
- //# sourceMappingURL=custom-server.js.map
@@ -73,4 +73,3 @@ ${isUsingTailwind
73
73
  });
74
74
  }
75
75
  exports.default = cypressComponentConfiguration;
76
- //# sourceMappingURL=cypress-component-configuration.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, 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);
@@ -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, options: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
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, options) {
13
+ function pageGenerator(host, schema) {
14
14
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
- const project = (0, devkit_1.readProjectConfiguration)(host, options.project);
16
- const directory = options.directory ? `pages/${options.directory}` : 'pages';
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
@@ -31,4 +31,3 @@ function fixPageDirForEslint(host) {
31
31
  }
32
32
  exports.fixPageDirForEslint = fixPageDirForEslint;
33
33
  exports.default = fixPageDirForEslint;
34
- //# sourceMappingURL=fix-page-dir-for-eslint.js.map
@@ -23,4 +23,3 @@ function removeStyledJsxBabelConfig(host) {
23
23
  }
24
24
  exports.removeStyledJsxBabelConfig = removeStyledJsxBabelConfig;
25
25
  exports.default = removeStyledJsxBabelConfig;
26
- //# sourceMappingURL=remove-styled-jsx-babel-plugin.js.map
@@ -36,4 +36,3 @@ function updateEmotionSetup(host) {
36
36
  }
37
37
  exports.updateEmotionSetup = updateEmotionSetup;
38
38
  exports.default = updateEmotionSetup;
39
- //# sourceMappingURL=update-emotion-setup.js.map
@@ -29,4 +29,3 @@ function update(host) {
29
29
  }
30
30
  exports.update = update;
31
31
  exports.default = update;
32
- //# sourceMappingURL=update-to-webpack-5.js.map
@@ -24,4 +24,3 @@ function update(host) {
24
24
  }
25
25
  exports.update = update;
26
26
  exports.default = update;
27
- //# sourceMappingURL=fix-less.js.map
@@ -43,4 +43,3 @@ function customBabelConfig(host, configPath) {
43
43
  (((_c = json.plugins) === null || _c === void 0 ? void 0 : _c.length) === 0 || !json.plugins));
44
44
  }
45
45
  exports.default = update;
46
- //# sourceMappingURL=enable-swc.js.map
@@ -33,4 +33,3 @@ function update(tree) {
33
33
  }
34
34
  exports.update = update;
35
35
  exports.default = update;
36
- //# sourceMappingURL=add-default-development-configurations.js.map
@@ -21,4 +21,3 @@ function update(tree) {
21
21
  }
22
22
  exports.update = update;
23
23
  exports.default = update;
24
- //# sourceMappingURL=add-dev-output-path.js.map
@@ -12,4 +12,3 @@ function update(tree) {
12
12
  }
13
13
  exports.update = update;
14
14
  exports.default = update;
15
- //# sourceMappingURL=add-gitignore-entry.js.map
@@ -26,4 +26,3 @@ function update(tree) {
26
26
  }
27
27
  exports.update = update;
28
28
  exports.default = update;
29
- //# sourceMappingURL=update-dev-output-path.js.map
@@ -29,4 +29,3 @@ function updateNextEslint(host) {
29
29
  }
30
30
  exports.updateNextEslint = updateNextEslint;
31
31
  exports.default = updateNextEslint;
32
- //# sourceMappingURL=update-next-eslint.js.map
@@ -25,4 +25,3 @@ function update(tree) {
25
25
  }
26
26
  exports.update = update;
27
27
  exports.default = update;
28
- //# sourceMappingURL=add-style-packages.js.map
@@ -10,4 +10,3 @@ function replacePackage(tree) {
10
10
  });
11
11
  }
12
12
  exports.default = replacePackage;
13
- //# sourceMappingURL=update-16-0-0-add-nx-packages.js.map
@@ -18,4 +18,3 @@ function update(tree) {
18
18
  });
19
19
  }
20
20
  exports.default = update;
21
- //# sourceMappingURL=remove-root-build-option.js.map
@@ -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;
@@ -15,4 +15,3 @@ function addGitIgnoreEntry(host) {
15
15
  host.write('.gitignore', content);
16
16
  }
17
17
  exports.addGitIgnoreEntry = addGitIgnoreEntry;
18
- //# sourceMappingURL=add-gitignore-entry.js.map
@@ -23,4 +23,3 @@ function composePlugins(...plugins) {
23
23
  };
24
24
  }
25
25
  exports.composePlugins = composePlugins;
26
- //# sourceMappingURL=compose-plugins.js.map
@@ -1,2 +1 @@
1
1
  module.exports = () => { };
2
- //# sourceMappingURL=config-invalid-function.fixture.js.map
@@ -1,2 +1 @@
1
1
  module.exports = 'BAD';
2
- //# sourceMappingURL=config-not-a-function.fixture.js.map
@@ -1,4 +1,3 @@
1
1
  module.exports = (phase, config, context) => {
2
2
  return Object.assign(Object.assign({}, config), { myPhase: phase, myCustomValue: context.options.customValue });
3
3
  };
4
- //# sourceMappingURL=config.fixture.js.map