Skip to content

Commit 8319d33

Browse files
committed
feat: ✨ create partykit-nuxt
0 parents  commit 8319d33

15 files changed

+10597
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_size = 2
5+
indent_style = space
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Logs
5+
*.log*
6+
7+
# Temp directories
8+
.temp
9+
.tmp
10+
.cache
11+
12+
# Yarn
13+
**/.yarn/cache
14+
**/.yarn/*state*
15+
16+
# Generated dirs
17+
dist
18+
19+
# Nuxt
20+
.nuxt
21+
.output
22+
.data
23+
.vercel_build_output
24+
.build-*
25+
.netlify
26+
27+
# Env
28+
.env
29+
30+
# Testing
31+
reports
32+
coverage
33+
*.lcov
34+
.nyc_output
35+
36+
# VSCode
37+
.vscode/*
38+
!.vscode/settings.json
39+
!.vscode/tasks.json
40+
!.vscode/launch.json
41+
!.vscode/extensions.json
42+
!.vscode/*.code-snippets
43+
44+
# Intellij idea
45+
*.iml
46+
.idea
47+
48+
# OSX
49+
.DS_Store
50+
.AppleDouble
51+
.LSOverride
52+
.AppleDB
53+
.AppleDesktop
54+
Network Trash Folder
55+
Temporary Items
56+
.apdisk

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.experimental.useFlatConfig": true
3+
}

README.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# 🎉 partykit-nuxt
2+
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![License][license-src]][license-href]
6+
[![Nuxt][nuxt-src]][nuxt-href]
7+
8+
Use PartyKit 🎉 with Nuxt 💚
9+
10+
Vue port of PartySocket (PartyKit's Client API), powered by VueUse's [useWebSocket](https://vueuse.org/core/useWebSocket/).
11+
12+
- [ Release Notes](/CHANGELOG.md)
13+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/partykit-nuxt?file=playground%2Fapp.vue) -->
14+
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
15+
16+
## Features
17+
18+
<!-- Highlight some of the features your module provide here -->
19+
- ↔️ &nbsp;usePartySocket() - Vue PartySocket composable
20+
21+
## Roadmap
22+
23+
- Automatically start PartyKit server with Nuxt
24+
25+
## Quick Setup
26+
27+
Install the module to your Nuxt application with one command:
28+
29+
```bash
30+
npx nuxi module add partykit-nuxt
31+
```
32+
33+
That's it! You can now use partykit-nuxt in your Nuxt app ✨
34+
35+
## Documentation
36+
37+
### `usePartySocket()`
38+
39+
```ts
40+
const { close, data, id, open, send, status, ws } = usePartySocket<string>({
41+
host: 'localhost:1999',
42+
room: 'room',
43+
immediate: false,
44+
autoReconnect: true,
45+
query: {
46+
token: accessToken,
47+
},
48+
})
49+
```
50+
51+
## Contribution
52+
53+
<details>
54+
<summary>Local development</summary>
55+
56+
```bash
57+
# Install dependencies
58+
npm install
59+
60+
# Generate type stubs
61+
npm run dev:prepare
62+
63+
# Develop with the playground
64+
npm run dev
65+
66+
# Build the playground
67+
npm run dev:build
68+
69+
# Run ESLint
70+
npm run lint
71+
72+
# Run Vitest
73+
npm run test
74+
npm run test:watch
75+
76+
# Release new version
77+
npm run release
78+
```
79+
80+
</details>
81+
82+
83+
<!-- Badges -->
84+
[npm-version-src]: https://img.shields.io/npm/v/partykit-nuxt/latest.svg?style=flat&colorA=020420&colorB=00DC82
85+
[npm-version-href]: https://npmjs.com/package/partykit-nuxt
86+
87+
[npm-downloads-src]: https://img.shields.io/npm/dm/partykit-nuxt.svg?style=flat&colorA=020420&colorB=00DC82
88+
[npm-downloads-href]: https://npmjs.com/package/partykit-nuxt
89+
90+
[license-src]: https://img.shields.io/npm/l/partykit-nuxt.svg?style=flat&colorA=020420&colorB=00DC82
91+
[license-href]: https://npmjs.com/package/partykit-nuxt
92+
93+
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
94+
[nuxt-href]: https://nuxt.com

eslint.config.mjs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3+
4+
// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
5+
export default createConfigForNuxt({
6+
features: {
7+
// Rules for module authors
8+
tooling: true,
9+
// Rules for formatting
10+
stylistic: true,
11+
},
12+
dirs: {
13+
src: [
14+
'./playground',
15+
],
16+
},
17+
})
18+
.append(
19+
// your custom flat config here...
20+
)

package.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "partykit-nuxt",
3+
"version": "0.0.0",
4+
"description": "Use PartyKit 🎉 with Nuxt 💚",
5+
"repository": "RihanArfan/partykit-nuxt",
6+
"license": "MIT",
7+
"type": "module",
8+
"exports": {
9+
".": {
10+
"types": "./dist/types.d.ts",
11+
"import": "./dist/module.mjs",
12+
"require": "./dist/module.cjs"
13+
}
14+
},
15+
"main": "./dist/module.cjs",
16+
"types": "./dist/types.d.ts",
17+
"files": [
18+
"dist"
19+
],
20+
"scripts": {
21+
"prepack": "nuxt-module-build build",
22+
"dev": "nuxi dev playground",
23+
"dev:build": "nuxi build playground",
24+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
25+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
26+
"lint": "eslint .",
27+
"test": "vitest run",
28+
"test:watch": "vitest watch",
29+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
30+
},
31+
"dependencies": {
32+
"@nuxt/kit": "^3.12.2",
33+
"@vueuse/core": "^10.11.0"
34+
},
35+
"devDependencies": {
36+
"@nuxt/devtools": "^1.3.3",
37+
"@nuxt/eslint-config": "^0.3.13",
38+
"@nuxt/module-builder": "^0.7.1",
39+
"@nuxt/schema": "^3.12.2",
40+
"@nuxt/test-utils": "^3.13.1",
41+
"@types/node": "^20.14.2",
42+
"changelogen": "^0.5.5",
43+
"eslint": "^9.5.0",
44+
"nuxt": "^3.12.2",
45+
"typescript": "latest",
46+
"vitest": "^1.6.0",
47+
"vue-tsc": "^2.0.21"
48+
}
49+
}

0 commit comments

Comments
 (0)