Skip to content

Commit ec46c6d

Browse files
author
Pascal Klesse
committed
chore: update configuration and dependencies for improved compatibility and performance
1 parent 57652d0 commit ec46c6d

22 files changed

+15399
-10306
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,18 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- uses: pnpm/action-setup@v4
18-
with:
19-
version: 10
20-
2117
- name: Use Node LTS ✨
2218
uses: actions/setup-node@v4
2319
with:
2420
node-version: lts/*
2521
registry-url: https://registry.npmjs.org
26-
cache: pnpm
22+
cache: npm
2723

2824
- name: Install dependencies 📦️
29-
run: pnpm install --frozen-lockfile
25+
run: npm ci
3026

3127
- name: Build playground
32-
run: cd playground/nuxt-app && pnpm install && pnpm build
28+
run: cd playground/nuxt-app && npm ci && npm run build
3329

3430
- name: Build
35-
run: pnpm build
31+
run: npm run build

.github/workflows/next.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,27 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- uses: pnpm/action-setup@v4
20-
with:
21-
version: 10
22-
2319
- name: Use Node LTS ✨
2420
uses: actions/setup-node@v4
2521
with:
2622
node-version: lts/*
2723
registry-url: https://registry.npmjs.org
28-
cache: pnpm
24+
cache: npm
2925

3026
- name: Install dependencies 📦️
31-
run: pnpm install --frozen-lockfile
27+
run: npm ci
3228

3329
- name: Install dependencies
34-
run: cd playground/nuxt-app && pnpm install && pnpm build
30+
run: cd playground/nuxt-app && npm ci && npm run build
3531

36-
- run: pnpm build
32+
- run: npm run build
3733

3834
- name: Set git identity
3935
run: |
4036
git config user.name 'github-actions[bot]'
4137
git config user.email 'github-actions[bot]@users.noreply.github.com'
4238
43-
- run: pnpm version prerelease --preid=dev
39+
- run: npm version prerelease --preid=dev
4440

4541
- name: Push
4642
run: |
@@ -49,7 +45,7 @@ jobs:
4945
5046
- name: Publish 🚀
5147
shell: bash
52-
run: pnpm publish --tag next --access public --no-git-checks
48+
run: npm publish --tag next --access public
5349
env:
5450
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5551

.github/workflows/release.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- uses: pnpm/action-setup@v4
19-
with:
20-
version: 10
21-
2218
- name: Use Node LTS ✨
2319
uses: actions/setup-node@v4
2420
with:
2521
node-version: lts/*
2622
registry-url: https://registry.npmjs.org
27-
cache: pnpm
23+
cache: npm
2824

2925
- run: |
3026
git config user.name github-actions
@@ -36,17 +32,18 @@ jobs:
3632
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3733

3834
- name: Install dependencies 📦️
39-
run: pnpm install --frozen-lockfile
35+
run: npm ci
4036

4137
- name: Build playground
42-
run: cd playground/nuxt-app && pnpm install && pnpm build
38+
run: cd playground/nuxt-app && npm ci && npm run build
4339

4440
- name: Build
45-
run: pnpm build
41+
run: npm run build
4642

47-
- uses: simenandre/publish-with-pnpm@v2
48-
with:
49-
npm-auth-token: ${{ secrets.NPM_TOKEN }}
43+
- name: Publish 🚀
44+
run: npm publish --access public
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5047

5148
- name: Deploy notification
5249
if: always()

CLAUDE.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is `@lenne.tech/nuxt-base`, a Nuxt module that provides GraphQL integration and code generation capabilities for Nuxt applications. The module focuses on GraphQL codegen, easy GraphQL syntax, and authentication helpers.
8+
9+
## Development Commands
10+
11+
### Core Development
12+
- `npm run dev:prepare` - Generate type stubs and prepare the development environment
13+
- `npm run dev` - Start development server with playground app on port 3001
14+
- `npm run dev:generate-types` - Start dev server with type generation enabled (GENERATE_TYPES=1)
15+
- `npm run dev:build` - Build the playground application
16+
17+
### Building and Testing
18+
- `npm run build` - Build the module using nuxt-module-build
19+
- `npm run test` - Run tests with Vitest
20+
- `npm run test:watch` - Run tests in watch mode
21+
22+
### Code Quality
23+
- `npm run lint` - Run ESLint on TypeScript, JavaScript, and Vue files
24+
- `npm run lint:fix` - Run ESLint with auto-fix
25+
26+
### Release Management
27+
- `npm run release` - Create a new release with standard-version and push to main
28+
- `npm run release:minor` - Create a minor release
29+
- `npm run release:major` - Create a major release
30+
31+
### Utilities
32+
- `npm run reinit` - Complete reinstall (removes lock files, node_modules, clears cache)
33+
34+
## Architecture Overview
35+
36+
### Module Structure
37+
- **`src/module.ts`** - Main Nuxt module definition with configuration options and setup logic
38+
- **`src/generate.ts`** - GraphQL type generation and composable creation logic
39+
- **`src/runtime/`** - Runtime code that gets bundled with the module
40+
41+
### Runtime Architecture
42+
The runtime is organized into several key directories:
43+
44+
- **`classes/`** - Core classes including GraphQL type helpers and standard utilities
45+
- **`composables/`** - Vue composables for GraphQL operations (query, mutation, subscription) and auth
46+
- **`enums/`** - GraphQL-related enums and request types
47+
- **`interfaces/`** - TypeScript interfaces for GraphQL operations and configuration
48+
- **`plugins/`** - Nuxt plugins for cookies, GraphQL meta, WebSocket, and auth
49+
- **`states/`** - Pinia/state management for authentication
50+
51+
### Key Features
52+
1. **GraphQL Code Generation** - Automatically generates TypeScript types and composables from GraphQL schema
53+
2. **Authentication System** - Built-in auth state management with JWT token handling
54+
3. **WebSocket Support** - Real-time GraphQL subscriptions via WebSocket
55+
4. **Type Safety** - Full TypeScript support with generated types
56+
57+
### Configuration
58+
Module configuration happens in `nuxt.config.ts` under the `nuxtBase` key:
59+
```typescript
60+
nuxtBase: {
61+
generateTypes: boolean, // Enable/disable type generation
62+
gqlHost: string, // GraphQL endpoint URL
63+
host: string, // Base host URL
64+
schema: string, // Path to GraphQL schema file
65+
storagePrefix: string, // Local storage prefix for auth tokens
66+
disableGraphql: boolean, // Completely disable GraphQL features
67+
registerAuthPlugins: boolean, // Enable auth plugins
68+
registerCookiePlugin: boolean, // Enable cookie plugin
69+
autoImport: boolean // Enable auto-import of generated composables
70+
}
71+
```
72+
73+
### Playground Application
74+
The `playground/nuxt-app/` directory contains a complete Nuxt application for testing the module:
75+
- Uses the module in development mode
76+
- Includes a GraphQL server in `playground/server/`
77+
- Demonstrates auth flows, GraphQL operations, and real-time features
78+
79+
### Type Generation Process
80+
When `generateTypes: true` or `GENERATE_TYPES=1`:
81+
1. Module loads GraphQL schema from file or introspects remote endpoint
82+
2. Generates TypeScript types in `src/base/default.ts`
83+
3. Creates typed composables in `src/base/index.ts`
84+
4. Auto-imports become available for use in Nuxt applications
85+
86+
### Testing
87+
- Uses Vitest for unit testing
88+
- Test fixtures in `test/fixtures/` for integration testing
89+
- ESLint configuration extends `@lenne.tech/eslint-config-vue`
90+
91+
## Important Notes
92+
93+
- Node.js >= 22 and npm >= 10 required
94+
- The module exits after type generation (5 second timeout) when `generateTypes` is enabled
95+
- WebSocket URL is automatically derived from `gqlHost` (https → wss, http → ws)
96+
- Built for ESM environments with proper transpilation handling for problematic dependencies

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
1. Add `@lenne.tech/nuxt-base` dependency to your project
2323

2424
```bash
25-
# Using pnpm
26-
pnpm add -D @lenne.tech/nuxt-base
25+
# Using npm
26+
npm install -D @lenne.tech/nuxt-base
2727

2828
# Using yarn
2929
yarn add --dev @lenne.tech/nuxt-base

eslint.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import vue from '@lenne.tech/eslint-config-vue';
22

3-
export default vue;
3+
export default [
4+
...vue,
5+
{
6+
ignores: ['playground/**']
7+
}
8+
];

0 commit comments

Comments
 (0)