From 7ec3bf335d5c69b7a1447d1e41c2d025ba637839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Tue, 2 Feb 2021 19:14:44 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20engine-ext=20/=20engine-core=20/=20vis?= =?UTF-8?q?ion-polyfill=20=E5=B7=A5=E7=A8=8B=E5=8C=96=E7=BB=9F=E4=B8=80=20?= =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE=20i18n=20=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20chore:=20ignitor=20devServer=20useLocalIp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/src/builtin-simulator/host.ts | 4 ++++ packages/engine/build.cloud.json | 8 +++---- packages/engine/package.json | 2 +- packages/engine/scripts/version.js | 21 ++++++++++++------- packages/ignitor/build.json | 1 + packages/plugin-designer/src/index.tsx | 6 ++++++ .../src/renderer-view.tsx | 3 +-- .../react-simulator-renderer/src/renderer.ts | 17 ++++++++------- packages/vision-polyfill/build.cloud.json | 8 +++---- 9 files changed, 44 insertions(+), 26 deletions(-) diff --git a/packages/designer/src/builtin-simulator/host.ts b/packages/designer/src/builtin-simulator/host.ts index 544abdc7f..0a7f9d950 100644 --- a/packages/designer/src/builtin-simulator/host.ts +++ b/packages/designer/src/builtin-simulator/host.ts @@ -144,6 +144,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost { + const distFile = join(distDir, 'js', name); + if (!fse.existsSync(distFile)) { + console.warn(`[engine] distFile: ${distFile} doesn\'t exist`); + return; + } -const indexContent = fse.readFileSync(distFile, 'utf-8'); + const indexContent = fse.readFileSync(distFile, 'utf-8'); -fse.writeFileSync(distFile, indexContent.replace('{{VERSION_PLACEHOLDER}}', releaseVersion)); + fse.writeFileSync(distFile, indexContent.replace('{{VERSION_PLACEHOLDER}}', releaseVersion)); +}); + +console.log('[engine] update engine version successfully!'); diff --git a/packages/ignitor/build.json b/packages/ignitor/build.json index b05041299..02cfe5fb3 100644 --- a/packages/ignitor/build.json +++ b/packages/ignitor/build.json @@ -9,6 +9,7 @@ }, "vendor": false, "devServer": { + "useLocalIp": true, "hot": false }, "publicPath": "/", diff --git a/packages/plugin-designer/src/index.tsx b/packages/plugin-designer/src/index.tsx index 5ba587bb8..d8c1d35b7 100644 --- a/packages/plugin-designer/src/index.tsx +++ b/packages/plugin-designer/src/index.tsx @@ -14,6 +14,7 @@ interface DesignerPluginState { extraEnvironment?: any[] | null; renderEnv?: string; device?: string; + locale?: string; designMode?: string; deviceClassName?: string; simulatorUrl: Asset | null; @@ -30,6 +31,7 @@ export default class DesignerPlugin extends PureComponent { - const newCtx = { - ...this._appContext, - }; - newCtx.utils.i18n.currentLocale = loc; - this._appContext = newCtx; + this._appContext.utils.i18n.currentLocale = loc; + this._locale = loc; }, - currentLocale: undefined, + currentLocale: this.locale, messages: {}, }, }, @@ -321,7 +320,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { return this._components; } // context from: utils、constants、history、location、match - @obx.ref private _appContext = {}; + @obx.ref private _appContext: any = {}; @computed get context(): any { return this._appContext; } @@ -333,6 +332,10 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer { @computed get device() { return this._device; } + @obx.ref private _locale: string = ''; + @computed get locale() { + return this._locale; + } @obx.ref private _componentsMap = {}; @computed get componentsMap(): any { return this._componentsMap; diff --git a/packages/vision-polyfill/build.cloud.json b/packages/vision-polyfill/build.cloud.json index 7b3143b76..3e8dd9a02 100644 --- a/packages/vision-polyfill/build.cloud.json +++ b/packages/vision-polyfill/build.cloud.json @@ -15,19 +15,19 @@ "monaco-editor/esm/vs/editor/editor.main.js": "var window.monaco", "@ali/lowcode-engine": "var window.AliLowCodeEngine", "@ali/lowcode-engine-ext": "var window.AliLowCodeEngineExt", + "@alifd/next": "var Next", "moment": "var moment", "lodash": "var _" }, - "browserslist": { - "chrome": 80 - }, + "polyfill": false, "outputDir": "dist", "vendor": false, "ignoreHtmlTemplate": true, "sourceMap": true, "plugins": [ "build-plugin-react-app", - "build-plugin-fusion", + ["build-plugin-fusion", { + }], ["build-plugin-moment-locales", { "locales": ["zh-cn"] }],