Skip to content

Commit 6a5d8bd

Browse files
author
winjo
committed
fix: fs-watch and react version
1 parent d886b59 commit 6a5d8bd

7 files changed

Lines changed: 37 additions & 28 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"lint-staged": "^10.5.1",
5252
"minimist": "^1.2.5",
5353
"prettier": "^2.1.2",
54-
"react-dom": "^17.0.1",
5554
"signale": "^1.4.0",
5655
"ts-node": "^9.0.0",
5756
"typescript": "^4.0.5"

packages/core/src/server/core/app.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import {
1616
ReporterService,
1717
ReporterMetadata,
1818
REPORT_HOST,
19+
StoragePaths,
1920
} from '@ali/ide-core-common'
2021
import { IExtensionBasicMetadata } from '@alipay/spacex-shared'
2122

2223
import { INodeLogger, NodeLogger } from './node-logger'
2324
import { FCServiceCenter, initFCService, ServerPort } from '../../connection'
2425
import { IServerApp } from '../../common'
2526
import { bootstrap } from './bootstrap'
27+
import { path, os } from '../node'
2628

2729
export abstract class NodeModule extends BasicModule {}
2830

@@ -57,7 +59,11 @@ interface Config {
5759
extensionMetadata?: IExtensionBasicMetadata[]
5860
}
5961

60-
export interface AppConfig extends Partial<Config> {}
62+
export interface AppConfig extends Partial<Config> {
63+
marketplace: {
64+
extensionDir: string
65+
}
66+
}
6167

6268
export interface IServerAppOpts extends Partial<Config> {
6369
modules?: ModuleConstructor[]
@@ -90,6 +96,13 @@ export class ServerApp implements IServerApp {
9096
injector: this.injector,
9197
workspaceDir: opts.workspaceDir,
9298
extensionDir: opts.extensionDir,
99+
marketplace: {
100+
extensionDir: path.join(
101+
os.homedir(),
102+
StoragePaths.DEFAULT_STORAGE_DIR_NAME,
103+
StoragePaths.MARKETPLACE_DIR
104+
),
105+
},
93106
logDir: opts.logDir,
94107
logLevel: opts.logLevel,
95108
LogServiceClass: opts.LogServiceClass,

packages/core/src/server/core/bootstrap.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ export const bootstrap = async (appConfig: AppConfig) => {
2424
}
2525
)
2626
})
27-
await fse.ensureDir(appConfig.workspaceDir || WORKSPACE_DIR)
27+
// 初始化文件目录
28+
await Promise.all([
29+
await fse.ensureDir(appConfig.workspaceDir || WORKSPACE_DIR),
30+
await fse.ensureDir(appConfig.marketplace.extensionDir),
31+
])
2832
}

packages/core/src/server/node/extend/fs-watch.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fs.closeSync = (fd) => {
206206
const _writeFile = fs.writeFile
207207
fs.writeFile = (filename: any, data: any, arg3?: any, cb?: any) => {
208208
const p = resolvePath(filename)
209-
const flag = arg3 && typeof arg3 === 'object' ? arg3.flag : 'w'
209+
const flag = arg3?.flag ?? 'w'
210210
fs.stat(p, (err) => {
211211
// 文件不存在且为写模式,那么会自动创建文件
212212
const willCreated = err && mayCreatedFile(flag)
@@ -215,7 +215,6 @@ fs.writeFile = (filename: any, data: any, arg3?: any, cb?: any) => {
215215
const newCb: any = (err: any, fd: any) => {
216216
const res = _cb(err, fd)
217217
if (!err) {
218-
console.log(11111111)
219218
emitter.fire({
220219
action: willCreated ? ActionType.CREATED : ActionType.MODIFIED,
221220
directory: path.dirname(p),
@@ -235,7 +234,7 @@ fs.writeFile = (filename: any, data: any, arg3?: any, cb?: any) => {
235234
const _writeFileSync = fs.writeFileSync
236235
fs.writeFileSync = (filename: any, data: any, arg3?: any) => {
237236
const p = resolvePath(filename)
238-
const flag = arg3 && typeof arg3 === 'object' ? arg3.flag : 'w'
237+
const flag = arg3?.flag ?? 'w'
239238
const willCreated = !fs.existsSync(p) && mayCreatedFile(flag)
240239
_writeFileSync(p, data, arg3)
241240
emitter.fire({

packages/core/src/server/node/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export * from './internal'
22

3+
// should place before other fs api
4+
export * from './extend/fs-watch'
5+
36
export { default as fse } from './extend/fs-extra'
47

58
export * from './extend/write-file-atomic'
6-
7-
export * from './extend/fs-watch'

packages/spacex/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"less-loader": "^6.0.0",
7676
"mini-css-extract-plugin": "^1.3.0",
7777
"node-notifier": "^8.0.0",
78-
"react": "^17.0.1",
79-
"react-dom": "^17.0.1",
78+
"react": "^16.14.0",
79+
"react-dom": "^16.14.0",
8080
"style-loader": "^0.23.1",
8181
"style-resources-loader": "^1.2.1",
8282
"thread-loader": "^3.0.1",

yarn.lock

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9979,14 +9979,15 @@ react-custom-scrollbars@^4.2.1:
99799979
prop-types "^15.5.10"
99809980
raf "^3.1.0"
99819981

9982-
react-dom@^17.0.1:
9983-
version "17.0.1"
9984-
resolved "https://registry.npm.alibaba-inc.com/react-dom/download/react-dom-17.0.1.tgz#1de2560474ec9f0e334285662ede52dbc5426fc6"
9985-
integrity sha1-HeJWBHTsnw4zQoVmLt5S28VCb8Y=
9982+
react-dom@^16.14.0:
9983+
version "16.14.0"
9984+
resolved "https://registry.npm.alibaba-inc.com/react-dom/download/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89"
9985+
integrity sha1-etg47Cmnd/s8dcOhkPZhz5Kri4k=
99869986
dependencies:
99879987
loose-envify "^1.1.0"
99889988
object-assign "^4.1.1"
9989-
scheduler "^0.20.1"
9989+
prop-types "^15.6.2"
9990+
scheduler "^0.19.1"
99909991

99919992
react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1:
99929993
version "16.13.1"
@@ -10063,7 +10064,7 @@ react-window@^1.8.5:
1006310064
"@babel/runtime" "^7.0.0"
1006410065
memoize-one ">=3.1.1 <6"
1006510066

10066-
react@^16.8.6:
10067+
react@^16.14.0, react@^16.8.6:
1006710068
version "16.14.0"
1006810069
resolved "https://registry.npm.alibaba-inc.com/react/download/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"
1006910070
integrity sha1-lNd23dCqo32j7aj8W2sYpMmjEU0=
@@ -10072,14 +10073,6 @@ react@^16.8.6:
1007210073
object-assign "^4.1.1"
1007310074
prop-types "^15.6.2"
1007410075

10075-
react@^17.0.1:
10076-
version "17.0.1"
10077-
resolved "https://registry.npm.alibaba-inc.com/react/download/react-17.0.1.tgz#6e0600416bd57574e3f86d92edba3d9008726127"
10078-
integrity sha1-bgYAQWvVdXTj+G2S7bo9kAhyYSc=
10079-
dependencies:
10080-
loose-envify "^1.1.0"
10081-
object-assign "^4.1.1"
10082-
1008310076
read-pkg-up@^1.0.1:
1008410077
version "1.0.1"
1008510078
resolved "https://registry.npm.alibaba-inc.com/read-pkg-up/download/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02"
@@ -10548,10 +10541,10 @@ saxes@^5.0.0:
1054810541
dependencies:
1054910542
xmlchars "^2.2.0"
1055010543

10551-
scheduler@^0.20.1:
10552-
version "0.20.1"
10553-
resolved "https://registry.npm.alibaba-inc.com/scheduler/download/scheduler-0.20.1.tgz#da0b907e24026b01181ecbc75efdc7f27b5a000c"
10554-
integrity sha1-2guQfiQCawEYHsvHXv3H8ntaAAw=
10544+
scheduler@^0.19.1:
10545+
version "0.19.1"
10546+
resolved "https://registry.npm.alibaba-inc.com/scheduler/download/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
10547+
integrity sha1-Tz4u0sGn1laB9MhU+oxaHMtA8ZY=
1055510548
dependencies:
1055610549
loose-envify "^1.1.0"
1055710550
object-assign "^4.1.1"

0 commit comments

Comments
 (0)