Skip to content

Commit 527ceb1

Browse files
authored
chore: expose package version (#479)
* chore: expose package version * chore: version bumping timing and github release * chore: fix jest global
1 parent a7f2c25 commit 527ceb1

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Github Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v1
15+
- name: Create Release
16+
run: npx conventional-github-releaser -p angular
17+
env:
18+
CI: true
19+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"update-readme": "node ./scripts/update-readme.js",
3737
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
3838
"version": "yarn changelog && yarn update-readme && git add CHANGELOG.md README.*",
39-
"release": "yarn test && yarn publish && git push && yarn release-gh",
39+
"release": "yarn version && yarn test && yarn publish --non-interactive && git push --follow-tags",
4040
"release-gh": "conventional-github-releaser -p angular"
4141
},
4242
"bugs": {
@@ -91,7 +91,8 @@
9191
"jest": {
9292
"verbose": true,
9393
"globals": {
94-
"__DEV__": true
94+
"__DEV__": true,
95+
"__VERSION__": "0.0.0"
9596
},
9697
"setupFiles": [
9798
"<rootDir>/test/setupTest.js"

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import resolve from '@rollup/plugin-node-resolve'
44
import { terser } from 'rollup-plugin-terser'
55
import replace from '@rollup/plugin-replace'
66
import dts from 'rollup-plugin-dts'
7+
import { version } from './package.json'
78

89
const builds = {
910
'cjs-dev': {
@@ -81,6 +82,7 @@ function genConfig({ outFile, format, mode }) {
8182
`(process.env.NODE_ENV !== 'production')`
8283
: // hard coded dev/prod builds
8384
!isProd,
85+
__VERSION__: JSON.stringify(version),
8486
}),
8587
isProd && terser(),
8688
].filter(Boolean),

src/global.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// Global compile-time constants
2-
declare var __DEV__: boolean
2+
declare const __DEV__: boolean
3+
declare const __VERSION__: string

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type Vue from 'vue'
22
import { Data, SetupFunction } from './component'
33
import { Plugin } from './install'
44

5+
export const version = __VERSION__
6+
57
export * from './apis'
68
export { getCurrentInstance } from './runtimeContext'
79
export {

0 commit comments

Comments
 (0)