Fix @type Installing

This commit is contained in:
William Monk
2017-05-22 13:31:27 +01:00
parent e7f422129c
commit 66e05f42e4
2 changed files with 33 additions and 23 deletions

View File

@@ -107,14 +107,6 @@ module.exports = function(
command = 'npm';
args = ['install', '--save', verbose && '--verbose'].filter(e => e);
}
args.push(
'react',
'react-dom',
'@types/node',
'@types/react',
'@types/react-dom',
'@types/jest'
);
// Install additional template dependencies, if present
const templateDependenciesPath = path.join(
@@ -131,19 +123,37 @@ module.exports = function(
fs.unlinkSync(templateDependenciesPath);
}
const types = [
'@types/node',
'@types/react',
'@types/react-dom',
'@types/jest',
];
console.log(`Installing ${types.join(', ')} ${command}...`);
console.log();
const proc = spawn.sync(command, args.concat(types), { stdio: 'inherit' });
if (proc.status !== 0) {
console.error(`\`${command} ${args.concat(types).join(' ')}\` failed`);
return;
}
// Install react and react-dom for backward compatibility with old CRA cli
// which doesn't install react and react-dom along with react-scripts
// or template is presetend (via --internal-testing-template)
// if (!isReactInstalled(appPackage) || template) {
console.log(`Installing react and react-dom using ${command}...`);
console.log();
if (!isReactInstalled(appPackage) || template) {
console.log(`Installing react and react-dom using ${command}...`);
console.log();
const proc = spawn.sync(command, args, { stdio: 'inherit' });
if (proc.status !== 0) {
console.error(`\`${command} ${args.join(' ')}\` failed`);
return;
const proc = spawn.sync(command, args.concat(['react', 'react-dom']), {
stdio: 'inherit',
});
if (proc.status !== 0) {
console.error(`\`${command} ${args.join(' ')}\` failed`);
return;
}
}
// }
// Display the most elegant way to cd.
// This needs to handle an undefined originalDirectory for