Skip to content

Commit

Permalink
Fix plugins in workstation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang Zhen committed Jan 16, 2018
1 parent cdba29a commit 8c02427
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 24 deletions.
13 changes: 10 additions & 3 deletions app/components/Plugins/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,18 @@ export const loadPackagesByType = registerAction(PRELOAD_REQUIRED_EXTENSION,
({ type, data, group }) => {
const fetchPackgeListPromise = api.fetchPackageList(type)
return fetchPackgeListPromise.then(async (list) => {
store.list.replace(list)
if (config.isLib) {
const filterList = list.filter((item) => {
return item.name !== 'platform' && item.name !== 'Debugger' && item.name !== 'collaboration'
})
store.list.replace(filterList)
} else {
store.list.replace(list)
}
if (group) {
return fetchPackageGroup('required', list, type, data)
return fetchPackageGroup('required', store.list, type, data)
}
for (const pkg of list) {
for (const pkg of filterList) {
await fetchPackage(pkg, type, data)
}
})
Expand Down
5 changes: 4 additions & 1 deletion app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const config = observable({
wsURL: getCookie('WS_URL') || __WS_URL__ || __BACKEND_URL__ || window.location.origin,
staticServingURL: getCookie('STATIC_SERVING_URL') || __STATIC_SERVING_URL__ || window.location.origin,
runMode: __RUN_MODE__,
isPlatform: Boolean(__RUN_MODE__),
// isPlatform: Boolean(__RUN_MODE__),
fsSocketConnected: false,
ttySocketConnected: false,
fileExcludePatterns: ['/.git', '/.coding-ide'],
Expand All @@ -31,6 +31,9 @@ const config = observable({
},
get isLib () {
return config.runMode === 'lib'
},
get isPlatform () {
return Boolean(__RUN_MODE__) || config.runMode === 'lib'
}
})

Expand Down
2 changes: 1 addition & 1 deletion app/workstation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'
import { render } from 'react-dom'
import Root from './containers/Root'
import WorkStation from './workstation/workstationFull'
import './styles/main.styl'
import './styles/workstation.styl'
import initialize from './initialize'
import InitializeContainer from './containers/Initialize'
import SettingState from 'components/Setting/state'
Expand Down
27 changes: 14 additions & 13 deletions app/workstation/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ async function initialize ({ persist }) {
return true
})

// await step('[1] load required package', async() => {
// try {
// await loadPackagesByType('Required', state, true)
// } catch (err) {
// return true
// }
// return true
// })
await step('[1] load required package', async() => {
try {
await loadPackagesByType('Required', state, true)
} catch (err) {
return true
}
return true
})

await step('=== Run steps in stepCache ===', async() => {
/*async function goto (key, hasNext = true) {
Expand All @@ -73,10 +73,11 @@ async function initialize ({ persist }) {
})


// await step(`[${stepNum++}] mount required package`, () => {
// mountPackagesByType('Required')
// return true
// })
await step(`[${stepNum++}] mount required package`, () => {
mountPackagesByType('Required')
return true
})

if (persist) {
await step(`[${stepNum++}] persist Store`, () => {
persistTask()
Expand All @@ -103,4 +104,4 @@ async function initialize ({ persist }) {
return step
}

export default initialize
export default initialize
2 changes: 1 addition & 1 deletion app/workstation/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const stepCache = observable.map({
// case 1: spaceKey in url
let spaceKey = null
// DEMO
spaceKey = 'dedyyz'
spaceKey = 'default'
// const wsPathPattern = /^\/ws\/([^/]+)\/?$/
// const match = wsPathPattern.exec(urlPath)
// if (match) spaceKey = match[1]
Expand Down
2 changes: 2 additions & 0 deletions app/workstation/workstationFull.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { loadPlugin } from 'components/Plugins/actions.js'
import Root from '../containers/Root'
import initialize from './initialize'
import { observer } from 'mobx-react'
Expand Down Expand Up @@ -30,6 +31,7 @@ class WorkStation extends Component {
this.handleHide = this.handleHide.bind(this)
}
componentWillMount () {
loadPlugin(require('../plugin/index.js').default)
}
componentDidMount () {
const that = this
Expand Down
2 changes: 1 addition & 1 deletion dist/terminal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/workstation.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coding-web-ide",
"version": "0.1.3",
"version": "0.1.4",
"description": "Coding WebIDE",
"main": "dist/workstation",
"private": true,
Expand All @@ -27,8 +27,8 @@
"packageList": "node packageListServer.js",
"pm2": "pm2 start task.yaml",
"clean-dist": "rm -rf dist",
"build-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib PACKAGE_SERVER=http://ide.codelife.me:8000 node_modules/.bin/webpack",
"start-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib NODE_ENV=dev webpack-dev-server --progress --colors"
"build-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib BACKEND_URL=http://ide-backend.xiayule.net WS_URL=http://ide-ws.xiayule.net STATIC_SERVING_URL=http://{space-key}-static-{access-token}.xiayule.net PACKAGE_SERVER=http://ide.xiayule.net node_modules/.bin/webpack",
"start-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib NODE_ENV=dev BACKEND_URL=http://ide-backend.xiayule.net WS_URL=http://ide-ws.xiayule.net STATIC_SERVING_URL=http://{space-key}-static-{access-token}.xiayule.net PACKAGE_SERVER=http://ide.xiayule.net webpack-dev-server --progress --colors"
},
"keywords": [
"coding",
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2631,6 +2631,15 @@ extglob@^0.3.1:
dependencies:
is-extglob "^1.0.0"

extract-text-webpack-plugin@2.1.2:
version "2.1.2"
resolved "http://registry.npm.taobao.org/extract-text-webpack-plugin/download/extract-text-webpack-plugin-2.1.2.tgz#756ef4efa8155c3681833fbc34da53b941746d6c"
dependencies:
async "^2.1.2"
loader-utils "^1.0.2"
schema-utils "^0.3.0"
webpack-sources "^1.0.1"

extsprintf@1.0.2:
version "1.0.2"
resolved "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
Expand Down Expand Up @@ -5920,6 +5929,10 @@ source-list-map@^1.1.1:
version "1.1.1"
resolved "http://registry.npm.taobao.org/source-list-map/download/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4"

source-list-map@^2.0.0:
version "2.0.0"
resolved "http://registry.npm.taobao.org/source-list-map/download/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"

source-map-support@^0.4.2:
version "0.4.14"
resolved "http://registry.npm.taobao.org/source-map-support/download/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef"
Expand Down Expand Up @@ -5958,6 +5971,10 @@ source-map@~0.5.0:
version "0.5.7"
resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

source-map@~0.6.1:
version "0.6.1"
resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

spdx-correct@~1.0.0:
version "1.0.2"
resolved "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
Expand Down Expand Up @@ -6645,6 +6662,13 @@ webpack-sources@^0.2.3:
source-list-map "^1.1.1"
source-map "~0.5.3"

webpack-sources@^1.0.1:
version "1.1.0"
resolved "http://registry.npm.taobao.org/webpack-sources/download/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54"
dependencies:
source-list-map "^2.0.0"
source-map "~0.6.1"

webpack@^2.2.1:
version "2.4.1"
resolved "http://registry.npm.taobao.org/webpack/download/webpack-2.4.1.tgz#15a91dbe34966d8a4b99c7d656efd92a2e5a6f6a"
Expand Down Expand Up @@ -6807,6 +6831,10 @@ xmlhttprequest@1.4.2:
version "4.0.1"
resolved "http://registry.npm.taobao.org/xtend/download/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"

xterm@^3.0.1:
version "3.0.1"
resolved "http://registry.npm.taobao.org/xterm/download/xterm-3.0.1.tgz#6fef126c6198699d08c3d1dfd43f4c7c45740d39"

y18n@^3.2.1:
version "3.2.1"
resolved "http://registry.npm.taobao.org/y18n/download/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
Expand Down

0 comments on commit 8c02427

Please # to comment.