Skip to content

Commit

Permalink
fix: read version from package file
Browse files Browse the repository at this point in the history
- tsup and extracts version as constant from the json file
  • Loading branch information
lukashroch committed Jan 18, 2025
1 parent d504b32 commit 3bd1046
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"node": ">=18.12.0"
},
"files": [
"package.json",
"dist"
],
"scripts": {
Expand Down
9 changes: 2 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
//
// SPDX-License-Identifier: MIT

import fs from 'fs';
import path from 'path';

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

export const CLIENT_ID_LENGTH = 20;
export const CLIENT_SECRET_LENGTH = 40;
Expand All @@ -19,7 +14,7 @@ export const JTI_LENGTH = 36;
export const JWT_EXPIRATION = 300;
export const JWT_LEEWAY = 60;

export const USER_AGENT = `duo_universal_node/${pkg.version}`;
export const USER_AGENT = `duo_universal_node/${version}`;
export const SIG_ALGORITHM = 'HS512';
export const GRANT_TYPE = 'authorization_code';
export const CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
Expand Down

0 comments on commit 3bd1046

Please sign in to comment.