mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix build env
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ node_modules/*
|
||||
!node_modules/boost
|
||||
Boost-darwin-x64/
|
||||
backup/
|
||||
compiled
|
||||
|
||||
@@ -10,7 +10,7 @@ import { findWhere, findIndex, pick } from 'lodash'
|
||||
import keygen from 'boost/keygen'
|
||||
import api from 'boost/api'
|
||||
import auth from 'boost/auth'
|
||||
import 'boost/socket'
|
||||
import io from 'boost/socket'
|
||||
|
||||
class HomePage extends React.Component {
|
||||
componentDidMount () {
|
||||
@@ -19,7 +19,8 @@ class HomePage extends React.Component {
|
||||
dispatch(switchUser(this.props.params.userId))
|
||||
|
||||
let currentUser = auth.user()
|
||||
let users = [currentUser].concat(currentUser.Teams)
|
||||
|
||||
let users = currentUser.Teams != null ? [currentUser].concat(currentUser.Teams) : [currentUser]
|
||||
users.forEach(user => {
|
||||
api.fetchArticles(user.id)
|
||||
.then(res => {
|
||||
@@ -30,6 +31,11 @@ class HomePage extends React.Component {
|
||||
console.error(err)
|
||||
})
|
||||
})
|
||||
|
||||
let token = auth.token()
|
||||
if (token != null) {
|
||||
io.emit('JOIN', {token})
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps (nextProps) {
|
||||
|
||||
@@ -167,6 +167,7 @@ export default class ArticleDetail extends React.Component {
|
||||
|
||||
api.createArticle(article)
|
||||
.then(res => {
|
||||
console.log('saved as new')
|
||||
console.log(res.body)
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -196,6 +197,7 @@ export default class ArticleDetail extends React.Component {
|
||||
|
||||
api.saveArticle(article)
|
||||
.then(res => {
|
||||
console.log('saved')
|
||||
console.log(res.body)
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
@@ -15,6 +15,7 @@ export default class ArticleList extends React.Component {
|
||||
|
||||
render () {
|
||||
let { articles, activeArticle } = this.props
|
||||
console.log(articles)
|
||||
|
||||
let articlesEl = articles.map(article => {
|
||||
let tags = Array.isArray(article.Tags) && article.Tags.length > 0
|
||||
|
||||
@@ -8,9 +8,9 @@ import Preferences from 'boost/components/modal/Preferences'
|
||||
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
|
||||
|
||||
export default class ArticleNavigator extends React.Component {
|
||||
componentDidMount () {
|
||||
this.handlePreferencesButtonClick()
|
||||
}
|
||||
// componentDidMount () {
|
||||
// this.handlePreferencesButtonClick()
|
||||
// }
|
||||
|
||||
handlePreferencesButtonClick (e) {
|
||||
openModal(Preferences)
|
||||
|
||||
@@ -15,6 +15,8 @@ export default class UserNavigator extends Component {
|
||||
}
|
||||
|
||||
renderUserList () {
|
||||
if (this.props.users == null) return null
|
||||
|
||||
var users = this.props.users.map((user, index) => (
|
||||
<li key={'user-' + user.id}>
|
||||
<Link to={'/users/' + user.id} activeClassName='active'>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Link } from 'react-router'
|
||||
import linkState from 'boost/linkState'
|
||||
import openExternal from 'boost/openExternal'
|
||||
import { signup } from 'boost/api'
|
||||
import auth from 'boost/auth'
|
||||
|
||||
export default class SignupContainer extends React.Component {
|
||||
constructor (props) {
|
||||
@@ -27,8 +28,8 @@ export default class SignupContainer extends React.Component {
|
||||
}, function () {
|
||||
signup(this.state.user)
|
||||
.then(res => {
|
||||
localStorage.setItem('token', res.body.token)
|
||||
localStorage.setItem('currentUser', JSON.stringify(res.body.user))
|
||||
let { user, token } = res.body
|
||||
auth.user(user, token)
|
||||
|
||||
this.props.history.pushState('home')
|
||||
})
|
||||
@@ -42,8 +43,7 @@ export default class SignupContainer extends React.Component {
|
||||
},
|
||||
isSending: false
|
||||
})
|
||||
}
|
||||
else if (err.status != null) {
|
||||
} else if (err.status != null) {
|
||||
return this.setState({
|
||||
error: {
|
||||
name: err.response.body.name,
|
||||
|
||||
@@ -56,14 +56,15 @@
|
||||
<script type="text/javascript">
|
||||
var version = require('remote').require('app').getVersion()
|
||||
document.title = 'Boost' + ((version == null || version.length === 0) ? ' DEV' : '')
|
||||
// require("babel-core/register")
|
||||
// require('./index')
|
||||
document.addEventListener('mousewheel', function(e) {
|
||||
if(e.deltaY % 1 !== 0) {
|
||||
e.preventDefault()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript" src='../../compiled/main.js'></script>
|
||||
<!--
|
||||
<script src="http://localhost:8080/assets/main.js"></script>
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export const API_URL = 'http://localhost:8000/'
|
||||
// export const API_URL = 'http://localhost:8000/'
|
||||
export const API_URL = 'http://boost-api4.elasticbeanstalk.com/'
|
||||
// export API_URL 'https://api2.b00st.io/'
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var url = path.resolve(process.cwd(), './submodules/ace/src-min')
|
||||
|
||||
var rootUrl = process.cwd()
|
||||
if (rootUrl === '/') rootUrl = require('remote').require('app').getAppPath()
|
||||
var url = path.resolve(rootUrl, './submodules/ace/src-min')
|
||||
console.log(url)
|
||||
|
||||
module.exports = fs.readdirSync(url)
|
||||
.filter(function (file) {
|
||||
|
||||
@@ -81,8 +81,12 @@ function articles (state, action) {
|
||||
let articles = JSON.parse(localStorage.getItem(teamKey))
|
||||
|
||||
let targetIndex = findIndex(articles, _article => article.key === _article.key)
|
||||
console.log('before')
|
||||
console.log(articles)
|
||||
if (targetIndex < 0) articles.unshift(article)
|
||||
else articles.splice(targetIndex, 1, article)
|
||||
console.log('after')
|
||||
console.log(articles)
|
||||
|
||||
localStorage.setItem(teamKey, JSON.stringify(articles))
|
||||
state[teamKey] = articles
|
||||
|
||||
32
lib/store.js
32
lib/store.js
@@ -1,20 +1,26 @@
|
||||
import React from 'react'
|
||||
import reducer from './reducer'
|
||||
import { createStore } from 'redux'
|
||||
// Devtools
|
||||
import { compose } from 'redux'
|
||||
import { devTools, persistState } from 'redux-devtools'
|
||||
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'
|
||||
// import React from 'react'
|
||||
// import { compose } from 'redux'
|
||||
// import { devTools, persistState } from 'redux-devtools'
|
||||
// import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react'
|
||||
|
||||
let finalCreateStore = compose(devTools(), persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)))(createStore)
|
||||
let store = finalCreateStore(reducer)
|
||||
console.log(process.env)
|
||||
|
||||
export let devToolElement = (
|
||||
<DebugPanel top right bottom>
|
||||
<DevTools store={store} monitor={LogMonitor} visibleOnLoad={false}/>
|
||||
</DebugPanel>
|
||||
)
|
||||
var store, devToolEl
|
||||
// if (process.env.NODE_ENV !== 'production') {
|
||||
// let finalCreateStore = compose(devTools(), persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)))(createStore)
|
||||
// let store = finalCreateStore(reducer)
|
||||
|
||||
// let store = createStore(reducer)
|
||||
// devToolEl = (
|
||||
// <DebugPanel top right bottom>
|
||||
// <DevTools store={store} monitor={LogMonitor} visibleOnLoad={false}/>
|
||||
// </DebugPanel>
|
||||
// )
|
||||
// } else {
|
||||
// }
|
||||
devToolEl = null
|
||||
store = createStore(reducer)
|
||||
|
||||
export let devToolElement = devToolEl
|
||||
export default store
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
"scripts": {
|
||||
"start": "electron ./main.js",
|
||||
"webpack": "webpack-dev-server --inline",
|
||||
"build": "electron-packager ./ Boost $npm_package_config_platform $npm_package_config_version $npm_package_config_ignore --overwrite"
|
||||
"compile": "NODE_ENV=production webpack --config webpack.config.production.js",
|
||||
"build": "electron-packager ./ Boost $npm_package_config_platform $npm_package_config_version $npm_package_config_ignore --overwrite",
|
||||
"codesign": "codesign --verbose --deep --force --sign \"MAISIN solutions Inc.\" Boost-darwin-x64/Boost.app"
|
||||
},
|
||||
"config": {
|
||||
"version": "--version=0.33.0 --app-version=$npm_package_version --app-bundle-id=com.maisin.boost",
|
||||
|
||||
@@ -25,8 +25,8 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
// new webpack.NoErrorsPlugin()
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoErrorsPlugin()
|
||||
],
|
||||
externals: [
|
||||
'socket.io-client',
|
||||
|
||||
67
webpack.config.production.js
Normal file
67
webpack.config.production.js
Normal file
@@ -0,0 +1,67 @@
|
||||
var webpack = require('webpack')
|
||||
module.exports = {
|
||||
devtool: 'source-map',
|
||||
entry: {
|
||||
main: './browser/main/index.js'
|
||||
},
|
||||
output: {
|
||||
path: 'compiled',
|
||||
filename: '[name].js',
|
||||
sourceMapFilename: '[name].map',
|
||||
publicPath: 'http://localhost:8090/assets',
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /(\.js|\.jsx)?$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'babel'
|
||||
},
|
||||
{
|
||||
test: /\.styl?$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'style-loader!css-loader!stylus-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'NODE_ENV': JSON.stringify('production'),
|
||||
'BABEL_ENV': JSON.stringify('production')
|
||||
}
|
||||
})
|
||||
// new webpack.optimize.UglifyJsPlugin({
|
||||
// compressor: {
|
||||
// warnings: false
|
||||
// }
|
||||
// })
|
||||
],
|
||||
externals: [
|
||||
'socket.io-client',
|
||||
'md5',
|
||||
'superagent',
|
||||
'superagent-promise',
|
||||
// 'react',
|
||||
// 'redux',
|
||||
// 'react-redux',
|
||||
// 'react-router',
|
||||
'lodash',
|
||||
// 'redbox-react',
|
||||
// 'react-transform-hmr',
|
||||
// 'react-transform-catch-errors',
|
||||
// 'redux-devtools',
|
||||
// 'redux-devtools/lib/react',
|
||||
// 'react-select',
|
||||
'markdown-it',
|
||||
'moment',
|
||||
'fs',
|
||||
'path'
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['', '.js', '.jsx', 'styl']
|
||||
},
|
||||
target: 'atom'
|
||||
}
|
||||
Reference in New Issue
Block a user