nx 20.5.0-beta.4 → 20.5.0-beta.5
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/package.json +11 -11
- package/src/command-line/init/command-object.js +5 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +1 -0
- package/src/command-line/init/implementation/utils.js +14 -0
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +25 -3
- package/src/command-line/release/config/config.js +1 -0
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/lock-file/yarn-parser.js +10 -10
- package/src/utils/find-matching-projects.js +2 -2
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[532],{2558:()=>{}},s=>{var e;e=2558,s(s.s=e)}]);
|
Binary file
|
@@ -29,14 +29,14 @@ function getYarnLockfileNodes(lockFileContent, lockFileHash, packageJson) {
|
|
29
29
|
const isBerry = !!__metadata;
|
30
30
|
// yarn classic splits keys when parsing so we need to stich them back together
|
31
31
|
const groupedDependencies = groupDependencies(dependencies, isBerry);
|
32
|
-
return getNodes(groupedDependencies, packageJson,
|
32
|
+
return getNodes(groupedDependencies, packageJson, isBerry);
|
33
33
|
}
|
34
34
|
function getYarnLockfileDependencies(lockFileContent, lockFileHash, ctx) {
|
35
35
|
const { __metadata, ...dependencies } = parseLockFile(lockFileContent, lockFileHash);
|
36
36
|
const isBerry = !!__metadata;
|
37
37
|
// yarn classic splits keys when parsing so we need to stich them back together
|
38
38
|
const groupedDependencies = groupDependencies(dependencies, isBerry);
|
39
|
-
return getDependencies(groupedDependencies,
|
39
|
+
return getDependencies(groupedDependencies, ctx);
|
40
40
|
}
|
41
41
|
function getPackageNameKeyPairs(keys) {
|
42
42
|
const result = new Map();
|
@@ -51,7 +51,7 @@ function getPackageNameKeyPairs(keys) {
|
|
51
51
|
});
|
52
52
|
return result;
|
53
53
|
}
|
54
|
-
function getNodes(dependencies, packageJson,
|
54
|
+
function getNodes(dependencies, packageJson, isBerry) {
|
55
55
|
const nodes = new Map();
|
56
56
|
const combinedDeps = {
|
57
57
|
...packageJson.dependencies,
|
@@ -68,7 +68,7 @@ function getNodes(dependencies, packageJson, keyMap, isBerry) {
|
|
68
68
|
nameKeyPairs.forEach((keySet, packageName) => {
|
69
69
|
const keysArray = Array.from(keySet);
|
70
70
|
// use key relevant to the package name
|
71
|
-
const version = findVersion(packageName, keysArray[0], snapshot, isBerry);
|
71
|
+
const [version, isAlias] = findVersion(packageName, keysArray[0], snapshot, isBerry);
|
72
72
|
// use keys linked to the extracted package name
|
73
73
|
keysArray.forEach((key) => {
|
74
74
|
// we don't need to keep duplicates, we can just track the keys
|
@@ -79,7 +79,7 @@ function getNodes(dependencies, packageJson, keyMap, isBerry) {
|
|
79
79
|
}
|
80
80
|
const node = {
|
81
81
|
type: 'npm',
|
82
|
-
name: version
|
82
|
+
name: version && !isAlias
|
83
83
|
? `npm:${packageName}@${version}`
|
84
84
|
: `npm:${packageName}`,
|
85
85
|
data: {
|
@@ -151,7 +151,7 @@ function findVersion(packageName, key, snapshot, isBerry) {
|
|
151
151
|
? snapshot.resolution && !snapshot.resolution.startsWith(`${packageName}@`)
|
152
152
|
: versionRange.startsWith('npm:');
|
153
153
|
if (isAlias) {
|
154
|
-
return versionRange;
|
154
|
+
return [versionRange, true];
|
155
155
|
}
|
156
156
|
// check for berry tarball packages
|
157
157
|
if (isBerry &&
|
@@ -159,13 +159,13 @@ function findVersion(packageName, key, snapshot, isBerry) {
|
|
159
159
|
// different registry would yield suffix following '::' which we don't need
|
160
160
|
snapshot.resolution.split('::')[0] !==
|
161
161
|
`${packageName}@npm:${snapshot.version}`) {
|
162
|
-
return snapshot.resolution.slice(packageName.length + 1);
|
162
|
+
return [snapshot.resolution.slice(packageName.length + 1)];
|
163
163
|
}
|
164
164
|
if (!isBerry && isTarballPackage(versionRange, snapshot)) {
|
165
|
-
return snapshot.resolved;
|
165
|
+
return [snapshot.resolved];
|
166
166
|
}
|
167
167
|
// otherwise it's a standard version
|
168
|
-
return snapshot.version;
|
168
|
+
return [snapshot.version];
|
169
169
|
}
|
170
170
|
// check if snapshot represents tarball package
|
171
171
|
function isTarballPackage(versionRange, snapshot) {
|
@@ -193,7 +193,7 @@ function getHoistedVersion(packageName) {
|
|
193
193
|
return version;
|
194
194
|
}
|
195
195
|
}
|
196
|
-
function getDependencies(dependencies,
|
196
|
+
function getDependencies(dependencies, ctx) {
|
197
197
|
const projectGraphDependencies = [];
|
198
198
|
Object.keys(dependencies).forEach((keys) => {
|
199
199
|
const snapshot = dependencies[keys];
|
@@ -112,8 +112,8 @@ function addMatchingProjectsByName(projectNames, projects, pattern, matchedProje
|
|
112
112
|
return;
|
113
113
|
}
|
114
114
|
if (!(0, globs_1.isGlobPattern)(pattern.value)) {
|
115
|
-
// Custom regex that is basically \b
|
116
|
-
const regex = new RegExp(`(?<![a-zA-Z0-9])${pattern.value}(?![a-zA-Z0-9])`, 'i');
|
115
|
+
// Custom regex that is basically \b but includes hyphens (-) and excludes underscores (_), so "foo" pattern matches "foo_bar" but not "foo-e2e".
|
116
|
+
const regex = new RegExp(`(?<![a-zA-Z0-9-])${pattern.value}(?![a-zA-Z0-9-])`, 'i');
|
117
117
|
const matchingProjects = Object.keys(projects).filter((name) => regex.test(name));
|
118
118
|
for (const projectName of matchingProjects) {
|
119
119
|
if (pattern.exclude) {
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function writeCracoConfig(appName: string, isCRA5: boolean, isStandalone: boolean): void;
|
@@ -1,61 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.writeCracoConfig = writeCracoConfig;
|
4
|
-
const fs_1 = require("fs");
|
5
|
-
function writeCracoConfig(appName, isCRA5, isStandalone) {
|
6
|
-
const configOverride = `
|
7
|
-
const path = require('path');
|
8
|
-
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
9
|
-
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
10
|
-
module.exports = {
|
11
|
-
webpack: {
|
12
|
-
configure: (config) => {
|
13
|
-
// Remove guard against importing modules outside of \`src\`.
|
14
|
-
// Needed for workspace projects.
|
15
|
-
config.resolve.plugins = config.resolve.plugins.filter(
|
16
|
-
(plugin) => !(plugin instanceof ModuleScopePlugin)
|
17
|
-
);
|
18
|
-
// Add support for importing workspace projects.
|
19
|
-
config.resolve.plugins.push(
|
20
|
-
new TsConfigPathsPlugin({
|
21
|
-
configFile: path.resolve(__dirname, 'tsconfig.json'),
|
22
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
23
|
-
mainFields: ['browser', 'module', 'main'],
|
24
|
-
})
|
25
|
-
);
|
26
|
-
${isCRA5
|
27
|
-
? `
|
28
|
-
// Replace include option for babel loader with exclude
|
29
|
-
// so babel will handle workspace projects as well.
|
30
|
-
config.module.rules[1].oneOf.forEach((r) => {
|
31
|
-
if (r.loader && r.loader.indexOf('babel') !== -1) {
|
32
|
-
r.exclude = /node_modules/;
|
33
|
-
delete r.include;
|
34
|
-
}
|
35
|
-
});`
|
36
|
-
: `
|
37
|
-
// Replace include option for babel loader with exclude
|
38
|
-
// so babel will handle workspace projects as well.
|
39
|
-
config.module.rules.forEach((r) => {
|
40
|
-
if (r.oneOf) {
|
41
|
-
const babelLoader = r.oneOf.find(
|
42
|
-
(rr) => rr.loader.indexOf('babel-loader') !== -1
|
43
|
-
);
|
44
|
-
babelLoader.exclude = /node_modules/;
|
45
|
-
delete babelLoader.include;
|
46
|
-
}
|
47
|
-
});
|
48
|
-
`}
|
49
|
-
return config;
|
50
|
-
},
|
51
|
-
},
|
52
|
-
jest: {
|
53
|
-
configure: (config) => {
|
54
|
-
config.resolver = '@nx/jest/plugins/resolver';
|
55
|
-
return config;
|
56
|
-
},
|
57
|
-
},
|
58
|
-
};
|
59
|
-
`;
|
60
|
-
(0, fs_1.writeFileSync)(isStandalone ? 'craco.config.js' : `apps/${appName}/craco.config.js`, configOverride);
|
61
|
-
}
|