Skip to content

Commit 992c5cb

Browse files
author
fanniehuang(黄敏)
committed
fix: resolve some conflict merge from master
1 parent c68d7a9 commit 992c5cb

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

packages/wxa-cli/scripts/buildLib.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# npx webpack "./lib/shim/promise.finally.js" --mode production --env.platform=node -o ./lib-dist/es/promise.finally.js
22

33
# cp -R ./src/tester/wxa-e2eTest ./lib-dist/wxa-e2eTest
4-
cp ./src/tester/wxa-e2eTest/e2eRecord2jsTpl.ejs ./dist/tester/wxa-e2eTest
5-
mkdir ./lib-dist/wxa-e2eTest
6-
cp ./src/tester/wxa-e2eTest/e2eTestSuite.js ./lib-dist/wxa-e2eTest/
7-
cp ./src/tester/wxa-e2eTest/e2eRecordBtn.wxa ./lib-dist/wxa-e2eTest/
8-
echo $MODE;
94

105
if test "$MODE" = 'dev'
116
then
@@ -24,3 +19,9 @@ else
2419

2520
npx babel ./lib/wxa_wrap.js --out-dir ./lib-dist/
2621
fi
22+
23+
cp ./src/tester/wxa-e2eTest/e2eRecord2jsTpl.ejs ./dist/tester/wxa-e2eTest
24+
mkdir ./lib-dist/wxa-e2eTest
25+
cp ./src/tester/wxa-e2eTest/e2eTestSuite.js ./lib-dist/wxa-e2eTest/
26+
cp ./src/tester/wxa-e2eTest/e2eRecordBtn.wxa ./lib-dist/wxa-e2eTest/
27+
echo $MODE;

packages/wxa-cli/src/builder.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ let debug = debugPKG('WXA:Builder');
2222
class Builder {
2323
constructor(wxaConfigs) {
2424
this.current = process.cwd();
25-
this.wxaConfigs = wxaConfigs;
26-
25+
this.wxaConfigs = wxaConfigs[0];
2726
// default wxa configurations.
2827
this.wxaConfigs.resolve.appConfigPath = path.join(this.wxaConfigs.context, 'app.json');
2928
if (this.wxaConfigs.resolve.wxaExt[0] !== '.') this.wxaConfigs.resolve.wxaExt = '.'+this.wxaConfigs.resolve.wxaExt;

packages/wxa-cli/src/compilers/wxa.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from 'path';
22
import {readFile, error, isFile, isEmpty} from '../utils';
3-
import {DOMParser} from 'xmldom';
43
import Coder from '../helpers/coder';
54
import logger from '../helpers/logger';
65
import DependencyResolver from '../helpers/dependencyResolver';

packages/wxa-cli/src/tester/e2eTester.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import logger from '../helpers/logger';
88
import simplify from '../helpers/simplifyObj';
99
import {applyPlugins, readFile, writeFile} from '../utils.js';
1010
import COLOR from '../const/color';
11-
11+
import {DirectiveBroker} from '../directive/directiveBroker';
1212
import crypto from 'crypto';
1313
import debugPKG from 'debug';
1414
import path from 'path';
@@ -45,7 +45,6 @@ class TesterScheduler extends Schedule {
4545
if (dep.meta && dep.meta.source === this.APP_SCRIPT_PATH) {
4646
this.tryWrapWXATestSuite(dep);
4747
}
48-
4948
if (dep.meta && dep.meta.source === this.APP_CONFIG_PATH) {
5049
this.tryAddGlobalTestComponent(dep);
5150
}
@@ -123,7 +122,7 @@ class TesterScheduler extends Schedule {
123122

124123
tryAddGlobalTestComponent(mdl) {
125124
try {
126-
let appConfigs = JSON.parse(mdl.code);
125+
let appConfigs = JSON.parse(mdl.content);
127126

128127
appConfigs['wxa.globalComponents'] = {
129128
...appConfigs['wxa.globalComponents'],
@@ -153,14 +152,17 @@ class TesterBuilder extends Builder {
153152
}
154153
await this.hooks.beforeRun.promise(this);
155154

156-
this.schedule = new TesterScheduler(this.loader);
157-
applyPlugins(this.wxaConfigs.plugins || [], this.schedule);
158-
this.schedule.progress.toggle(cmd.progress);
159-
this.schedule.set('cmdOptions', cmd);
160-
this.schedule.set('wxaConfigs', this.wxaConfigs || {});
155+
this.scheduler = new TesterScheduler(this.loader);
156+
this.directiveBroker = new DirectiveBroker(this.scheduler);
157+
158+
applyPlugins(this.wxaConfigs.plugins || [], this.scheduler);
159+
this.scheduler.progress.toggle(cmd.progress);
160+
this.scheduler.set('cmdOptions', cmd);
161+
this.scheduler.set('wxaConfigs', this.wxaConfigs || {});
162+
this.scheduler.set('directiveBroker', this.directiveBroker);
161163

162164
debug('builder wxaConfigs is %O', this.wxaConfigs);
163-
debug('schedule options is %O', this.schedule);
165+
debug('schedule options is %O', this.scheduler);
164166
try {
165167
await this.handleEntry(cmd);
166168
} catch (error) {

packages/wxa-cli/src/wxa.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import commander from 'commander';
22
import inquirer from 'inquirer';
3-
import deepmerge from 'deepmerge';
43
import path from 'path';
5-
import DefaultWxaConfigs from './const/defaultWxaConfigs';
64
import Builder from './builder';
75
import Tester from './tester/index';
86
import https from 'https';
@@ -13,6 +11,7 @@ import {spawnDevToolCli} from './toolcli';
1311
import {getConfigs} from './getConfigs';
1412
import {WXA_PROJECT_NAME} from './const/wxaConfigs';
1513
import {isEmpty} from './utils';
14+
import logger from './helpers/logger';
1615

1716
const version = require('../package.json').version;
1817

@@ -97,8 +96,7 @@ commander
9796
.option('--cli-path [cliPath]', '微信开发者工具路径')
9897
.action((cmd)=>{
9998
logger.info('Hey', `This is ${chalk.keyword('orange')('wxa@'+version)}, Running in ${chalk.keyword('orange')(process.env.NODE_ENV || 'development')}, Tester Mode`);
100-
let wxaConfigs = getWxaConfigs();
101-
99+
let wxaConfigs = getConfigs();
102100
new Tester(cmd, wxaConfigs).build();
103101
});
104102

@@ -160,7 +158,7 @@ commander
160158
.option('-m, --multi', '三方开发模式,一次操作多个项目')
161159
.option('-p, --project <project>', '三方开发模式,单独指定操作的项目')
162160
.action(async (cmd)=>{
163-
let wxaConfigs = getWxaConfigs();
161+
let wxaConfigs = getConfigs();
164162

165163
let newCli = wrapWxaConfigs((subWxaConfigs, cmd)=>{
166164
let cli = new Toolcli(subWxaConfigs);

0 commit comments

Comments
 (0)