@nx/react 16.4.0-beta.0 → 16.4.0-beta.2
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/ast-utils.js +0 -1
- package/babel.js +0 -1
- package/index.js +0 -1
- package/module-federation.js +0 -1
- package/package.json +7 -7
- package/plugins/bundle-rollup.js +0 -1
- package/plugins/component-testing/index.js +0 -1
- package/plugins/component-testing/webpack-fallback.js +0 -1
- package/plugins/jest.js +0 -1
- package/plugins/storybook/index.js +65 -4
- package/plugins/storybook/merge-plugins.js +0 -1
- package/plugins/webpack.js +0 -1
- package/plugins/with-react.js +0 -1
- package/src/executors/module-federation-dev-server/compat.js +0 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -1
- package/src/executors/module-federation-ssr-dev-server/compat.js +0 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -1
- package/src/generators/application/application.js +4 -5
- package/src/generators/application/lib/add-cypress.js +0 -1
- package/src/generators/application/lib/add-jest.js +0 -1
- package/src/generators/application/lib/add-project.js +0 -1
- package/src/generators/application/lib/add-routing.js +0 -1
- package/src/generators/application/lib/create-application-files.js +0 -1
- package/src/generators/application/lib/find-free-port.js +0 -1
- package/src/generators/application/lib/get-app-tests.js +0 -1
- package/src/generators/application/lib/install-common-dependencies.js +15 -9
- package/src/generators/application/lib/normalize-options.js +0 -1
- package/src/generators/application/lib/set-defaults.js +1 -2
- package/src/generators/application/lib/show-possible-warnings.d.ts +3 -0
- package/src/generators/application/lib/show-possible-warnings.js +11 -0
- package/src/generators/application/lib/update-jest-config.js +0 -1
- package/src/generators/application/schema.d.ts +1 -1
- package/src/generators/application/schema.json +2 -2
- package/src/generators/component/component.js +0 -1
- package/src/generators/component/get-component-tests.js +0 -1
- package/src/generators/component/noramlized-schema.js +0 -1
- package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -1
- package/src/generators/component-story/component-story.js +0 -1
- package/src/generators/component-test/component-test.js +0 -1
- package/src/generators/component-test/schema.js +0 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -1
- package/src/generators/cypress-component-configuration/lib/add-files.js +0 -1
- package/src/generators/hook/hook.js +0 -1
- package/src/generators/host/host.js +0 -1
- package/src/generators/host/lib/add-module-federation-files.js +0 -1
- package/src/generators/host/lib/setup-ssr-for-host.js +0 -1
- package/src/generators/host/lib/update-module-federation-e2e-project.js +0 -1
- package/src/generators/host/schema.d.ts +1 -1
- package/src/generators/host/schema.json +1 -1
- package/src/generators/init/init.js +0 -26
- package/src/generators/init/schema.d.ts +0 -1
- package/src/generators/init/schema.json +0 -5
- package/src/generators/library/lib/add-linting.js +0 -1
- package/src/generators/library/lib/add-rollup-build-target.js +0 -1
- package/src/generators/library/lib/create-files.js +25 -4
- package/src/generators/library/lib/install-common-dependencies.js +3 -1
- package/src/generators/library/lib/maybe-js.js +0 -1
- package/src/generators/library/lib/normalize-options.js +0 -1
- package/src/generators/library/lib/set-defaults.js +0 -1
- package/src/generators/library/lib/update-app-routes.js +0 -1
- package/src/generators/library/library.js +1 -2
- package/src/generators/redux/redux.js +0 -1
- package/src/generators/remote/lib/setup-ssr-for-remote.js +0 -1
- package/src/generators/remote/lib/update-host-with-remote.js +0 -1
- package/src/generators/remote/remote.js +0 -1
- package/src/generators/remote/schema.d.ts +1 -1
- package/src/generators/remote/schema.json +1 -1
- package/src/generators/setup-ssr/setup-ssr.js +0 -1
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +0 -1
- package/src/generators/setup-tailwind/lib/update-project.js +0 -1
- package/src/generators/setup-tailwind/schema.js +0 -1
- package/src/generators/setup-tailwind/setup-tailwind.js +0 -1
- package/src/generators/stories/stories.js +0 -1
- package/src/generators/storybook-configuration/configuration.js +0 -1
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js +0 -1
- package/src/migrations/update-12-0-0/update-emotion-setup.js +0 -1
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js +0 -1
- package/src/migrations/update-12-8-0/update-12-8-0.js +0 -1
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js +0 -1
- package/src/migrations/update-13-0-0/update-emotion-setup.js +0 -1
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js +0 -1
- package/src/migrations/update-13-10-0/update-13-10-0.js +0 -1
- package/src/migrations/update-14-0-0/add-default-development-configurations.js +0 -1
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +0 -1
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +0 -1
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js +0 -1
- package/src/migrations/update-14-6-0/add-preset-jest-config.js +0 -1
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +0 -1
- package/src/migrations/update-15-3-0/update-rollup-executor.js +0 -1
- package/src/migrations/update-15-6-3/webpack-config-setup.js +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -1
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +0 -1
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +0 -1
- package/src/module-federation/ast-utils.js +0 -1
- package/src/module-federation/load-config.js +0 -1
- package/src/module-federation/models.js +0 -1
- package/src/module-federation/package-json.js +0 -1
- package/src/module-federation/utils.js +0 -1
- package/src/module-federation/with-module-federation-ssr.js +0 -1
- package/src/module-federation/with-module-federation.js +0 -1
- package/src/rules/add-styled-dependencies.js +0 -1
- package/src/rules/update-module-federation-project.js +0 -1
- package/src/utils/assertion.js +0 -1
- package/src/utils/ast-utils.js +0 -1
- package/src/utils/component-props.js +0 -1
- package/src/utils/create-ts-config.js +0 -1
- package/src/utils/ct-utils.js +0 -1
- package/src/utils/dependencies.js +0 -1
- package/src/utils/format-file.js +0 -1
- package/src/utils/get-in-source-vitest-tests-template.js +0 -1
- package/src/utils/jest-utils.js +0 -1
- package/src/utils/lint.js +0 -1
- package/src/utils/styled.js +0 -1
- package/src/utils/testing-generators.js +0 -1
- package/src/utils/versions.js +0 -1
- package/tailwind.js +0 -1
- package/ast-utils.js.map +0 -1
- package/babel.js.map +0 -1
- package/index.js.map +0 -1
- package/module-federation.js.map +0 -1
- package/plugins/bundle-rollup.js.map +0 -1
- package/plugins/component-testing/index.js.map +0 -1
- package/plugins/component-testing/webpack-fallback.js.map +0 -1
- package/plugins/jest.js.map +0 -1
- package/plugins/storybook/index.js.map +0 -1
- package/plugins/storybook/merge-plugins.js.map +0 -1
- package/plugins/webpack.js.map +0 -1
- package/plugins/with-react.js.map +0 -1
- package/src/executors/module-federation-dev-server/compat.js.map +0 -1
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +0 -1
- package/src/executors/module-federation-ssr-dev-server/compat.js.map +0 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +0 -1
- package/src/generators/application/application.js.map +0 -1
- package/src/generators/application/lib/add-cypress.js.map +0 -1
- package/src/generators/application/lib/add-jest.js.map +0 -1
- package/src/generators/application/lib/add-project.js.map +0 -1
- package/src/generators/application/lib/add-routing.js.map +0 -1
- package/src/generators/application/lib/create-application-files.js.map +0 -1
- package/src/generators/application/lib/find-free-port.js.map +0 -1
- package/src/generators/application/lib/get-app-tests.js.map +0 -1
- package/src/generators/application/lib/install-common-dependencies.js.map +0 -1
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/lib/set-defaults.js.map +0 -1
- package/src/generators/application/lib/update-jest-config.js.map +0 -1
- package/src/generators/component/component.js.map +0 -1
- package/src/generators/component/get-component-tests.js.map +0 -1
- package/src/generators/component/noramlized-schema.js.map +0 -1
- package/src/generators/component-cypress-spec/component-cypress-spec.js.map +0 -1
- package/src/generators/component-story/component-story.js.map +0 -1
- package/src/generators/component-test/component-test.js.map +0 -1
- package/src/generators/component-test/schema.js.map +0 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +0 -1
- package/src/generators/cypress-component-configuration/lib/add-files.js.map +0 -1
- package/src/generators/hook/hook.js.map +0 -1
- package/src/generators/host/host.js.map +0 -1
- package/src/generators/host/lib/add-module-federation-files.js.map +0 -1
- package/src/generators/host/lib/setup-ssr-for-host.js.map +0 -1
- package/src/generators/host/lib/update-module-federation-e2e-project.js.map +0 -1
- package/src/generators/init/init.js.map +0 -1
- package/src/generators/library/files/common/.babelrc__tmpl__ +0 -16
- package/src/generators/library/lib/add-linting.js.map +0 -1
- package/src/generators/library/lib/add-rollup-build-target.js.map +0 -1
- package/src/generators/library/lib/create-files.js.map +0 -1
- package/src/generators/library/lib/install-common-dependencies.js.map +0 -1
- package/src/generators/library/lib/maybe-js.js.map +0 -1
- package/src/generators/library/lib/normalize-options.js.map +0 -1
- package/src/generators/library/lib/set-defaults.js.map +0 -1
- package/src/generators/library/lib/update-app-routes.js.map +0 -1
- package/src/generators/library/library.js.map +0 -1
- package/src/generators/redux/redux.js.map +0 -1
- package/src/generators/remote/lib/setup-ssr-for-remote.js.map +0 -1
- package/src/generators/remote/lib/update-host-with-remote.js.map +0 -1
- package/src/generators/remote/remote.js.map +0 -1
- package/src/generators/setup-ssr/setup-ssr.js.map +0 -1
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js.map +0 -1
- package/src/generators/setup-tailwind/lib/update-project.js.map +0 -1
- package/src/generators/setup-tailwind/schema.js.map +0 -1
- package/src/generators/setup-tailwind/setup-tailwind.js.map +0 -1
- package/src/generators/stories/stories.js.map +0 -1
- package/src/generators/storybook-configuration/configuration.js.map +0 -1
- package/src/migrations/update-12-0-0/remove-react-redux-types-package.js.map +0 -1
- package/src/migrations/update-12-0-0/update-emotion-setup.js.map +0 -1
- package/src/migrations/update-12-0-0/use-react-jsx-in-tsconfig.js.map +0 -1
- package/src/migrations/update-12-8-0/update-12-8-0.js.map +0 -1
- package/src/migrations/update-13-0-0/migrate-storybook-to-webpack-5.js.map +0 -1
- package/src/migrations/update-13-0-0/update-emotion-setup.js.map +0 -1
- package/src/migrations/update-13-0-0/webpack5-changes-utils.js.map +0 -1
- package/src/migrations/update-13-10-0/update-13-10-0.js.map +0 -1
- package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +0 -1
- package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +0 -1
- package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +0 -1
- package/src/migrations/update-14-1-0/update-external-emotion-jsx-runtime.js.map +0 -1
- package/src/migrations/update-14-6-0/add-preset-jest-config.js.map +0 -1
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js.map +0 -1
- package/src/migrations/update-15-3-0/update-rollup-executor.js.map +0 -1
- package/src/migrations/update-15-6-3/webpack-config-setup.js.map +0 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +0 -1
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js.map +0 -1
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js.map +0 -1
- package/src/module-federation/ast-utils.js.map +0 -1
- package/src/module-federation/load-config.js.map +0 -1
- package/src/module-federation/models.js.map +0 -1
- package/src/module-federation/package-json.js.map +0 -1
- package/src/module-federation/utils.js.map +0 -1
- package/src/module-federation/with-module-federation-ssr.js.map +0 -1
- package/src/module-federation/with-module-federation.js.map +0 -1
- package/src/rules/add-styled-dependencies.js.map +0 -1
- package/src/rules/update-module-federation-project.js.map +0 -1
- package/src/utils/assertion.js.map +0 -1
- package/src/utils/ast-utils.js.map +0 -1
- package/src/utils/component-props.js.map +0 -1
- package/src/utils/create-ts-config.js.map +0 -1
- package/src/utils/ct-utils.js.map +0 -1
- package/src/utils/dependencies.js.map +0 -1
- package/src/utils/format-file.js.map +0 -1
- package/src/utils/get-in-source-vitest-tests-template.js.map +0 -1
- package/src/utils/jest-utils.js.map +0 -1
- package/src/utils/lint.js.map +0 -1
- package/src/utils/styled.js.map +0 -1
- package/src/utils/testing-generators.js.map +0 -1
- package/src/utils/versions.js.map +0 -1
- package/tailwind.js.map +0 -1
package/ast-utils.js
CHANGED
|
@@ -9,4 +9,3 @@ Object.defineProperty(exports, "findElements", { enumerable: true, get: function
|
|
|
9
9
|
Object.defineProperty(exports, "findDefaultExport", { enumerable: true, get: function () { return ast_utils_1.findDefaultExport; } });
|
|
10
10
|
Object.defineProperty(exports, "findClosestOpening", { enumerable: true, get: function () { return ast_utils_1.findClosestOpening; } });
|
|
11
11
|
Object.defineProperty(exports, "isTag", { enumerable: true, get: function () { return ast_utils_1.isTag; } });
|
|
12
|
-
//# sourceMappingURL=ast-utils.js.map
|
package/babel.js
CHANGED
package/index.js
CHANGED
|
@@ -43,4 +43,3 @@ Object.defineProperty(exports, "componentTestGenerator", { enumerable: true, get
|
|
|
43
43
|
var setup_tailwind_1 = require("./src/generators/setup-tailwind/setup-tailwind");
|
|
44
44
|
Object.defineProperty(exports, "setupTailwindGenerator", { enumerable: true, get: function () { return setup_tailwind_1.setupTailwindGenerator; } });
|
|
45
45
|
tslib_1.__exportStar(require("./plugins/with-react"), exports);
|
|
46
|
-
//# sourceMappingURL=index.js.map
|
package/module-federation.js
CHANGED
|
@@ -10,4 +10,3 @@ module.exports = with_module_federation_1.withModuleFederation;
|
|
|
10
10
|
// Allow newer generated code to work: `const { withModuleFederation } = require(...)`;
|
|
11
11
|
module.exports.withModuleFederation = with_module_federation_1.withModuleFederation;
|
|
12
12
|
module.exports.withModuleFederationForSSR = with_module_federation_ssr_1.withModuleFederationForSSR;
|
|
13
|
-
//# sourceMappingURL=module-federation.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "16.4.0-beta.
|
|
3
|
+
"version": "16.4.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx 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.",
|
|
6
6
|
"repository": {
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"migrations": "./migrations.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nrwl/react": "16.4.0-beta.
|
|
35
|
-
"@nx/devkit": "16.4.0-beta.
|
|
36
|
-
"@nx/js": "16.4.0-beta.
|
|
37
|
-
"@nx/linter": "16.4.0-beta.
|
|
38
|
-
"@nx/web": "16.4.0-beta.
|
|
34
|
+
"@nrwl/react": "16.4.0-beta.2",
|
|
35
|
+
"@nx/devkit": "16.4.0-beta.2",
|
|
36
|
+
"@nx/js": "16.4.0-beta.2",
|
|
37
|
+
"@nx/linter": "16.4.0-beta.2",
|
|
38
|
+
"@nx/web": "16.4.0-beta.2",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
40
40
|
"@svgr/webpack": "^8.0.1",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"types": "./index.d.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "abb2678056668cc8beaaf9c5ebc2a2e6ad487173"
|
|
50
50
|
}
|
package/plugins/bundle-rollup.js
CHANGED
package/plugins/jest.js
CHANGED
|
@@ -8,6 +8,7 @@ const path_1 = require("path");
|
|
|
8
8
|
const webpack_1 = require("webpack");
|
|
9
9
|
const merge_plugins_1 = require("./merge-plugins");
|
|
10
10
|
const with_react_1 = require("../with-react");
|
|
11
|
+
const fs_1 = require("fs");
|
|
11
12
|
// This is shamelessly taken from CRA and modified for NX use
|
|
12
13
|
// https://github.com/facebook/create-react-app/blob/4784997f0682e75eb32a897b4ffe34d735912e6c/packages/react-scripts/config/env.js#L71
|
|
13
14
|
function getClientEnvironment(mode) {
|
|
@@ -44,6 +45,67 @@ function getClientEnvironment(mode) {
|
|
|
44
45
|
}
|
|
45
46
|
const core = (prev, options) => (Object.assign(Object.assign({}, prev), { disableWebpackDefaults: true }));
|
|
46
47
|
exports.core = core;
|
|
48
|
+
const getProjectData = (storybookOptions) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
const fallbackData = {
|
|
50
|
+
workspaceRoot: storybookOptions.configDir,
|
|
51
|
+
projectRoot: '',
|
|
52
|
+
sourceRoot: '',
|
|
53
|
+
};
|
|
54
|
+
// Edge-case: not running from Nx
|
|
55
|
+
if (!process.env.NX_WORKSPACE_ROOT)
|
|
56
|
+
return fallbackData;
|
|
57
|
+
const projectGraph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
58
|
+
const projectNode = projectGraph.nodes[process.env.NX_TASK_TARGET_PROJECT];
|
|
59
|
+
return projectNode
|
|
60
|
+
? {
|
|
61
|
+
workspaceRoot: process.env.NX_WORKSPACE_ROOT,
|
|
62
|
+
projectRoot: projectNode.data.root,
|
|
63
|
+
sourceRoot: projectNode.data.sourceRoot,
|
|
64
|
+
projectNode,
|
|
65
|
+
}
|
|
66
|
+
: // Edge-case: missing project node
|
|
67
|
+
fallbackData;
|
|
68
|
+
});
|
|
69
|
+
const fixBabelConfigurationIfNeeded = (webpackConfig, projectData) => {
|
|
70
|
+
if (!projectData.projectNode)
|
|
71
|
+
return;
|
|
72
|
+
const isUsingBabelUpwardRootMode = Object.keys(projectData.projectNode.data.targets).find((k) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const targetConfig = projectData.projectNode.data.targets[k];
|
|
75
|
+
return ((targetConfig.executor === '@nx/webpack:webpack' ||
|
|
76
|
+
targetConfig.executor === '@nrwl/webpack:webpack') &&
|
|
77
|
+
((_a = targetConfig.options) === null || _a === void 0 ? void 0 : _a.babelUpwardRootMode));
|
|
78
|
+
});
|
|
79
|
+
if (isUsingBabelUpwardRootMode)
|
|
80
|
+
return;
|
|
81
|
+
let babelrcPath;
|
|
82
|
+
for (const ext of ['', '.json', '.js', '.cjs', '.mjs', '.cts']) {
|
|
83
|
+
const candidate = (0, path_1.join)(projectData.workspaceRoot, projectData.projectRoot, `.babelrc${ext}`);
|
|
84
|
+
if ((0, fs_1.existsSync)(candidate)) {
|
|
85
|
+
babelrcPath = candidate;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Unexpected setup, skip.
|
|
90
|
+
if (!babelrcPath)
|
|
91
|
+
return;
|
|
92
|
+
let babelRuleItem;
|
|
93
|
+
for (const rule of webpackConfig.module.rules) {
|
|
94
|
+
if (typeof rule === 'string')
|
|
95
|
+
continue;
|
|
96
|
+
if (!Array.isArray(rule.use))
|
|
97
|
+
continue;
|
|
98
|
+
for (const item of rule.use) {
|
|
99
|
+
if (typeof item !== 'string' && item['loader'].includes('babel-loader')) {
|
|
100
|
+
babelRuleItem = item;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (babelRuleItem) {
|
|
106
|
+
babelRuleItem.options.configFile = babelrcPath;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
47
109
|
const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
110
|
var _a, _b, _c, _d, _e, _f;
|
|
49
111
|
devkit_1.logger.info('=> Loading Nx React Storybook Addon from "@nx/react/plugins/storybook"');
|
|
@@ -57,9 +119,9 @@ const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void
|
|
|
57
119
|
}
|
|
58
120
|
const { withNx, withWeb } = require('@nx/webpack');
|
|
59
121
|
const tsconfigPath = (0, path_1.join)(options.configDir, 'tsconfig.json');
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
122
|
+
const projectData = yield getProjectData(options);
|
|
123
|
+
fixBabelConfigurationIfNeeded(storybookWebpackConfig, projectData);
|
|
124
|
+
const builderOptions = Object.assign(Object.assign({}, options), { root: projectData.workspaceRoot, projectRoot: projectData.projectRoot, sourceRoot: projectData.sourceRoot, fileReplacements: [], sourceMap: true, styles: (_a = options.styles) !== null && _a !== void 0 ? _a : [], optimization: {}, tsConfig: tsconfigPath, extractCss: storybookWebpackConfig.mode === 'production', target: 'web' });
|
|
63
125
|
// ESM build for modern browsers.
|
|
64
126
|
let baseWebpackConfig = {};
|
|
65
127
|
const configure = (0, config_1.composePluginsSync)(withNx({ skipTypeChecking: true }), withWeb(), (0, with_react_1.withReact)());
|
|
@@ -77,4 +139,3 @@ const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void
|
|
|
77
139
|
.plugins) !== null && _d !== void 0 ? _d : [])) }), plugins: (0, merge_plugins_1.mergePlugins)(new webpack_1.DefinePlugin(getClientEnvironment(storybookWebpackConfig.mode).stringified), ...((_e = storybookWebpackConfig.plugins) !== null && _e !== void 0 ? _e : []), ...((_f = finalConfig.plugins) !== null && _f !== void 0 ? _f : [])) });
|
|
78
140
|
});
|
|
79
141
|
exports.webpack = webpack;
|
|
80
|
-
//# sourceMappingURL=index.js.map
|
package/plugins/webpack.js
CHANGED
package/plugins/with-react.js
CHANGED
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const devkit_1 = require("@nx/devkit");
|
|
4
4
|
const module_federation_dev_server_impl_1 = require("./module-federation-dev-server.impl");
|
|
5
5
|
exports.default = (0, devkit_1.convertNxExecutor)(module_federation_dev_server_impl_1.default);
|
|
6
|
-
//# sourceMappingURL=compat.js.map
|
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const devkit_1 = require("@nx/devkit");
|
|
4
4
|
const module_federation_ssr_dev_server_impl_1 = require("./module-federation-ssr-dev-server.impl");
|
|
5
5
|
exports.default = (0, devkit_1.convertNxExecutor)(module_federation_ssr_dev_server_impl_1.default);
|
|
6
|
-
//# sourceMappingURL=compat.js.map
|
|
@@ -21,6 +21,7 @@ const install_common_dependencies_1 = require("./lib/install-common-dependencies
|
|
|
21
21
|
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
22
22
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
23
23
|
const chalk = require("chalk");
|
|
24
|
+
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
24
25
|
function addLinting(host, options) {
|
|
25
26
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
27
|
const tasks = [];
|
|
@@ -42,9 +43,7 @@ function addLinting(host, options) {
|
|
|
42
43
|
tasks.push(lintTask);
|
|
43
44
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, '.eslintrc.json'), lint_1.extendReactEslintJson);
|
|
44
45
|
if (!options.skipPackageJson) {
|
|
45
|
-
const installTask = yield (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies,
|
|
46
|
-
? { 'swc-loader': versions_1.swcLoaderVersion }
|
|
47
|
-
: {})));
|
|
46
|
+
const installTask = yield (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
48
47
|
const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(host);
|
|
49
48
|
tasks.push(installTask, addSwcTask);
|
|
50
49
|
}
|
|
@@ -56,7 +55,8 @@ function applicationGenerator(host, schema) {
|
|
|
56
55
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
56
|
const tasks = [];
|
|
58
57
|
const options = (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
59
|
-
|
|
58
|
+
(0, show_possible_warnings_1.showPossibleWarnings)(host, options);
|
|
59
|
+
const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true, skipHelperLibs: options.bundler === 'vite' }));
|
|
60
60
|
tasks.push(initTask);
|
|
61
61
|
if (!options.rootProject) {
|
|
62
62
|
(0, create_ts_config_1.extractTsConfigBase)(host);
|
|
@@ -164,4 +164,3 @@ function applicationGenerator(host, schema) {
|
|
|
164
164
|
exports.applicationGenerator = applicationGenerator;
|
|
165
165
|
exports.default = applicationGenerator;
|
|
166
166
|
exports.applicationSchematic = (0, devkit_1.convertNxGenerator)(applicationGenerator);
|
|
167
|
-
//# sourceMappingURL=application.js.map
|
|
@@ -101,4 +101,3 @@ function createApplicationFiles(host, options) {
|
|
|
101
101
|
(0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
|
|
102
102
|
}
|
|
103
103
|
exports.createApplicationFiles = createApplicationFiles;
|
|
104
|
-
//# sourceMappingURL=create-application-files.js.map
|
|
@@ -4,26 +4,32 @@ exports.installCommonDependencies = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const versions_1 = require("../../../utils/versions");
|
|
6
6
|
function installCommonDependencies(host, options) {
|
|
7
|
-
|
|
7
|
+
const devDependencies = {};
|
|
8
8
|
// Vite requires style preprocessors to be installed manually.
|
|
9
9
|
// `@nx/webpack` installs them automatically for now.
|
|
10
|
-
// TODO(jack): Once we clean up webpack we can remove this check
|
|
11
10
|
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
|
|
12
11
|
switch (options.style) {
|
|
13
12
|
case 'scss':
|
|
14
|
-
devDependencies =
|
|
13
|
+
devDependencies['sass'] = versions_1.sassVersion;
|
|
15
14
|
break;
|
|
16
15
|
case 'less':
|
|
17
|
-
devDependencies =
|
|
16
|
+
devDependencies['less'] = versions_1.lessVersion;
|
|
18
17
|
break;
|
|
19
18
|
case 'styl': // @TODO(17): deprecated, going to be removed in Nx 17
|
|
20
|
-
devDependencies =
|
|
19
|
+
devDependencies['stylus'] = versions_1.stylusVersion;
|
|
21
20
|
break;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if (options.bundler === 'webpack') {
|
|
24
|
+
if (options.compiler === 'swc') {
|
|
25
|
+
devDependencies['swc-loader'] = versions_1.swcLoaderVersion;
|
|
26
|
+
}
|
|
27
|
+
else if (options.compiler === 'babel') {
|
|
28
|
+
// babel-loader is currently included in @nx/webpack
|
|
29
|
+
// TODO(jack): Install babel-loader and other babel packages only as needed
|
|
30
|
+
devDependencies['@babel/preset-react'] = versions_1.babelPresetReactVersion;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
|
|
27
34
|
}
|
|
28
35
|
exports.installCommonDependencies = installCommonDependencies;
|
|
29
|
-
//# sourceMappingURL=install-common-dependencies.js.map
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setDefaults = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
function setDefaults(host, options) {
|
|
6
|
-
if (options.
|
|
6
|
+
if (options.skipNxJson) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
@@ -20,4 +20,3 @@ function setDefaults(host, options) {
|
|
|
20
20
|
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
21
21
|
}
|
|
22
22
|
exports.setDefaults = setDefaults;
|
|
23
|
-
//# sourceMappingURL=set-defaults.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.showPossibleWarnings = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function showPossibleWarnings(tree, options) {
|
|
7
|
+
if (options.style === 'styled-jsx' && options.compiler === 'swc') {
|
|
8
|
+
devkit_1.logger.warn(`styled-jsx may not work with SWC. Try using ${chalk.bold('nx g @nx/react:app --compiler=babel')} instead.`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.showPossibleWarnings = showPossibleWarnings;
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"default": false,
|
|
99
99
|
"x-priority": "internal"
|
|
100
100
|
},
|
|
101
|
-
"
|
|
102
|
-
"description": "Skip updating `
|
|
101
|
+
"skipNxJson": {
|
|
102
|
+
"description": "Skip updating `nx.json` with default options based on values provided to this app.",
|
|
103
103
|
"type": "boolean",
|
|
104
104
|
"default": false,
|
|
105
105
|
"x-priority": "internal"
|
|
@@ -102,4 +102,3 @@ function findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2
|
|
|
102
102
|
}
|
|
103
103
|
exports.default = componentCypressGenerator;
|
|
104
104
|
exports.componentCypressSchematic = (0, devkit_1.convertNxGenerator)(componentCypressGenerator);
|
|
105
|
-
//# sourceMappingURL=component-cypress-spec.js.map
|
|
@@ -78,4 +78,3 @@ function componentStoryGenerator(host, schema) {
|
|
|
78
78
|
exports.componentStoryGenerator = componentStoryGenerator;
|
|
79
79
|
exports.default = componentStoryGenerator;
|
|
80
80
|
exports.componentStorySchematic = (0, devkit_1.convertNxGenerator)(componentStoryGenerator);
|
|
81
|
-
//# sourceMappingURL=component-story.js.map
|
|
@@ -18,4 +18,3 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
|
|
|
18
18
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/module-federation`), options.appProjectRoot, templateVariables);
|
|
19
19
|
}
|
|
20
20
|
exports.addModuleFederationFiles = addModuleFederationFiles;
|
|
21
|
-
//# sourceMappingURL=add-module-federation-files.js.map
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"default": false,
|
|
80
80
|
"x-priority": "internal"
|
|
81
81
|
},
|
|
82
|
-
"
|
|
82
|
+
"skipNxJson": {
|
|
83
83
|
"description": "Skip updating workspace.json with default options based on values provided to this app (e.g. babel, style).",
|
|
84
84
|
"type": "boolean",
|
|
85
85
|
"default": false,
|
|
@@ -29,22 +29,6 @@ function updateDependencies(host, schema) {
|
|
|
29
29
|
'@testing-library/react': versions_1.testingLibraryReactVersion,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function initRootBabelConfig(tree, schema) {
|
|
33
|
-
var _a;
|
|
34
|
-
if (tree.exists('/babel.config.json') || tree.exists('/babel.config.js')) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!schema.skipBabelConfig) {
|
|
38
|
-
(0, devkit_1.writeJson)(tree, '/babel.config.json', {
|
|
39
|
-
babelrcRoots: ['*'], // Make sure .babelrc files other than root can be loaded in a monorepo
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
43
|
-
if ((_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.sharedGlobals) {
|
|
44
|
-
nxJson.namedInputs.sharedGlobals.push('{workspaceRoot}/babel.config.json');
|
|
45
|
-
}
|
|
46
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
47
|
-
}
|
|
48
32
|
function reactInitGenerator(host, schema) {
|
|
49
33
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
34
|
const tasks = [];
|
|
@@ -57,15 +41,6 @@ function reactInitGenerator(host, schema) {
|
|
|
57
41
|
const cypressTask = yield cypressInitGenerator(host, {});
|
|
58
42
|
tasks.push(cypressTask);
|
|
59
43
|
}
|
|
60
|
-
if (!schema.skipPackageJson && !schema.skipBabelConfig) {
|
|
61
|
-
const installBabelTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
62
|
-
'@babel/preset-react': versions_1.babelPresetReactVersion,
|
|
63
|
-
});
|
|
64
|
-
tasks.push(installBabelTask);
|
|
65
|
-
}
|
|
66
|
-
if (!schema.skipBabelConfig) {
|
|
67
|
-
initRootBabelConfig(host, schema);
|
|
68
|
-
}
|
|
69
44
|
if (!schema.skipPackageJson) {
|
|
70
45
|
const installTask = updateDependencies(host, schema);
|
|
71
46
|
tasks.push(installTask);
|
|
@@ -76,4 +51,3 @@ function reactInitGenerator(host, schema) {
|
|
|
76
51
|
exports.reactInitGenerator = reactInitGenerator;
|
|
77
52
|
exports.default = reactInitGenerator;
|
|
78
53
|
exports.reactInitSchematic = (0, devkit_1.convertNxGenerator)(reactInitGenerator);
|
|
79
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -28,11 +28,6 @@
|
|
|
28
28
|
"type": "boolean",
|
|
29
29
|
"default": false
|
|
30
30
|
},
|
|
31
|
-
"skipBabelConfig": {
|
|
32
|
-
"description": "Do not generate a root babel.config.json (if babel is not needed).",
|
|
33
|
-
"type": "boolean",
|
|
34
|
-
"default": false
|
|
35
|
-
},
|
|
36
31
|
"skipHelperLibs": {
|
|
37
32
|
"description": "Do not install tslib.",
|
|
38
33
|
"type": "boolean",
|