Skip to content

Commit cb13df3

Browse files
committed
update build and release scripts for weex
1 parent 2f63cc8 commit cb13df3

File tree

5 files changed

+84
-6
lines changed

5 files changed

+84
-6
lines changed

Diff for: build/build.js

+12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ const main = fs
1515
.replace(/Vue\.version = '[^']+'/, "Vue.version = '" + version + "'")
1616
fs.writeFileSync('src/core/index.js', main)
1717

18+
// update weex subversion
19+
const weexVersion = process.env.WEEX_VERSION || require('../packages/weex-vue-framework/package.json').version
20+
const weexMain = fs
21+
.readFileSync('src/entries/weex-framework.js', 'utf-8')
22+
.replace(/Vue\.version = '[^']+'/, "Vue.version = '" + weexVersion + "'")
23+
fs.writeFileSync('src/entries/weex-framework.js', weexMain)
24+
1825
let builds = require('./config').getAllBuilds()
1926

2027
// filter builds via command line arg
@@ -23,6 +30,11 @@ if (process.argv[2]) {
2330
builds = builds.filter(b => {
2431
return filters.some(f => b.dest.indexOf(f) > -1)
2532
})
33+
} else {
34+
// filter out weex builds by default
35+
builds = builds.filter(b => {
36+
return b.dest.indexOf('weex') === -1
37+
})
2638
}
2739

2840
build(builds)

Diff for: build/ci.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ npm run test:types
55
npm run test:cover
66
npm run test:e2e -- --env phantomjs
77
npm run test:ssr
8+
npm run test:weex
89

910
# report coverage stats for non-PRs
1011
if [[ -z $CI_PULL_REQUEST ]]; then

Diff for: build/get-weex-version.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
var coreVersion = require('../package.json').version
2+
var weexVersion = require('../packages/weex-vue-framework/package.json').version
3+
var weexBaseVersion = weexVersion.match(/^[\d.]+/)[0]
4+
var weexSubVersion = Number(weexVersion.match(/-weex\.(\d+)$/)[1])
5+
6+
if (weexBaseVersion === coreVersion) {
7+
// same core version, increment sub version
8+
weexSubVersion++
9+
} else {
10+
// new core version, reset sub version
11+
weexSubVersion = 1
12+
}
13+
14+
if (process.argv[2] === '-c') {
15+
console.log(weexVersion)
16+
} else {
17+
console.log(weexBaseVersion + '-weex.' + weexSubVersion)
18+
}
19+
20+
module.exports = {
21+
base: weexBaseVersion,
22+
sub: weexSubVersion
23+
}

Diff for: build/release-weex.sh

+38
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
11
# TODO, only release weex package by bumping the weex postfix
2+
set -e
3+
CUR_VERSION=`node build/get-weex-version.js -c`
4+
NEXT_VERSION=`node build/get-weex-version.js`
5+
6+
echo "Current: $CUR_VERSION"
7+
read -p "Enter new version ($NEXT_VERSION): " -n 1 -r
8+
if ! [[ -z $REPLY ]]; then
9+
NEXT_VERSION=$REPLY
10+
fi
11+
12+
read -p "Releasing weex-vue-framework@$NEXT_VERSION - are you sure? (y/n) " -n 1 -r
13+
echo
14+
if [[ $REPLY =~ ^[Yy]$ ]]; then
15+
echo "Releasing weex-vue-framework@$NEXT_VERSION ..."
16+
npm run lint
17+
npm run flow
18+
npm run test:weex
19+
20+
# build
21+
WEEX_VERSION=$NEXT_VERSION npm run build:weex
22+
23+
# update package
24+
cd packages/weex-vue-framework
25+
npm version $NEXT_VERSION
26+
npm publish
27+
cd -
28+
29+
cd packages/weex-template-compiler
30+
npm version $NEXT_VERSION
31+
npm publish
32+
cd -
33+
34+
# commit
35+
git add src/entries/weex-framework.js
36+
git add packages/weex-template-compiler
37+
git add packages/weex-vue-framework
38+
git commit -m "[release] weex-vue-framework@$NEXT_VERSION"
39+
fi

Diff for: build/release.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
set -e
2-
echo "Enter release version: "
3-
read VERSION
42

5-
read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
6-
echo # (optional) move to a new line
7-
if [[ $REPLY =~ ^[Yy]$ ]]
8-
then
3+
if [[ -z $1 ]]; then
4+
echo "Enter new version: "
5+
read VERSION
6+
else
7+
VERSION=$1
8+
fi
9+
10+
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
11+
echo
12+
if [[ $REPLY =~ ^[Yy]$ ]]; then
913
echo "Releasing $VERSION ..."
1014
export SAUCE_BUILD_ID=$VERSION:`date +"%s"`
1115

0 commit comments

Comments
 (0)