Skip to content

Commit

Permalink
feat: ✨ create partykit-nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
RihanArfan committed Jun 20, 2024
0 parents commit 8319d33
Show file tree
Hide file tree
Showing 15 changed files with 10,597 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Dependencies
node_modules

# Logs
*.log*

# Temp directories
.temp
.tmp
.cache

# Yarn
**/.yarn/cache
**/.yarn/*state*

# Generated dirs
dist

# Nuxt
.nuxt
.output
.data
.vercel_build_output
.build-*
.netlify

# Env
.env

# Testing
reports
coverage
*.lcov
.nyc_output

# VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.experimental.useFlatConfig": true
}
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# πŸŽ‰ partykit-nuxt

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

Use PartyKit πŸŽ‰ with Nuxt πŸ’š

Vue port of PartySocket (PartyKit's Client API), powered by VueUse's [useWebSocket](https://vueuse.org/core/useWebSocket/).

- [✨  Release Notes](/CHANGELOG.md)
<!-- - [πŸ€ Online playground](https://stackblitz.com/github/your-org/partykit-nuxt?file=playground%2Fapp.vue) -->
<!-- - [πŸ“– &nbsp;Documentation](https://example.com) -->

## Features

<!-- Highlight some of the features your module provide here -->
- ↔️ &nbsp;usePartySocket() - Vue PartySocket composable

## Roadmap

- Automatically start PartyKit server with Nuxt

## Quick Setup

Install the module to your Nuxt application with one command:

```bash
npx nuxi module add partykit-nuxt
```

That's it! You can now use partykit-nuxt in your Nuxt app ✨

## Documentation

### `usePartySocket()`

```ts
const { close, data, id, open, send, status, ws } = usePartySocket<string>({
host: 'localhost:1999',
room: 'room',
immediate: false,
autoReconnect: true,
query: {
token: accessToken,
},
})
```

## Contribution

<details>
<summary>Local development</summary>

```bash
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release
```

</details>


<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/partykit-nuxt/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/partykit-nuxt

[npm-downloads-src]: https://img.shields.io/npm/dm/partykit-nuxt.svg?style=flat&colorA=020420&colorB=00DC82
[npm-downloads-href]: https://npmjs.com/package/partykit-nuxt

[license-src]: https://img.shields.io/npm/l/partykit-nuxt.svg?style=flat&colorA=020420&colorB=00DC82
[license-href]: https://npmjs.com/package/partykit-nuxt

[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
[nuxt-href]: https://nuxt.com
20 changes: 20 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
export default createConfigForNuxt({
features: {
// Rules for module authors
tooling: true,
// Rules for formatting
stylistic: true,
},
dirs: {
src: [
'./playground',
],
},
})
.append(
// your custom flat config here...
)
49 changes: 49 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "partykit-nuxt",
"version": "0.0.0",
"description": "Use PartyKit πŸŽ‰ with Nuxt πŸ’š",
"repository": "RihanArfan/partykit-nuxt",
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./dist/types.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"files": [
"dist"
],
"scripts": {
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
"lint": "eslint .",
"test": "vitest run",
"test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
},
"dependencies": {
"@nuxt/kit": "^3.12.2",
"@vueuse/core": "^10.11.0"
},
"devDependencies": {
"@nuxt/devtools": "^1.3.3",
"@nuxt/eslint-config": "^0.3.13",
"@nuxt/module-builder": "^0.7.1",
"@nuxt/schema": "^3.12.2",
"@nuxt/test-utils": "^3.13.1",
"@types/node": "^20.14.2",
"changelogen": "^0.5.5",
"eslint": "^9.5.0",
"nuxt": "^3.12.2",
"typescript": "latest",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.21"
}
}
Loading

0 comments on commit 8319d33

Please sign in to comment.