Skip to content

Commit

Permalink
Install NPM dependencies in a Gulp task
Browse files Browse the repository at this point in the history
  • Loading branch information
wwebfor committed Jan 8, 2016
1 parent 49ef8a0 commit df5d63a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion app/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define(['underscore'], function (_) {

var constants = {};

constants.VERSION = '0.7.1';
constants.VERSION = '0.7.2-RC';
constants.URL = location.origin + location.pathname.replace('index.html', '');

// List of hosts and urls where default dropbox API will work
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "laverna",
"version": "0.7.1",
"version": "0.7.2-RC",
"license": "MPL-2.0",
"dependencies": {
"backbone": "~1.2.3",
Expand Down
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getTask(task) {
'less' , 'prism' , 'require' , 'electron' ,
'htmlmin', 'cssmin' , 'htmlManifest',
'copy' , 'copyRelease', 'copyDist' ,
'reload' , 'clean'
'reload' , 'clean' , 'npm'
]
.forEach(function(task) {
var taskFun = getTask(task);
Expand Down Expand Up @@ -59,6 +59,7 @@ gulp.task('release', plugins.sequence(
'build',
'clean:release',
['copyDist', 'copyRelease'],
'npm:install',
'electron',
'release:after'
));
Expand Down
24 changes: 0 additions & 24 deletions gulps/copyRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,6 @@
module.exports = function(gulp) {
return function() {
return gulp.src([
'./node_modules/connect/**',
'./node_modules/buffer-crc32/**',
'./node_modules/fresh/**',
'./node_modules/bytes/**',
'./node_modules/cookie/**',
'./node_modules/cookie-signature/**',
'./node_modules/mime/**',
'./node_modules/debug/**',
'./node_modules/depd/**',
'./node_modules/finalhandler/**',
'./node_modules/on-headers/**',
'./node_modules/parseurl/**',
'./node_modules/range-parser/**',
'./node_modules/serve-static/**',
'./node_modules/type-is/**',
'./node_modules/send/**',

'./node_modules/colors/**',
'./node_modules/optimist/**',
'./node_modules/electron-window-state/**',
'./node_modules/open/**',
'./node_modules/jsonfile/**',
'./node_modules/mkdirp/**',
'./node_modules/wordwrap/**',
'./server.js',
'./package.json'
], {base: './'})
Expand Down
14 changes: 14 additions & 0 deletions gulps/npm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

module.exports = function(gulp, plugins) {
return {
install: function() {
return gulp.src('./release/laverna/package.json')
.pipe(
plugins.shell(
'cd ./release/laverna && npm install --production && cd ../../'
)
);
},
};
};
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "laverna",
"version": "0.7.1",
"version": "0.7.2-RC",
"license": "MPL-2.0",
"repository": {
"type": "git",
Expand All @@ -11,11 +11,13 @@
},
"main": "electron.js",
"dependencies": {
"node-static": "^0.7.7"
"electron-window-state": "^1.1.0",
"finalhandler": "^0.4.1",
"open": "0.0.5",
"serve-static": "^1.10.0"
},
"devDependencies": {
"chai": "^3.4.0",
"electron-window-state": "^1.1.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.0.2",
"gulp-clean": "^0.3.1",
Expand All @@ -41,8 +43,7 @@
"gulp-util": "^3.0.7",
"jshint-stylish": "^2.1.0",
"merge-stream": "^1.0.0",
"nightwatch": "^0.8.9",
"open": "0.0.5"
"nightwatch": "^0.8.9"
},
"engines": {
"node": ">=0.8.0"
Expand Down
20 changes: 15 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
'use strict';
const PORT = 9100;
var connect = require('connect');
const PORT = 9100;

connect()
.use(connect.static(__dirname + '/dist'))
.listen(PORT);
var finalhandler = require('finalhandler'),
http = require('http'),
serveStatic = require('serve-static'),
serve,
server;

serve = serveStatic(__dirname + '/dist', {index: ['index.html']});

server = http.createServer(function(req, res) {
var done = finalhandler(req, res);
serve(req, res, done);
});

server.listen(PORT);

console.log('Server is running on port: ' + PORT);

0 comments on commit df5d63a

Please sign in to comment.