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 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | exports.default = (ctx) => {
|
36 | ctx.registerPlatform({
|
37 | name: 'weapp',
|
38 | useConfigName: 'mini',
|
39 | fn({ config }) {
|
40 | return __awaiter(this, void 0, void 0, function* () {
|
41 | const { appPath, nodeModulesPath, outputPath } = ctx.paths;
|
42 | const { npm, emptyDirectory } = ctx.helper;
|
43 | emptyDirectory(outputPath);
|
44 |
|
45 | ctx.generateProjectConfig({
|
46 | srcConfigName: 'project.config.json',
|
47 | distConfigName: 'project.config.json'
|
48 | });
|
49 |
|
50 | const miniRunnerOpts = Object.assign({}, config, { nodeModulesPath, buildAdapter: config.platform, isBuildPlugin: false, globalObject: 'wx', fileType: {
|
51 | templ: '.wxml',
|
52 | style: '.wxss',
|
53 | config: '.json',
|
54 | script: '.js'
|
55 | }, isUseComponentBuildPage: true });
|
56 |
|
57 | const miniRunner = yield npm.getNpmPkg('@tarojs/mini-runner', appPath);
|
58 | yield miniRunner(appPath, miniRunnerOpts);
|
59 | });
|
60 | }
|
61 | });
|
62 | };
|