Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed Jun 21, 2024
1 parent 032e1b0 commit 687e60c
Show file tree
Hide file tree
Showing 20 changed files with 10,725 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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Yizack Rangel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @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(
{
rules: {
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
'unicorn/escape-case': 'off',
'no-misleading-character-class': 'off',
},
},
)
67 changes: 67 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "nuxt-webhooks-validator",
"version": "1.0.0",
"description": "Easy validate webhooks in Nuxt",
"keywords": [
"nuxt",
"webhooks",
"validator"
],
"repository": "Yizack/nuxt-webhooks-validator",
"homepage": "https://github.com/Yizack/nuxt-webhooks-validator",
"author": {
"name": "Yizack Rangel",
"email": "yizackr@gmail.com",
"url": "https://yizack.com/"
},
"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 --fix",
"test": "vitest run --reporter=verbose",
"test:watch": "vitest watch"
},
"dependencies": {
"@nuxt/kit": "^3.12.2",
"defu": "^6.1.4",
"unenv": "^1.9.0"
},
"devDependencies": {
"@nuxt/devtools": "^1.3.3",
"@nuxt/eslint-config": "^0.3.13",
"@nuxt/module-builder": "^0.8.0",
"@nuxt/schema": "^3.12.2",
"@nuxt/test-utils": "^3.13.1",
"@types/node": "^20.14.7",
"changelogen": "^0.5.5",
"eslint": "^9.5.0",
"nuxt": "^3.12.2",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.21"
},
"packageManager": "pnpm@9.4.0",
"changelog": {
"repo": {
"repo": "Yizack/nuxt-webhooks-validator",
"provider": "github",
"domain": "github.com"
}
}
}
3 changes: 3 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Waiting for webhooks</div>
</template>
17 changes: 17 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default defineNuxtConfig({
modules: ['../src/module'],
webhooks: {
paddle: {
webhookId: '',
},
paypal: {
clientId: '',
secretKey: '',
webhookId: '',
},
twitch: {
secretKey: '',
},
},
devtools: { enabled: true },
})
13 changes: 13 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"private": true,
"name": "my-module-playground",
"type": "module",
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
},
"dependencies": {
"nuxt": "latest"
}
}
7 changes: 7 additions & 0 deletions playground/server/api/webhooks/paddle.post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineEventHandler(async (event) => {
const isValidWebhook = await webhooks.isValidPaddleWebhook(event)

if (!isValidWebhook) throw createError({ status: 400, message: 'Invalid webhook' })

return { isValidWebhook }
})
7 changes: 7 additions & 0 deletions playground/server/api/webhooks/paypal.post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineEventHandler(async (event) => {
const isValidWebhook = await webhooks.isValidPaypalWebhook(event)

if (!isValidWebhook) throw createError({ status: 400, message: 'Invalid webhook' })

return { isValidWebhook }
})
7 changes: 7 additions & 0 deletions playground/server/api/webhooks/twitch.post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineEventHandler(async (event) => {
const isValidWebhook = await webhooks.isValidTwitchWebhook(event)

if (!isValidWebhook) throw createError({ status: 400, message: 'Invalid webhook' })

return { isValidWebhook }
})
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 687e60c

Please sign in to comment.