mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46: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 path = require('path')
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
const packager = require('electron-packager')
|
const packager = require('electron-packager')
|
||||||
|
const fs = require('fs')
|
||||||
|
const merge = require('merge-stream')
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
var auth_code
|
var auth_code
|
||||||
@@ -55,6 +57,30 @@ module.exports = function (grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-electron-installer')
|
grunt.loadNpmTasks('grunt-electron-installer')
|
||||||
grunt.loadNpmTasks('grunt-electron-installer-debian')
|
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 () {
|
grunt.registerTask('compile', function () {
|
||||||
var done = this.async()
|
var done = this.async()
|
||||||
var execPath = path.join('node_modules', '.bin', 'webpack') + ' --config webpack-production.config.js'
|
var execPath = path.join('node_modules', '.bin', 'webpack') + ' --config webpack-production.config.js'
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
<div id="content"></div>
|
<div id="content"></div>
|
||||||
<script src="../submodules/ace/src-min/ace.js"></script>
|
<script src="../submodules/ace/src-min/ace.js"></script>
|
||||||
<script src="../resources/katex.min.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>
|
<script>
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
|
|||||||
@@ -57,6 +57,10 @@
|
|||||||
|
|
||||||
<script src="../submodules/ace/src-min/ace.js"></script>
|
<script src="../submodules/ace/src-min/ace.js"></script>
|
||||||
<script src="../resources/katex.min.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'>
|
<script type='text/javascript'>
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "boost",
|
"name": "boost",
|
||||||
"version": "0.5.9",
|
"version": "0.6.0",
|
||||||
"description": "Boostnote",
|
"description": "Boostnote",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron ./index.js",
|
"start": "electron ./index.js",
|
||||||
"hot": "electron ./index.js --hot",
|
"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": {
|
"config": {
|
||||||
"electron-version": "0.36.11"
|
"electron-version": "0.36.11"
|
||||||
|
|||||||
@@ -19,9 +19,15 @@ var config = {
|
|||||||
new webpack.NoErrorsPlugin(),
|
new webpack.NoErrorsPlugin(),
|
||||||
new NodeTargetPlugin()
|
new NodeTargetPlugin()
|
||||||
],
|
],
|
||||||
|
stylus: {
|
||||||
|
use: [require('nib')()],
|
||||||
|
import: [
|
||||||
|
'~nib/lib/nib/index.styl',
|
||||||
|
path.resolve(__dirname, 'browser/styles/index.styl')
|
||||||
|
]
|
||||||
|
},
|
||||||
externals: [
|
externals: [
|
||||||
'electron',
|
'electron',
|
||||||
'socket.io-client',
|
|
||||||
'md5',
|
'md5',
|
||||||
'superagent',
|
'superagent',
|
||||||
'superagent-promise',
|
'superagent-promise',
|
||||||
@@ -33,7 +39,14 @@ var config = {
|
|||||||
'fs-jetpack',
|
'fs-jetpack',
|
||||||
'markdown-it-math',
|
'markdown-it-math',
|
||||||
'@rokt33r/sanitize-html',
|
'@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