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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor version replacement #4400

Merged
merged 1 commit into from
Dec 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 0 additions & 14 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ if (!fs.existsSync('dist')) {
fs.mkdirSync('dist')
}

// Update main file
const version = process.env.VERSION || require('../package.json').version
const main = fs
.readFileSync('src/core/index.js', 'utf-8')
.replace(/Vue\.version = '[^']+'/, "Vue.version = '" + version + "'")
fs.writeFileSync('src/core/index.js', main)

// update weex subversion
const weexVersion = process.env.WEEX_VERSION || require('../packages/weex-vue-framework/package.json').version
const weexMain = fs
.readFileSync('src/entries/weex-framework.js', 'utf-8')
.replace(/Vue\.version = '[^']+'/, "Vue.version = '" + weexVersion + "'")
fs.writeFileSync('src/entries/weex-framework.js', weexMain)

let builds = require('./config').getAllBuilds()

// filter builds via command line arg
Expand Down
5 changes: 4 additions & 1 deletion build/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const buble = require('rollup-plugin-buble')
const replace = require('rollup-plugin-replace')
const alias = require('rollup-plugin-alias')
const version = process.env.VERSION || require('../package.json').version
const weexVersion = process.env.WEEX_VERSION || require('../packages/weex-vue-framework/package.json').version

const banner =
'/*!\n' +
Expand Down Expand Up @@ -103,7 +104,9 @@ function genConfig (opts) {
moduleName: 'Vue',
plugins: [
replace({
__WEEX__: !!opts.weex
__WEEX__: !!opts.weex,
__WEEX_VERSION__: weexVersion,
__VERSION__: version
}),
flow(),
buble(),
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Object.defineProperty(Vue.prototype, '$isServer', {
get: isServerRendering
})

Vue.version = '2.1.4'
Vue.version = '__VERSION__'

export default Vue
2 changes: 1 addition & 1 deletion src/entries/weex-framework.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Vue from 'weex/runtime/index'
import renderer from 'weex/runtime/config'

Vue.weexVersion = '2.0.5-weex.1'
Vue.weexVersion = '__WEEX_VERSION__'
export { Vue }

const {
Expand Down