Skip to content

Commit

Permalink
Change how version string is loaded from package.json (#21)
Browse files Browse the repository at this point in the history
* Change how version string is loaded from package.json

* Add --resolveJsonModule to  build flags

* Try adding current directory to rootDirs

* Add JSON module flag to test

* Update tsconfig.json
  • Loading branch information
mbish authored Feb 2, 2024
1 parent 4c662e3 commit f6bd8be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
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"]
}

0 comments on commit f6bd8be

Please sign in to comment.