@nrwl/react 14.5.0-beta.2 → 14.5.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.
- package/CHANGELOG.md +1 -1
- package/generators.json +20 -6
- package/package.json +10 -10
- package/src/generators/init/init.js +1 -1
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +15 -0
- package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +17 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +36 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js.map +1 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +15 -0
- package/src/generators/setup-tailwind/lib/update-project.js.map +1 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +3 -0
- package/src/generators/setup-tailwind/schema.js.map +1 -0
- package/src/generators/setup-tailwind/schema.json +39 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +5 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +40 -0
- package/src/generators/setup-tailwind/setup-tailwind.js.map +1 -0
- package/src/utils/versions.d.ts +4 -0
- package/src/utils/versions.js +5 -1
- package/src/utils/versions.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [14.5.0-beta.
|
|
6
|
+
# [14.5.0-beta.3](https://github.com/nrwl/nx/compare/14.4.2...14.5.0-beta.3) (2022-07-21)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/react
|
package/generators.json
CHANGED
|
@@ -44,28 +44,28 @@
|
|
|
44
44
|
"storybook-configuration": {
|
|
45
45
|
"factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationSchematic",
|
|
46
46
|
"schema": "./src/generators/storybook-configuration/schema.json",
|
|
47
|
-
"description": "Set up storybook for a React app or library",
|
|
47
|
+
"description": "Set up storybook for a React app or library.",
|
|
48
48
|
"hidden": false
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
"component-story": {
|
|
52
52
|
"factory": "./src/generators/component-story/component-story#componentStorySchematic",
|
|
53
53
|
"schema": "./src/generators/component-story/schema.json",
|
|
54
|
-
"description": "Generate storybook story for a React component",
|
|
54
|
+
"description": "Generate storybook story for a React component.",
|
|
55
55
|
"hidden": false
|
|
56
56
|
},
|
|
57
57
|
|
|
58
58
|
"stories": {
|
|
59
59
|
"factory": "./src/generators/stories/stories#storiesSchematic",
|
|
60
60
|
"schema": "./src/generators/stories/schema.json",
|
|
61
|
-
"description": "Create stories/specs for all components declared in an app or library",
|
|
61
|
+
"description": "Create stories/specs for all components declared in an app or library.",
|
|
62
62
|
"hidden": false
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
"component-cypress-spec": {
|
|
66
66
|
"factory": "./src/generators/component-cypress-spec/component-cypress-spec#componentCypressSchematic",
|
|
67
67
|
"schema": "./src/generators/component-cypress-spec/schema.json",
|
|
68
|
-
"description": "Create a Cypress spec for a UI component that has a story",
|
|
68
|
+
"description": "Create a Cypress spec for a UI component that has a story.",
|
|
69
69
|
"hidden": false
|
|
70
70
|
},
|
|
71
71
|
|
|
@@ -79,14 +79,21 @@
|
|
|
79
79
|
"cypress-component-configuration": {
|
|
80
80
|
"factory": "./src/generators/cypress-component-configuration/cypress-component-configuration#cypressComponentConfigGenerator",
|
|
81
81
|
"schema": "./src/generators/cypress-component-configuration/schema.json",
|
|
82
|
-
"description": "Setup Cypress component testing for a React project",
|
|
82
|
+
"description": "Setup Cypress component testing for a React project.",
|
|
83
83
|
"hidden": false
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
"component-test": {
|
|
87
87
|
"factory": "./src/generators/component-test/component-test#componentTestGenerator",
|
|
88
88
|
"schema": "./src/generators/component-test/schema.json",
|
|
89
|
-
"description": "Generate a Cypress component test for a React component",
|
|
89
|
+
"description": "Generate a Cypress component test for a React component.",
|
|
90
|
+
"hidden": false
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
"setup-tailwind": {
|
|
94
|
+
"factory": "./src/generators/setup-tailwind/setup-tailwind#setupTailwindSchematic",
|
|
95
|
+
"schema": "./src/generators/setup-tailwind/schema.json",
|
|
96
|
+
"description": "Set up Tailwind configuration for a project.",
|
|
90
97
|
"hidden": false
|
|
91
98
|
}
|
|
92
99
|
},
|
|
@@ -190,6 +197,13 @@
|
|
|
190
197
|
"schema": "./src/generators/component-test/schema.json",
|
|
191
198
|
"description": "Generate a Cypress component test for a React component",
|
|
192
199
|
"hidden": false
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
"setup-tailwind": {
|
|
203
|
+
"factory": "./src/generators/setup-tailwind/setup-tailwind#setupTailwindGenerator",
|
|
204
|
+
"schema": "./src/generators/setup-tailwind/schema.json",
|
|
205
|
+
"description": "Set up Tailwind configuration for a project.",
|
|
206
|
+
"hidden": false
|
|
193
207
|
}
|
|
194
208
|
}
|
|
195
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react",
|
|
3
|
-
"version": "14.5.0-beta.
|
|
3
|
+
"version": "14.5.0-beta.3",
|
|
4
4
|
"description": "The React plugin contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/core": "^7.15.0",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
|
-
"@nrwl/cypress": "14.5.0-beta.
|
|
36
|
-
"@nrwl/devkit": "14.5.0-beta.
|
|
37
|
-
"@nrwl/jest": "14.5.0-beta.
|
|
38
|
-
"@nrwl/js": "14.5.0-beta.
|
|
39
|
-
"@nrwl/linter": "14.5.0-beta.
|
|
40
|
-
"@nrwl/storybook": "14.5.0-beta.
|
|
41
|
-
"@nrwl/web": "14.5.0-beta.
|
|
42
|
-
"@nrwl/workspace": "14.5.0-beta.
|
|
35
|
+
"@nrwl/cypress": "14.5.0-beta.3",
|
|
36
|
+
"@nrwl/devkit": "14.5.0-beta.3",
|
|
37
|
+
"@nrwl/jest": "14.5.0-beta.3",
|
|
38
|
+
"@nrwl/js": "14.5.0-beta.3",
|
|
39
|
+
"@nrwl/linter": "14.5.0-beta.3",
|
|
40
|
+
"@nrwl/storybook": "14.5.0-beta.3",
|
|
41
|
+
"@nrwl/web": "14.5.0-beta.3",
|
|
42
|
+
"@nrwl/workspace": "14.5.0-beta.3",
|
|
43
43
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
44
44
|
"@storybook/node-logger": "6.1.20",
|
|
45
45
|
"@svgr/webpack": "^6.1.2",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"webpack": "^5.58.1",
|
|
55
55
|
"webpack-merge": "^5.8.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "8c7b76e8f1f42a33dfcbf7245664082cbc10f619"
|
|
58
58
|
}
|
|
@@ -22,7 +22,7 @@ function updateDependencies(host) {
|
|
|
22
22
|
react: versions_1.reactVersion,
|
|
23
23
|
'react-dom': versions_1.reactDomVersion,
|
|
24
24
|
'regenerator-runtime': '0.13.7',
|
|
25
|
-
tslib:
|
|
25
|
+
tslib: versions_1.tsLibVersion,
|
|
26
26
|
}, {
|
|
27
27
|
'@nrwl/react': versions_1.nxVersion,
|
|
28
28
|
'@types/node': versions_1.typesNodeVersion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,2CAAqD;AACrD,yCAQsB;AACtB,qCAA+C;AAC/C,mCAA6C;AAC7C,2FAAqF;AACrF,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,2CAAqD;AACrD,yCAQsB;AACtB,qCAA+C;AAC/C,mCAA6C;AAC7C,2FAAqF;AACrF,mDAU8B;AAG9B,SAAS,UAAU,CAAC,IAAU;IAC5B,MAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC;IAClD,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAClE,MAAM,UAAU,mCACX,SAAS,CAAC,UAAU,KACvB,aAAa,kCACR,eAAe,KAClB,WAAW,kCACN,eAAe,CAAC,WAAW,KAC9B,KAAK,EAAE,IAAI,SAGhB,CAAC;IAEF,IAAA,qCAA4B,EAAC,IAAI,kCAAO,SAAS,KAAE,UAAU,IAAG,CAAC;AACnE,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAU;IACpC,IAAA,0CAAiC,EAAC,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;IAE7D,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ;QACE,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,uBAAY;QACnB,WAAW,EAAE,0BAAe;QAC5B,qBAAqB,EAAE,QAAQ;QAC/B,KAAK,EAAE,uBAAY;KACpB,EACD;QACE,aAAa,EAAE,oBAAS;QACxB,aAAa,EAAE,2BAAgB;QAC/B,cAAc,EAAE,4BAAiB;QACjC,kBAAkB,EAAE,+BAAoB;QACxC,wBAAwB,EAAE,qCAA0B;QACpD,qBAAqB,EAAE,mCAAwB;KAChD,CACF,CAAC;AACJ,CAAC;AAED,SAAsB,kBAAkB,CAAC,IAAU,EAAE,MAAkB;;QACrE,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjB,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,EAAE;YAC9D,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACtB;QACD,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,EAAE;YAC/D,MAAM,WAAW,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;SACzB;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AApBD,gDAoBC;AAED,kBAAe,kBAAkB,CAAC;AAErB,QAAA,kBAAkB,GAAG,IAAA,2BAAkB,EAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { createGlobPatternsForDependencies } = require('@nrwl/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}/**/*!(*.stories|*.spec).{ts,tsx,html}'
|
|
10
|
+
),
|
|
11
|
+
...createGlobPatternsForDependencies(__dirname),
|
|
12
|
+
],
|
|
13
|
+
theme: {
|
|
14
|
+
extend: {},
|
|
15
|
+
},
|
|
16
|
+
plugins: [],
|
|
17
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addTailwindStyleImports = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const knownLocations = [
|
|
6
|
+
// Plain React
|
|
7
|
+
'src/styles.css',
|
|
8
|
+
'src/styles.scss',
|
|
9
|
+
'src/styles.styl',
|
|
10
|
+
'src/styles.less',
|
|
11
|
+
// Next.js
|
|
12
|
+
'pages/styles.css',
|
|
13
|
+
'pages/styles.scss',
|
|
14
|
+
'pages/styles.styl',
|
|
15
|
+
'pages/styles.less',
|
|
16
|
+
];
|
|
17
|
+
function addTailwindStyleImports(tree, project, _options) {
|
|
18
|
+
const candidates = knownLocations.map((x) => (0, devkit_1.joinPathFragments)(project.root, x));
|
|
19
|
+
const stylesPath = candidates.find((x) => tree.exists(x));
|
|
20
|
+
if (stylesPath) {
|
|
21
|
+
const content = tree.read(stylesPath).toString();
|
|
22
|
+
tree.write(stylesPath, `@tailwind components;\n@tailwind base;\n@tailwind utilities;\n${content}`);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `
|
|
26
|
+
Could not find stylesheet to update. Add the following imports to your stylesheet (e.g. styles.css):
|
|
27
|
+
|
|
28
|
+
@tailwind components;
|
|
29
|
+
@tailwind base;
|
|
30
|
+
@tailwind utilities;
|
|
31
|
+
|
|
32
|
+
See our guide for more details: https://nx.dev/guides/using-tailwind-css-in-react`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.addTailwindStyleImports = addTailwindStyleImports;
|
|
36
|
+
//# sourceMappingURL=add-tailwind-style-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-tailwind-style-imports.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/setup-tailwind/lib/add-tailwind-style-imports.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AAKtB,MAAM,cAAc,GAAG;IACrB,cAAc;IACd,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IAEjB,UAAU;IACV,kBAAkB;IAClB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;CACpB,CAAC;AAEF,SAAgB,uBAAuB,CACrC,IAAU,EACV,OAA6B,EAC7B,QAA8B;IAE9B,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1C,IAAA,0BAAiB,EAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CACnC,CAAC;IACF,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1D,IAAI,UAAU,EAAE;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjD,IAAI,CAAC,KAAK,CACR,UAAU,EACV,iEAAiE,OAAO,EAAE,CAC3E,CAAC;KACH;SAAM;QACL,eAAM,CAAC,IAAI,CACT,IAAA,qBAAY,EAAA;;;;;;;0FAOwE,CACrF,CAAC;KACH;AACH,CAAC;AA5BD,0DA4BC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateProject = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function updateProject(tree, config, options) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
var _d;
|
|
8
|
+
if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/web:webpack') {
|
|
9
|
+
(_c = (_d = config.targets.build).options) !== null && _c !== void 0 ? _c : (_d.options = {});
|
|
10
|
+
config.targets.build.options.postcssConfig = (0, devkit_1.joinPathFragments)(config.root, 'postcss.config.js');
|
|
11
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, config);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.updateProject = updateProject;
|
|
15
|
+
//# sourceMappingURL=update-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-project.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/setup-tailwind/lib/update-project.ts"],"names":[],"mappings":";;;AACA,yCAA6E;AAI7E,SAAgB,aAAa,CAC3B,IAAU,EACV,MAA4B,EAC5B,OAA6B;;;IAE7B,IAAI,CAAA,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,0CAAE,KAAK,0CAAE,QAAQ,MAAK,mBAAmB,EAAE;QAC5D,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,EAAC,OAAO,uCAAP,OAAO,GAAK,EAAE,EAAC;QACpC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,GAAG,IAAA,0BAAiB,EAC5D,MAAM,CAAC,IAAI,EACX,mBAAmB,CACpB,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KAC3D;AACH,CAAC;AAbD,sCAaC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://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": { "$source": "projectName" },
|
|
20
|
+
"x-prompt": "What project would you like to add the Tailwind CSS setup?"
|
|
21
|
+
},
|
|
22
|
+
"buildTarget": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The name of the target used to build the project. This option is not needed in most cases.",
|
|
25
|
+
"default": "build"
|
|
26
|
+
},
|
|
27
|
+
"skipFormat": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "Skips formatting the workspace after the generator completes."
|
|
30
|
+
},
|
|
31
|
+
"skipPackageJson": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false,
|
|
34
|
+
"description": "Do not add dependencies to `package.json`."
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["project"]
|
|
39
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
|
+
import type { SetupTailwindOptions } from './schema';
|
|
3
|
+
export declare function setupTailwindGenerator(tree: Tree, options: SetupTailwindOptions): Promise<GeneratorCallback>;
|
|
4
|
+
export default setupTailwindGenerator;
|
|
5
|
+
export declare const setupTailwindSchematic: (generatorOptions: SetupTailwindOptions) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupTailwindSchematic = exports.setupTailwindGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
|
+
const versions_1 = require("../../utils/versions");
|
|
8
|
+
const add_tailwind_style_imports_1 = require("./lib/add-tailwind-style-imports");
|
|
9
|
+
const update_project_1 = require("./lib/update-project");
|
|
10
|
+
function setupTailwindGenerator(tree, options) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const tasks = [];
|
|
13
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
14
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'postcss.config.js')) ||
|
|
15
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js'))) {
|
|
16
|
+
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.`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files'), project.root, {
|
|
20
|
+
tmpl: '',
|
|
21
|
+
});
|
|
22
|
+
(0, add_tailwind_style_imports_1.addTailwindStyleImports)(tree, project, options);
|
|
23
|
+
(0, update_project_1.updateProject)(tree, project, options);
|
|
24
|
+
if (!options.skipPackageJson) {
|
|
25
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
26
|
+
autoprefixer: versions_1.autoprefixerVersion,
|
|
27
|
+
postcss: versions_1.postcssVersion,
|
|
28
|
+
tailwindcss: versions_1.tailwindcssVersion,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
if (!options.skipFormat) {
|
|
32
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
33
|
+
}
|
|
34
|
+
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.setupTailwindGenerator = setupTailwindGenerator;
|
|
38
|
+
exports.default = setupTailwindGenerator;
|
|
39
|
+
exports.setupTailwindSchematic = (0, devkit_1.convertNxGenerator)(setupTailwindGenerator);
|
|
40
|
+
//# sourceMappingURL=setup-tailwind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-tailwind.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/setup-tailwind/setup-tailwind.ts"],"names":[],"mappings":";;;;AACA,yCASsB;AACtB,2FAAqF;AAErF,mDAI8B;AAE9B,iFAA2E;AAC3E,yDAAqD;AAErD,SAAsB,sBAAsB,CAC1C,IAAU,EACV,OAA6B;;QAE7B,MAAM,KAAK,GA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11yVersion = "6.6.0";
|
|
|
23
23
|
export declare const eslintPluginReactVersion = "7.30.1";
|
|
24
24
|
export declare const eslintPluginReactHooksVersion = "4.6.0";
|
|
25
25
|
export declare const babelPluginStyledComponentsVersion = "1.10.7";
|
|
26
|
+
export declare const tsLibVersion = "^2.3.0";
|
|
27
|
+
export declare const postcssVersion = "8.4.14";
|
|
28
|
+
export declare const tailwindcssVersion = "3.1.6";
|
|
29
|
+
export declare const autoprefixerVersion = "10.4.7";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactTestRendererVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactVersion = exports.typesReactRouterDomVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.typesNodeVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxVersion = void 0;
|
|
3
|
+
exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactTestRendererVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactVersion = exports.typesReactRouterDomVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.typesNodeVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
exports.reactVersion = '18.2.0';
|
|
6
6
|
exports.reactDomVersion = '18.2.0';
|
|
@@ -27,4 +27,8 @@ exports.eslintPluginJsxA11yVersion = '6.6.0';
|
|
|
27
27
|
exports.eslintPluginReactVersion = '7.30.1';
|
|
28
28
|
exports.eslintPluginReactHooksVersion = '4.6.0';
|
|
29
29
|
exports.babelPluginStyledComponentsVersion = '1.10.7';
|
|
30
|
+
exports.tsLibVersion = '^2.3.0';
|
|
31
|
+
exports.postcssVersion = '8.4.14';
|
|
32
|
+
exports.tailwindcssVersion = '3.1.6';
|
|
33
|
+
exports.autoprefixerVersion = '10.4.7';
|
|
30
34
|
//# sourceMappingURL=versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/react/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAElD,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAC9B,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAChC,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAE/B,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAE5B,QAAA,uBAAuB,GAAG,OAAO,CAAC;AAClC,QAAA,4BAA4B,GAAG,QAAQ,CAAC;AAExC,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAChC,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,kBAAkB,GAAG,QAAQ,CAAC;AAE3C,4FAA4F;AAC/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