@cloudbase/lowcode-builder 0.1.6 → 0.1.9

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.
@@ -11,7 +11,7 @@ export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap
11
11
  * miniprogram的代码,IDE插件后续会提供端功能
12
12
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
13
13
  */
14
- export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm.zip";
14
+ export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20220425.zip";
15
15
  /**
16
16
  * miniprogram_npm存放目录。IDE插件builder用到
17
17
  */
@@ -45,7 +45,7 @@ exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myq
45
45
  * 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488&region=ap-shanghai&path=%252Flcap-builder%252F
46
46
  */
47
47
  // export const miniprogramURL = 'https://cos-1252394733.cos.ap-nanjing.myqcloud.com/miniprogram_npm.zip';
48
- exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm.zip';
48
+ exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20220425.zip';
49
49
  /**
50
50
  * miniprogram_npm存放目录。IDE插件builder用到
51
51
  */
@@ -234,14 +234,16 @@ async function generateWxMp({ weapps, projDir, appId, domain, materials, plugins
234
234
  }
235
235
  }
236
236
  }));
237
- if (!isBrowserMpBuilder && fs.existsSync(path_1.default.join(miniprogramRoot, 'package.json'))) {
237
+ if (!isBrowserMpBuilder &&
238
+ fs.existsSync(path_1.default.join(miniprogramRoot, 'package.json'))) {
238
239
  await (0, webpack_1.installDependencies)(miniprogramRoot);
239
240
  }
240
241
  await handleMpPlugins();
241
242
  console.timeEnd(operationLabel);
242
243
  // web端的builder不需要清除
243
244
  !isBrowserMpBuilder && cleanProj(weapps, miniprogramRoot);
244
- !isBrowserMpBuilder && cleanMaterils(path_1.default.join(miniprogramRoot, config_1.materialsDirName), allAppUsedComps);
245
+ !isBrowserMpBuilder &&
246
+ cleanMaterils(path_1.default.join(miniprogramRoot, config_1.materialsDirName), allAppUsedComps);
245
247
  return { miniprogramRoot };
246
248
  function resolveNpmDeps() {
247
249
  var _a;
@@ -366,6 +368,7 @@ async function generateFramework(appData, outDir, ctx) {
366
368
  subPackageName: '',
367
369
  isBare: true,
368
370
  domain: ctx.domain || '',
371
+ appConfig: JSON.stringify({}),
369
372
  },
370
373
  };
371
374
  }
@@ -395,6 +398,16 @@ async function generateFramework(appData, outDir, ctx) {
395
398
  : '',
396
399
  subPackageName: appData.rootPath || '',
397
400
  isBare: false,
401
+ appConfig: (0, util_3.JsonToStringWithVariableName)({
402
+ id: ctx.appId,
403
+ staticResourceDomain: ctx.domain || '',
404
+ envVersion: (ctx === null || ctx === void 0 ? void 0 : ctx.isProduction) ? 'production' : 'preview',
405
+ pages: appData.pageInstanceList
406
+ .sort((item) => (item.isHome ? -1 : 1))
407
+ .map((item) => ({
408
+ id: item.id,
409
+ })),
410
+ }),
398
411
  },
399
412
  'app/common.js': {
400
413
  mods: appData.lowCodes
@@ -107,7 +107,7 @@ function generateWxml(widgets, docTag, wxmlDataPrefix, ctx, usingComponents, com
107
107
  }
108
108
  const attrPrefix = `${wxmlDataPrefix.widgetProp}${id}${curForNodes
109
109
  .map((forNodeId) => `[${wxmlDataPrefix.forIndex}${forNodeId}]`)
110
- .join('')}.`;
110
+ .join('')}`;
111
111
  const idAttr = curForNodes.length < 1
112
112
  ? id
113
113
  : `{{'${id}'${curForNodes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "0.1.6",
3
+ "version": "0.1.9",
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",
@@ -25,7 +25,8 @@
25
25
  "scripts": {
26
26
  "dev": "tsc -w",
27
27
  "develop": "tsc -w",
28
- "build": "rm -rf lib && tsc && npm run build:web",
28
+ "clean": "rm -rf lib && rm -rf dist",
29
+ "build": "tsc",
29
30
  "test": "jest",
30
31
  "test:build": "ts-node ./__test__/build.ts",
31
32
  "dev:web": "rm -rf dist && node ./webpack/scripts/web.pre.js && cross-env NODE_ENV=development webpack-dev-server --config ./webpack/web.config.js",
@@ -72,6 +73,7 @@
72
73
  "@types/react": "^16.9.49",
73
74
  "@types/webpack": "^4.41.22",
74
75
  "@types/weixin-app": "^2.9.0",
76
+ "cross-env": "^7.0.3",
75
77
  "csstype": "^2.6.10",
76
78
  "jest": "^26.0.1",
77
79
  "ts-loader": "^8.3.0",
@@ -21,7 +21,9 @@ export const app = createGlboalApi()
21
21
  export { process }
22
22
 
23
23
  function createGlboalApi() {
24
- const mpApp = createMpApp();
24
+ const mpApp = createMpApp({
25
+ appConfig: <%= appConfig %>;
26
+ });
25
27
  const globalAPI = {
26
28
  id: '<%= appId %>',
27
29
  domain: '<%= domain %>',
@@ -55,7 +55,7 @@ export function createEventHandlers(evtListeners, context) {
55
55
  detail: res
56
56
  })
57
57
  } catch (e) {
58
- let eventName = l.key ? `${l.key}_fail` : ''
58
+ let eventName = l.key ? `${prefix}$${l.key}_fail` : ''
59
59
  if (self[eventName]) {
60
60
  await self[eventName]({
61
61
  ...event,
@@ -9,7 +9,7 @@
9
9
  "@tcwd/weapps-core": "2.2.6",
10
10
  "@tcwd/weapps-sdk": "1.2.9",
11
11
  "@zxing/library": "^0.18.6",
12
- "@cloudbase/weda-client": "stable",
12
+ "@cloudbase/weda-client": "0.1.11",
13
13
  "fastclick": "^1.0.6",
14
14
  "lodash": "^4.17.19",
15
15
  "mobx": "^5.15.4",
@@ -60,4 +60,4 @@
60
60
  "webpack-cli": "^4.2.0",
61
61
  "webpack-dev-server": "^3.11.0"
62
62
  }
63
- }
63
+ }