Skip to content

Commit 2d7a3c3

Browse files
committed
Initial version
0 parents  commit 2d7a3c3

25 files changed

+11644
-0
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: corepack enable
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Install dependencies
23+
run: npx nypm@latest i
24+
25+
- name: Lint
26+
run: npm run lint
27+
28+
test:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
- run: corepack enable
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
38+
- name: Install dependencies
39+
run: npx nypm@latest i
40+
41+
- name: Playground prepare
42+
run: npm run dev:prepare
43+
44+
- name: Test
45+
run: npm run test

.gitignore

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

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "client: chrome",
11+
"url": "http://localhost:3000"
12+
},
13+
{
14+
"name": "server: nuxt",
15+
"command": "npm run dev",
16+
"request": "launch",
17+
"type": "node-terminal"
18+
}
19+
],
20+
"compounds": [
21+
{
22+
"name": "fullstack: nuxt",
23+
"configurations": ["client: chrome", "server: nuxt"]
24+
}
25+
]
26+
}

.vscode/settings.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnType": false,
5+
"editor.formatOnPaste": false,
6+
"editor.formatOnSave": false,
7+
8+
// Auto fix
9+
"editor.codeActionsOnSave": {
10+
"source.fixAll.eslint": "explicit",
11+
"source.organizeImports": "never"
12+
},
13+
14+
// Silent the stylistic rules in you IDE, but still auto fix them
15+
"eslint.rules.customizations": [
16+
{ "rule": "style/*", "severity": "off", "fixable": true },
17+
{ "rule": "format/*", "severity": "off", "fixable": true },
18+
{ "rule": "*-indent", "severity": "off", "fixable": true },
19+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
20+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
21+
{ "rule": "*-order", "severity": "off", "fixable": true },
22+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
23+
{ "rule": "*-newline", "severity": "off", "fixable": true },
24+
{ "rule": "*quotes", "severity": "off", "fixable": true },
25+
{ "rule": "*semi", "severity": "off", "fixable": true }
26+
],
27+
28+
// Enable eslint for all supported languages
29+
"eslint.validate": [
30+
"javascript",
31+
"javascriptreact",
32+
"typescript",
33+
"typescriptreact",
34+
"vue",
35+
"html",
36+
"markdown",
37+
"json",
38+
"jsonc",
39+
"yaml",
40+
"toml",
41+
"xml",
42+
"gql",
43+
"graphql",
44+
"astro",
45+
"svelte",
46+
"css",
47+
"less",
48+
"scss",
49+
"pcss",
50+
"postcss"
51+
]
52+
}

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!--
2+
Get your module up and running quickly.
3+
4+
Find and replace all on all files (CMD+SHIFT+F):
5+
- Name: My Plugin
6+
- Package name: gabortorma/mwm-nitro-plugin-template
7+
- Description: My new Nitro plugin
8+
-->
9+
10+
# My Plugin
11+
12+
[![npm version][npm-version-src]][npm-version-href]
13+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
14+
[![License][license-src]][license-href]
15+
[![code style][code-style-src]][code-style-href]
16+
17+
My new Nuxt module for doing amazing things.
18+
19+
- [&nbsp;Release Notes](/CHANGELOG.md)
20+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/mwm-nitro-plugin-template?file=playground%2Fapp.vue) -->
21+
<!-- - [📖 &nbsp;Documentation](https://example.com) -->
22+
23+
## Install
24+
25+
```bash
26+
pnpm install add -D mwm-nitro-plugin-template
27+
```
28+
29+
## Usage
30+
31+
### Nuxt
32+
33+
Add the plugin to your `nuxt.config.js`:
34+
35+
```ts
36+
export default defineNuxtConfig({
37+
nitro: {
38+
plugins: ['@gabortorma/mwm-nitro-plugin-template']
39+
}
40+
})
41+
```
42+
43+
### Nitro
44+
45+
Add the plugin to your `nitro.config.js`:
46+
47+
```ts
48+
export default defineNitroConfig({
49+
plugins: ['@gabortorma/mwm-nitro-plugin-template']
50+
})
51+
```
52+
53+
## Contribution
54+
55+
<details>
56+
<summary>Local development</summary>
57+
58+
```bash
59+
# Install dependencies
60+
npm install
61+
62+
# Generate type stubs
63+
npm run dev:prepare
64+
65+
# Develop with the playground
66+
npm run dev
67+
68+
# Build the playground
69+
npm run dev:build
70+
71+
# Run ESLint
72+
npm run lint
73+
74+
# Run Vitest
75+
npm run test
76+
npm run test:watch
77+
78+
# Release new version
79+
npm run release
80+
```
81+
82+
</details>
83+
84+
<!-- Badges -->
85+
86+
[npm-version-src]: https://img.shields.io/npm/v/@gabortorma/mwm-nitro-plugin-template/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
87+
[npm-version-href]: https://npmjs.com/package/@gabortorma/mwm-nitro-plugin-template
88+
[npm-downloads-src]: https://img.shields.io/npm/dm/@gabortorma/mwm-nitro-plugin-template.svg?style=flat&colorA=18181B&colorB=28CF8D
89+
[npm-downloads-href]: https://npmjs.com/package/@gabortorma/mwm-nitro-plugin-template
90+
[license-src]: https://img.shields.io/npm/l/@gabortorma/mwm-nitro-plugin-template.svg?style=flat&colorA=18181B&colorB=28CF8D
91+
[license-href]: https://npmjs.com/package/@gabortorma/mwm-nitro-plugin-template
92+
[code-style-src]: https://antfu.me/badge-code-style.svg
93+
[code-style-href]: https://github.com/gabortorma/antfu-eslint-config

eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import antfu from '@gabortorma/antfu-eslint-config'
2+
import withNuxt from './playground/.nuxt/eslint.config.mjs'
3+
4+
export default withNuxt(antfu())

package.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "@gabortorma/mwm-nitro-plugin-template",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
6+
"description": "My new Nitro plugin",
7+
"license": "MIT",
8+
"repository": {
9+
"url": "git@github.com:gabortorma/mwm-nitro-plugin-template"
10+
},
11+
"keywords": [
12+
"nitro",
13+
"nitro-plugin",
14+
"template"
15+
],
16+
"exports": {
17+
".": {
18+
"types": "./dist/index.d.ts",
19+
"import": "./dist/index.mjs",
20+
"require": "./dist/index.cjs"
21+
}
22+
},
23+
"main": "./dist/index.cjs",
24+
"types": "./dist/index.d.ts",
25+
"files": [
26+
"dist"
27+
],
28+
"scripts": {
29+
"prepack": "unbuild",
30+
"dev": "nuxi dev playground",
31+
"dev:build": "nuxi build playground",
32+
"dev:prepare": "nuxi prepare playground",
33+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
34+
"lint": "eslint .",
35+
"lint:fix": "eslint . --fix",
36+
"test": "vitest run",
37+
"test:watch": "vitest watch",
38+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
39+
"postinstall": "nuxi prepare && nitro prepare"
40+
},
41+
"dependencies": {
42+
"@feathersjs/express": "^5.0.30",
43+
"engine.io": "^6.6.0",
44+
"express": "^4.21.0",
45+
"h3": "^1.12.0",
46+
"nitropack": "^2.9.7"
47+
},
48+
"devDependencies": {
49+
"@gabortorma/antfu-eslint-config": "^1.5.0",
50+
"@nuxt/devtools": "^1.4.2",
51+
"@nuxt/schema": "^3.13.1",
52+
"@nuxt/test-utils": "^3.14.2",
53+
"@types/node": "^20.16.5",
54+
"@vitest/ws-client": "^2.1.1",
55+
"add": "^2.0.6",
56+
"changelogen": "^0.5.5",
57+
"nuxt": "^3.13.1",
58+
"typescript": "^5.6.2",
59+
"unbuild": "^2.0.0",
60+
"vitest": "^2.1.1",
61+
"vue-tsc": "^2.1.6"
62+
}
63+
}

playground/app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<div>
3+
<NuxtPage />
4+
</div>
5+
</template>

playground/nuxt.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export default defineNuxtConfig({
2+
nitro: {
3+
plugins: [
4+
'../../src/index.ts',
5+
],
6+
// https://nitro.unjs.io/guide/websocket#usage
7+
experimental: {
8+
websocket: true,
9+
},
10+
},
11+
12+
compatibilityDate: '2024-09-12',
13+
14+
modules: [
15+
['@nuxt/eslint', {
16+
checker: true,
17+
config: {
18+
standalone: false,
19+
},
20+
}],
21+
],
22+
23+
devtools: {
24+
enabled: false,
25+
},
26+
})

playground/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "my-module-playground",
3+
"type": "module",
4+
"private": true,
5+
"scripts": {
6+
"dev": "nuxi dev",
7+
"build": "nuxi build",
8+
"generate": "nuxi generate"
9+
},
10+
"dependencies": {
11+
"nuxt": "^3.13.1"
12+
}
13+
}

0 commit comments

Comments
 (0)