Skip to content

Commit 9652caf

Browse files
committed
Change npm install.
1 parent 9a9aa0d commit 9652caf

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

gulpfile.babel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const TEST_FILES = ['test/**/*_test.js', '!test/fixtures/*.js']
1010

1111
gulp.task('test', ['compile'], () => {
1212
return gulp.src(TEST_FILES)
13-
.pipe(mocha({ timeout: 25000, reporter: 'nyan' }))
13+
//.pipe(mocha({ timeout: 25000, reporter: 'nyan' }))
14+
.pipe(mocha({ timeout: 25000, reporter: 'dot' }))
1415
})
1516

1617
gulp.task('compile', () => {

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@
3030
},
3131
"dependencies": {
3232
"archiver": "^0.20.0",
33-
"aws-sdk": "^2.2.23",
33+
"aws-sdk": "^2.2.24",
3434
"babel-polyfill": "^6.3.14",
3535
"bluebird": "^3.1.1",
3636
"del": "^2.2.0",
3737
"ejs": "^2.3.4",
3838
"node-aws-lambda": "^0.1.7",
39-
"node-serialize": "0.0.4"
39+
"node-serialize": "0.0.4",
40+
"npm": "^3.5.2"
4041
},
4142
"devDependencies": {
42-
"babel-core": "^6.3.17",
43+
"babel-core": "^6.3.21",
4344
"babel-plugin-espower": "^2.0.0",
4445
"babel-polyfill": "^6.3.14",
4546
"babel-preset-es2015": "^6.3.13",

src/LambdaApplicationBuilder.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import del from 'del'
3-
import child_process from 'child_process'
43

4+
import npm from 'npm'
55
import Promise from 'bluebird'
66
import serialize from 'node-serialize'
77

@@ -34,19 +34,14 @@ export default class LambdaApplicationBuilder {
3434
this.lambdaCodeGennerator.serializeLambda())
3535
}
3636

37-
installPackages(done, err) {
38-
child_process
39-
.exec('npm i',
40-
{ cwd: this.appPath() },
41-
(error, stdout, stderr) => {
42-
if (error !== null) {
43-
console.log('exec error: ' + error)
44-
err(error)
45-
}
46-
else {
47-
done(this)
48-
}
49-
})
37+
installPackages(done, error) {
38+
npm.load({ production: true, level: 'error' }, (err) => {
39+
if (err) { return error(err) }
40+
npm.commands.install(this.appPath(), [], (_err, data) => {
41+
if (_err) { error(_err) }
42+
else { done(data) }
43+
})
44+
})
5045
}
5146

5247
build() {

0 commit comments

Comments
 (0)