@nx/next 23.0.0-beta.1 → 23.0.0-beta.3

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 (62) hide show
  1. package/index.d.ts +0 -1
  2. package/index.d.ts.map +1 -1
  3. package/index.js +1 -3
  4. package/package.json +10 -10
  5. package/plugins/with-nx.d.ts.map +1 -1
  6. package/plugins/with-nx.js +3 -11
  7. package/src/generators/application/application.d.ts.map +1 -1
  8. package/src/generators/application/application.js +0 -15
  9. package/src/generators/application/files/app/page.tsx__tmpl__ +4 -16
  10. package/src/generators/application/files/common/__dot__babelrc +2 -19
  11. package/src/generators/application/files/common/index.d.ts__tmpl__ +0 -7
  12. package/src/generators/application/files/common/next.config.js__tmpl__ +0 -56
  13. package/src/generators/application/files/common/tsconfig.json__tmpl__ +0 -1
  14. package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +4 -13
  15. package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
  16. package/src/generators/application/lib/add-e2e.js +2 -4
  17. package/src/generators/application/lib/create-application-files.d.ts.map +1 -1
  18. package/src/generators/application/lib/create-application-files.js +2 -21
  19. package/src/generators/application/lib/normalize-options.d.ts +0 -1
  20. package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
  21. package/src/generators/application/lib/normalize-options.js +0 -4
  22. package/src/generators/application/schema.json +2 -21
  23. package/src/generators/component/schema.json +2 -21
  24. package/src/generators/library/library.d.ts.map +1 -1
  25. package/src/generators/library/library.js +0 -6
  26. package/src/generators/library/schema.json +2 -21
  27. package/src/generators/page/schema.json +2 -17
  28. package/src/utils/styles.d.ts +0 -62
  29. package/src/utils/styles.d.ts.map +1 -1
  30. package/src/utils/styles.js +4 -50
  31. package/src/utils/versions.d.ts +1 -4
  32. package/src/utils/versions.d.ts.map +1 -1
  33. package/src/utils/versions.js +2 -5
  34. package/tailwind.d.ts +3 -5
  35. package/tailwind.d.ts.map +1 -1
  36. package/tailwind.js +36 -11
  37. package/src/generators/application/files/app-styled-components/layout.tsx__tmpl__ +0 -21
  38. package/src/generators/application/files/app-styled-components/registry.tsx__tmpl__ +0 -33
  39. package/src/generators/application/files/app-styled-jsx/layout.tsx__tmpl__ +0 -16
  40. package/src/generators/application/files/app-styled-jsx/registry.tsx__tmpl__ +0 -23
  41. package/src/generators/application/files/pages/_document.tsx__tmpl__ +0 -33
  42. package/src/generators/application/lib/show-possible-warnings.d.ts +0 -4
  43. package/src/generators/application/lib/show-possible-warnings.d.ts.map +0 -1
  44. package/src/generators/application/lib/show-possible-warnings.js +0 -9
  45. package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +0 -15
  46. package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +0 -23
  47. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +0 -4
  48. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts.map +0 -1
  49. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +0 -27
  50. package/src/generators/setup-tailwind/lib/update-project.d.ts +0 -4
  51. package/src/generators/setup-tailwind/lib/update-project.d.ts.map +0 -1
  52. package/src/generators/setup-tailwind/lib/update-project.js +0 -11
  53. package/src/generators/setup-tailwind/schema.d.ts +0 -7
  54. package/src/generators/setup-tailwind/schema.d.ts.map +0 -1
  55. package/src/generators/setup-tailwind/schema.js +0 -2
  56. package/src/generators/setup-tailwind/schema.json +0 -47
  57. package/src/generators/setup-tailwind/setup-tailwind.d.ts +0 -5
  58. package/src/generators/setup-tailwind/setup-tailwind.d.ts.map +0 -1
  59. package/src/generators/setup-tailwind/setup-tailwind.js +0 -35
  60. package/src/utils/generate-globs.d.ts +0 -6
  61. package/src/utils/generate-globs.d.ts.map +0 -1
  62. package/src/utils/generate-globs.js +0 -28
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './src/utils/types';
2
- export { createGlobPatternsOfDependentProjects } from './src/utils/generate-globs';
3
2
  export { applicationGenerator } from './src/generators/application/application';
4
3
  export { componentGenerator } from './src/generators/component/component';
5
4
  export { libraryGenerator } from './src/generators/library/library';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
package/index.js CHANGED
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.composePlugins = exports.withNx = exports.pageGenerator = exports.libraryGenerator = exports.componentGenerator = exports.applicationGenerator = exports.createGlobPatternsOfDependentProjects = void 0;
3
+ exports.composePlugins = exports.withNx = exports.pageGenerator = exports.libraryGenerator = exports.componentGenerator = exports.applicationGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./src/utils/types"), exports);
6
- var generate_globs_1 = require("./src/utils/generate-globs");
7
- Object.defineProperty(exports, "createGlobPatternsOfDependentProjects", { enumerable: true, get: function () { return generate_globs_1.createGlobPatternsOfDependentProjects; } });
8
6
  var application_1 = require("./src/generators/application/application");
9
7
  Object.defineProperty(exports, "applicationGenerator", { enumerable: true, get: function () { return application_1.applicationGenerator; } });
10
8
  var component_1 = require("./src/generators/component/component");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/next",
3
- "version": "23.0.0-beta.1",
3
+ "version": "23.0.0-beta.3",
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, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "next": ">=14.0.0 <17.0.0"
37
37
  },
38
38
  "dependencies": {
39
- "@nx/devkit": "23.0.0-beta.1",
39
+ "@nx/devkit": "23.0.0-beta.3",
40
40
  "@babel/plugin-proposal-decorators": "^7.22.7",
41
41
  "@svgr/webpack": "^8.1.0",
42
42
  "copy-webpack-plugin": "^14.0.0",
@@ -44,17 +44,17 @@
44
44
  "semver": "^7.6.3",
45
45
  "tslib": "^2.3.0",
46
46
  "webpack-merge": "^5.8.0",
47
- "@nx/js": "23.0.0-beta.1",
48
- "@nx/eslint": "23.0.0-beta.1",
49
- "@nx/react": "23.0.0-beta.1",
50
- "@nx/web": "23.0.0-beta.1",
51
- "@nx/webpack": "23.0.0-beta.1",
47
+ "@nx/js": "23.0.0-beta.3",
48
+ "@nx/eslint": "23.0.0-beta.3",
49
+ "@nx/react": "23.0.0-beta.3",
50
+ "@nx/web": "23.0.0-beta.3",
51
+ "@nx/webpack": "23.0.0-beta.3",
52
52
  "@phenomnomnominal/tsquery": "~6.1.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@nx/cypress": "23.0.0-beta.1",
56
- "@nx/playwright": "23.0.0-beta.1",
57
- "nx": "23.0.0-beta.1"
55
+ "@nx/cypress": "23.0.0-beta.3",
56
+ "@nx/playwright": "23.0.0-beta.3",
57
+ "nx": "23.0.0-beta.3"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,CAAC,EAAE;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,gBAAgB,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACvD,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA+ED;;GAEG;AACH,iBAAS,MAAM,CACb,WAAW,GAAS,aAAa,EACjC,OAAO,GAAE,aAAkC,GAC1C,YAAY,CA4Hd;AAED,wBAAgB,aAAa,CAC3B,UAAU,GAAS,aAAa,EAChC,OAAO,GAAE,aAAkC,GAC1C,UAAU,CAiIZ;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,uBAAuB,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,IAAI,GAAG,MAAM,CAcf;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,QAM3D;AASD,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,CAAC,EAAE;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,gBAAgB,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACvD,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA+ED;;GAEG;AACH,iBAAS,MAAM,CACb,WAAW,GAAS,aAAa,EACjC,OAAO,GAAE,aAAkC,GAC1C,YAAY,CAkHd;AAED,wBAAgB,aAAa,CAC3B,UAAU,GAAS,aAAa,EAChC,OAAO,GAAE,aAAkC,GAC1C,UAAU,CAiIZ;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,uBAAuB,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,IAAI,GAAG,MAAM,CAcf;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,QAM3D;AASD,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -112,17 +112,9 @@ function withNx(_nextConfig = {}, context = getWithNxContext()) {
112
112
  };
113
113
  }
114
114
  else {
115
- const { createProjectGraphAsync, joinPathFragments, offsetFromRoot, workspaceRoot, } = require('@nx/devkit');
116
- let graph;
117
- try {
118
- graph = await createProjectGraphAsync({
119
- exitOnError: false,
120
- resetDaemonClient: true,
121
- });
122
- }
123
- catch (e) {
124
- throw new Error('Could not create project graph. Please ensure that your workspace is valid.', { cause: e });
125
- }
115
+ const { readCachedProjectGraph, joinPathFragments, offsetFromRoot, workspaceRoot, } = require('@nx/devkit');
116
+ // Since this is invoked by an Nx task, the graph is already cached.
117
+ const graph = readCachedProjectGraph();
126
118
  const originalTarget = {
127
119
  project: process.env.NX_TASK_TARGET_PROJECT,
128
120
  target: process.env.NX_TASK_TARGET_TARGET,
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwBlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAmI5E"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAuBlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAkH5E"}
@@ -4,7 +4,6 @@ exports.applicationGenerator = applicationGenerator;
4
4
  exports.applicationGeneratorInternal = applicationGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
- const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
8
7
  const versions_1 = require("@nx/react/src/utils/versions");
9
8
  const version_utils_1 = require("@nx/react/src/utils/version-utils");
10
9
  const normalize_options_1 = require("./lib/normalize-options");
@@ -18,14 +17,12 @@ const styles_1 = require("../../utils/styles");
18
17
  const add_linting_1 = require("./lib/add-linting");
19
18
  const custom_server_1 = require("../custom-server/custom-server");
20
19
  const update_cypress_tsconfig_1 = require("./lib/update-cypress-tsconfig");
21
- const show_possible_warnings_1 = require("./lib/show-possible-warnings");
22
20
  const versions_2 = require("../../utils/versions");
23
21
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
24
22
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
25
23
  const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
26
24
  const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
27
25
  const jest_config_util_1 = require("../../utils/jest-config-util");
28
- const version_utils_2 = require("../../utils/version-utils");
29
26
  async function applicationGenerator(host, schema) {
30
27
  return await applicationGeneratorInternal(host, {
31
28
  addPlugin: false,
@@ -46,7 +43,6 @@ async function applicationGeneratorInternal(host, schema) {
46
43
  });
47
44
  tasks.push(jsInitTask);
48
45
  const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
49
- (0, show_possible_warnings_1.showPossibleWarnings)(host, options);
50
46
  const nextTask = await (0, init_1.nextInitGenerator)(host, {
51
47
  ...options,
52
48
  skipFormat: true,
@@ -65,17 +61,6 @@ async function applicationGeneratorInternal(host, schema) {
65
61
  tasks.push(e2eTask);
66
62
  const jestTask = await (0, add_jest_1.addJest)(host, options);
67
63
  tasks.push(jestTask);
68
- if (options.style === 'tailwind') {
69
- const tailwindTask = await (0, setup_tailwind_1.setupTailwindGenerator)(host, {
70
- project: options.projectName,
71
- });
72
- tasks.push(tailwindTask);
73
- }
74
- // LESS is not currrently supported with Turbopack
75
- // Turbopack is default in Next 16, set to webpack
76
- if (options.style === 'less' && (await (0, version_utils_2.isNext16)(host))) {
77
- devkit_1.logger.warn("NX LESS is only supported with Webpack bundler. Please ensure you run your application with '--webpack'.");
78
- }
79
64
  const styledTask = (0, styles_1.addStyleDependencies)(host, {
80
65
  style: options.style,
81
66
  swc: !host.exists((0, devkit_1.joinPathFragments)(options.appProjectRoot, '.babelrc')),
@@ -1,17 +1,6 @@
1
- <%_ if (style !== 'none') { _%>
2
- <%_ if (styledModule && (styledModule === 'styled-jsx' || styledModule === 'styled-components')) { _%>
3
- 'use client';
4
- <%_ } _%>
5
- <%_ if (styledModule && styledModule !== 'styled-jsx') { var wrapper = 'StyledPage'; _%>
6
- import styled from '<%= styledModule %>';
7
- <%_ } else { var wrapper = 'div'; _%>
8
- <%- (style !== 'styled-jsx' && style !== 'tailwind') ? `import styles from './page.module.${style}';` : '' %>
9
- <%_ } _%>
10
-
11
- <%_ if (styledModule && styledModule !== 'styled-jsx') { _%>
12
- const StyledPage = styled.div`<%- pageStyleContent %>`;
13
- <%_ } _%>
14
- <% } %>
1
+ <%_ if (style !== 'none') { var wrapper = 'div'; _%>
2
+ import styles from './page.module.<%= style %>';
3
+ <% } else { var wrapper = 'div'; } %>
15
4
  export default function Index() {
16
5
  /*
17
6
  * Replace the elements below with your own.
@@ -19,8 +8,7 @@ export default function Index() {
19
8
  * Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
20
9
  */
21
10
  return (
22
- <<%= wrapper %><% if (!styledModule && style !== 'tailwind') {%> className={styles.page}<% } %>>
23
- <%- styledModule === 'styled-jsx' && style !== 'none' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
11
+ <<%= wrapper %><% if (style !== 'none') {%> className={styles.page}<% } %>>
24
12
  <%- appContent %>
25
13
  </<%= wrapper %>>
26
14
  );
@@ -1,21 +1,4 @@
1
1
  {
2
- "presets": [
3
- <% if (style === '@emotion/styled') { %>
4
- [
5
- "@nx/next/babel",
6
- {
7
- "preset-react": {
8
- "runtime": "automatic",
9
- "importSource": "@emotion/react"
10
- }
11
- }
12
- ]
13
- <% } else { %>
14
- "@nx/next/babel"
15
- <% } %>
16
- ],
17
- "plugins": [
18
- <% if (style === '@emotion/styled') { %>"@emotion/babel-plugin"<% } %>
19
- <% if (style === 'styled-components') { %>["styled-components", { "pure": true, "ssr": true }]<% } %>
20
- ]
2
+ "presets": ["@nx/next/babel"],
3
+ "plugins": []
21
4
  }
@@ -4,10 +4,3 @@ declare module '*.svg' {
4
4
  export const ReactComponent: any;
5
5
  export default content;
6
6
  }
7
-
8
- <% if (style === 'less') { %>
9
- declare module '*.module.less' {
10
- const classes: { readonly [key: string]: string };
11
- export default classes;
12
- }
13
- <% } %>
@@ -3,61 +3,6 @@
3
3
  // eslint-disable-next-line @typescript-eslint/no-var-requires
4
4
  const { composePlugins, withNx } = require('@nx/next');
5
5
 
6
- <% if (style === 'less') { %>
7
- // This plugin is needed until this PR is merged.
8
- // https://github.com/vercel/next.js/pull/23185
9
- const { withLess } = require('@nx/next/plugins/with-less');
10
-
11
- /**
12
- * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
13
- **/
14
- const nextConfig = {
15
- // Use this to set Nx-specific options
16
- // See: https://nx.dev/recipes/next/next-config-setup
17
- nx: {},
18
- };
19
-
20
- const plugins = [
21
- // Add more Next.js plugins to this list if needed.
22
- withLess,
23
- withNx,
24
- ];
25
-
26
- module.exports = composePlugins(...plugins)(nextConfig);
27
- <% } else if (
28
- style === 'styled-components'
29
- ||style === '@emotion/styled'
30
- || style === 'styled-jsx'
31
- || style === 'none'
32
- ) { %>
33
- /**
34
- * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
35
- **/
36
- const nextConfig = {
37
- // Use this to set Nx-specific options
38
- // See: https://nx.dev/recipes/next/next-config-setup
39
- nx: {},
40
- <% if (style === 'styled-components') { %>
41
- compiler: {
42
- // For other options, see https://styled-components.com/docs/tooling#babel-plugin
43
- styledComponents: true,
44
- },
45
- <% } else if (style === '@emotion/styled') { %>
46
- compiler: {
47
- // For other options, see https://nextjs.org/docs/architecture/nextjs-compiler#emotion
48
- emotion: true,
49
- },
50
- <% } %>
51
- };
52
-
53
- const plugins = [
54
- // Add more Next.js plugins to this list if needed.
55
- withNx,
56
- ];
57
-
58
- module.exports = composePlugins(...plugins)(nextConfig);
59
- <% } else {
60
- // Defaults to CSS/SASS (which don't need plugin as of Next 9.3) %>
61
6
  /**
62
7
  * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
63
8
  **/
@@ -73,4 +18,3 @@ const plugins = [
73
18
  ];
74
19
 
75
20
  module.exports = composePlugins(...plugins)(nextConfig);
76
- <% } %>
@@ -2,7 +2,6 @@
2
2
  "extends": "<%= rootTsConfigPath %>",
3
3
  "compilerOptions": {
4
4
  "jsx": "preserve",
5
- <% if (style === '@emotion/styled') { %>"jsxImportSource": "@emotion/react",<% } %>
6
5
  "strict": true,
7
6
  "noEmit": true,
8
7
  "emitDeclarationOnly": false,
@@ -1,14 +1,6 @@
1
- <%_ if (style !== 'none') { _%>
2
- <%_ if (styledModule && styledModule !== 'styled-jsx') { var wrapper = 'StyledPage'; _%>
3
- import styled from '<%= styledModule %>';
4
- <% } else { var wrapper = 'div';%>
5
- <%- (style !== 'styled-jsx' && style !== 'tailwind') ? `import styles from './${fileName}.module.${style}';` : '' %>
6
- <%_ } _%>
7
-
8
- <%_ if (styledModule && styledModule !== 'styled-jsx') { _%>
9
- const StyledPage = styled.div`<%- pageStyleContent %>`;
10
- <%_ } _%>
11
- <%_ } _%>
1
+ <%_ if (style !== 'none') { var wrapper = 'div'; _%>
2
+ import styles from './<%= fileName %>.module.<%= style %>';
3
+ <% } else { var wrapper = 'div'; } %>
12
4
 
13
5
  export function Index() {
14
6
  /*
@@ -17,8 +9,7 @@ export function Index() {
17
9
  * Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
18
10
  */
19
11
  return (
20
- <<%= wrapper %><% if (!styledModule && style !== 'tailwind') {%> className={styles.page}<% } %>>
21
- <%- styledModule === 'styled-jsx' && style !== 'none' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
12
+ <<%= wrapper %><% if (style !== 'none') {%> className={styles.page}<% } %>>
22
13
  <%- appContent %>
23
14
  </<%= wrapper %>>
24
15
  );
@@ -1 +1 @@
1
- {"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACJ,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAmI5B"}
1
+ {"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACJ,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA8H5B"}
@@ -5,14 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
6
6
  const web_1 = require("@nx/web");
7
7
  const versions_1 = require("../../../utils/versions");
8
- const version_utils_1 = require("../../../utils/version-utils");
9
8
  async function addE2e(host, options) {
10
9
  const nxJson = (0, devkit_1.readNxJson)(host);
11
10
  const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
12
11
  ? p === '@nx/next/plugin'
13
12
  : p.plugin === '@nx/next/plugin');
14
13
  const e2eWebServerInfo = await getNextE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'next.config.js'), options.addPlugin);
15
- const forceWebpack = options.style === 'less' && (await (0, version_utils_1.isNext16)(host));
16
14
  if (options.e2eTestRunner === 'cypress') {
17
15
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
18
16
  if (!hasPlugin) {
@@ -56,7 +54,7 @@ async function addE2e(host, options) {
56
54
  baseUrl: e2eWebServerInfo.e2eWebServerAddress,
57
55
  jsx: true,
58
56
  webServerCommands: {
59
- default: `${e2eWebServerInfo.e2eWebServerCommand}${forceWebpack ? ' --webpack' : ''}`,
57
+ default: e2eWebServerInfo.e2eWebServerCommand,
60
58
  },
61
59
  ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
62
60
  ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
@@ -98,7 +96,7 @@ async function addE2e(host, options) {
98
96
  linter: options.linter,
99
97
  setParserOptionsProject: options.setParserOptionsProject,
100
98
  webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
101
- webServerCommand: `${e2eWebServerInfo.e2eWebServerCommand}${forceWebpack ? ' --webpack' : ''}`,
99
+ webServerCommand: e2eWebServerInfo.e2eWebServerCommand,
102
100
  addPlugin: options.addPlugin,
103
101
  });
104
102
  return e2eTask;
@@ -1 +1 @@
1
- {"version":3,"file":"create-application-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQvD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,iBA0K1B"}
1
+ {"version":3,"file":"create-application-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQvD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,iBA4I1B"}
@@ -32,7 +32,7 @@ async function createApplicationFiles(host, options) {
32
32
  appContent: (0, create_application_files_helpers_1.createAppJsx)(options.projectName),
33
33
  styleContent: (0, create_application_files_helpers_1.createStyleRules)(),
34
34
  pageStyleContent: `.page {}`,
35
- stylesExt: options.style === 'less' ? options.style : 'css',
35
+ stylesExt: 'css',
36
36
  isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
37
37
  isNext16: await (0, version_utils_1.isNext16)(host),
38
38
  };
@@ -45,15 +45,7 @@ async function createApplicationFiles(host, options) {
45
45
  if (options.unitTestRunner === 'none') {
46
46
  host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'specs', `index.spec.${options.js ? 'jsx' : 'tsx'}`));
47
47
  }
48
- if (options.style === 'styled-components') {
49
- (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app-styled-components'), (0, path_1.join)(generatedAppFilePath, 'app'), templateVariables);
50
- }
51
- else if (options.style === 'styled-jsx') {
52
- (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app-styled-jsx'), (0, path_1.join)(generatedAppFilePath, 'app'), templateVariables);
53
- }
54
- else {
55
- (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app-default-layout'), (0, path_1.join)(generatedAppFilePath, 'app'), templateVariables);
56
- }
48
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app-default-layout'), (0, path_1.join)(generatedAppFilePath, 'app'), templateVariables);
57
49
  }
58
50
  else {
59
51
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/pages'), (0, path_1.join)(generatedAppFilePath, 'pages'), templateVariables);
@@ -98,17 +90,6 @@ async function createApplicationFiles(host, options) {
98
90
  if (options.swc !== false) {
99
91
  host.delete(`${options.appProjectRoot}/.babelrc`);
100
92
  }
101
- if (options.styledModule || options.style === 'tailwind') {
102
- if (options.appDir) {
103
- host.delete(`${generatedAppFilePath}/app/page.module.${options.style}`);
104
- }
105
- else {
106
- host.delete(`${generatedAppFilePath}/pages/${options.fileName}.module.${options.style}`);
107
- }
108
- }
109
- if (options.style !== 'styled-components') {
110
- host.delete(`${generatedAppFilePath}/pages/_document.tsx`);
111
- }
112
93
  if (options.js) {
113
94
  host.delete(`${options.appProjectRoot}/index.d.ts`);
114
95
  (0, devkit_1.toJS)(host);
@@ -10,7 +10,6 @@ export interface NormalizedSchema extends Omit<Schema, 'name' | 'useTsSolution'>
10
10
  e2eProjectRoot: string;
11
11
  parsedTags: string[];
12
12
  fileName: string;
13
- styledModule: null | string;
14
13
  isTsSolutionSetup: boolean;
15
14
  js?: boolean;
16
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,IAAI,EAAE,MAAM,YAAY,CAAC;AAMjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAyE3B"}
1
+ {"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,IAAI,EAAE,MAAM,YAAY,CAAC;AAMjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAoE3B"}
@@ -29,9 +29,6 @@ async function normalizeOptions(host, options) {
29
29
  const fileName = 'index';
30
30
  const appDir = options.appDir ?? true;
31
31
  const src = options.src ?? true;
32
- const styledModule = /^(css|scss|less|tailwind)$/.test(options.style)
33
- ? null
34
- : options.style;
35
32
  (0, assertion_1.assertValidStyle)(options.style);
36
33
  return {
37
34
  ...options,
@@ -49,7 +46,6 @@ async function normalizeOptions(host, options) {
49
46
  projectSimpleName: projectNames.projectSimpleName,
50
47
  style: options.style || 'css',
51
48
  swc: options.swc ?? true,
52
- styledModule,
53
49
  unitTestRunner: options.unitTestRunner || 'jest',
54
50
  importPath,
55
51
  isTsSolutionSetup,
@@ -27,6 +27,7 @@
27
27
  "type": "string",
28
28
  "default": "css",
29
29
  "alias": "s",
30
+ "enum": ["css", "scss", "none"],
30
31
  "x-prompt": {
31
32
  "message": "Which stylesheet format would you like to use?",
32
33
  "type": "list",
@@ -37,27 +38,7 @@
37
38
  },
38
39
  {
39
40
  "value": "scss",
40
- "label": "SASS(.scss) [ https://sass-lang.com ]"
41
- },
42
- {
43
- "value": "less",
44
- "label": "LESS [ https://lesscss.org ]"
45
- },
46
- {
47
- "value": "tailwind",
48
- "label": "tailwind [ https://tailwindcss.com/ ]"
49
- },
50
- {
51
- "value": "styled-components",
52
- "label": "styled-components [ https://styled-components.com ]"
53
- },
54
- {
55
- "value": "@emotion/styled",
56
- "label": "emotion [ https://emotion.sh ]"
57
- },
58
- {
59
- "value": "styled-jsx",
60
- "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
41
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
61
42
  },
62
43
  {
63
44
  "value": "none",
@@ -25,6 +25,7 @@
25
25
  "type": "string",
26
26
  "alias": "s",
27
27
  "default": "css",
28
+ "enum": ["css", "scss", "none"],
28
29
  "x-prompt": {
29
30
  "message": "Which stylesheet format would you like to use?",
30
31
  "type": "list",
@@ -35,27 +36,7 @@
35
36
  },
36
37
  {
37
38
  "value": "scss",
38
- "label": "SASS(.scss) [ https://sass-lang.com ]"
39
- },
40
- {
41
- "value": "less",
42
- "label": "LESS [ https://lesscss.org ]"
43
- },
44
- {
45
- "value": "tailwind",
46
- "label": "tailwind [ https://tailwindcss.com/ ]"
47
- },
48
- {
49
- "value": "styled-components",
50
- "label": "styled-components [ https://styled-components.com ]"
51
- },
52
- {
53
- "value": "@emotion/styled",
54
- "label": "emotion [ https://emotion.sh ]"
55
- },
56
- {
57
- "value": "styled-jsx",
58
- "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
39
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
59
40
  },
60
41
  {
61
42
  "value": "none",
@@ -1 +1 @@
1
- {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BAMpE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BA+L5E;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAalC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BAMpE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BAoL5E;AAED,eAAe,gBAAgB,CAAC"}
@@ -97,12 +97,6 @@ export async function HelloServer() {
97
97
  });
98
98
  }
99
99
  }
100
- (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.json'), (json) => {
101
- if (options.style === '@emotion/styled') {
102
- json.compilerOptions.jsxImportSource = '@emotion/react';
103
- }
104
- return json;
105
- });
106
100
  (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'), (json) => {
107
101
  if (!json.compilerOptions) {
108
102
  json.compilerOptions = {
@@ -27,6 +27,7 @@
27
27
  "type": "string",
28
28
  "default": "css",
29
29
  "alias": "s",
30
+ "enum": ["css", "scss", "none"],
30
31
  "x-prompt": {
31
32
  "message": "Which stylesheet format would you like to use?",
32
33
  "type": "list",
@@ -37,27 +38,7 @@
37
38
  },
38
39
  {
39
40
  "value": "scss",
40
- "label": "SASS(.scss) [ https://sass-lang.com ]"
41
- },
42
- {
43
- "value": "less",
44
- "label": "LESS [ https://lesscss.org ]"
45
- },
46
- {
47
- "value": "tailwind",
48
- "label": "tailwind [ https://tailwindcss.com/ ]"
49
- },
50
- {
51
- "value": "styled-components",
52
- "label": "styled-components [ https://styled-components.com ]"
53
- },
54
- {
55
- "value": "@emotion/styled",
56
- "label": "emotion [ https://emotion.sh ]"
57
- },
58
- {
59
- "value": "styled-jsx",
60
- "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
41
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
61
42
  },
62
43
  {
63
44
  "value": "none",
@@ -25,6 +25,7 @@
25
25
  "type": "string",
26
26
  "alias": "s",
27
27
  "default": "css",
28
+ "enum": ["css", "scss", "none"],
28
29
  "x-prompt": {
29
30
  "message": "Which stylesheet format would you like to use?",
30
31
  "type": "list",
@@ -35,23 +36,7 @@
35
36
  },
36
37
  {
37
38
  "value": "scss",
38
- "label": "SASS(.scss) [ https://sass-lang.com ]"
39
- },
40
- {
41
- "value": "less",
42
- "label": "LESS [ https://lesscss.org ]"
43
- },
44
- {
45
- "value": "styled-components",
46
- "label": "styled-components [ https://styled-components.com ]"
47
- },
48
- {
49
- "value": "@emotion/styled",
50
- "label": "emotion [ https://emotion.sh ]"
51
- },
52
- {
53
- "value": "styled-jsx",
54
- "label": "styled-jsx [ https://www.npmjs.com/package/styled-jsx ]"
39
+ "label": "SASS(.scss) [ https://sass-lang.com ]"
55
40
  },
56
41
  {
57
42
  "value": "none",