@nx/next 16.0.0-beta.1

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 (213) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/babel.d.ts +0 -0
  5. package/babel.js +13 -0
  6. package/babel.js.map +1 -0
  7. package/executors.json +36 -0
  8. package/generators.json +72 -0
  9. package/index.d.ts +8 -0
  10. package/index.js +20 -0
  11. package/index.js.map +1 -0
  12. package/migrations.json +312 -0
  13. package/package.json +64 -0
  14. package/plugins/with-less.d.ts +2 -0
  15. package/plugins/with-less.js +79 -0
  16. package/plugins/with-less.js.map +1 -0
  17. package/plugins/with-nx.d.ts +13 -0
  18. package/plugins/with-nx.js +278 -0
  19. package/plugins/with-nx.js.map +1 -0
  20. package/plugins/with-stylus.d.ts +2 -0
  21. package/plugins/with-stylus.js +79 -0
  22. package/plugins/with-stylus.js.map +1 -0
  23. package/src/executors/build/build.impl.d.ts +6 -0
  24. package/src/executors/build/build.impl.js +62 -0
  25. package/src/executors/build/build.impl.js.map +1 -0
  26. package/src/executors/build/compat.d.ts +2 -0
  27. package/src/executors/build/compat.js +6 -0
  28. package/src/executors/build/compat.js.map +1 -0
  29. package/src/executors/build/lib/check-project.d.ts +1 -0
  30. package/src/executors/build/lib/check-project.js +13 -0
  31. package/src/executors/build/lib/check-project.js.map +1 -0
  32. package/src/executors/build/lib/create-next-config-file.d.ts +3 -0
  33. package/src/executors/build/lib/create-next-config-file.js +15 -0
  34. package/src/executors/build/lib/create-next-config-file.js.map +1 -0
  35. package/src/executors/build/lib/update-package-json.d.ts +3 -0
  36. package/src/executors/build/lib/update-package-json.js +24 -0
  37. package/src/executors/build/lib/update-package-json.js.map +1 -0
  38. package/src/executors/build/schema.json +68 -0
  39. package/src/executors/export/compat.d.ts +2 -0
  40. package/src/executors/export/compat.js +6 -0
  41. package/src/executors/export/compat.js.map +1 -0
  42. package/src/executors/export/export.impl.d.ts +6 -0
  43. package/src/executors/export/export.impl.js +53 -0
  44. package/src/executors/export/export.impl.js.map +1 -0
  45. package/src/executors/export/schema.json +30 -0
  46. package/src/executors/server/compat.d.ts +2 -0
  47. package/src/executors/server/compat.js +6 -0
  48. package/src/executors/server/compat.js.map +1 -0
  49. package/src/executors/server/lib/default-server.d.ts +6 -0
  50. package/src/executors/server/lib/default-server.js +31 -0
  51. package/src/executors/server/lib/default-server.js.map +1 -0
  52. package/src/executors/server/lib/tsnode-register.d.ts +1 -0
  53. package/src/executors/server/lib/tsnode-register.js +23 -0
  54. package/src/executors/server/lib/tsnode-register.js.map +1 -0
  55. package/src/executors/server/schema.json +56 -0
  56. package/src/executors/server/server.impl.d.ts +7 -0
  57. package/src/executors/server/server.impl.js +114 -0
  58. package/src/executors/server/server.impl.js.map +1 -0
  59. package/src/generators/application/application.d.ts +4 -0
  60. package/src/generators/application/application.js +43 -0
  61. package/src/generators/application/application.js.map +1 -0
  62. package/src/generators/application/files/app/api/hello/route.ts__tmpl__ +4 -0
  63. package/src/generators/application/files/app/global.__stylesExt____tmpl__ +1 -0
  64. package/src/generators/application/files/app/layout.tsx__tmpl__ +22 -0
  65. package/src/generators/application/files/app/page.module.__style__ +1 -0
  66. package/src/generators/application/files/app/page.tsx__tmpl__ +28 -0
  67. package/src/generators/application/files/common/.babelrc__tmpl__ +21 -0
  68. package/src/generators/application/files/common/index.d.ts__tmpl__ +18 -0
  69. package/src/generators/application/files/common/next-env.d.ts__tmpl__ +5 -0
  70. package/src/generators/application/files/common/next.config.js__tmpl__ +112 -0
  71. package/src/generators/application/files/common/public/.gitkeep +0 -0
  72. package/src/generators/application/files/common/public/favicon.ico +0 -0
  73. package/src/generators/application/files/common/specs/__fileName__.spec.tsx__tmpl__ +11 -0
  74. package/src/generators/application/files/common/tsconfig.json__tmpl__ +18 -0
  75. package/src/generators/application/files/pages/__fileName__.module.__style__ +1 -0
  76. package/src/generators/application/files/pages/__fileName__.tsx__tmpl__ +28 -0
  77. package/src/generators/application/files/pages/_app.tsx__tmpl__ +18 -0
  78. package/src/generators/application/files/pages/_document.tsx__tmpl__ +33 -0
  79. package/src/generators/application/files/pages/styles.__stylesExt____tmpl__ +1 -0
  80. package/src/generators/application/lib/add-cypress.d.ts +3 -0
  81. package/src/generators/application/lib/add-cypress.js +18 -0
  82. package/src/generators/application/lib/add-cypress.js.map +1 -0
  83. package/src/generators/application/lib/add-jest.d.ts +3 -0
  84. package/src/generators/application/lib/add-jest.js +36 -0
  85. package/src/generators/application/lib/add-jest.js.map +1 -0
  86. package/src/generators/application/lib/add-linting.d.ts +3 -0
  87. package/src/generators/application/lib/add-linting.js +66 -0
  88. package/src/generators/application/lib/add-linting.js.map +1 -0
  89. package/src/generators/application/lib/add-project.d.ts +3 -0
  90. package/src/generators/application/lib/add-project.js +56 -0
  91. package/src/generators/application/lib/add-project.js.map +1 -0
  92. package/src/generators/application/lib/create-application-files.d.ts +3 -0
  93. package/src/generators/application/lib/create-application-files.helpers.d.ts +2 -0
  94. package/src/generators/application/lib/create-application-files.helpers.js +785 -0
  95. package/src/generators/application/lib/create-application-files.helpers.js.map +1 -0
  96. package/src/generators/application/lib/create-application-files.js +40 -0
  97. package/src/generators/application/lib/create-application-files.js.map +1 -0
  98. package/src/generators/application/lib/normalize-options.d.ts +13 -0
  99. package/src/generators/application/lib/normalize-options.js +35 -0
  100. package/src/generators/application/lib/normalize-options.js.map +1 -0
  101. package/src/generators/application/lib/set-defaults.d.ts +3 -0
  102. package/src/generators/application/lib/set-defaults.js +14 -0
  103. package/src/generators/application/lib/set-defaults.js.map +1 -0
  104. package/src/generators/application/lib/update-jest-config.d.ts +3 -0
  105. package/src/generators/application/lib/update-jest-config.js +16 -0
  106. package/src/generators/application/lib/update-jest-config.js.map +1 -0
  107. package/src/generators/application/schema.d.ts +19 -0
  108. package/src/generators/application/schema.json +131 -0
  109. package/src/generators/component/component.d.ts +15 -0
  110. package/src/generators/component/component.js +34 -0
  111. package/src/generators/component/component.js.map +1 -0
  112. package/src/generators/component/schema.json +119 -0
  113. package/src/generators/custom-server/custom-server.d.ts +4 -0
  114. package/src/generators/custom-server/custom-server.js +79 -0
  115. package/src/generators/custom-server/custom-server.js.map +1 -0
  116. package/src/generators/custom-server/files/server/main.ts__tmpl__ +46 -0
  117. package/src/generators/custom-server/files/tsconfig.server.json__tmpl__ +15 -0
  118. package/src/generators/custom-server/schema.d.ts +4 -0
  119. package/src/generators/custom-server/schema.json +30 -0
  120. package/src/generators/init/init.d.ts +5 -0
  121. package/src/generators/init/init.js +49 -0
  122. package/src/generators/init/init.js.map +1 -0
  123. package/src/generators/init/schema.d.ts +7 -0
  124. package/src/generators/init/schema.json +39 -0
  125. package/src/generators/library/lib/normalize-options.d.ts +7 -0
  126. package/src/generators/library/lib/normalize-options.js +17 -0
  127. package/src/generators/library/lib/normalize-options.js.map +1 -0
  128. package/src/generators/library/library.d.ts +5 -0
  129. package/src/generators/library/library.js +79 -0
  130. package/src/generators/library/library.js.map +1 -0
  131. package/src/generators/library/schema.d.ts +25 -0
  132. package/src/generators/library/schema.json +156 -0
  133. package/src/generators/page/page.d.ts +5 -0
  134. package/src/generators/page/page.js +27 -0
  135. package/src/generators/page/page.js.map +1 -0
  136. package/src/generators/page/schema.d.ts +13 -0
  137. package/src/generators/page/schema.json +107 -0
  138. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.d.ts +3 -0
  139. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js +34 -0
  140. package/src/migrations/update-12-10-0/fix-page-dir-for-eslint.js.map +1 -0
  141. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.d.ts +3 -0
  142. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js +26 -0
  143. package/src/migrations/update-12-8-0/remove-styled-jsx-babel-plugin.js.map +1 -0
  144. package/src/migrations/update-13-0-0/update-emotion-setup.d.ts +3 -0
  145. package/src/migrations/update-13-0-0/update-emotion-setup.js +39 -0
  146. package/src/migrations/update-13-0-0/update-emotion-setup.js.map +1 -0
  147. package/src/migrations/update-13-0-0/update-to-webpack-5.d.ts +3 -0
  148. package/src/migrations/update-13-0-0/update-to-webpack-5.js +32 -0
  149. package/src/migrations/update-13-0-0/update-to-webpack-5.js.map +1 -0
  150. package/src/migrations/update-13-0-3/fix-less.d.ts +3 -0
  151. package/src/migrations/update-13-0-3/fix-less.js +27 -0
  152. package/src/migrations/update-13-0-3/fix-less.js.map +1 -0
  153. package/src/migrations/update-13-1-1/enable-swc.d.ts +3 -0
  154. package/src/migrations/update-13-1-1/enable-swc.js +46 -0
  155. package/src/migrations/update-13-1-1/enable-swc.js.map +1 -0
  156. package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +3 -0
  157. package/src/migrations/update-14-0-0/add-default-development-configurations.js +36 -0
  158. package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +1 -0
  159. package/src/migrations/update-14-4-3/add-dev-output-path.d.ts +3 -0
  160. package/src/migrations/update-14-4-3/add-dev-output-path.js +24 -0
  161. package/src/migrations/update-14-4-3/add-dev-output-path.js.map +1 -0
  162. package/src/migrations/update-14-5-3/add-gitignore-entry.d.ts +3 -0
  163. package/src/migrations/update-14-5-3/add-gitignore-entry.js +15 -0
  164. package/src/migrations/update-14-5-3/add-gitignore-entry.js.map +1 -0
  165. package/src/migrations/update-14-5-3/update-dev-output-path.d.ts +3 -0
  166. package/src/migrations/update-14-5-3/update-dev-output-path.js +29 -0
  167. package/src/migrations/update-14-5-3/update-dev-output-path.js.map +1 -0
  168. package/src/migrations/update-14-5-7/update-next-eslint.d.ts +3 -0
  169. package/src/migrations/update-14-5-7/update-next-eslint.js +32 -0
  170. package/src/migrations/update-14-5-7/update-next-eslint.js.map +1 -0
  171. package/src/migrations/update-15-8-8/add-style-packages.d.ts +3 -0
  172. package/src/migrations/update-15-8-8/add-style-packages.js +28 -0
  173. package/src/migrations/update-15-8-8/add-style-packages.js.map +1 -0
  174. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  175. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  176. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  177. package/src/utils/add-gitignore-entry.d.ts +2 -0
  178. package/src/utils/add-gitignore-entry.js +18 -0
  179. package/src/utils/add-gitignore-entry.js.map +1 -0
  180. package/src/utils/config-invalid-function.fixture.d.ts +0 -0
  181. package/src/utils/config-invalid-function.fixture.js +2 -0
  182. package/src/utils/config-invalid-function.fixture.js.map +1 -0
  183. package/src/utils/config-not-a-function.fixture.d.ts +0 -0
  184. package/src/utils/config-not-a-function.fixture.js +2 -0
  185. package/src/utils/config-not-a-function.fixture.js.map +1 -0
  186. package/src/utils/config.d.ts +15 -0
  187. package/src/utils/config.fixture.d.ts +0 -0
  188. package/src/utils/config.fixture.js +4 -0
  189. package/src/utils/config.fixture.js.map +1 -0
  190. package/src/utils/config.js +87 -0
  191. package/src/utils/config.js.map +1 -0
  192. package/src/utils/constants.d.ts +1 -0
  193. package/src/utils/constants.js +5 -0
  194. package/src/utils/constants.js.map +1 -0
  195. package/src/utils/create-copy-plugin.d.ts +2 -0
  196. package/src/utils/create-copy-plugin.js +63 -0
  197. package/src/utils/create-copy-plugin.js.map +1 -0
  198. package/src/utils/generate-globs.d.ts +5 -0
  199. package/src/utils/generate-globs.js +30 -0
  200. package/src/utils/generate-globs.js.map +1 -0
  201. package/src/utils/styles.d.ts +40 -0
  202. package/src/utils/styles.js +56 -0
  203. package/src/utils/styles.js.map +1 -0
  204. package/src/utils/types.d.ts +53 -0
  205. package/src/utils/types.js +3 -0
  206. package/src/utils/types.js.map +1 -0
  207. package/src/utils/versions.d.ts +9 -0
  208. package/src/utils/versions.js +13 -0
  209. package/src/utils/versions.js.map +1 -0
  210. package/tailwind.d.ts +2 -0
  211. package/tailwind.js +7 -0
  212. package/tailwind.js.map +1 -0
  213. package/typings/image.d.ts +12 -0
@@ -0,0 +1,18 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ declare module '*.svg' {
3
+ const content: any;
4
+ export const ReactComponent: any;
5
+ export default content;
6
+ }
7
+
8
+ <% if (style === 'less') { %>
9
+ declare module '*.module.less' {
10
+ const classes: { readonly [key: string]: string };
11
+ export default classes;
12
+ }
13
+ <% } else if (style === 'styl') { %>
14
+ declare module '*.module.styl' {
15
+ const classes: { readonly [key: string]: string };
16
+ export default classes;
17
+ }
18
+ <% } %>
@@ -0,0 +1,5 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+
4
+ // NOTE: This file should not be edited
5
+ // see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -0,0 +1,112 @@
1
+ //@ts-check
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
4
+ const { composePlugins, withNx } = require('@nrwl/next');
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('@nrwl/next/plugins/with-less');
10
+
11
+ /**
12
+ * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
13
+ **/
14
+ const nextConfig = {
15
+ nx: {
16
+ // Set this to true if you would like to to use SVGR
17
+ // See: https://github.com/gregberge/svgr
18
+ svgr: false,
19
+ },
20
+ <% if(appDir) { %>
21
+ experimental: {
22
+ appDir: true
23
+ },
24
+ <% } %>
25
+ };
26
+
27
+ const plugins = [
28
+ // Add more Next.js plugins to this list if needed.
29
+ withLess,
30
+ withNx,
31
+ ];
32
+
33
+ module.exports = composePlugins(...plugins)(nextConfig));
34
+ <% } else if (style === 'styl') { %>
35
+ const { withStylus } = require('@nrwl/next/plugins/with-stylus');
36
+
37
+ /**
38
+ * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
39
+ **/
40
+ const nextConfig = {
41
+ nx: {
42
+ // Set this to true if you would like to to use SVGR
43
+ // See: https://github.com/gregberge/svgr
44
+ svgr: false,
45
+ },
46
+ <% if(appDir) { %>
47
+ experimental: {
48
+ appDir: true
49
+ },
50
+ <% } %>
51
+ };
52
+
53
+ const plugins = [
54
+ // Add more Next.js plugins to this list if needed.
55
+ withStylus,
56
+ withNx,
57
+ ];
58
+
59
+ module.exports = composePlugins(...plugins)(nextConfig);
60
+ <% } else if (
61
+ style === 'styled-components'
62
+ ||style === '@emotion/styled'
63
+ || style === 'styled-jsx'
64
+ || style === 'none'
65
+ ) { %>
66
+ /**
67
+ * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
68
+ **/
69
+ const nextConfig = {
70
+ nx: {
71
+ // Set this to true if you would like to to use SVGR
72
+ // See: https://github.com/gregberge/svgr
73
+ svgr: false,
74
+ },
75
+ <% if(appDir) { %>
76
+ experimental: {
77
+ appDir: true
78
+ },
79
+ <% } %>
80
+ };
81
+
82
+ const plugins = [
83
+ // Add more Next.js plugins to this list if needed.
84
+ withNx,
85
+ ];
86
+
87
+ module.exports = composePlugins(...plugins)(nextConfig);
88
+ <% } else {
89
+ // Defaults to CSS/SASS (which don't need plugin as of Next 9.3) %>
90
+ /**
91
+ * @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
92
+ **/
93
+ const nextConfig = {
94
+ nx: {
95
+ // Set this to true if you would like to use SVGR
96
+ // See: https://github.com/gregberge/svgr
97
+ svgr: false,
98
+ },
99
+ <% if(appDir) { %>
100
+ experimental: {
101
+ appDir: true
102
+ },
103
+ <% } %>
104
+ };
105
+
106
+ const plugins = [
107
+ // Add more Next.js plugins to this list if needed.
108
+ withNx,
109
+ ];
110
+
111
+ module.exports = composePlugins(...plugins)(nextConfig);
112
+ <% } %>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+
4
+ import Index from '../pages/index';
5
+
6
+ describe('Index', () => {
7
+ it('should render successfully', () => {
8
+ const { baseElement } = render(<Index />);
9
+ expect(baseElement).toBeTruthy();
10
+ });
11
+ });
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "<%= rootTsConfigPath %>",
3
+ "compilerOptions": {
4
+ "jsx": "preserve",
5
+ <% if (style === '@emotion/styled') { %>"jsxImportSource": "@emotion/react",<% } %>
6
+ "allowJs": true,
7
+ "esModuleInterop": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": false,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "noEmit": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "incremental": true
15
+ },
16
+ "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"],
17
+ "exclude": ["node_modules", "jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
18
+ }
@@ -0,0 +1 @@
1
+ <%- pageStyleContent %>
@@ -0,0 +1,28 @@
1
+ <% if (styledModule && styledModule !== 'styled-jsx') {
2
+ var wrapper = 'StyledPage';
3
+ %>import styled from '<%= styledModule %>';<% } else {
4
+ var wrapper = 'div';
5
+ %>
6
+ <%- style !== 'styled-jsx' ? `import styles from './${fileName}.module.${style}';` : '' %>
7
+ <% }
8
+ %>
9
+
10
+ <% if (styledModule && styledModule !== 'styled-jsx') { %>
11
+ const StyledPage = styled.div`<%- pageStyleContent %>`;
12
+ <% }%>
13
+
14
+ export function Index() {
15
+ /*
16
+ * Replace the elements below with your own.
17
+ *
18
+ * Note: The corresponding styles are in the ./<%= fileName %>.<%= style %> file.
19
+ */
20
+ return (
21
+ <<%= wrapper %><% if (!styledModule) {%> className={styles.page}<% } %>>
22
+ <%- styledModule === 'styled-jsx' ? `<style jsx>{\`${pageStyleContent}\`}</style>` : `` %>
23
+ <%- appContent %>
24
+ </<%= wrapper %>>
25
+ );
26
+ };
27
+
28
+ export default Index;
@@ -0,0 +1,18 @@
1
+ import { AppProps } from 'next/app';
2
+ import Head from 'next/head';
3
+ import './styles.<%= stylesExt %>';
4
+
5
+ function CustomApp({ Component, pageProps }: AppProps) {
6
+ return (
7
+ <>
8
+ <Head>
9
+ <title>Welcome to <%= name %>!</title>
10
+ </Head>
11
+ <main className="app">
12
+ <Component {...pageProps}/>
13
+ </main>
14
+ </>
15
+ );
16
+ };
17
+
18
+ export default CustomApp;
@@ -0,0 +1,33 @@
1
+ /* eslint-disable react/display-name */
2
+ import Document, { Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps } from 'next/document';
3
+ import { ServerStyleSheet } from 'styled-components';
4
+
5
+ export default class CustomDocument extends Document {
6
+ static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
7
+ const originalRenderPage = ctx.renderPage;
8
+
9
+ const sheet = new ServerStyleSheet();
10
+
11
+ ctx.renderPage = () => originalRenderPage({
12
+ enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />),
13
+ enhanceComponent: (Component) => Component,
14
+ });
15
+
16
+ const intialProps = await Document.getInitialProps(ctx);
17
+ const styles = sheet.getStyleElement();
18
+
19
+ return {...intialProps, styles };
20
+ }
21
+
22
+ render() {
23
+ return (
24
+ <Html>
25
+ <Head>{this.props.styles}</Head>
26
+ <body>
27
+ <Main />
28
+ <NextScript />
29
+ </body>
30
+ </Html>
31
+ );
32
+ }
33
+ }
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addCypress(host: Tree, options: NormalizedSchema): Promise<() => void>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addCypress = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const linter_1 = require("@nx/linter");
7
+ const versions_1 = require("../../../utils/versions");
8
+ function addCypress(host, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ if (options.e2eTestRunner !== 'cypress') {
11
+ return () => { };
12
+ }
13
+ const { cypressProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
14
+ return cypressProjectGenerator(host, Object.assign(Object.assign({}, options), { linter: linter_1.Linter.EsLint, name: `${options.name}-e2e`, directory: options.directory, project: options.projectName, skipFormat: true }));
15
+ });
16
+ }
17
+ exports.addCypress = addCypress;
18
+ //# sourceMappingURL=add-cypress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-cypress.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-cypress.ts"],"names":[],"mappings":";;;;AAAA,uCAAiD;AACjD,uCAAoC;AAEpC,sDAAoD;AAGpD,SAAsB,UAAU,CAAC,IAAU,EAAE,OAAyB;;QACpE,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;YACvC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAA,sBAAa,EAE/C,aAAa,EAAE,oBAAS,CAAC,CAAC;QAC5B,OAAO,uBAAuB,CAAC,IAAI,kCAC9B,OAAO,KACV,MAAM,EAAE,eAAM,CAAC,MAAM,EACrB,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,MAAM,EAC3B,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,OAAO,EAAE,OAAO,CAAC,WAAW,EAC5B,UAAU,EAAE,IAAI,IAChB,CAAC;IACL,CAAC;CAAA;AAhBD,gCAgBC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addJest(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addJest = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const versions_1 = require("../../../utils/versions");
7
+ function addJest(host, options) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ if (options.unitTestRunner !== 'jest') {
10
+ return () => { };
11
+ }
12
+ const { jestProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
13
+ const jestTask = yield jestProjectGenerator(host, Object.assign(Object.assign({}, options), { project: options.projectName, supportTsx: true, skipSerializers: true, setupFile: 'none', compiler: 'babel', skipFormat: true }));
14
+ const tsConfigSpecJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'));
15
+ (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
16
+ var _a, _b, _c, _d;
17
+ var _e;
18
+ (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : (json.compilerOptions = {});
19
+ (_b = (_e = json.compilerOptions).types) !== null && _b !== void 0 ? _b : (_e.types = []);
20
+ json.compilerOptions.types.push(...((_d = (_c = tsConfigSpecJson === null || tsConfigSpecJson === void 0 ? void 0 : tsConfigSpecJson.compilerOptions) === null || _c === void 0 ? void 0 : _c.types) !== null && _d !== void 0 ? _d : []));
21
+ return json;
22
+ });
23
+ (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'), (json) => {
24
+ json.compilerOptions.jsx = 'react';
25
+ // have to override exclude otherwise lint will fail with setParserOptionsProject and jest.config.ts
26
+ if (options.setParserOptionsProject) {
27
+ const tsConfig = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'));
28
+ json.exclude = tsConfig.exclude.filter((e) => e !== 'jest.config.ts');
29
+ }
30
+ return json;
31
+ });
32
+ return jestTask;
33
+ });
34
+ }
35
+ exports.addJest = addJest;
36
+ //# sourceMappingURL=add-jest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AAEpB,sDAAoD;AAGpD,SAAsB,OAAO,CAAC,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OAAO,CAAC;YACnC,oGAAoG;YACpG,IAAI,OAAO,CAAC,uBAAuB,EAAE;gBACnC,MAAM,QAAQ,GAAG,IAAA,iBAAQ,EACvB,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAC3D,CAAC;gBACF,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC;aACvE;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAxDD,0BAwDC"}
@@ -0,0 +1,3 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addLinting(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addLinting = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const linter_1 = require("@nx/linter");
6
+ const devkit_1 = require("@nx/devkit");
7
+ const lint_1 = require("@nx/react/src/utils/lint");
8
+ function addLinting(host, options) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const lintTask = yield (0, linter_1.lintProjectGenerator)(host, {
11
+ linter: options.linter,
12
+ project: options.projectName,
13
+ tsConfigPaths: [
14
+ (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
15
+ ],
16
+ unitTestRunner: options.unitTestRunner,
17
+ eslintFilePatterns: [`${options.appProjectRoot}/**/*.{ts,tsx,js,jsx}`],
18
+ skipFormat: true,
19
+ });
20
+ if (options.linter === linter_1.Linter.EsLint) {
21
+ (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, '.eslintrc.json'), (json) => {
22
+ var _a, _b, _c;
23
+ json = (0, lint_1.extendReactEslintJson)(json);
24
+ // Turn off @next/next/no-html-link-for-pages since there is an issue with nextjs throwing linting errors
25
+ // TODO(nicholas): remove after Vercel updates nextjs linter to only lint ["*.ts", "*.tsx", "*.js", "*.jsx"]
26
+ json.ignorePatterns = [...json.ignorePatterns, '.next/**/*'];
27
+ json.rules = Object.assign({ '@next/next/no-html-link-for-pages': 'off' }, json.rules);
28
+ // Find the override that handles both TS and JS files.
29
+ const commonOverride = (_a = json.overrides) === null || _a === void 0 ? void 0 : _a.find((o) => ['*.ts', '*.tsx', '*.js', '*.jsx'].every((ext) => o.files.includes(ext)));
30
+ if (commonOverride) {
31
+ // Only set parserOptions.project if it already exists (defined by options.setParserOptionsProject)
32
+ if ((_b = commonOverride.parserOptions) === null || _b === void 0 ? void 0 : _b.project) {
33
+ commonOverride.parserOptions.project = [
34
+ `${options.appProjectRoot}/tsconfig(.*)?.json`,
35
+ ];
36
+ }
37
+ // Configure custom pages directory for next rule
38
+ if (commonOverride.rules) {
39
+ commonOverride.rules = Object.assign(Object.assign({}, commonOverride.rules), { '@next/next/no-html-link-for-pages': [
40
+ 'error',
41
+ `${options.appProjectRoot}/pages`,
42
+ ] });
43
+ }
44
+ }
45
+ (_c = json.extends) !== null && _c !== void 0 ? _c : (json.extends = []);
46
+ if (typeof json.extends === 'string') {
47
+ json.extends = [json.extends];
48
+ }
49
+ // add next.js configuration
50
+ json.extends.unshift(...['next', 'next/core-web-vitals']);
51
+ // remove nx/react plugin, as it conflicts with the next.js one
52
+ json.extends = json.extends.filter((name) => name !== 'plugin:@nrwl/nx/react');
53
+ json.extends.unshift('plugin:@nrwl/nx/react-typescript');
54
+ if (!json.env) {
55
+ json.env = {};
56
+ }
57
+ json.env.jest = true;
58
+ return json;
59
+ });
60
+ }
61
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
62
+ return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
63
+ });
64
+ }
65
+ exports.addLinting = addLinting;
66
+ //# sourceMappingURL=add-linting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-linting.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":";;;;AAAA,uCAA0D;AAC1D,uCAOoB;AACpB,mDAGkC;AAGlC,SAAsB,UAAU,CAC9B,IAAU,EACV,OAAyB;;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAoB,EAAC,IAAI,EAAE;YAChD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,WAAW;YAC5B,aAAa,EAAE;gBACb,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC;aAC/D;YACD,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,kBAAkB,EAAE,CAAC,GAAG,OAAO,CAAC,cAAc,uBAAuB,CAAC;YACtE,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,KAAK,eAAM,CAAC,MAAM,EAAE;YACpC,IAAA,mBAAU,EACR,IAAI,EACJ,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,gBAAgB,CAAC,EAC3D,CAAC,IAAI,EAAE,EAAE;;gBACP,IAAI,GAAG,IAAA,4BAAqB,EAAC,IAAI,CAAC,CAAC;gBAEnC,yGAAyG;gBACzG,4GAA4G;gBAE5G,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;gBAE7D,IAAI,CAAC,KAAK,mBACR,mCAAmC,EAAE,KAAK,IACvC,IAAI,CAAC,KAAK,CACd,CAAC;gBAEF,uDAAuD;gBACvD,MAAM,cAAc,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAChD,CAAC,MAAM,EAAE,OAAO,EAAE,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AI,CAAC;YACd,CAAC,CACF,CAAC;SACH;QAED,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ,8BAAuB,CAAC,YAAY,EACpC,8BAAuB,CAAC,eAAe,CACxC,CAAC;QAEF,OAAO,IAAA,yBAAgB,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;CAAA;AAtFD,gCAsFC"}
@@ -0,0 +1,3 @@
1
+ import { NormalizedSchema } from './normalize-options';
2
+ import { Tree } from '@nx/devkit';
3
+ export declare function addProject(host: Tree, options: NormalizedSchema): void;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addProject = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function addProject(host, options) {
6
+ const targets = {};
7
+ targets.build = {
8
+ executor: '@nrwl/next:build',
9
+ outputs: ['{options.outputPath}'],
10
+ defaultConfiguration: 'production',
11
+ options: {
12
+ root: options.appProjectRoot,
13
+ outputPath: (0, devkit_1.joinPathFragments)('dist', options.appProjectRoot),
14
+ },
15
+ configurations: {
16
+ development: {
17
+ outputPath: options.appProjectRoot,
18
+ },
19
+ production: {},
20
+ },
21
+ };
22
+ targets.serve = {
23
+ executor: '@nrwl/next:server',
24
+ defaultConfiguration: 'development',
25
+ options: {
26
+ buildTarget: `${options.projectName}:build`,
27
+ dev: true,
28
+ },
29
+ configurations: {
30
+ development: {
31
+ buildTarget: `${options.projectName}:build:development`,
32
+ dev: true,
33
+ },
34
+ production: {
35
+ buildTarget: `${options.projectName}:build:production`,
36
+ dev: false,
37
+ },
38
+ },
39
+ };
40
+ targets.export = {
41
+ executor: '@nrwl/next:export',
42
+ options: {
43
+ buildTarget: `${options.projectName}:build:production`,
44
+ },
45
+ };
46
+ const project = {
47
+ root: options.appProjectRoot,
48
+ sourceRoot: options.appProjectRoot,
49
+ projectType: 'application',
50
+ targets,
51
+ tags: options.parsedTags,
52
+ };
53
+ (0, devkit_1.addProjectConfiguration)(host, options.projectName, Object.assign({}, project));
54
+ }
55
+ exports.addProject = addProject;
56
+ //# sourceMappingURL=add-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AACA,uCAKoB;AAEpB,SAAgB,UAAU,CAAC,IAAU,EAAE,OAAyB;IAC9D,MAAM,OAAO,GAAwB,EAAE,CAAC;IAExC,OAAO,CAAC,KAAK,GAAG;QACd,QAAQ,EAAE,kBAAkB;QAC5B,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,OAAO,CAAC,cAAc;aACnC;YACD,UAAU,EAAE,EAAE;SACf;KACF,CAAC;IAEF,OAAO,CAAC,KAAK,GAAG;QACd,QAAQ,EAAE,mBAAmB;QAC7B,oBAAoB,EAAE,aAAa;QACnC,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,QAAQ;YAC3C,GAAG,EAAE,IAAI;SACV;QACD,cAAc,EAAE;YACd,WAAW,EAAE;gBACX,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,oBAAoB;gBACvD,GAAG,EAAE,IAAI;aACV;YACD,UAAU,EAAE;gBACV,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,mBAAmB;gBACtD,GAAG,EAAE,KAAK;aACX;SACF;KACF,CAAC;IAEF,OAAO,CAAC,MAAM,GAAG;QACf,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE;YACP,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,mBAAmB;SACvD;KACF,CAAC;IAEF,MAAM,OAAO,GAAyB;QACpC,IAAI,EAAE,OAAO,CAAC,cAAc;QAC5B,UAAU,EAAE,OAAO,CAAC,cAAc;QAClC,WAAW,EAAE,aAAa;QAC1B,OAAO;QACP,IAAI,EAAE,OAAO,CAAC,UAAU;KACzB,CAAC;IAEF,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,oBAC5C,OAAO,EACV,CAAC;AACL,CAAC;AAxDD,gCAwDC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function createApplicationFiles(host: Tree, options: NormalizedSchema): void;
@@ -0,0 +1,2 @@
1
+ export declare function createAppJsx(name: string): string;
2
+ export declare function createStyleRules(): string;