Skip to content

Commit 6525ee5

Browse files
committed
Add Node 22+ support
1 parent 4ab2e61 commit 6525ee5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

bin/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import chalk from 'chalk';
55
import ora from 'ora';
66
import updateNotifier from 'update-notifier';
77
import dayjs from 'dayjs';
8-
import pkg from '../package.json' assert { type: 'json' };
8+
import { pkg } from './pkg.js';
99

1010
function exit(e: any) {
1111
if (e.message) {

bin/metering.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { mkdirp } from 'mkdirp';
55
import fs from 'fs';
66
import path from 'path';
77
import { type APIResponse, Session } from '../lib/index.js';
8-
import pkg from '../package.json' assert { type: 'json' };
8+
import { pkg } from './pkg.js';
99

1010
export type Format = 'pretty' | 'json' | 'csv';
1111

bin/pkg.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import fs from 'node:fs';
2+
import { dirname, join } from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const packageJSONPath = import.meta.url.includes('dist') ? '../../package.json' : '../package.json';
6+
7+
export const pkg = JSON.parse(fs.readFileSync(join(dirname(fileURLToPath(import.meta.url)), packageJSONPath), 'utf8'));

bin/store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Conf from 'conf';
2-
import pkg from '../package.json' assert { type: 'json' };
2+
import { pkg } from './pkg.js';
33

44
const TOKEN = 'token';
55

0 commit comments

Comments
 (0)