Skip to content

Commit

Permalink
fix: --version option
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jan 13, 2024
1 parent 2dfc980 commit d266622
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bin.ts
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
import { extname, join } from 'node:path'
import { extname } from 'node:path'
import { parseArgs } from 'node:util'

import chalk from 'chalk'
Expand All @@ -10,6 +10,7 @@ import { Adapter, Low } from 'lowdb'
import { DataFile, JSONFile } from 'lowdb/node'
import { PackageJson } from 'type-fest'

import { fileURLToPath } from 'node:url'
import { createApp } from './app.js'
import { Observer } from './observer.js'
import { Data } from './service.js'
Expand Down Expand Up @@ -70,7 +71,10 @@ function args(): {
// --version
if (values.version) {
const pkg = JSON.parse(
readFileSync(join(__dirname, '../package.json'), 'utf8'),
readFileSync(
fileURLToPath(new URL('../package.json', import.meta.url)),
'utf-8',
),
) as PackageJson
console.log(pkg.version)
process.exit()
Expand Down

0 comments on commit d266622

Please sign in to comment.