@nx/react 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 (87) hide show
  1. package/generators.json +0 -7
  2. package/index.d.ts +0 -2
  3. package/index.d.ts.map +1 -1
  4. package/index.js +1 -5
  5. package/package.json +17 -22
  6. package/src/generators/application/application.d.ts.map +1 -1
  7. package/src/generators/application/application.js +0 -15
  8. package/src/generators/application/files/base-rsbuild/tsconfig.app.json__tmpl__ +0 -2
  9. package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +0 -2
  10. package/src/generators/application/files/base-vite/index.html__tmpl__ +1 -1
  11. package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +0 -2
  12. package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +0 -2
  13. package/src/generators/application/lib/add-project.js +4 -4
  14. package/src/generators/application/lib/bundlers/add-rsbuild.d.ts.map +1 -1
  15. package/src/generators/application/lib/bundlers/add-rsbuild.js +2 -21
  16. package/src/generators/application/lib/bundlers/add-rspack.d.ts +0 -1
  17. package/src/generators/application/lib/bundlers/add-rspack.d.ts.map +1 -1
  18. package/src/generators/application/lib/bundlers/add-rspack.js +0 -25
  19. package/src/generators/application/lib/create-application-files.d.ts +1 -2
  20. package/src/generators/application/lib/create-application-files.d.ts.map +1 -1
  21. package/src/generators/application/lib/create-application-files.js +8 -60
  22. package/src/generators/application/lib/install-common-dependencies.d.ts.map +1 -1
  23. package/src/generators/application/lib/install-common-dependencies.js +2 -7
  24. package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
  25. package/src/generators/application/lib/normalize-options.js +0 -4
  26. package/src/generators/application/lib/update-jest-config.d.ts.map +1 -1
  27. package/src/generators/application/lib/update-jest-config.js +0 -3
  28. package/src/generators/application/schema.d.ts +0 -1
  29. package/src/generators/application/schema.json +2 -21
  30. package/src/generators/component/component.d.ts.map +1 -1
  31. package/src/generators/component/component.js +2 -5
  32. package/src/generators/component/files/__fileName__.__ext__ +3 -18
  33. package/src/generators/component/lib/normalize-options.d.ts.map +1 -1
  34. package/src/generators/component/lib/normalize-options.js +0 -4
  35. package/src/generators/component/schema.d.ts +0 -1
  36. package/src/generators/component/schema.json +2 -21
  37. package/src/generators/host/schema.json +2 -21
  38. package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +0 -1
  39. package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +0 -1
  40. package/src/generators/library/lib/add-rollup-build-target.d.ts.map +1 -1
  41. package/src/generators/library/lib/add-rollup-build-target.js +1 -6
  42. package/src/generators/library/lib/create-files.d.ts.map +1 -1
  43. package/src/generators/library/lib/create-files.js +1 -12
  44. package/src/generators/library/lib/install-common-dependencies.d.ts.map +1 -1
  45. package/src/generators/library/lib/install-common-dependencies.js +2 -7
  46. package/src/generators/library/schema.json +2 -21
  47. package/src/generators/remote/schema.json +2 -21
  48. package/src/migrations/update-22-0-0/add-svgr-to-webpack-config.d.ts.map +1 -1
  49. package/src/migrations/update-22-0-0/add-svgr-to-webpack-config.js +32 -5
  50. package/src/utils/assertion.d.ts.map +1 -1
  51. package/src/utils/assertion.js +1 -10
  52. package/src/utils/create-ts-config.js +0 -7
  53. package/src/utils/versions.d.ts +1 -14
  54. package/src/utils/versions.d.ts.map +1 -1
  55. package/src/utils/versions.js +2 -17
  56. package/tailwind.d.ts +2 -3
  57. package/tailwind.d.ts.map +1 -1
  58. package/tailwind.js +11 -5
  59. package/typings/style.d.ts +1 -9
  60. package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +0 -46
  61. package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +0 -49
  62. package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +0 -45
  63. package/src/generators/application/files/style-tailwind/src/styles.css +0 -1
  64. package/src/generators/application/lib/show-possible-warnings.d.ts +0 -4
  65. package/src/generators/application/lib/show-possible-warnings.d.ts.map +0 -1
  66. package/src/generators/application/lib/show-possible-warnings.js +0 -11
  67. package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +0 -15
  68. package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +0 -17
  69. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +0 -4
  70. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts.map +0 -1
  71. package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +0 -27
  72. package/src/generators/setup-tailwind/lib/update-project.d.ts +0 -4
  73. package/src/generators/setup-tailwind/lib/update-project.d.ts.map +0 -1
  74. package/src/generators/setup-tailwind/lib/update-project.js +0 -11
  75. package/src/generators/setup-tailwind/schema.d.ts +0 -7
  76. package/src/generators/setup-tailwind/schema.d.ts.map +0 -1
  77. package/src/generators/setup-tailwind/schema.js +0 -2
  78. package/src/generators/setup-tailwind/schema.json +0 -47
  79. package/src/generators/setup-tailwind/setup-tailwind.d.ts +0 -5
  80. package/src/generators/setup-tailwind/setup-tailwind.d.ts.map +0 -1
  81. package/src/generators/setup-tailwind/setup-tailwind.js +0 -35
  82. package/src/rules/add-styled-dependencies.d.ts +0 -6
  83. package/src/rules/add-styled-dependencies.d.ts.map +0 -1
  84. package/src/rules/add-styled-dependencies.js +0 -16
  85. package/src/utils/styled.d.ts +0 -4
  86. package/src/utils/styled.d.ts.map +0 -1
  87. package/src/utils/styled.js +0 -62
package/tailwind.js CHANGED
@@ -2,12 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createGlobPatternsForDependencies = createGlobPatternsForDependencies;
4
4
  const generate_globs_1 = require("@nx/js/src/utils/generate-globs");
5
+ let hasWarned = false;
5
6
  /**
6
- * Generates a set of glob patterns based off the source root of the app and its dependencies
7
- * @param dirPath workspace relative directory path that will be used to infer the parent project and dependencies
8
- * @param fileGlobPattern pass a custom glob pattern to be used
7
+ * @deprecated `@nx/react/tailwind` will be removed in Nx 24. Migrate to Tailwind CSS v4 which no longer needs glob patterns.
8
+ * See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react
9
9
  */
10
- function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/*!(*.stories|*.spec).{tsx,ts,jsx,js,html}') {
10
+ function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/!(*.stories|*.spec).{tsx,ts,jsx,js,html}') {
11
+ if (!hasWarned) {
12
+ hasWarned = true;
13
+ console.warn(`\nWARNING: "@nx/react/tailwind" is deprecated and will be removed in Nx 24.\n` +
14
+ `Migrate to Tailwind CSS v4 which no longer needs glob patterns for content detection.\n` +
15
+ `See: https://nx.dev/docs/technologies/react/guides/using-tailwind-css-in-react\n`);
16
+ }
11
17
  try {
12
18
  return (0, generate_globs_1.createGlobPatternsForDependencies)(dirPath, fileGlobPattern);
13
19
  }
@@ -19,7 +25,7 @@ function createGlobPatternsForDependencies(dirPath, fileGlobPattern = '/**/*!(*.
19
25
  * autocomplete features, for example.
20
26
  *
21
27
  * In order to best support that use-case, we therefore do not hard error when the ProjectGraph is
22
- * fundamently unavailable in this tailwind-specific context.
28
+ * fundamentally unavailable in this tailwind-specific context.
23
29
  */
24
30
  console.warn('\nWARNING: There was an error creating glob patterns, returning an empty array\n' +
25
31
  `${e.message}\n`);
@@ -1,9 +1 @@
1
- export type SupportedStyles =
2
- | 'css'
3
- | 'scss'
4
- | 'less'
5
- | 'tailwind'
6
- | 'styled-components'
7
- | '@emotion/styled'
8
- | 'styled-jsx'
9
- | 'none';
1
+ export type SupportedStyles = 'css' | 'scss' | 'none';
@@ -1,46 +0,0 @@
1
- <%_ if (classComponent) { _%>
2
- import { Component } from 'react';
3
- <%_ } _%>
4
- <%_ if (!minimal) { _%>
5
- import NxWelcome from "./nx-welcome";
6
- <%_ } _%>
7
-
8
- <%_ if (classComponent) { _%>
9
- export class App extends Component {
10
- override render() {
11
- return (
12
- <div>
13
- <style jsx>{`/** your style here **/`}</style>
14
- <%_ if (!minimal) { _%>
15
- <NxWelcome title="<%= projectName %>"/>
16
- <%_ } else { _%>
17
- <h1>
18
- <span> Hello there, </span>
19
- Welcome <%= projectName %> 👋
20
- </h1>
21
- <%_ } _%>
22
- </div>
23
- );
24
- }
25
- }
26
- <%_ } else { _%>
27
- export function App() {
28
- return (
29
- <div>
30
- <style jsx>{`/** your style here **/`}</style>
31
- <%_ if (!minimal) { _%>
32
- <NxWelcome title="<%= projectName %>"/>
33
- <%_ } else { _%>
34
- <h1>
35
- <span> Hello there, </span>
36
- Welcome <%= projectName %> 👋
37
- </h1>
38
- <%_ } _%>
39
- </div>
40
- );
41
- }
42
- <%_ } _%>
43
-
44
- export default App;
45
-
46
- <% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
@@ -1,49 +0,0 @@
1
- <%_ if (classComponent) { _%>
2
- import { Component } from 'react';
3
- <%_ } _%>
4
- import styled from '<%= styledModule %>';
5
- <%_ if (!minimal) { _%>
6
- import NxWelcome from "./nx-welcome";
7
- <%_ } _%>
8
-
9
- const StyledApp = styled.div`
10
- /* Your style here */
11
- `;
12
-
13
- <%_ if (classComponent) { _%>
14
- export class App extends Component {
15
- override render() {
16
- return (
17
- <StyledApp>
18
- <%_ if (!minimal) { _%>
19
- <NxWelcome title="<%= projectName %>"/>
20
- <%_ } else { _%>
21
- <h1>
22
- <span> Hello there, </span>
23
- Welcome <%= projectName %> 👋
24
- </h1>
25
- <%_ } _%>
26
- </StyledApp>
27
- );
28
- }
29
- }
30
- <%_ } else { _%>
31
- export function App() {
32
- return (
33
- <StyledApp>
34
- <%_ if (!minimal) { _%>
35
- <NxWelcome title="<%= projectName %>"/>
36
- <%_ } else { _%>
37
- <h1>
38
- <span> Hello there, </span>
39
- Welcome <%= projectName %> 👋
40
- </h1>
41
- <%_ } _%>
42
- </StyledApp>
43
- );
44
- }
45
- <%_ } _%>
46
-
47
- export default App;
48
-
49
- <% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
@@ -1,45 +0,0 @@
1
- <%_ if (classComponent) { _%>
2
- import { Component } from 'react';
3
- <%_ } if (!minimal) { _%>
4
- import NxWelcome from "./nx-welcome";
5
- <%_ } if (bundler === "rspack" || bundler === 'rsbuild') { _%>
6
- import '../styles.css';
7
- <%_ } _%>
8
-
9
- <%_ if (classComponent) { _%>
10
- export class App extends Component {
11
- override render() {
12
- return (
13
- <div>
14
- <%_ if (!minimal) { _%>
15
- <NxWelcome title="<%= projectName %>"/>
16
- <%_ } else { _%>
17
- <h1>
18
- <span> Hello there, </span>
19
- Welcome <%= projectName %> 👋
20
- </h1>
21
- <%_ } _%>
22
- </div>
23
- );
24
- }
25
- }
26
- <%_ } else { _%>
27
- export function App() {
28
- return (
29
- <div>
30
- <%_ if (!minimal) { _%>
31
- <NxWelcome title="<%= projectName %>"/>
32
- <%_ } else { _%>
33
- <h1>
34
- <span> Hello there, </span>
35
- Welcome <%= projectName %> 👋
36
- </h1>
37
- <%_ } _%>
38
- </div>
39
- );
40
- }
41
- <%_ } _%>
42
-
43
- export default App;
44
-
45
- <% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
@@ -1 +0,0 @@
1
- /* You can add global styles to this file, and also import other style files */
@@ -1,4 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { NormalizedSchema, Schema } from '../schema';
3
- export declare function showPossibleWarnings(tree: Tree, options: NormalizedSchema<Schema>): void;
4
- //# sourceMappingURL=show-possible-warnings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"show-possible-warnings.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/show-possible-warnings.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAErD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,QASlC"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showPossibleWarnings = showPossibleWarnings;
4
- const tslib_1 = require("tslib");
5
- const pc = tslib_1.__importStar(require("picocolors"));
6
- const devkit_1 = require("@nx/devkit");
7
- function showPossibleWarnings(tree, options) {
8
- if (options.style === 'styled-jsx' && options.compiler === 'swc') {
9
- devkit_1.logger.warn(`styled-jsx may not work with SWC. Try using ${pc.bold('nx g @nx/react:app --compiler=babel')} instead.`);
10
- }
11
- }
@@ -1,15 +0,0 @@
1
- const { join } = require('path');
2
-
3
- // Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
4
- // option from your application's configuration (i.e. project.json).
5
- //
6
- // See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries
7
-
8
- module.exports = {
9
- plugins: {
10
- tailwindcss: {
11
- config: join(__dirname, 'tailwind.config.js'),
12
- },
13
- autoprefixer: {},
14
- },
15
- }
@@ -1,17 +0,0 @@
1
- const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
2
- const { join } = require('path');
3
-
4
- /** @type {import('tailwindcss').Config} */
5
- module.exports = {
6
- content: [
7
- join(
8
- __dirname,
9
- '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}'
10
- ),
11
- ...createGlobPatternsForDependencies(__dirname),
12
- ],
13
- theme: {
14
- extend: {},
15
- },
16
- plugins: [],
17
- };
@@ -1,4 +0,0 @@
1
- import { ProjectConfiguration, Tree } from '@nx/devkit';
2
- import { SetupTailwindOptions } from '../schema';
3
- export declare function addTailwindStyleImports(tree: Tree, project: ProjectConfiguration, _options: SetupTailwindOptions): void;
4
- //# sourceMappingURL=add-tailwind-style-imports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-tailwind-style-imports.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EAEpB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAWjD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,oBAAoB,QA2B/B"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addTailwindStyleImports = addTailwindStyleImports;
4
- const devkit_1 = require("@nx/devkit");
5
- // base directories and file types to simplify locating the stylesheet
6
- const baseDirs = ['src', 'pages', 'src/pages', 'src/app', 'app'];
7
- const fileNames = ['styles', 'global'];
8
- const extensions = ['.css', '.scss', '.less'];
9
- const knownLocations = baseDirs.flatMap((dir) => fileNames.flatMap((name) => extensions.map((ext) => `${dir}/${name}${ext}`)));
10
- function addTailwindStyleImports(tree, project, _options) {
11
- const candidates = knownLocations.map((currentPath) => (0, devkit_1.joinPathFragments)(project.root, currentPath));
12
- const stylesPath = candidates.find((currentStylePath) => tree.exists(currentStylePath));
13
- if (stylesPath) {
14
- const content = tree.read(stylesPath).toString();
15
- tree.write(stylesPath, `@tailwind base;\n@tailwind components;\n@tailwind utilities;\n${content}`);
16
- }
17
- else {
18
- devkit_1.logger.warn((0, devkit_1.stripIndents) `
19
- Could not find stylesheet to update. Add the following imports to your stylesheet (e.g. styles.css):
20
-
21
- @tailwind base;
22
- @tailwind components;
23
- @tailwind utilities;
24
-
25
- See our guide for more details: https://nx.dev/guides/using-tailwind-css-in-react`);
26
- }
27
- }
@@ -1,4 +0,0 @@
1
- import type { ProjectConfiguration, Tree } from '@nx/devkit';
2
- import { SetupTailwindOptions } from '../schema';
3
- export declare function updateProject(tree: Tree, config: ProjectConfiguration, options: SetupTailwindOptions): void;
4
- //# sourceMappingURL=update-project.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/setup-tailwind/lib/update-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAG7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEjD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,oBAAoB,QAU9B"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateProject = updateProject;
4
- const devkit_1 = require("@nx/devkit");
5
- function updateProject(tree, config, options) {
6
- if (config?.targets?.build?.executor === '@nx/webpack:webpack') {
7
- config.targets.build.options ??= {};
8
- config.targets.build.options.postcssConfig = (0, devkit_1.joinPathFragments)(config.root, 'postcss.config.js');
9
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, config);
10
- }
11
- }
@@ -1,7 +0,0 @@
1
- export interface SetupTailwindOptions {
2
- project: string;
3
- buildTarget?: string;
4
- skipFormat?: boolean;
5
- skipPackageJson?: boolean;
6
- }
7
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,47 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "NxReactTailwindSetupGenerator",
5
- "title": "Configures Tailwind CSS for an application or a buildable/publishable library.",
6
- "description": "Adds the Tailwind CSS configuration files for a given React project and installs, if needed, the packages required for Tailwind CSS to work.",
7
- "type": "object",
8
- "examples": [
9
- {
10
- "command": "nx g setup-tailwind --project=my-app",
11
- "description": "Initialize Tailwind configuration for the `my-app` project."
12
- }
13
- ],
14
- "properties": {
15
- "project": {
16
- "type": "string",
17
- "description": "The name of the project to add the Tailwind CSS setup for.",
18
- "alias": "p",
19
- "$default": {
20
- "$source": "argv",
21
- "index": 0
22
- },
23
- "x-dropdown": "projects",
24
- "x-prompt": "What project would you like to add the Tailwind CSS setup?",
25
- "x-priority": "important"
26
- },
27
- "buildTarget": {
28
- "type": "string",
29
- "description": "The name of the target used to build the project. This option is not needed in most cases.",
30
- "default": "build",
31
- "x-priority": "important"
32
- },
33
- "skipFormat": {
34
- "type": "boolean",
35
- "description": "Skips formatting the workspace after the generator completes.",
36
- "x-priority": "internal"
37
- },
38
- "skipPackageJson": {
39
- "type": "boolean",
40
- "default": false,
41
- "description": "Do not add dependencies to `package.json`.",
42
- "x-priority": "internal"
43
- }
44
- },
45
- "additionalProperties": false,
46
- "required": ["project"]
47
- }
@@ -1,5 +0,0 @@
1
- import type { GeneratorCallback, Tree } from '@nx/devkit';
2
- import type { SetupTailwindOptions } from './schema';
3
- export declare function setupTailwindGenerator(tree: Tree, options: SetupTailwindOptions): Promise<GeneratorCallback>;
4
- export default setupTailwindGenerator;
5
- //# sourceMappingURL=setup-tailwind.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup-tailwind.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/setup-tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAgB1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,oBAAoB,8BA8C9B;AAED,eAAe,sBAAsB,CAAC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupTailwindGenerator = setupTailwindGenerator;
4
- const devkit_1 = require("@nx/devkit");
5
- const versions_1 = require("../../utils/versions");
6
- const add_tailwind_style_imports_1 = require("./lib/add-tailwind-style-imports");
7
- const update_project_1 = require("./lib/update-project");
8
- const path_1 = require("path");
9
- async function setupTailwindGenerator(tree, options) {
10
- devkit_1.logger.warn(`The 'setup-tailwind' generator is deprecated. Generating Tailwind configuration is no longer maintained. This generator will be removed in Nx 23.`);
11
- const tasks = [];
12
- const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
13
- if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'postcss.config.js')) ||
14
- tree.exists((0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js'))) {
15
- devkit_1.logger.info(`Skipping setup since there are existing PostCSS or Tailwind configuration files. For manual setup instructions, see https://nx.dev/guides/using-tailwind-css-in-react.`);
16
- return;
17
- }
18
- (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files'), project.root, {
19
- tmpl: '',
20
- });
21
- (0, add_tailwind_style_imports_1.addTailwindStyleImports)(tree, project, options);
22
- (0, update_project_1.updateProject)(tree, project, options);
23
- if (!options.skipPackageJson) {
24
- tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
25
- autoprefixer: versions_1.autoprefixerVersion,
26
- postcss: versions_1.postcssVersion,
27
- tailwindcss: versions_1.tailwindcssVersion,
28
- }));
29
- }
30
- if (!options.skipFormat) {
31
- await (0, devkit_1.formatFiles)(tree);
32
- }
33
- return (0, devkit_1.runTasksInSerial)(...tasks);
34
- }
35
- exports.default = setupTailwindGenerator;
@@ -1,6 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export declare function addStyledModuleDependencies(host: Tree, options: {
3
- styledModule?: string;
4
- compiler?: 'babel' | 'swc';
5
- }): import("@nx/devkit").GeneratorCallback;
6
- //# sourceMappingURL=add-styled-dependencies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-styled-dependencies.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/rules/add-styled-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,IAAI,EAAE,MAAM,YAAY,CAAC;AAMhE,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CAAE,0CAgB/D"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addStyledModuleDependencies = addStyledModuleDependencies;
4
- const devkit_1 = require("@nx/devkit");
5
- const styled_1 = require("../utils/styled");
6
- function addStyledModuleDependencies(host, options) {
7
- const extraDependencies = options.compiler === 'swc'
8
- ? styled_1.cssInJsDependenciesSwc[options.styledModule]
9
- : styled_1.cssInJsDependenciesBabel[options.styledModule];
10
- if (extraDependencies) {
11
- return (0, devkit_1.addDependenciesToPackageJson)(host, extraDependencies.dependencies, extraDependencies.devDependencies);
12
- }
13
- else {
14
- return () => { };
15
- }
16
- }
@@ -1,4 +0,0 @@
1
- import { PackageDependencies } from './dependencies';
2
- export declare const cssInJsDependenciesBabel: Record<string, PackageDependencies>;
3
- export declare const cssInJsDependenciesSwc: Record<string, PackageDependencies>;
4
- //# sourceMappingURL=styled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/styled.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CA2BxE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CA6BtE,CAAC"}
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cssInJsDependenciesSwc = exports.cssInJsDependenciesBabel = void 0;
4
- const versions_1 = require("./versions");
5
- exports.cssInJsDependenciesBabel = {
6
- 'styled-components': {
7
- dependencies: {
8
- 'react-is': versions_1.reactIsVersion,
9
- 'styled-components': versions_1.styledComponentsVersion,
10
- },
11
- devDependencies: {
12
- '@types/styled-components': versions_1.typesStyledComponentsVersion,
13
- '@types/react-is': versions_1.typesReactIsVersion,
14
- 'babel-plugin-styled-components': versions_1.babelPluginStyledComponentsVersion,
15
- },
16
- },
17
- '@emotion/styled': {
18
- dependencies: {
19
- '@emotion/styled': versions_1.emotionStyledVersion,
20
- '@emotion/react': versions_1.emotionReactVersion,
21
- },
22
- devDependencies: {
23
- '@emotion/babel-plugin': versions_1.emotionBabelPlugin,
24
- },
25
- },
26
- 'styled-jsx': {
27
- dependencies: {
28
- 'styled-jsx': versions_1.styledJsxVersion,
29
- },
30
- devDependencies: {},
31
- },
32
- };
33
- exports.cssInJsDependenciesSwc = {
34
- 'styled-components': {
35
- dependencies: {
36
- 'react-is': versions_1.reactIsVersion,
37
- 'styled-components': versions_1.styledComponentsVersion,
38
- },
39
- devDependencies: {
40
- '@types/styled-components': versions_1.typesStyledComponentsVersion,
41
- '@types/react-is': versions_1.typesReactIsVersion,
42
- '@swc/plugin-styled-components': versions_1.swcPluginStyledComponentsVersion,
43
- },
44
- },
45
- '@emotion/styled': {
46
- dependencies: {
47
- '@emotion/styled': versions_1.emotionStyledVersion,
48
- '@emotion/react': versions_1.emotionReactVersion,
49
- },
50
- devDependencies: {
51
- '@swc/plugin-emotion': versions_1.swcPluginEmotionVersion,
52
- },
53
- },
54
- 'styled-jsx': {
55
- dependencies: {
56
- 'styled-jsx': versions_1.styledJsxVersion,
57
- },
58
- devDependencies: {
59
- '@swc/plugin-styled-jsx': versions_1.swcPluginStyledJsxVersion,
60
- },
61
- },
62
- };