@cloudbase/framework-plugin-low-code 0.6.18 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +68 -12
- package/package.json +1 -1
- package/template/package.json +2 -0
- package/template/src/router/index.tpl +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -90,6 +90,10 @@ declare class LowCodePlugin extends Plugin {
|
|
|
90
90
|
protected _website: any;
|
|
91
91
|
protected _rules: any;
|
|
92
92
|
protected _skipInstallExt: any;
|
|
93
|
+
protected _gatewayConfig?: {
|
|
94
|
+
Domain: string;
|
|
95
|
+
Path: string;
|
|
96
|
+
};
|
|
93
97
|
constructor(name: string, api: PluginServiceApi, inputs: IFrameworkPluginLowCodeInputs);
|
|
94
98
|
_initDir(): void;
|
|
95
99
|
_subPluginConstructor(resolveInputs: ResolvedInputs): void;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAUrE,OAAO,EACL,SAAS,EAET,cAAc,EAGf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAWvD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAM7D,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,2BAA2B,IAAK,CAAC;AAoB9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;CAqBnB,CAAC;AAEF,MAAM,WAAW,6BAA6B;IA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AC9B,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;IACxB,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IACtB,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC;IAC/B,SAAS,CAAC,cAAc,CAAC,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;gBAEO,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,6BAA6B;IA8I9C,QAAQ;IAMR,qBAAqB,CAAC,aAAa,EAAE,cAAc;IAmGnD,eAAe;IAUf,KAAK,CAAC,KAAK,KAAA;IASX,QAAQ,CAAC,KAAK,KAAA;IAWR,IAAI;IAKJ,GAAG;IAKH,MAAM;IAKN,OAAO;IAKP,KAAK;IA8RL,OAAO;IA6FP,MAAM;IAwGN,mBAAmB,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAgBjD,eAAe,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAqBnD,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA4HhB,2BAA2B;IA6E3B,UAAU;IAwBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IAuCvB,yBAAyB;CA6FhC;AAgCD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -292,7 +292,7 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
292
292
|
return __awaiter(this, void 0, void 0, function* () { });
|
|
293
293
|
}
|
|
294
294
|
build() {
|
|
295
|
-
var _a;
|
|
295
|
+
var _a, _b, _c, _d;
|
|
296
296
|
return __awaiter(this, void 0, void 0, function* () {
|
|
297
297
|
let { logger } = this.api;
|
|
298
298
|
const staticDir = path_1.default.resolve(__dirname, '../../../static');
|
|
@@ -326,13 +326,53 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
326
326
|
this.api.logger.error('获取静态托管失败: ', e);
|
|
327
327
|
throw e;
|
|
328
328
|
}
|
|
329
|
+
const domain = ((_b = this._website) === null || _b === void 0 ? void 0 : _b.cdnDomain) || ((_c = mainAppSerializeData.extra) === null || _c === void 0 ? void 0 : _c.domain);
|
|
330
|
+
if (common_2.buildAsWebByBuildType(buildTypeList) &&
|
|
331
|
+
this._resolvedInputs.deployOptions.mode === types_1.DEPLOY_MODE.UPLOAD) {
|
|
332
|
+
let { appConfig = {} } = mainAppSerializeData;
|
|
333
|
+
let { window = {} } = appConfig;
|
|
334
|
+
try {
|
|
335
|
+
const { Data = {} } = yield this.api.cloudbaseManager
|
|
336
|
+
.commonService('lowcode', '2021-01-08')
|
|
337
|
+
.call({
|
|
338
|
+
Action: 'DescribeAppCustomUrls',
|
|
339
|
+
Param: {
|
|
340
|
+
EnvId: this.api.envId,
|
|
341
|
+
IgnorePublished: true,
|
|
342
|
+
WeAppId: appId,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
this.api.logger.debug('DescribeAppCustomUrls', Data, {
|
|
346
|
+
EnvId: this.api.envId,
|
|
347
|
+
IgnorePublished: true,
|
|
348
|
+
WeAppId: appId,
|
|
349
|
+
});
|
|
350
|
+
this._gatewayConfig = (_d = Data === null || Data === void 0 ? void 0 : Data.Items) === null || _d === void 0 ? void 0 : _d[0];
|
|
351
|
+
if (this._gatewayConfig) {
|
|
352
|
+
const path = this._gatewayConfig.Path;
|
|
353
|
+
window.publicPath = `https://${domain}${this._getWebRootPath()}`;
|
|
354
|
+
if (!common_2.buildAsAdminPortalByBuildType(buildTypeList)) {
|
|
355
|
+
window.basename = path;
|
|
356
|
+
}
|
|
357
|
+
appConfig.window = window;
|
|
358
|
+
this._resolvedInputs.mainAppSerializeData.appConfig = appConfig;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
catch (e) {
|
|
362
|
+
this.api.logger.error('路由失败', e, {
|
|
363
|
+
EnvId: this.api.envId,
|
|
364
|
+
IgnorePublished: true,
|
|
365
|
+
WeAppId: appId,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
329
369
|
try {
|
|
330
370
|
if (!debug) {
|
|
331
371
|
pauseConsoleOutput();
|
|
332
372
|
}
|
|
333
373
|
this._time("build process");
|
|
334
374
|
this._appPath = yield new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
335
|
-
var
|
|
375
|
+
var _e, _f;
|
|
336
376
|
try {
|
|
337
377
|
yield core_1.default({
|
|
338
378
|
mainAppSerializeData,
|
|
@@ -345,16 +385,16 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
345
385
|
runtime: this._resolvedInputs.runtime,
|
|
346
386
|
ignoreInstall: this._resolvedInputs.ignoreInstall,
|
|
347
387
|
mode: webpackMode,
|
|
348
|
-
deployMode: (
|
|
388
|
+
deployMode: (_e = this._resolvedInputs.deployOptions) === null || _e === void 0 ? void 0 : _e.mode,
|
|
349
389
|
watch: false,
|
|
350
390
|
generateMpType,
|
|
351
391
|
generateMpPath,
|
|
352
392
|
isCleanDistDir: false,
|
|
353
393
|
plugins,
|
|
354
394
|
extraData,
|
|
355
|
-
isCrossAccount: this._resolvedInputs.mpAppId !== ((
|
|
395
|
+
isCrossAccount: this._resolvedInputs.mpAppId !== ((_f = this._resolvedInputs.deployOptions) === null || _f === void 0 ? void 0 : _f.targetMpAppId),
|
|
356
396
|
resourceAppid: this._resolvedInputs.mpAppId,
|
|
357
|
-
domain
|
|
397
|
+
domain,
|
|
358
398
|
}, (err, result) => __awaiter(this, void 0, void 0, function* () {
|
|
359
399
|
if (!err) {
|
|
360
400
|
try {
|
|
@@ -556,8 +596,10 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
556
596
|
const isPreview = (deployOptions === null || deployOptions === void 0 ? void 0 : deployOptions.mode) === types_1.DEPLOY_MODE.PREVIEW;
|
|
557
597
|
const link = common_2.buildAsAdminPortalByBuildType(this._resolvedInputs.buildTypeList)
|
|
558
598
|
? `https://${this._website.cdnDomain}/adminportal/#/app/${isPreview ? `${appId}-preview` : appId}?envType=${isPreview ? 'preivew' : 'prod'}`
|
|
559
|
-
:
|
|
560
|
-
this.
|
|
599
|
+
: this._gatewayConfig
|
|
600
|
+
? `https://${this._gatewayConfig.Domain + this._gatewayConfig.Path}`
|
|
601
|
+
: `https://${this._website.cdnDomain +
|
|
602
|
+
this._webPlugin.resolvedInputs.cloudPath}`;
|
|
561
603
|
const qrcodeOutputPath = path_1.default.resolve(this.api.projectPath, QRCODE_PATH);
|
|
562
604
|
yield qrcode_1.default.toFile(path_1.default.resolve(this.api.projectPath, QRCODE_PATH), link, {
|
|
563
605
|
errorCorrectionLevel: 'M',
|
|
@@ -916,12 +958,14 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
916
958
|
}
|
|
917
959
|
return arr;
|
|
918
960
|
}, []);
|
|
919
|
-
(
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
961
|
+
if (!this._gatewayConfig) {
|
|
962
|
+
(_b = this._resolvedInputs.mainAppSerializeData.pageInstanceList) === null || _b === void 0 ? void 0 : _b.forEach((page) => {
|
|
963
|
+
rules.push({
|
|
964
|
+
keyPrefixEquals: `${path.slice(1)}${page.id}`,
|
|
965
|
+
replaceKeyWith: path,
|
|
966
|
+
});
|
|
923
967
|
});
|
|
924
|
-
}
|
|
968
|
+
}
|
|
925
969
|
this._rules = rules;
|
|
926
970
|
}
|
|
927
971
|
}
|
|
@@ -936,6 +980,18 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
936
980
|
domainConfig: { FollowRedirect: 'on' },
|
|
937
981
|
}));
|
|
938
982
|
yield Promise.all(modifyDomainConfigPromises);
|
|
983
|
+
if (this._gatewayConfig) {
|
|
984
|
+
yield this.api.cloudbaseManager
|
|
985
|
+
.commonService('lowcode', '2021-01-08')
|
|
986
|
+
.call({
|
|
987
|
+
Action: 'PublishAppCustomUrl',
|
|
988
|
+
Param: {
|
|
989
|
+
EnvId: this.api.envId,
|
|
990
|
+
WeAppId: this._resolvedInputs.appId,
|
|
991
|
+
IndexPath: this._getWebRootPath(),
|
|
992
|
+
},
|
|
993
|
+
});
|
|
994
|
+
}
|
|
939
995
|
yield hostingService.setWebsiteDocument({
|
|
940
996
|
indexDocument: 'index.html',
|
|
941
997
|
routingRules: this._rules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
package/template/package.json
CHANGED
|
@@ -12,6 +12,7 @@ export default () => {
|
|
|
12
12
|
<Router history={process.env.isAdminPortal? generateHashHistory({basename: "<%= basename %>"}) : history }>
|
|
13
13
|
<Switch>
|
|
14
14
|
<%= routerRenders %>
|
|
15
|
+
{process.env.isAdminPortal && <Route children={() => <Redirect to={'/404'} />} />}
|
|
15
16
|
</Switch>
|
|
16
17
|
</Router>
|
|
17
18
|
)
|