Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how version string is loaded from package.json #21

Merged
merged 5 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
//
// SPDX-License-Identifier: MIT

import fs from 'fs';

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

export const CLIENT_ID_LENGTH = 20;
export const CLIENT_SECRET_LENGTH = 40;
Expand All @@ -16,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
19 changes: 5 additions & 14 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@
"declaration": true,
"strict": true,
"esModuleInterop": true,
"rootDir": "src",
"types": [
"node",
"jest",
"jest-extended"
]
"resolveJsonModule": true,
"rootDirs": ["src", "."],
"types": ["node", "jest", "jest-extended"]
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
"include": ["src/**/*.ts", "test/**/*.ts"],
"exclude": ["node_modules", "dist"]
}
Loading