@@ -4,18 +4,21 @@ var gulpFail = require('gulp-fail');
44var path = require ( 'path' ) ;
55var webpack = require ( "webpack" ) ;
66var webpackProductionConfig = require ( "./webpack.production.config.js" ) ;
7+ var webpackDevConfig = require ( "./webpack.config.js" ) ;
78var ElectronPackager = require ( 'electron-packager' ) ;
89var child_process = require ( 'child_process' ) ;
910var fs = require ( 'fs' ) ;
1011var plist = require ( 'plist' ) ;
1112var $ = require ( 'gulp-load-plugins' ) ( ) ;
13+ var open = require ( 'gulp-open' ) ;
1214var runSequence = require ( 'run-sequence' ) ;
1315
14- var BUILD_VERSION = "0.7.0 " ;
16+ var BUILD_VERSION = "0.7.1 " ;
1517
1618var SIGN_PACKAGE = process . env [ 'SIGN_DECO_PACKAGE' ] == 'true'
1719
1820var child = null
21+ var debug_child = null
1922gulp . task ( 'clean-pkg' , $ . shell . task ( [ "rm -rf " + ( path . join ( __dirname , '../dist' ) ) , "mkdir -p " + ( path . join ( __dirname , '../dist/osx' ) ) ] ) ) ;
2023
2124gulp . task ( 'copy-libraries' , [ 'electron-pack' ] , $ . shell . task ( [ "mkdir " + '../app/deco/Deco-darwin-x64/Deco.app/Contents/Resources/app.asar.unpacked' , "cp -rf " + ( path . join ( __dirname , './package/deco_unpack_lib/*' ) ) + " " + ( path . join ( __dirname , '../app/deco/Deco-darwin-x64/Deco.app/Contents/Resources/app.asar.unpacked/' ) ) ] ) ) ;
@@ -108,6 +111,19 @@ gulp.task("build", function(callback) {
108111 } ) ;
109112} ) ;
110113
114+ gulp . task ( "build-dev" , function ( callback ) {
115+ return webpack ( webpackDevConfig , function ( err , stats ) {
116+ if ( err ) {
117+ throw new gutil . PluginError ( "webpack:build" , err ) ;
118+ }
119+ gutil . log ( "[webpack:build]" , stats . toString ( {
120+ colors : true
121+ } ) ) ;
122+ callback ( ) ;
123+ } ) ;
124+ } ) ;
125+
126+
111127gulp . task ( 'build-web' , [ 'build' , 'clean-pkg' ] , function ( callback ) {
112128 child_process . execSync ( 'npm run build' , {
113129 cwd : path . join ( __dirname , '../web' )
@@ -123,10 +139,41 @@ gulp.task("start", ["build"], function(callback) {
123139 } ) ;
124140} ) ;
125141
142+ gulp . task ( 'debug' , [ 'run-debug-processes' ] , function ( callback ) {
143+ gulp . src ( __filename )
144+ . pipe ( open ( {
145+ uri : 'http://127.0.0.1:3000/?port=5858' ,
146+ //TODO: needs to change for OS once we support other platforms
147+ app : '/Applications/Google\ Chrome.app' ,
148+ } ) )
149+ callback ( )
150+ } ) ;
151+
152+ gulp . task ( "run-debug-processes" , [ "build-dev" ] , function ( callback ) {
153+ child = child_process . fork ( "" + ( path . join ( __dirname , './node_modules/.bin/electron' ) ) , [ "--debug-brk=5858" , __dirname , "--dev-mode" ] , {
154+ cwd : __dirname ,
155+ env : process . env
156+ } ) ;
157+ debug_child = child_process . fork ( "" + ( path . join ( __dirname , './node_modules/.bin/electron' ) ) , [
158+ "node_modules/node-inspector/bin/inspector.js" ,
159+ "--web-port=3000" ,
160+ ] , {
161+ cwd : __dirname ,
162+ env : Object . assign ( { } ,
163+ process . env , {
164+ ELECTRON_RUN_AS_NODE : true ,
165+ } )
166+ } ) ;
167+ callback ( )
168+ } )
169+
126170process . on ( 'exit' , function ( ) {
127171 if ( child != null && ! child . killed ) {
128172 child . kill ( ) ;
129173 }
174+ if ( debug_child != null && ! debug_child . killed ) {
175+ debug_child . kill ( ) ;
176+ }
130177} ) ;
131178
132179gulp . task ( 'default' , function ( ) {
0 commit comments