Skip to content

Commit d08d04d

Browse files
authored
Package JSON fix (#30)
* Change how version string is loaded from package.json
1 parent 544a3c6 commit d08d04d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
2323
},
2424
"files": [
25+
"package.json",
2526
"dist"
2627
],
2728
"scripts": {

‎src/constants.ts‎

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

6-
import { version } from '../package.json';
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+
);
712

813
export const CLIENT_ID_LENGTH = 20;
914
export const CLIENT_SECRET_LENGTH = 40;
@@ -14,7 +19,7 @@ export const JTI_LENGTH = 36;
1419
export const JWT_EXPIRATION = 300;
1520
export const JWT_LEEWAY = 60;
1621

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

0 commit comments

Comments
 (0)