Skip to content

Commit 211b5f3

Browse files
authored
feat: add auto version (#51)
1 parent 00ba857 commit 211b5f3

File tree

15 files changed

+26
-4
lines changed

15 files changed

+26
-4
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"lint": "eslint . --ext .ts",
2121
"lint:fix": "eslint . --ext .ts --fix",
2222
"prepublishOnly": "npx only-allow pnpm && npm run build",
23+
"postversion": "genversion src/version.ts --es6 && git add src/version.ts package.json && git commit --amend --no-edit",
2324
"slip44": "npm i bip44-constants@latest -D && node scripts/slip44-json.js",
2425
"character": "node scripts/get_character_list.js"
2526
},
@@ -54,6 +55,7 @@
5455
"eslint": "8.22.0",
5556
"eslint-config-blockabc": "^0.15.2",
5657
"eslint-plugin-n": "^15.3.0",
58+
"genversion": "^3.1.1",
5759
"jest": "^28.1.1",
5860
"ts-jest": "^28.0.5",
5961
"ts-node": "^10.8.1",

packages/plugin-avatar/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"scripts": {
88
"clear": "rm -rf ./lib/ ./lib.esm/",
99
"prepublishOnly": "npx only-allow pnpm && npm run build",
10+
"postversion": "genversion src/version.ts --es6 && git add src/version.ts package.json && git commit --amend --no-edit",
1011
"build": "npm run clear && npm run build:esm && npm run build:commonjs",
1112
"build:commonjs": "tsc -p tsconfig.build.json",
1213
"build:esm": "tsc -p tsconfig.build.esm.json",

packages/plugin-avatar/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { fetchJson } from '@ethersproject/web'
44
import { BigNumber } from '@ethersproject/bignumber'
55
import { hexConcat, hexDataSlice, hexZeroPad } from '@ethersproject/bytes'
66
import { toUtf8String } from '@ethersproject/strings'
7+
import { version } from './version'
78

89
const matcherIpfs = /^(ipfs):\/\/(.*)$/i
910

@@ -52,7 +53,7 @@ interface BitPluginAvatarOptions {
5253
}
5354

5455
export class BitPluginAvatar implements BitPluginBase {
55-
version = '0.0.1'
56+
version = version
5657
name = 'BitPluginAvatar'
5758

5859
ipfs = 'https://gateway.ipfs.io'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Generated by genversion.
2+
export const version = '0.0.1'

packages/plugin-register/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"scripts": {
88
"clear": "rm -rf ./lib/ ./lib.esm/",
99
"prepublishOnly": "npx only-allow pnpm && npm run build",
10+
"postversion": "genversion src/version.ts --es6 && git add src/version.ts package.json && git commit --amend --no-edit",
1011
"build": "npm run clear && npm run build:esm && npm run build:commonjs",
1112
"build:commonjs": "tsc -p tsconfig.build.json",
1213
"build:esm": "tsc -p tsconfig.build.esm.json",

packages/plugin-register/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import GnosisSDK, { EthSignSignature } from '@gnosis.pm/safe-core-sdk'
2121
import EthNftGnosisAbi from './EthNftGnosisAbi.json'
2222
import EthNftAbi from './EthNftAbi.json'
2323
import { ethers } from 'ethers'
24+
import { version } from './version'
2425

2526
export class BitPluginRegister implements BitPluginBase {
26-
version = '0.0.1' // todo: use version replacement
27+
version = version
2728
name = 'BitPluginRegister'
2829

2930
onInstall (dotbit: DotBit) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Generated by genversion.
2+
export const version = '0.0.2'

packages/plugin-template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"scripts": {
88
"clear": "rm -rf ./lib/ ./lib.esm/",
99
"prepublishOnly": "npm run build",
10+
"postversion": "genversion src/version.ts --es6 && git add src/version.ts package.json && git commit --amend --no-edit",
1011
"build": "npm run clear && npm run build:esm && npm run build:commonjs",
1112
"build:commonjs": "tsc -p tsconfig.build.json",
1213
"build:esm": "tsc -p tsconfig.build.esm.json",

packages/plugin-template/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { DotBit, BitAccount, BitPluginBase, sleep } from 'dotbit'
22
import './types'
3+
import { version } from './version'
34

45
export class BitPluginTemplate implements BitPluginBase {
5-
version = '0.0.1'
6+
version = version
67
name = 'BitPluginTemplate'
78

89
onInstall (dotbit: DotBit) {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Generated by genversion.
2+
export const version = '0.0.2'

0 commit comments

Comments
 (0)