You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: improve package development experience (#1064)
* chore(deps): add next and react to dev dependencies
* chore: move build configs to avoid crash with next dev
* chore: add next js dev app
* chore: remove .txt extension from LICENSE file
* chore: update CONTRIBUTING.md
* chore: watch css under development
* style(lint): run linter on index.css
* chore: fix some imports for dev server
* refactor: simplify client code
* chore: mention VSCode extension for linting
* docs: reword CONTRIBUTING.md
* chore: ignore linting pages and components
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+23-46Lines changed: 23 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,70 +17,47 @@ Anyone can be a contributor. Either you found a typo, or you have an awesome fea
17
17
* Pull Requests should be raised for any change
18
18
* Pull Requests need approval of a [core contributor](https://next-auth.js.org/contributors#core-team) before merging
19
19
* Rebasing in Pull Requests is preferred to keep a clean commit history (see below)
20
-
*Running`npm run lint:fix` before committing can make resolving conflicts easier
20
+
*Run`npm run lint:fix` before committing to make resolving conflicts easier (VSCode users, check out [this extension](https://marketplace.visualstudio.com/items?itemName=chenxsan.vscode-standardjs) to fix lint issues in development)
21
21
* We encourage you to test your changes, and if you have the opportunity, please make those tests part of the Pull Request
22
22
* If you add new functionality, please provide the corresponding documentation as well and make it part of the Pull Request
23
23
24
24
### Setting up local environment
25
25
26
-
A quick and dirty guide on how to setup *next-auth* locally to work on it and test out any changes:
26
+
A quick guide on how to setup *next-auth* locally to work on it and test out any changes:
3. Link your project back to your local copy of next auth:
39
-
40
-
cd ../your-application
41
-
npm link ../next-auth
34
+
2. Install packages:
35
+
```sh
36
+
npm i
37
+
```
42
38
43
-
4. Finally link React between the repo and the version installed in your project:
39
+
3. Populate `.env.local`:
40
+
41
+
Copy `.env.example` to `.env.local`, and add your env variables for each provider you want to test.
44
42
45
-
cd ../next-auth
46
-
npm link ../your-application/node_modules/react
43
+
>NOTE: You can configure providers of the dev app in `pages/api/auth/[...nextauth].js`
47
44
48
-
*This is an annoying step and not obvious, but is needed because of how React has been written (otherwise React crashes when you try to use the `useSession()` hook in your project).*
45
+
4. Start the dev application/server and CSS watching:
46
+
```sh
47
+
npm run dev
48
+
```
49
49
50
-
That's it!
50
+
Your dev application will be available on ```http://localhost:3000```
51
51
52
-
Notes: You may need to repeat both `npm link` steps if you install / update additional dependencies with `npm i`.
52
+
That's it! 🎉
53
53
54
54
If you need an example project to link to, you can use [next-auth-example](https://github.com/iaincollins/next-auth-example).
55
55
56
56
#### Hot reloading
57
57
58
-
You might find it helpful to use the `npm run watch` command in the next-auth project, which will automatically (and silently) rebuild JS and CSS files as you edit them.
59
-
60
-
cd next-auth/
61
-
npm run watch
62
-
63
-
If you are working on `next-auth/src/client/index.js` hot reloading will work as normal in your Next.js app.
58
+
When running `npm run dev`, you start a Next.js dev server on `http://localhost:3000`, which includes hot reloading out of the box. Make changes on any of the files in `src` and see the changes immediately.
64
59
65
-
However, if you are working on anything else (e.g. `next-auth/src/server/*` etc) then you will need to *stop and start* your app for changes to apply as **Next.js will not hot reload those changes by default**. To facilitate this, you can try [this webpack plugin](https://www.npmjs.com/package/webpack-clear-require-cache-plugin). Note that the `next.config.js` syntax in the plugin README may be out of date. It should look like this:
0 commit comments