Skip to content

Commit d735a07

Browse files
author
Meo Huynh
committed
Only use yarn.lock.cached if using the default Yarn registry
1 parent 3efcdbf commit d735a07

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

packages/create-react-app/createReactApp.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,21 @@ function createApp(
268268
}
269269

270270
if (useYarn) {
271-
fs.copySync(
272-
require.resolve('./yarn.lock.cached'),
273-
path.join(root, 'yarn.lock')
274-
);
271+
let yarnUsesDefaultRegistry = true;
272+
try {
273+
yarnUsesDefaultRegistry =
274+
execSync('yarnpkg config get registry')
275+
.toString()
276+
.trim() === 'https://registry.yarnpkg.com';
277+
} catch (e) {
278+
// ignore
279+
}
280+
if (yarnUsesDefaultRegistry) {
281+
fs.copySync(
282+
require.resolve('./yarn.lock.cached'),
283+
path.join(root, 'yarn.lock')
284+
);
285+
}
275286
}
276287

277288
run(

0 commit comments

Comments
 (0)