Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit e87df91

Browse files
authored
Merge pull request #143 from swengorschewski/dependencies
Install typings as dev dependencies
2 parents d0d5133 + 6ae7751 commit e87df91

File tree

1 file changed

+17
-18
lines changed
  • packages/react-scripts/scripts

1 file changed

+17
-18
lines changed

packages/react-scripts/scripts/init.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ module.exports = function(
4545
eject: 'react-scripts-ts eject',
4646
};
4747

48-
console.log(appPackage);
49-
5048
fs.writeFileSync(
5149
path.join(appPath, 'package.json'),
5250
JSON.stringify(appPackage, null, 2)
@@ -104,6 +102,23 @@ module.exports = function(
104102
args = ['install', '--save', verbose && '--verbose'].filter(e => e);
105103
}
106104

105+
// Install dev dependencies
106+
const types = [
107+
'@types/node',
108+
'@types/react',
109+
'@types/react-dom',
110+
'@types/jest',
111+
];
112+
113+
console.log(`Installing ${types.join(', ')} as dev dependencies ${command}...`);
114+
console.log();
115+
116+
const devProc = spawn.sync(command, args.concat('-D').concat(types), { stdio: 'inherit' });
117+
if (devProc.status !== 0) {
118+
console.error(`\`${command} ${args.concat(types).join(' ')}\` failed`);
119+
return;
120+
}
121+
107122
// Install additional template dependencies, if present
108123
const templateDependenciesPath = path.join(
109124
appPath,
@@ -119,22 +134,6 @@ module.exports = function(
119134
fs.unlinkSync(templateDependenciesPath);
120135
}
121136

122-
const types = [
123-
'@types/node',
124-
'@types/react',
125-
'@types/react-dom',
126-
'@types/jest',
127-
];
128-
129-
console.log(`Installing ${types.join(', ')} ${command}...`);
130-
console.log();
131-
132-
const proc = spawn.sync(command, args.concat(types), { stdio: 'inherit' });
133-
if (proc.status !== 0) {
134-
console.error(`\`${command} ${args.concat(types).join(' ')}\` failed`);
135-
return;
136-
}
137-
138137
// Install react and react-dom for backward compatibility with old CRA cli
139138
// which doesn't install react and react-dom along with react-scripts
140139
// or template is presetend (via --internal-testing-template)

0 commit comments

Comments
 (0)