From 948377ba9371c27e56001ede7d8896aa22b0ce94 Mon Sep 17 00:00:00 2001 From: Rokt33r Date: Mon, 18 Apr 2016 05:47:13 +0900 Subject: [PATCH] Use browser target dist of react stuff for faster compile --- gruntfile.js | 26 ++++++++++++++++++++++++++ lib/finder.html | 4 ++++ lib/main.html | 4 ++++ package.json | 5 +++-- webpack-skeleton.js | 17 +++++++++++++++-- 5 files changed, 52 insertions(+), 4 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index e4ab430f..e2cb3cfc 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -1,6 +1,8 @@ const path = require('path') const ChildProcess = require('child_process') const packager = require('electron-packager') +const fs = require('fs') +const merge = require('merge-stream') module.exports = function (grunt) { var auth_code @@ -55,6 +57,30 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-electron-installer') grunt.loadNpmTasks('grunt-electron-installer-debian') + grunt.registerTask('copy', function () { + var done = this.async() + var targetPaths = [ + 'node_modules/react/dist/react.min.js', + 'node_modules/react-dom/dist/react-dom.min.js', + 'node_modules/react-redux/dist/react-redux.min.js', + 'node_modules/redux/dist/redux.min.js' + ] + + var merged = merge() + targetPaths.forEach(function (targetPath) { + var read = fs + .createReadStream(path.resolve(__dirname, targetPath)) + var write = fs.createWriteStream(path.resolve(__dirname, 'compiled', path.basename(targetPath))) + read.pipe(write) + merged.add(read) + }) + + merged + .on('end', function () { + done() + }) + }) + grunt.registerTask('compile', function () { var done = this.async() var execPath = path.join('node_modules', '.bin', 'webpack') + ' --config webpack-production.config.js' diff --git a/lib/finder.html b/lib/finder.html index c802dd3d..50412a5d 100644 --- a/lib/finder.html +++ b/lib/finder.html @@ -29,6 +29,10 @@
+ + + + + + + +