Skip to content

Commit

Permalink
fix: add types
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Aug 2, 2023
1 parent c994dcc commit bb8a523
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ jobs:
with:
useLockFile: false

- name: 💪 Generate Types
run:
npx -p typescript tsc --declaration --emitDeclarationOnly --allowJs
--checkJs --downlevelIteration --moduleResolution nodenext --target
es2022 --outDir . index.js

- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v3.2.0
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
# This is generated during release
index.d.ts
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
* This was copy/paste/modified/tested from https://npm.im/notp (MIT)
*/
import * as crypto from 'crypto'
/**
* @typedef {import('buffer').Buffer} Buffer
*/

/**
* @type {{ encode: (data: string | Buffer) => string, decode: (data: string) => Buffer }}
*/
import * as base32 from 'thirty-two'

// SHA1 is not secure, but in the context of TOTPs, it's unrealistic to expect
Expand Down
21 changes: 18 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 19 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"exports": {
".": "./index.js"
},
"files": [
"index.js",
"index.d.ts"
],
"publishConfig": {
"access": "public"
},
Expand All @@ -14,7 +18,18 @@
"test": "node --test --test-reporter spec --experimental-test-coverage *.test.js",
"test:watch": "node --test --test-reporter spec --watch *.test.js"
},
"keywords": [],
"keywords": [
"totp",
"2fa",
"two-factor",
"authentication",
"google authenticator",
"1password",
"authy",
"otp",
"time-based one time password",
"one time password"
],
"author": "Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com/)",
"license": "MIT",
"dependencies": {
Expand All @@ -38,5 +53,8 @@
}
}
]
},
"devDependencies": {
"@types/node": "^20.4.5"
}
}

0 comments on commit bb8a523

Please sign in to comment.