We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a999518 commit 913c009Copy full SHA for 913c009
packages/create-react-dependency/stages/installDependencies.js
@@ -2,12 +2,26 @@
2
3
const { execSync } = require("child_process");
4
5
+const yarnInstalled = () => {
6
+ try {
7
+ execSync('yarnpkg --version', { stdio: 'ignore' });
8
+ return true;
9
+ } catch (error) {
10
+ return false;
11
+ }
12
+}
13
+
14
const installDependencies = dir => {
15
const originalDirectory = process.cwd();
16
try {
17
process.chdir(dir);
18
- execSync("yarnpkg install", { stdio: "inherit" });
19
+ if (yarnInstalled) {
20
+ execSync("yarnpkg install", { stdio: "inherit" });
21
+ } else {
22
+ execSync("npm install", { stdio: "inherit" });
23
24
25
} catch (err) {
26
console.log(`\x1b[31m${err}\x1b[0m`);
27
}
0 commit comments