Skip to content

Commit 8c02427

Browse files
author
Yang Zhen
committed
Fix plugins in workstation
1 parent cdba29a commit 8c02427

File tree

10 files changed

+65
-24
lines changed

10 files changed

+65
-24
lines changed

app/components/Plugins/actions.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,18 @@ export const loadPackagesByType = registerAction(PRELOAD_REQUIRED_EXTENSION,
133133
({ type, data, group }) => {
134134
const fetchPackgeListPromise = api.fetchPackageList(type)
135135
return fetchPackgeListPromise.then(async (list) => {
136-
store.list.replace(list)
136+
if (config.isLib) {
137+
const filterList = list.filter((item) => {
138+
return item.name !== 'platform' && item.name !== 'Debugger' && item.name !== 'collaboration'
139+
})
140+
store.list.replace(filterList)
141+
} else {
142+
store.list.replace(list)
143+
}
137144
if (group) {
138-
return fetchPackageGroup('required', list, type, data)
145+
return fetchPackageGroup('required', store.list, type, data)
139146
}
140-
for (const pkg of list) {
147+
for (const pkg of filterList) {
141148
await fetchPackage(pkg, type, data)
142149
}
143150
})

app/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const config = observable({
1111
wsURL: getCookie('WS_URL') || __WS_URL__ || __BACKEND_URL__ || window.location.origin,
1212
staticServingURL: getCookie('STATIC_SERVING_URL') || __STATIC_SERVING_URL__ || window.location.origin,
1313
runMode: __RUN_MODE__,
14-
isPlatform: Boolean(__RUN_MODE__),
14+
// isPlatform: Boolean(__RUN_MODE__),
1515
fsSocketConnected: false,
1616
ttySocketConnected: false,
1717
fileExcludePatterns: ['/.git', '/.coding-ide'],
@@ -31,6 +31,9 @@ const config = observable({
3131
},
3232
get isLib () {
3333
return config.runMode === 'lib'
34+
},
35+
get isPlatform () {
36+
return Boolean(__RUN_MODE__) || config.runMode === 'lib'
3437
}
3538
})
3639

app/workstation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33
import { render } from 'react-dom'
44
import Root from './containers/Root'
55
import WorkStation from './workstation/workstationFull'
6-
import './styles/main.styl'
6+
import './styles/workstation.styl'
77
import initialize from './initialize'
88
import InitializeContainer from './containers/Initialize'
99
import SettingState from 'components/Setting/state'

app/workstation/initialize.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ async function initialize ({ persist }) {
3939
return true
4040
})
4141

42-
// await step('[1] load required package', async() => {
43-
// try {
44-
// await loadPackagesByType('Required', state, true)
45-
// } catch (err) {
46-
// return true
47-
// }
48-
// return true
49-
// })
42+
await step('[1] load required package', async() => {
43+
try {
44+
await loadPackagesByType('Required', state, true)
45+
} catch (err) {
46+
return true
47+
}
48+
return true
49+
})
5050

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

7575

76-
// await step(`[${stepNum++}] mount required package`, () => {
77-
// mountPackagesByType('Required')
78-
// return true
79-
// })
76+
await step(`[${stepNum++}] mount required package`, () => {
77+
mountPackagesByType('Required')
78+
return true
79+
})
80+
8081
if (persist) {
8182
await step(`[${stepNum++}] persist Store`, () => {
8283
persistTask()
@@ -103,4 +104,4 @@ async function initialize ({ persist }) {
103104
return step
104105
}
105106

106-
export default initialize
107+
export default initialize

app/workstation/state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const stepCache = observable.map({
1919
// case 1: spaceKey in url
2020
let spaceKey = null
2121
// DEMO
22-
spaceKey = 'dedyyz'
22+
spaceKey = 'default'
2323
// const wsPathPattern = /^\/ws\/([^/]+)\/?$/
2424
// const match = wsPathPattern.exec(urlPath)
2525
// if (match) spaceKey = match[1]

app/workstation/workstationFull.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Component } from 'react'
22
import PropTypes from 'prop-types'
3+
import { loadPlugin } from 'components/Plugins/actions.js'
34
import Root from '../containers/Root'
45
import initialize from './initialize'
56
import { observer } from 'mobx-react'
@@ -30,6 +31,7 @@ class WorkStation extends Component {
3031
this.handleHide = this.handleHide.bind(this)
3132
}
3233
componentWillMount () {
34+
loadPlugin(require('../plugin/index.js').default)
3335
}
3436
componentDidMount () {
3537
const that = this

dist/terminal.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/workstation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coding-web-ide",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Coding WebIDE",
55
"main": "dist/workstation",
66
"private": true,
@@ -27,8 +27,8 @@
2727
"packageList": "node packageListServer.js",
2828
"pm2": "pm2 start task.yaml",
2929
"clean-dist": "rm -rf dist",
30-
"build-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib PACKAGE_SERVER=http://ide.codelife.me:8000 node_modules/.bin/webpack",
31-
"start-lib": "npm run clean-dist && PACKAGE_DEV=false RUN_MODE=lib NODE_ENV=dev webpack-dev-server --progress --colors"
30+
"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",
31+
"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"
3232
},
3333
"keywords": [
3434
"coding",

yarn.lock

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,6 +2631,15 @@ extglob@^0.3.1:
26312631
dependencies:
26322632
is-extglob "^1.0.0"
26332633

2634+
2635+
version "2.1.2"
2636+
resolved "http://registry.npm.taobao.org/extract-text-webpack-plugin/download/extract-text-webpack-plugin-2.1.2.tgz#756ef4efa8155c3681833fbc34da53b941746d6c"
2637+
dependencies:
2638+
async "^2.1.2"
2639+
loader-utils "^1.0.2"
2640+
schema-utils "^0.3.0"
2641+
webpack-sources "^1.0.1"
2642+
26342643
26352644
version "1.0.2"
26362645
resolved "http://registry.npm.taobao.org/extsprintf/download/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
@@ -5920,6 +5929,10 @@ source-list-map@^1.1.1:
59205929
version "1.1.1"
59215930
resolved "http://registry.npm.taobao.org/source-list-map/download/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4"
59225931

5932+
source-list-map@^2.0.0:
5933+
version "2.0.0"
5934+
resolved "http://registry.npm.taobao.org/source-list-map/download/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
5935+
59235936
source-map-support@^0.4.2:
59245937
version "0.4.14"
59255938
resolved "http://registry.npm.taobao.org/source-map-support/download/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef"
@@ -5958,6 +5971,10 @@ source-map@~0.5.0:
59585971
version "0.5.7"
59595972
resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
59605973

5974+
source-map@~0.6.1:
5975+
version "0.6.1"
5976+
resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
5977+
59615978
spdx-correct@~1.0.0:
59625979
version "1.0.2"
59635980
resolved "http://registry.npm.taobao.org/spdx-correct/download/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
@@ -6645,6 +6662,13 @@ webpack-sources@^0.2.3:
66456662
source-list-map "^1.1.1"
66466663
source-map "~0.5.3"
66476664

6665+
webpack-sources@^1.0.1:
6666+
version "1.1.0"
6667+
resolved "http://registry.npm.taobao.org/webpack-sources/download/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54"
6668+
dependencies:
6669+
source-list-map "^2.0.0"
6670+
source-map "~0.6.1"
6671+
66486672
webpack@^2.2.1:
66496673
version "2.4.1"
66506674
resolved "http://registry.npm.taobao.org/webpack/download/webpack-2.4.1.tgz#15a91dbe34966d8a4b99c7d656efd92a2e5a6f6a"
@@ -6807,6 +6831,10 @@ [email protected]:
68076831
version "4.0.1"
68086832
resolved "http://registry.npm.taobao.org/xtend/download/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
68096833

6834+
xterm@^3.0.1:
6835+
version "3.0.1"
6836+
resolved "http://registry.npm.taobao.org/xterm/download/xterm-3.0.1.tgz#6fef126c6198699d08c3d1dfd43f4c7c45740d39"
6837+
68106838
y18n@^3.2.1:
68116839
version "3.2.1"
68126840
resolved "http://registry.npm.taobao.org/y18n/download/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

0 commit comments

Comments
 (0)