Skip to content

Commit 3bd1046

Browse files
committed
fix: read version from package file
- tsup and extracts version as constant from the json file
1 parent d504b32 commit 3bd1046

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"node": ">=18.12.0"
3535
},
3636
"files": [
37-
"package.json",
3837
"dist"
3938
],
4039
"scripts": {

src/constants.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
//
44
// SPDX-License-Identifier: MIT
55

6-
import fs from 'fs';
7-
import path from 'path';
8-
9-
const pkg = JSON.parse(
10-
fs.readFileSync(path.join(__dirname, '../package.json'), { encoding: 'utf-8' }),
11-
);
6+
import { version } from '../package.json';
127

138
export const CLIENT_ID_LENGTH = 20;
149
export const CLIENT_SECRET_LENGTH = 40;
@@ -19,7 +14,7 @@ export const JTI_LENGTH = 36;
1914
export const JWT_EXPIRATION = 300;
2015
export const JWT_LEEWAY = 60;
2116

22-
export const USER_AGENT = `duo_universal_node/${pkg.version}`;
17+
export const USER_AGENT = `duo_universal_node/${version}`;
2318
export const SIG_ALGORITHM = 'HS512';
2419
export const GRANT_TYPE = 'authorization_code';
2520
export const CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';

0 commit comments

Comments
 (0)