mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Use browser target dist of react stuff
for faster compile
This commit is contained in:
26
gruntfile.js
26
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'
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
<div id="content"></div>
|
||||
<script src="../submodules/ace/src-min/ace.js"></script>
|
||||
<script src="../resources/katex.min.js"></script>
|
||||
<script src="../compiled/react.min.js"></script>
|
||||
<script src="../compiled/react-dom.min.js"></script>
|
||||
<script src="../compiled/redux.min.js"></script>
|
||||
<script src="../compiled/react-redux.min.js"></script>
|
||||
<script>
|
||||
const electron = require('electron')
|
||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
|
||||
<script src="../submodules/ace/src-min/ace.js"></script>
|
||||
<script src="../resources/katex.min.js"></script>
|
||||
<script src="../compiled/react.min.js"></script>
|
||||
<script src="../compiled/react-dom.min.js"></script>
|
||||
<script src="../compiled/redux.min.js"></script>
|
||||
<script src="../compiled/react-redux.min.js"></script>
|
||||
<script type='text/javascript'>
|
||||
const electron = require('electron')
|
||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "boost",
|
||||
"version": "0.5.9",
|
||||
"version": "0.6.0",
|
||||
"description": "Boostnote",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "electron ./index.js",
|
||||
"hot": "electron ./index.js --hot",
|
||||
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js"
|
||||
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
|
||||
"postinstall": "grunt copy"
|
||||
},
|
||||
"config": {
|
||||
"electron-version": "0.36.11"
|
||||
|
||||
@@ -19,9 +19,15 @@ var config = {
|
||||
new webpack.NoErrorsPlugin(),
|
||||
new NodeTargetPlugin()
|
||||
],
|
||||
stylus: {
|
||||
use: [require('nib')()],
|
||||
import: [
|
||||
'~nib/lib/nib/index.styl',
|
||||
path.resolve(__dirname, 'browser/styles/index.styl')
|
||||
]
|
||||
},
|
||||
externals: [
|
||||
'electron',
|
||||
'socket.io-client',
|
||||
'md5',
|
||||
'superagent',
|
||||
'superagent-promise',
|
||||
@@ -33,7 +39,14 @@ var config = {
|
||||
'fs-jetpack',
|
||||
'markdown-it-math',
|
||||
'@rokt33r/sanitize-html',
|
||||
'markdown-it-checkbox'
|
||||
'markdown-it-checkbox',
|
||||
'season',
|
||||
{
|
||||
react: 'var React',
|
||||
'react-dom': 'var ReactDOM',
|
||||
'react-redux': 'var ReactRedux',
|
||||
'redux': 'var Redux'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user