1 | "use strict";
|
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3 | return new (P || (P = Promise))(function (resolve, reject) {
|
4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
7 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8 | });
|
9 | };
|
10 | Object.defineProperty(exports, "__esModule", { value: true });
|
11 | const util_1 = require("../../util");
|
12 | exports.default = (ctx) => {
|
13 | ctx.registerPlatform({
|
14 | name: 'alipay',
|
15 | useConfigName: 'mini',
|
16 | fn({ config }) {
|
17 | return __awaiter(this, void 0, void 0, function* () {
|
18 | const { appPath, nodeModulesPath, outputPath } = ctx.paths;
|
19 | const { npm, emptyDirectory } = ctx.helper;
|
20 | emptyDirectory(outputPath);
|
21 |
|
22 | const miniRunnerOpts = Object.assign({}, config, { nodeModulesPath, buildAdapter: config.platform, isBuildPlugin: false, globalObject: 'my', fileType: {
|
23 | templ: '.axml',
|
24 | style: '.acss',
|
25 | config: '.json',
|
26 | script: '.js'
|
27 | }, isUseComponentBuildPage: false });
|
28 | ctx.modifyBuildTempFileContent(({ tempFiles }) => {
|
29 | const replaceKeyMap = {
|
30 | navigationBarTitleText: 'defaultTitle',
|
31 | navigationBarBackgroundColor: 'titleBarColor',
|
32 | enablePullDownRefresh: 'pullRefresh',
|
33 | list: 'items',
|
34 | text: 'name',
|
35 | iconPath: 'icon',
|
36 | selectedIconPath: 'activeIcon',
|
37 | color: 'textColor'
|
38 | };
|
39 | Object.keys(tempFiles).forEach(key => {
|
40 | const item = tempFiles[key];
|
41 | if (item.config) {
|
42 | util_1.recursiveReplaceObjectKeys(item.config, replaceKeyMap);
|
43 | }
|
44 | });
|
45 | });
|
46 |
|
47 | const miniRunner = yield npm.getNpmPkg('@tarojs/mini-runner', appPath);
|
48 | yield miniRunner(appPath, miniRunnerOpts);
|
49 | });
|
50 | }
|
51 | });
|
52 | };
|