File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import { findRoot } from './core/config.ts' ;
44import { log , colorize } from './utils/logger.ts' ;
5+ import { getVersion } from './version-info.ts' ;
56
67const args = process . argv . slice ( 2 ) ;
78const command = args [ 0 ] ;
@@ -143,6 +144,11 @@ async function main() {
143144 break ;
144145 }
145146
147+ case '--version' :
148+ case '-v' :
149+ console . log ( `bumpy ${ getVersion ( ) } ` ) ;
150+ break ;
151+
146152 case 'help' :
147153 case '--help' :
148154 case '-h' :
@@ -163,7 +169,7 @@ async function main() {
163169
164170function printHelp ( ) {
165171 console . log ( `
166- ${ colorize ( ' 🐸 bumpy' , 'bold' ) } - Modern monorepo versioning
172+ ${ colorize ( ` 🐸 bumpy v ${ getVersion ( ) } ` , 'bold' ) } - Modern monorepo versioning
167173
168174 Usage: bumpy <command> [options]
169175
Original file line number Diff line number Diff line change 1+ declare const __BUMPY_VERSION__ : string | undefined ;
2+
3+ /** Get the bumpy version. Injected at build time by tsdown, falls back to "dev" when running from source. */
4+ export function getVersion ( ) : string {
5+ return typeof __BUMPY_VERSION__ !== 'undefined' ? __BUMPY_VERSION__ : 'dev' ;
6+ }
Original file line number Diff line number Diff line change 11import { defineConfig } from 'tsdown' ;
2+ import { readFileSync } from 'node:fs' ;
3+
4+ const pkg = JSON . parse ( readFileSync ( './package.json' , 'utf-8' ) ) ;
25
36export default defineConfig ( {
47 entry : {
@@ -8,4 +11,7 @@ export default defineConfig({
811 format : 'esm' ,
912 dts : true ,
1013 clean : true ,
14+ define : {
15+ __BUMPY_VERSION__ : JSON . stringify ( pkg . version ) ,
16+ } ,
1117} ) ;
You can’t perform that action at this time.
0 commit comments