Development Setup
This guide will help you set up a local development environment for contributing to Tourista.
Prerequisites
Node.js 16.0 or higher
pnpm 10.6.2 or higher (package manager)
Git for version control
A Next.js test project (your own or the demo app)
Library Repository Setup
1. Clone the Library Repository
git clone https://github.com/RicSala/tourista.git
cd tourista2. Quick Development Setup
The easiest way to get started:
pnpm run dev:setupThis script (scripts/setup-dev.sh) will:
Install dependencies
Build the library once
Create a global pnpm link
Start watch mode for auto-rebuilding
3. Manual Setup (Alternative)
If you prefer manual setup:
Linking to Your Test Project
In Your Next.js Application
After setting up the library, link it in your test project:
Using the Demo Application
If you're using the tourista-demo repository:
The demo's dev:link script handles cleanup and linking automatically.
Available Scripts in Library
pnpm run build
Build library with tsup (cjs, esm, dts)
pnpm run dev
Watch mode - rebuilds on changes
pnpm run dev:setup
Run setup script (install, build, link, watch)
pnpm run type:check
TypeScript type checking
pnpm run lint
Run ESLint
pnpm run lint:fix
Auto-fix ESLint issues
pnpm run link
Create global pnpm link
pnpm run unlink
Remove global pnpm link
pnpm run version:patch
Bump patch version
pnpm run version:minor
Bump minor version
pnpm run version:major
Bump major version
Build Configuration
The library uses tsup for building with the following configuration:
Formats: CommonJS and ESM modules
Type Definitions: Generated automatically
Clean Build: Removes previous build artifacts
No Code Splitting: Single bundle output
Type Checking
Always run type checking before committing:
This ensures no TypeScript errors are introduced.
Linting
The project uses ESLint with TypeScript support:
Project Structure
Troubleshooting
Link Not Working
If the linked package isn't recognized:
Verify global link exists:
Unlink and relink:
Note the package name difference:
Published package:
TouristaLocal development link:
tourista
Build Errors
If build fails:
Clear the dist folder:
Rebuild:
Type Errors in Test Project
Ensure TypeScript server is restarted in your IDE after linking.
Hot Reload Not Working
If changes aren't reflected:
Ensure dev mode is running:
pnpm run devCheck that the link is active
Restart your Next.js dev server
Git Hooks
The project uses Husky for Git hooks. Run pnpm run prepare to set them up.
Next Steps
Read the Architecture guide to understand the codebase
Check Code Style for coding standards
See Pull Requests for contribution guidelines
Last updated