Skip to content

Commit

Permalink
chore: use module-builder stub mode for more accurate types
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Dec 6, 2023
1 parent b42ea57 commit be1928d
Show file tree
Hide file tree
Showing 19 changed files with 953 additions and 919 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
cache: pnpm

- name: Install
run: pnpm i
run: pnpm install

- name: Build type stubs
run: pnpm dev:prepare

- name: Lint
run: pnpm run lint
Expand All @@ -37,7 +40,10 @@ jobs:
cache: pnpm

- name: Install
run: pnpm i
run: pnpm install

- name: Build type stubs
run: pnpm dev:prepare

- name: Typecheck
run: pnpm run test:types
Expand All @@ -60,7 +66,10 @@ jobs:
cache: pnpm

- name: Install
run: pnpm i
run: pnpm install

- name: Build type stubs
run: pnpm dev:prepare

- name: Test
run: pnpm run test
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install
run: pnpm i
run: pnpm install

- name: Build type stubs
run: pnpm dev:prepare

- name: Publish to npm
run: npm publish --access public
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![npm version](https://img.shields.io/npm/v/nuxt-api-party?color=a1b858&label=)](https://www.npmjs.com/package/nuxt-api-party)

> [Nuxt](https://nuxt.com) module to securely connect with any API.
[Nuxt](https://nuxt.com) module to securely connect with any API.

- [ Release Notes](https://github.com/johannschopplich/nuxt-api-party/releases)
- [📖  Read the documentation](https://nuxt-api-party.byjohann.dev)
Expand All @@ -21,6 +21,7 @@

## Setup

> [!TIP]
> [📖 Read the documentation](https://nuxt-api-party.byjohann.dev)
```bash
Expand All @@ -33,6 +34,7 @@ npm i -D nuxt-api-party

## Basic Usage

> [!TIP]
> [📖 Read the documentation](https://nuxt-api-party.byjohann.dev)
Add this module `nuxt-api-party` to your Nuxt config and prepare your first API connection by setting an endpoint object with the following properties for the `apiParty` module option:
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"serve": "vitepress serve"
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.23",
"unocss": "^0.57.7",
"@iconify-json/carbon": "^1.1.24",
"unocss": "^0.58.0",
"vitepress": "1.0.0-rc.31"
}
}
12 changes: 5 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import antfu from '@antfu/eslint-config'

export default await antfu(
{
rules: {
'node/prefer-global/buffer': 'off',
'node/prefer-global/process': 'off',
},
export default await antfu({
rules: {
'node/prefer-global/buffer': 'off',
'node/prefer-global/process': 'off',
},
)
})
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,39 @@
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare test/fixture",
"docs": "pnpm -C docs run dev",
"docs:build": "pnpm -C docs run build",
"docs:serve": "pnpm -C docs run serve",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "vitest",
"test:types": "tsc --noEmit",
"release": "bumpp --commit --push --tag",
"prepare": "nuxi prepare playground && nuxi prepare test/fixture"
"release": "bumpp --commit --push --tag"
},
"dependencies": {
"@nuxt/kit": "^3.8.2",
"defu": "^6.1.3",
"ofetch": "^1.3.3",
"ohash": "^1.1.3",
"pathe": "^1.1.1",
"scule": "^1.1.0",
"scule": "^1.1.1",
"ufo": "^1.3.2"
},
"optionalDependencies": {
"openapi-typescript": "^6.7.1"
"openapi-typescript": "^6.7.2"
},
"devDependencies": {
"@antfu/eslint-config": "^2.1.1",
"@antfu/eslint-config": "^2.3.3",
"@nuxt/module-builder": "^0.5.4",
"@nuxt/test-utils": "^3.8.1",
"@types/node": "^20.10.0",
"@types/node": "^20.10.3",
"bumpp": "^9.2.0",
"eslint": "^8.54.0",
"eslint": "^8.55.0",
"nuxt": "^3.8.2",
"nuxt-api-party": "workspace:*",
"typescript": "^5.3.2",
"vitest": "^0.34.6",
"vue-tsc": "^1.8.22"
"vue-tsc": "^1.8.24"
}
}
8 changes: 7 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"name": "playground",
"private": true
"type": "module",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
}
}
5 changes: 4 additions & 1 deletion playground/server/api/_jsonPlaceholder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// import { $jsonPlaceholder } from '#nuxt-api-party/server'
// import { $jsonPlaceholder } from '#imports'
// eslint-disable-next-line ts/prefer-ts-expect-error
// @ts-ignore: Should work but doesn't with `tsc --noEmit`
import { $jsonPlaceholder } from '#nuxt-api-party/server'

export default defineEventHandler(async () => {
const response = await $jsonPlaceholder('posts/1')
Expand Down
3 changes: 3 additions & 0 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}
Loading

0 comments on commit be1928d

Please sign in to comment.