Skip to content

Commit

Permalink
Global installs dont have a local node_modules, so dont try cache the…
Browse files Browse the repository at this point in the history
… warning
  • Loading branch information
orta committed Jan 24, 2025
1 parent ae19b67 commit d5b166a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ function writeWarningFile() {
ourPackageInNodeModules,
'given-deprecation-warning'
);
fs.writeFileSync(warningFilePath, 'true');

if (fs.existsSync(ourPackageInNodeModules)) {
fs.writeFileSync(warningFilePath, 'true');
return true;
}
return false;
}

let projectName;
Expand All @@ -83,11 +88,14 @@ function init() {
console.log(
chalk.underline('https://react.dev/learn/start-a-new-react-project')
);
console.log('');
console.log(
chalk.grey('This error message will only be shown once per install.')
);
writeWarningFile();

const wroteWarningFile = writeWarningFile();
if (wroteWarningFile) {
console.log('');
console.log(
chalk.grey('This error message will only be shown once per install.')
);
}
}

const program = new commander.Command(packageJson.name)
Expand Down

0 comments on commit d5b166a

Please sign in to comment.