Skip to content

Commit

Permalink
chore: expose package version (#479)
Browse files Browse the repository at this point in the history
* chore: expose package version

* chore: version bumping timing and github release

* chore: fix jest global
  • Loading branch information
antfu authored Aug 22, 2020
1 parent a7f2c25 commit 527ceb1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Github Release

on:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Create Release
run: npx conventional-github-releaser -p angular
env:
CI: true
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"update-readme": "node ./scripts/update-readme.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"version": "yarn changelog && yarn update-readme && git add CHANGELOG.md README.*",
"release": "yarn test && yarn publish && git push && yarn release-gh",
"release": "yarn version && yarn test && yarn publish --non-interactive && git push --follow-tags",
"release-gh": "conventional-github-releaser -p angular"
},
"bugs": {
Expand Down Expand Up @@ -91,7 +91,8 @@
"jest": {
"verbose": true,
"globals": {
"__DEV__": true
"__DEV__": true,
"__VERSION__": "0.0.0"
},
"setupFiles": [
"<rootDir>/test/setupTest.js"
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import replace from '@rollup/plugin-replace'
import dts from 'rollup-plugin-dts'
import { version } from './package.json'

const builds = {
'cjs-dev': {
Expand Down Expand Up @@ -81,6 +82,7 @@ function genConfig({ outFile, format, mode }) {
`(process.env.NODE_ENV !== 'production')`
: // hard coded dev/prod builds
!isProd,
__VERSION__: JSON.stringify(version),
}),
isProd && terser(),
].filter(Boolean),
Expand Down
3 changes: 2 additions & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// Global compile-time constants
declare var __DEV__: boolean
declare const __DEV__: boolean
declare const __VERSION__: string
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import type Vue from 'vue'
import { Data, SetupFunction } from './component'
import { Plugin } from './install'

export const version = __VERSION__

export * from './apis'
export { getCurrentInstance } from './runtimeContext'
export {
Expand Down

0 comments on commit 527ceb1

Please sign in to comment.