Skip to content

Add no-bin-links option to create-react-app #7243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const program = new commander.Command(packageJson.name)
'--scripts-version <alternative-package>',
'use a non-standard version of react-scripts'
)
.option('--no-bin-links')
.option('--use-npm')
.option('--use-pnp')
.option('--typescript')
Expand Down Expand Up @@ -178,6 +179,7 @@ createApp(
projectName,
program.verbose,
program.scriptsVersion,
program.binLinks,
program.useNpm,
program.usePnp,
program.typescript,
Expand All @@ -188,6 +190,7 @@ function createApp(
name,
verbose,
version,
binLinks,
useNpm,
usePnp,
useTypescript,
Expand Down Expand Up @@ -294,6 +297,7 @@ function createApp(
verbose,
originalDirectory,
template,
binLinks,
useYarn,
usePnp,
useTypescript
Expand All @@ -309,13 +313,24 @@ function shouldUseYarn() {
}
}

function install(root, useYarn, usePnp, dependencies, verbose, isOnline) {
function install(
root,
binLinks,
useYarn,
usePnp,
dependencies,
verbose,
isOnline
) {
return new Promise((resolve, reject) => {
let command;
let args;
if (useYarn) {
command = 'yarnpkg';
args = ['add', '--exact'];
if (!binLinks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also be passed in if we're using npm?

args.push('--no-bin-links');
}
if (!isOnline) {
args.push('--offline');
}
Expand Down Expand Up @@ -378,6 +393,7 @@ function run(
verbose,
originalDirectory,
template,
binLinks,
useYarn,
usePnp,
useTypescript
Expand Down Expand Up @@ -416,6 +432,7 @@ function run(

return install(
root,
binLinks,
useYarn,
usePnp,
allDependencies,
Expand Down