forked from nextauthjs/next-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts): expose types from main package (nextauthjs#1773)
* chore: add beta to release flow/GH actions * feat(ts): expose types from the package (nextauthjs#1665) * chore(types): move existing types to the repo * feat(ts): expose types from the main package * chore(deps): bring back `react-dom` version range * chore(ts): cleanup deps and comments * chore(ci): run types tests on a separate workflow * chore(ci): fix typo on types workflow * fix(ts): correctly export sub-module types (nextauthjs#1677) * chore(types): build types script Adds a script that moves the declaration files we have in `./types` to `./dist` relative to the files they intend to type. This is the first step, we still need to change what we declare in `package.json`, add the script to the CI pipeline if we're happy with it and figure out how to type `next-auth/jwt`. * refactor(lint): fix build-types script * fix(ts): add .d.ts sub-module files to package.json nextauthjs#1677 seemed to miss this * fix(built): typo in package.json * fix(build): fix release * feat(ts): support module augmentation (nextauthjs#1681) * chore(ts): remove unused imports * refactor(ts): clean up CallbackOptions * docs(ts): explain Module Augmentation * docs(ts): don't use @ in folder name "types" * test(ts): make jwt params optional * docs(ts): fix typo (TypeScript -> NextAuth.js) * style: replace ts-standard with eslint/prettier (nextauthjs#1724) * style: move from ts-standard to eslint/prettier * fix: install remaining eslint-config-standard peer deps * fix: add remaining missing dependencies/config Co-authored-by: Balázs Orbán <[email protected]> * docs(lint): update contributing.md (nextauthjs#1760) Regarding ESLint / Prettier use and link to their VSCode extensions * refactor(ts): de-duplicate types (nextauthjs#1690) * refactor(ts): deduplicate internal types * refactor(ts): ease up providers typings * test(ts): fix failing TS tests * test(ts): rename TS property to fix test * docs(ts): mention TS docs in README.md * feat(ts): move/update client types * refactor(TS): rename some types * test(ts): fix client tests * docs(ts): move function descriptions to .d.ts * chore: fix lint error * refactor(ts): separate internal types * chore: simplify build-types script * chore: update type import paths in src * chore(build): create root files at build * chore: remove unnecessary .npmignore * chore: run prettier on types * fix(ts): clean up jwt types * fix(ts): make getToken return type depend on raw param * docs(page): explain page errors, add theming note * docs(ts): add JSDoc to NextAuthOptions props * chore(ts): remove unused import * docs(ts): change JSDOC docs notation * refactor(build): extract module entries into enum * chore(ts): move ClientSafeProvider * chore(ts): simplify GetTokenParams generic * style(lint): fix linting errors * chore: re-add generic extension to GetTokenParams * fix(ts): extract EmailConfigServerOptions to interface * fix(ts): use relative imports * Merge branch 'main' into beta * Merge main into beta * fix(ts): fix typos, add more links to documentation * test(ts): update JWT getToken test * fix(build): fix tsconfig.json formatting * test(ts): use absolute imports in test files * fix(ts): add missing callbacks JSDoc * docs: mention TS in FAQ, fix typos * docs: fix some typos in the docs Co-authored-by: Lluis Agusti <[email protected]> Co-authored-by: Nico Domino <[email protected]>
- Loading branch information
1 parent
bd922db
commit a3ead96
Showing
60 changed files
with
3,171 additions
and
2,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,12 @@ on: | |
push: | ||
branches: | ||
- main | ||
- beta | ||
- next | ||
pull_request: | ||
branches: | ||
- main | ||
- beta | ||
- next | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ on: | |
push: | ||
branches: | ||
- 'main' | ||
- 'beta' | ||
- 'next' | ||
- '3.x' | ||
pull_request: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Types | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- beta | ||
- next | ||
pull_request: | ||
branches: | ||
- main | ||
- beta | ||
- next | ||
|
||
jobs: | ||
lint-and-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
- name: Install dependencies | ||
uses: bahmutov/npm-install@v1 | ||
- name: Check types | ||
run: npm run test:types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const fs = require("fs-extra") | ||
const path = require("path") | ||
|
||
const MODULE_ENTRIES = { | ||
SERVER: "index", | ||
CLIENT: "client", | ||
PROVIDERS: "providers", | ||
ADAPTERS: "adapters", | ||
JWT: "jwt", | ||
} | ||
|
||
const BUILD_TARGETS = { | ||
[`${MODULE_ENTRIES.SERVER}.js`]: "module.exports = require('./dist/server').default\n", | ||
[`${MODULE_ENTRIES.CLIENT}.js`]: "module.exports = require('./dist/client').default\n", | ||
[`${MODULE_ENTRIES.ADAPTERS}.js`]: "module.exports = require('./dist/adapters').default\n", | ||
[`${MODULE_ENTRIES.PROVIDERS}.js`]: "module.exports = require('./dist/providers').default\n", | ||
[`${MODULE_ENTRIES.JWT}.js`]: "module.exports = require('./dist/lib/jwt').default\n", | ||
} | ||
|
||
Object.entries(BUILD_TARGETS).forEach(([target, content]) => { | ||
fs.writeFile(path.join(process.cwd(), target), content, (err) => { | ||
if (err) throw err | ||
console.log(`[build] created "${target}" in root folder`) | ||
}) | ||
}) | ||
|
||
const TYPES_TARGETS = [ | ||
`${MODULE_ENTRIES.SERVER}.d.ts`, | ||
`${MODULE_ENTRIES.CLIENT}.d.ts`, | ||
`${MODULE_ENTRIES.ADAPTERS}.d.ts`, | ||
`${MODULE_ENTRIES.PROVIDERS}.d.ts`, | ||
`${MODULE_ENTRIES.JWT}.d.ts`, | ||
"internals", | ||
] | ||
|
||
TYPES_TARGETS.forEach((target) => { | ||
fs.copy( | ||
path.resolve("types", target), | ||
path.join(process.cwd(), target), | ||
(err) => { | ||
if (err) throw err | ||
console.log(`[build-types] copying "${target}" to root folder`) | ||
} | ||
) | ||
}) |
Oops, something went wrong.