@cloudbase/framework-plugin-low-code 0.6.9 → 0.6.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/mp/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,UAAU,EAEV,OAAO,EAIR,MAAM,mBAAmB,CAAC;AAU3B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAkB/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAEL,SAAS,EACT,YAAY,EACZ,UAAU,EACX,MAAM,iBAAiB,CAAC;AAUzB,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE;IACD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QACP,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B,GAAG,OAAO,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC,CA6RvC;AAkKD,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,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AAkKD,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,aAAa,iBAgCnB;AAYD,wBAAgB,oBAAoB,CAAC,EACnC,YAAY,EACZ,MAAM,EACN,SAAS,GACV,EAAE;IACD,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;;;EA0CA"}
@@ -97,30 +97,26 @@ function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isPr
97
97
  const projectConfigJsonPath = path_1.default.join(projDir, mainAppData.rootPath || '', 'project.config.json');
98
98
  let projectConfigJson = yield fs.readJSON(projectConfigJsonPath);
99
99
  const miniprogramRoot = path_1.default.join(projDir, projectConfigJson.miniprogramRoot || '/');
100
- yield generateFramework(mainAppData, miniprogramRoot, buildContext);
101
- let appFileData = {
102
- 'common/style.js': {},
103
- 'common/utils.wxs': {
104
- domain: domain,
105
- },
106
- 'common/util.js': {
107
- isAdminPortal: common_1.buildAsAdminPortalByBuildType(buildTypeList),
108
- },
109
- 'common/widget.js': {},
110
- 'common/url.js': {},
111
- 'common/weapp-sdk.js': {},
112
- 'common/weapp-page.js': {
113
- dataPropNames: wxmlDataPrefix,
114
- debug: !buildContext.isProduction,
115
- },
116
- 'common/weapp-component.js': {},
117
- 'common/merge-renderer.js': {
118
- dataPropNames: wxmlDataPrefix,
119
- debug: !buildContext.isProduction,
120
- },
121
- 'common/process.js': {},
122
- 'common/data-patch.js': {},
123
- };
100
+ let appFileData = {};
101
+ if (weapps.find((item) => !item.mpPkgUrl)) {
102
+ yield generateFramework(mainAppData, miniprogramRoot, buildContext);
103
+ if (mainAppData.mpPkgUrl) {
104
+ let appJsPath = path_1.default.join(miniprogramRoot, 'app.js');
105
+ let appJsContent = yield fs.readFile(appJsPath);
106
+ yield generateFiles_1.writeFile(appJsPath, `import { app as wedaApp } from './app/weapps-api'\n${appJsContent}`);
107
+ }
108
+ appFileData = Object.assign(Object.assign({}, appFileData), { 'common/style.js': {}, 'common/utils.wxs': {
109
+ domain: domain,
110
+ }, 'common/util.js': {
111
+ isAdminPortal: common_1.buildAsAdminPortalByBuildType(buildTypeList),
112
+ }, 'common/widget.js': {}, 'common/url.js': {}, 'common/weapp-sdk.js': {}, 'common/weapp-page.js': {
113
+ dataPropNames: wxmlDataPrefix,
114
+ debug: !buildContext.isProduction,
115
+ }, 'common/weapp-component.js': {}, 'common/merge-renderer.js': {
116
+ dataPropNames: wxmlDataPrefix,
117
+ debug: !buildContext.isProduction,
118
+ }, 'common/process.js': {}, 'common/data-patch.js': {} });
119
+ }
124
120
  if (mainAppData.mpPkgUrl) {
125
121
  if (!projectConfigJson.setting) {
126
122
  projectConfigJson.setting = {};
@@ -141,9 +137,6 @@ function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isPr
141
137
  }
142
138
  appJson.subpackages = subpackages;
143
139
  yield generateFiles_1.writeFile(appJsonPath, JSON.stringify(appJson, undefined, 2));
144
- let appJsPath = path_1.default.join(miniprogramRoot, 'app.js');
145
- let appJsContent = yield fs.readFile(appJsPath);
146
- yield generateFiles_1.writeFile(appJsPath, `import { app as wedaApp } from './app/weapps-api'\n${appJsContent}`);
147
140
  }
148
141
  else {
149
142
  appFileData = Object.assign(Object.assign({}, appFileData), { 'common/wx_yypt_report_v2.js': {}, 'app.js': { yyptConfig: yyptConfig }, 'app.json': { content: appConfig }, 'app.wxss': {
@@ -168,26 +161,28 @@ function generateWxMp({ weapps, projDir, appId, domain, materials, plugins, isPr
168
161
  `${projDir} to ${miniprogramRoot}`);
169
162
  yield fs.move(path_1.default.join(projDir, config_1.materialsDirName), path_1.default.join(miniprogramRoot, config_1.materialsDirName));
170
163
  }
171
- const datasourceFileData = {
172
- 'datasources/index.js': {},
173
- 'datasources/config.js.tpl': {
174
- envID: mainAppData.envId,
175
- appID: appId,
176
- resourceAppid: !!options.isCrossAccount ? options.resourceAppid : '',
177
- isProd: deployMode === types_1.DEPLOY_MODE.UPLOAD,
178
- },
179
- 'datasources/datasource-profiles.js.tpl': {
180
- datasourceProfiles: util_3.JsonToStringWithVariableName(dataSource_1.getDatasourceProfiles(weapps.reduce((datasources, app) => {
181
- datasources.push(...(app.datasources || []));
182
- return datasources;
183
- }, []))),
184
- },
185
- 'datasources/dataset-profiles.js.tpl': {
186
- datasetProfiles: util_3.JsonToStringWithVariableName(dataSource_1.getDatasetProfiles(mainAppData, weapps)),
187
- },
188
- };
189
- console.log('Generating ' + em('datasources') + ' files');
190
- yield generateFiles_1.default(datasourceFileData, templateDir, miniprogramRoot, buildContext);
164
+ if (weapps.find((item) => !item.mpPkgUrl)) {
165
+ const datasourceFileData = {
166
+ 'datasources/index.js': {},
167
+ 'datasources/config.js.tpl': {
168
+ envID: mainAppData.envId,
169
+ appID: appId,
170
+ resourceAppid: !!options.isCrossAccount ? options.resourceAppid : '',
171
+ isProd: deployMode === types_1.DEPLOY_MODE.UPLOAD,
172
+ },
173
+ 'datasources/datasource-profiles.js.tpl': {
174
+ datasourceProfiles: util_3.JsonToStringWithVariableName(dataSource_1.getDatasourceProfiles(weapps.reduce((datasources, app) => {
175
+ datasources.push(...(app.datasources || []));
176
+ return datasources;
177
+ }, []))),
178
+ },
179
+ 'datasources/dataset-profiles.js.tpl': {
180
+ datasetProfiles: util_3.JsonToStringWithVariableName(dataSource_1.getDatasetProfiles(mainAppData, weapps)),
181
+ },
182
+ };
183
+ console.log('Generating ' + em('datasources') + ' files');
184
+ yield generateFiles_1.default(datasourceFileData, templateDir, miniprogramRoot, buildContext);
185
+ }
191
186
  yield Promise.all(weapps.map((app, index) => __awaiter(this, void 0, void 0, function* () {
192
187
  if (index == 0) {
193
188
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"postProcess.d.ts","sourceRoot":"","sources":["../../src/utils/postProcess.ts"],"names":[],"mappings":"AAKA,wBAAgB,wBAAwB,CAAC,eAAe,KAAA,EAAE,IAAI,KAAA,QAI7D;AAED,wBAAgB,0BAA0B,CAAC,WAAW,KAAA,EAAE,aAAa,KAAA,QAqBpE"}
1
+ {"version":3,"file":"postProcess.d.ts","sourceRoot":"","sources":["../../src/utils/postProcess.ts"],"names":[],"mappings":"AAKA,wBAAgB,wBAAwB,CAAC,eAAe,KAAA,EAAE,IAAI,KAAA,QAI7D;AAED,wBAAgB,0BAA0B,CAAC,WAAW,KAAA,EAAE,aAAa,KAAA,QAkBpE"}
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
5
24
  Object.defineProperty(exports, "__esModule", { value: true });
6
25
  exports.postprocessDeployExtraJson = exports.postprocessProjectConfig = void 0;
7
- const fs_extra_1 = __importDefault(require("fs-extra"));
26
+ const fs_extra_1 = __importStar(require("fs-extra"));
8
27
  const lodash_1 = require("lodash");
9
28
  const path_1 = __importDefault(require("path"));
10
29
  function postprocessProjectConfig(projectJsonPath, data) {
@@ -17,11 +36,9 @@ function postprocessDeployExtraJson(projectPath, deployOptions) {
17
36
  if (targetMpAppId !== mpAppId) {
18
37
  let projectJson = fs_extra_1.default.readJsonSync(path_1.default.resolve(projectPath, 'project.config.json'));
19
38
  const miniprogramRoot = (projectJson === null || projectJson === void 0 ? void 0 : projectJson.miniprogramRoot) || './';
20
- fs_extra_1.default.writeFileSync(path_1.default.resolve(projectPath, miniprogramRoot, 'ext.json'), JSON.stringify({
21
- extEnable: true,
22
- extAppid: targetMpAppId,
23
- directCommit: true,
24
- }, null, 2));
39
+ const extPaht = path_1.default.resolve(projectPath, miniprogramRoot, 'ext.json');
40
+ const extJson = Object.assign(Object.assign({}, (fs_extra_1.default.existsSync(extPaht) ? fs_extra_1.readJsonSync(extPaht) : {})), { extEnable: true, extAppid: targetMpAppId, directCommit: true });
41
+ fs_extra_1.default.writeFileSync(extPaht, JSON.stringify(extJson, null, 2));
25
42
  }
26
43
  }
27
44
  exports.postprocessDeployExtraJson = postprocessDeployExtraJson;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/framework-plugin-low-code",
3
- "version": "0.6.9",
3
+ "version": "0.6.13",
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",
@@ -1,5 +1,5 @@
1
- import dataSourceProfiles from './datasource-profiles'
2
1
  import datasetProfiles from './dataset-profiles'
2
+ const dataSourceProfiles = require('./datasource-profiles.js')
3
3
 
4
4
  /**
5
5
  * 数据源基本配置
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * 数据源摘要描述数组
3
3
  */
4
- export default <%= datasourceProfiles %>
4
+ module.exports = <%= datasourceProfiles %>