Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加差异化标签功能于watch #4

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5290af3
Add diffTag
yylgit May 25, 2020
f749ae6
add diffTag
yylgit May 25, 2020
6dd790c
watch and diff
yylgit May 26, 2020
f3c995c
delete lock
yylgit May 27, 2020
1570529
upgrade, [email protected], alibaba adaptor api getStorageSync updated
Irisel Jun 17, 2020
2bed771
upgrade, rm additional yarn.lock
Irisel Jun 17, 2020
179b8f8
adaptor gulp now use adaptor.js from src, instead of node_modules
Irisel Jun 17, 2020
7846fff
upgrade, onLongpress replace to onlongtap, for alibaba wxml
Jun 19, 2020
12bdf15
upgrade
Jun 19, 2020
4cdb779
upgrade, update alibaba converter
Jun 19, 2020
b185cd8
upgrade, temporary add converter copy of src/converter/lib to ./lib, …
Jun 19, 2020
bed6b9d
catchlongtap replace to catchlongpress
Jun 22, 2020
306249a
upgrade, alibaba upload now send type image
Jul 1, 2020
ea17e3c
upgrade
Jul 1, 2020
b448092
upgrade, replace alibaba httprequest to request
Jul 10, 2020
beedf51
convert
yylgit Jul 16, 2020
9a07a12
changelog
yylgit Jul 17, 2020
a709d0a
2.1.2
yylgit Jul 21, 2020
67d8d8d
eslint
Jul 27, 2020
2fb9dc7
upgrade, now use unuglify adaptor
Jul 27, 2020
5b95782
upgrade
Jul 27, 2020
5773773
upgrade
Jul 27, 2020
09811a4
upgrade, new version 2.1.5
Jul 27, 2020
2a543b9
upgrade, update baidu adaptor, tt adaptor, all css converter, not rep…
Jul 28, 2020
391cf8e
upgrade, converter import from src instead of lib
Jul 28, 2020
9d53de3
convert
yylgit Aug 10, 2020
7cff276
path
yylgit Aug 11, 2020
618f323
2.2.0
yylgit Aug 11, 2020
98ef808
upgrade
Aug 11, 2020
455e06b
upgrade, add diffDefine
Mar 25, 2021
17db5f2
upgrade
Mar 25, 2021
42e2c7d
no need to deal with package.json
Apr 29, 2021
6e0b035
upgrade
May 10, 2021
f8e8170
upgrade
May 10, 2021
42d1cf4
diffDefine added to alipay
May 17, 2021
2e7b372
upgrade
May 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
demo
node_modules
src
DEV.md
gulpfile.js
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2.1.0 增加微信插件结构转换其他小程序
项目中配置wwto.config.js
module.exports = {
plugins: {
imPlugin: './app/plugin'
}
}
73 changes: 71 additions & 2 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const commander = require('commander');
const fs = require('fs');
const path = require('path');
const logger = require('../lib/utils/logger');
const wto = require('../lib/index.js');

const wto = require('../src/index.js');
const watch = require('glob-watcher');
function readFile(p) {
let rst = '';
p = (typeof (p) === 'object') ? path.join(p.dir, p.base) : p;
Expand All @@ -27,6 +27,14 @@ function getVersion() {
return version;
}

function isFile(filePath) {
if (fs.existsSync(filePath)) {
var fileStat = fs.statSync(filePath);
return fileStat.isFile();
} else {
return false;
}
}
function displayVersion() {
const version = getVersion();
const chars = [
Expand Down Expand Up @@ -70,21 +78,82 @@ commander.command('build')
.option('-s, --source <source>', '源码目录')
.option('-t, --target <target>', '生成代码目录')
.action(cmd => {
let config = {};
const configFile = path.join(process.cwd(), "./wwto.config.js");

if (isFile(configFile)) {
config = require(configFile);
}
cmd.config = config;
if (cmd.platform === 'baidu') {
wto.toBaidu(cmd);
} else if (cmd.platform === 'alibaba') {
wto.toAlibaba(cmd);
} else if (cmd.platform === 'toutiao') {
wto.toToutiao(cmd);
} else if (cmd.platform === 'wx') {
wto.toWx(cmd);
} else {
wto.toAll(Object.assign(true, cmd, {
wxTarget: [cmd.target, '/wx'].join('/'),
baiduTarget: [cmd.target, '/baidu'].join('/'),
alibabaTarget: [cmd.target, '/alibaba'].join('/'),
toutiaoTarget: [cmd.target, '/toutiao'].join('/')
}));
}
});

let compileIndex = 0;
function watchFile(opt, callback) {
const src = opt.source || './src';
const watcher = watch([src + '/**/**.**']);
logger.info('编译中.......,编译索引:' + ++compileIndex);
callback();
watcher.on('change', function(path, stat) {
logger.info('编译中.......,编译索引:' + ++compileIndex);
callback();
});
}
commander.command('watch')
.description('dev模式编译项目')
.option('-p, --platform <platform>', '目标平台')
.option('-s, --source <source>', '源码目录')
.option('-t, --target <target>', '生成代码目录')
.action(cmd => {
let config = {};
const configFile = path.join(process.cwd(), "./wwto.config.js");

if (isFile(configFile)) {
config = require(configFile);
}
cmd.config = config;
if (cmd.platform === 'baidu') {
watchFile(cmd, function() {
wto.toBaidu(cmd);
});
} else if (cmd.platform === 'alibaba') {
watchFile(cmd, function() {
wto.toAlibaba(cmd);
});
} else if (cmd.platform === 'toutiao') {
watchFile(cmd, function() {
wto.toToutiao(cmd);
});
} else if (cmd.platform === 'wx') {
watchFile(cmd, function() {
wto.toWx(cmd);
});
} else {
watchFile(cmd, function() {
wto.toAll(Object.assign(true, cmd, {
baiduTarget: [cmd.target, '/baidu'].join('/'),
alibabaTarget: [cmd.target, '/alibaba'].join('/'),
toutiaoTarget: [cmd.target, '/toutiao'].join('/')
}));
});
}
});

commander.command('plugin')
.description('编译插件')
.option('-s, --source <source>', '源码目录')
Expand Down
1 change: 1 addition & 0 deletions lib/adaptor/lib/alibaba.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading