docs: establish convention for how examples reference the core lib#258
docs: establish convention for how examples reference the core lib#258
Conversation
Agent-Logs-Url: https://github.com/forwardsoftware/react-auth/sessions/e8235823-3c6d-4d94-9c62-91510d96b22b Co-authored-by: panz3r <1754457+panz3r@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Establishes and documents a consistent convention for how example apps in examples/ reference @forward-software/react-auth, aligning the Vite examples with the existing showcase pattern and adding central documentation for contributors.
Changes:
- Add Vite
resolve.aliasto point@forward-software/react-authat../../lib/src/index.tsin the Vite examples (base,reqres,refresh-token). - Add TypeScript
compilerOptions.pathsmappings in those examples for editor/TS resolution. - Add/expand documentation describing the “two-layer” convention and how to run/add examples.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/base/vite.config.ts | Adds Vite alias so the example can import the local core lib source during monorepo dev. |
| examples/base/tsconfig.json | Adds TS paths mapping for @forward-software/react-auth. |
| examples/reqres/vite.config.ts | Adds Vite alias to local core lib source. |
| examples/reqres/tsconfig.json | Adds TS paths mapping for @forward-software/react-auth. |
| examples/refresh-token/vite.config.ts | Adds Vite alias to local core lib source. |
| examples/refresh-token/tsconfig.json | Adds TS paths mapping for @forward-software/react-auth. |
| examples/README.md | New central documentation for examples, including the convention and run instructions. |
| CONTRIBUTING.md | Adds “Contributing examples” section documenting the convention and listing showcase. |
| AGENTS.md | Expands the Examples section with a table and documents the convention. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot can you look into the comments made to the PR and apply appropriate changes? |
Agent-Logs-Url: https://github.com/forwardsoftware/react-auth/sessions/2a5acf4a-9e14-4363-a256-2ae07dc8095a Co-authored-by: panz3r <1754457+panz3r@users.noreply.github.com>
Applied all the review feedback in commit f4bab83:
|
Affected Package(s)
Related Issue(s)
Motivation
No documented convention existed for how example apps should depend on
@forward-software/react-auth.base,reqres, andrefresh-tokenpinned a published version with no local alias, whileshowcasealready used Vite path aliases to the lib source andexpoused a Babel alias — with no convention written down anywhere.Description of Changes
Convention established: examples use a two-layer approach —
package.jsonlists the published version (for standalone/CI use), and the bundler + TypeScript are configured to alias the import to../../lib/src/index.tsduring monorepo development so changes tolib/are reflected immediately.examples/base,reqres,refresh-token—vite.config.ts: addedresolve.aliaspointing to local lib source (matchingshowcase)examples/base,reqres,refresh-token—tsconfig.json: addedcompilerOptions.baseUrlandcompilerOptions.pathsfor TypeScript/IDE resolution (baseUrlis required forpathsto be applied bytsc)examples/README.md(new): central reference covering the two-layer convention for both Vite and Expo setups, how to run each example, and how to add a new oneCONTRIBUTING.md: added "Contributing examples" section with code snippets for Vite and Expo setups (including the Expo TypeScriptpathswildcard mapping); addedshowcase/to the examples listAGENTS.md: expanded Examples section with a table (includingshowcase/) and the full convention with snippets for both platforms, including the Expo TypeScriptpathsmappingVite alias pattern (now applied consistently):
Expo / React Native alias pattern:
Breaking Changes
None
How to Test
Vitest) and build steps pass successfully on this PR.pnpm installto install dependencies.pnpm --filter <affected-package> testto run tests for the affected package.pnpm --filter <affected-package> buildto verify the build succeeds.pnpm --filter <affected-package> lintto check for linting errors.Checklist
Notes for Reviewers
The
showcaseexample already had the correct pattern — this PR makes the other three Vite examples consistent with it and documents the full convention (Vite + Expo) so contributors have a clear reference. ThebaseUrl: "."addition ensurestsccorrectly applies thepathsmapping in the three updated examples.