generator-clam
Advanced tools
Comparing version 0.1.58 to 0.1.59
@@ -93,2 +93,8 @@ // 'use strict'; | ||
{ | ||
name : 'isH5', | ||
message: 'is A H5 Project?', | ||
default: 'Y/n', | ||
warning: '' | ||
}, | ||
{ | ||
name : 'srcDir', | ||
@@ -157,2 +163,3 @@ message: 'create "src" directory?', | ||
this.email = props.email; | ||
this.isH5 = (/^y/i).test(props.isH5) ? 'true':'false'; | ||
this.port = props.port; | ||
@@ -159,0 +166,0 @@ this.proxyPort = props.proxyPort; |
@@ -34,3 +34,4 @@ { | ||
"grunt-prompt": "~1.1.0", | ||
"grunt-tpl-compiler":"" | ||
"grunt-tpl-compiler":"", | ||
"grunt-inline-assets":"" | ||
}, | ||
@@ -37,0 +38,0 @@ |
@@ -5,2 +5,3 @@ { | ||
"type": "clam", | ||
"isH5": "true", | ||
"port":"<%= port %>", | ||
@@ -7,0 +8,0 @@ "proxyPort":"<%= proxyPort %>", |
@@ -1,6 +0,3 @@ | ||
/** | ||
* http://g.tbcdn.cn/<%= groupName %>/<%= packageName %>/@@version/config.js | ||
*/ | ||
(function(){ | ||
KISSY.config('tag', null); //去除?t时间戳 | ||
KISSY.config('tag', null); | ||
@@ -34,3 +31,2 @@ var debug = (location.search.indexOf('ks-debug') >= 0); | ||
name: '<%= packageName %>', | ||
// 修改 abc.json 中的 version 字段来生成版本号 | ||
path: 'http://' + srcHost +'/<%= groupName %>/<%= packageName %>/@@version', | ||
@@ -37,0 +33,0 @@ ignorePackageNameInUri: true |
@@ -46,3 +46,3 @@ /** | ||
var Gpkg = grunt.file.readJSON('abc.json'); | ||
if (Gpkg.env === 'daily') base = 'http://g.assets.daily.taobao.net'; | ||
var isH5 = Gpkg.isH5 === "true" ? true : false; | ||
grunt.initConfig({ | ||
@@ -117,46 +117,2 @@ | ||
prompt: { | ||
assets_pub: { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'assets_pub', | ||
type: 'list', | ||
message: 'assets发布,publish type?', | ||
default: 'prepub', | ||
choices: [ | ||
{ | ||
value: 'prepub', | ||
name: '预发,g.assets.daily.taobao.net' | ||
}, | ||
{ | ||
value: 'publish', | ||
name: '正式,g.tbcdn.cn' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
grunt_default: { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'grunt_default', | ||
type: 'list', | ||
message: 'assets构建,build type?', | ||
default: base.valueOf(), | ||
choices: [ | ||
{ | ||
value: 'http://g.assets.daily.taobao.net', | ||
name: '预发,g.assets.daily.taobao.net' | ||
}, | ||
{ | ||
value: 'http://g.tbcdn.cn', | ||
name: '正式,g.tbcdn.cn' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
awpp_question: { | ||
@@ -173,11 +129,15 @@ options: { | ||
value: 'waptest', | ||
name: '日常,waptest' | ||
name: '日常,wapp.waptest.taobao.com' | ||
}, | ||
{ | ||
value: 'wapa --autoparse false', | ||
name: '预发,wapa' | ||
name: '预发,wapp.wapa.taobao.com' | ||
}, | ||
{ | ||
value: 'm --pub false --needperform false', | ||
name: '线上预览环境,wapp.m.taobao.com' | ||
}, | ||
{ | ||
value: 'm', | ||
name: '正式,m' | ||
name: '正式,h5.m.taobao.com' | ||
} | ||
@@ -190,2 +150,21 @@ ] | ||
}, | ||
'inline-assets':{ | ||
options:{ | ||
encoding:'utf8', | ||
// 本地文件引用替换为线上地址 | ||
// KISSY Modules Maps File 地址 | ||
comboMapFile: '../../map.js' | ||
}, | ||
main:{ | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd:'build', | ||
// 对'*.html'文件进行HTML合并解析 | ||
src: ['pages/**/*.html'], | ||
dest: 'build/' | ||
} | ||
] | ||
} | ||
}, | ||
// 静态合并HTML和抽取JS/CSS,解析juicer语法到vm/php | ||
@@ -200,2 +179,3 @@ // https://npmjs.org/package/grunt-combohtml | ||
}, | ||
assetseParser: !isH5, | ||
// 本地文件引用替换为线上地址 | ||
@@ -421,3 +401,3 @@ relative: base + '/<%= abcpkg.group %>/<%= abcpkg.name %>/<%= abcpkg.version %>/', | ||
var msg = grunt.config('awpp_question'); | ||
var command = 'cd build/pages/ ; awpp ./ -p ' + clamUtil.awppDirName(Gpkg.name) + ' -e ' + msg + " ; cd ../../"; | ||
var command = 'cd build/pages/ ; awpp ./ -p ' + clamUtil.awppDirName(Gpkg.name) + ' -e ' + msg + " --notusetoken false --onlinetoken 1baabcdb896630f7a87f9fde4e4d985b --dailytoken db9b515a3c1cb1b0e3bf0bf7b0cbf416 -o 拔赤; cd ../../"; | ||
return command; | ||
@@ -561,2 +541,4 @@ } | ||
grunt.loadNpmTasks('grunt-prompt'); | ||
grunt.loadNpmTasks('grunt-inline-assets'); | ||
grunt.loadNpmTasks('grunt-tpl-compiler'); | ||
@@ -574,7 +556,11 @@ // 根据需要打开这些配置 | ||
grunt.registerTask('prepub', 'clam pre publish...', function (msg) { | ||
base = 'g.assets.daily.taobao.net'; | ||
grunt.config('grunt_default', base); | ||
task.run(['exec_build']); | ||
task.run(['exec:add', 'exec:commit:' + msg]); | ||
task.run(['exec:prepub']); | ||
var done = this.async(); | ||
clamUtil.getBranchVersion(function(version){ | ||
grunt.log.write(('当前分支:' + version).green); | ||
grunt.config.set('currentBranch', version); | ||
task.run(['exec_build']); | ||
task.run(['exec:add', 'exec:commit:' + msg]); | ||
task.run(['exec:prepub']); | ||
done(); | ||
}); | ||
}); | ||
@@ -584,8 +570,12 @@ | ||
grunt.registerTask('publish', 'clam 正式发布', function (msg) { | ||
base = 'g.tbcdn.cn'; | ||
grunt.config('grunt_default', base); | ||
task.run(['exec_build']); | ||
task.run(['exec:add', 'exec:commit:' + msg]); | ||
task.run(['exec:prepub']); | ||
task.run(['exec:grunt_publish']); | ||
var done = this.async(); | ||
clamUtil.getBranchVersion(function(version){ | ||
grunt.log.write(('当前分支:' + version).green); | ||
grunt.config.set('currentBranch', version); | ||
task.run(['exec_build']); | ||
// task.run(['exec:add', 'exec:commit:' + msg]); | ||
// task.run(['exec:prepub']); | ||
task.run(['exec:tag', 'exec:publish']); | ||
done(); | ||
}); | ||
}); | ||
@@ -605,3 +595,2 @@ | ||
grunt.registerTask('exec_build', '执行构建脚本', function () { | ||
base = grunt.config('grunt_default') || base; | ||
var actions = [ | ||
@@ -615,9 +604,11 @@ 'clean:build', | ||
'kmc', | ||
'tms', | ||
'combohtml' | ||
'tms' | ||
]; | ||
if (!/g.tbcdn.cn/.test(base)) { | ||
actions.push('replace:daily'); | ||
if(isH5){ | ||
actions = actions.concat([ | ||
'inline-assets' | ||
]); | ||
} | ||
actions = actions.concat([ | ||
'combohtml', | ||
'replace:dist', | ||
@@ -630,10 +621,4 @@ 'uglify', | ||
grunt.registerTask('exec_publish', '发布、预发assets', function () { | ||
var pubtype = grunt.config('assets_pub'); | ||
pubtype = 'exec:grunt_' + pubtype; | ||
task.run(pubtype); | ||
}); | ||
// 默认构建任务 | ||
grunt.registerTask('build', ['prompt:grunt_default', 'exec_build']); | ||
grunt.registerTask('build', ['exec_build']); | ||
@@ -643,5 +628,2 @@ // 发布页面 | ||
// 发布assets | ||
grunt.registerTask('pub', ['prompt:assets_pub', 'exec_publish']); | ||
grunt.registerTask('newbranch', '获取当前最大版本号,创建新的分支', function (type, msg) { | ||
@@ -688,15 +670,5 @@ var done = this.async(); | ||
// 获取当前分支 | ||
exec('git branch', function (err, stdout, stderr, cb) { | ||
var reg = /\*\s+daily\/(\S+)/, | ||
match = stdout.match(reg); | ||
if (!match) { | ||
grunt.log.error('当前分支为 master 或者名字不合法(daily/x.y.z),请切换到daily分支'.red); | ||
grunt.log.error('创建新daily分支:grunt newbranch'.yellow); | ||
grunt.log.error('只执行构建:grunt build'.yellow); | ||
return; | ||
} | ||
grunt.log.write(('当前分支:' + match[1]).green); | ||
grunt.config.set('currentBranch', match[1]); | ||
clamUtil.getBranchVersion(function(version){ | ||
grunt.log.write(('当前分支:' + version).green); | ||
grunt.config.set('currentBranch', version); | ||
done(); | ||
@@ -708,11 +680,5 @@ }); | ||
task.run(['build']); | ||
} else if ('publish' === type) { | ||
task.run(['exec:tag', 'exec:publish']); | ||
} else if ('prepub' === type) { | ||
task.run(['exec:add', 'exec:commit:' + msg]); | ||
task.run(['exec:prepub']); | ||
} | ||
}); | ||
}; | ||
}; |
{ | ||
"name" : "generator-clam", | ||
"version" : "0.1.58", | ||
"version" : "0.1.59", | ||
"description" : "A Clam generator for Yeoman", | ||
@@ -5,0 +5,0 @@ "keywords" : [ |
@@ -755,1 +755,10 @@ ## 淘宝北京前端开发工具集 | ||
### ChangeLog | ||
#### 0.1.59 | ||
1. 新增H5类型的项目 | ||
1. 如果是H5类型的项目,构建时优先内建Assets | ||
1. awpp新增线上预览环节 | ||
1. awpp版本更新 | ||
1. awpp发布制定拔赤为页面管理员,用以编辑和授权用 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
764
337282
6399