Skip to content

Commit 5767e90

Browse files
authored
Merge pull request #77 from cyclejs-community/installBasicDeps
install project main dependencies seperately
2 parents 3dfa954 + 67e1ae8 commit 5767e90

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

packages/cycle-scripts/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
"cycle-scripts": "./index.js"
3131
},
3232
"dependencies": {
33-
"@cycle/dom": "^14.3.0",
34-
"@cycle/xstream-run": "^4.2.0",
3533
"babel-core": "^6.17.0",
3634
"babel-loader": "^6.2.5",
3735
"babel-preset-es2015": "^6.16.0",
@@ -43,7 +41,6 @@
4341
"mocha": "^3.1.2",
4442
"progress-bar-webpack-plugin": "^1.9.0",
4543
"webpack": "^1.13.2",
46-
"webpack-dev-server": "^1.16.2",
47-
"xstream": "^9.3.0"
44+
"webpack-dev-server": "^1.16.2"
4845
}
4946
}

packages/cycle-scripts/scripts/init.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
const fs = require('fs-extra')
44
const path = require('path')
55
const chalk = require('chalk')
6+
const spawn = require('cross-spawn')
7+
8+
const basicDependencies = [
9+
'@cycle/dom',
10+
'@cycle/xstream-run',
11+
'xstream'
12+
]
613

714
function patchGitignore (appPath) {
815
// Rename gitignore after the fact to prevent npm from renaming it to .npmignore
@@ -81,5 +88,30 @@ module.exports = function init (appPath, appName, verbose, originalDirectory) {
8188
// Copy flavor files
8289
fs.copySync(path.join(ownPath, 'template'), appPath)
8390
patchGitignore(appPath)
84-
successMsg(appName, appPath)
91+
92+
const listOfbasicDependencies = basicDependencies
93+
.slice(0, (basicDependencies.length - 1))
94+
.join(', ')
95+
.concat(` and ${basicDependencies.slice(-1)}`)
96+
97+
console.log(`Installing ${listOfbasicDependencies} using npm...`)
98+
console.log()
99+
100+
const args = [
101+
'install'
102+
].concat(
103+
basicDependencies
104+
).concat([
105+
'--save',
106+
verbose && '--verbose'
107+
]).filter(Boolean)
108+
109+
var proc = spawn('npm', args, {stdio: 'inherit'})
110+
proc.on('close', function (code) {
111+
if (code !== 0) {
112+
console.error(chalk.red('`npm ' + args.join(' ') + '` failed'))
113+
return
114+
}
115+
successMsg(appName, appPath)
116+
})
85117
}

0 commit comments

Comments
 (0)