Skip to content

Commit

Permalink
Merge pull request #78 from inaiat/feat/v7
Browse files Browse the repository at this point in the history
feat: v7
  • Loading branch information
inaiat authored Jun 4, 2024
2 parents 9a08aa5 + 33dfd84 commit 585cd73
Show file tree
Hide file tree
Showing 25 changed files with 5,724 additions and 19,451 deletions.
44 changes: 33 additions & 11 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
name: Publish Package to npmjs
name: Publish
on:
release:
types: [created]
push:
branches:
- main

jobs:
build:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish --access public

- name: Install corepack
run: npm install -g corepack && corepack enable

- name: Install dependencies
run: pnpm install

- name: Build and test
run: pnpm build && pnpm test

- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Publish package on JSR
# run: pnpm dlx jsr publish

1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm check-commit
2 changes: 1 addition & 1 deletion BUILD_SHA
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a5a6e7962f19d4d754db2afff78546e392f79b5c
739aa6efb9c96e31554306b4761349550825fb2e
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const userSchema = schema({
const userIndexes = [{ key: { name: 1 } }]

declare module 'fastify' {
interface PaprModels {
user: Model<typeof userSchema[0], Partial<typeof userSchema[1]>>
interface FastifyPapr {
user: user: Model<typeof userSchema[0], Partial<typeof userSchema[1]>>
}
}

Expand All @@ -39,7 +39,9 @@ export default fp<FastifyPaprOptions>(

await fastify.register(fastifyPaprPlugin, {
db: fastify.mongo.client.db('test'),
models: { user: asCollection('user', userSchema, userIndexes) },
models: {
user: asCollection('user', userSchema, userIndexes)
},
})
},
{ name: 'papr' },
Expand Down
26 changes: 26 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"lineWidth": 120,
"typescript": {
"quoteStyle": "preferSingle",
"semiColons": "asi",
"binaryExpression.operatorPosition": "sameLine",
"newLineKind": "auto"
},
"json": {},
"markdown": {},
"includes": [
"**/*.{ts,mjs,js,json}"
],
"excludes": [
"**/coverage",
"**/report",
"**/node_modules",
"**/*-lock.json",
"**/dist"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.90.4.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.17.0.wasm"
]
}
77 changes: 77 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import eslint from '@eslint/js'
import functional from 'eslint-plugin-functional/flat'
import n from 'eslint-plugin-n'
import unicorn from 'eslint-plugin-unicorn'
import tseslint from 'typescript-eslint'

const customRules = {
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'no-console': 'error',

'capitalized-comments': 'off',
'new-cap': 'off',
'n/no-missing-import': 'off',
'unicorn/prevent-abbreviations': 'off',

'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/object-curly-spacing': 'off',

'n/no-unpublished-import': 'off',
'unicorn/import-style': 'off',
'unicorn/no-array-method-this-argument': 'off',
'unicorn/no-array-callback-reference': 'off',

'functional/prefer-readonly-type': 'off',
'functional/no-classes': 'off',
'functional/no-return-void': 'off',
'functional/no-let': [
'error',
{
'ignoreIdentifierPattern': '^mut(able|.*)_',
},
],
'functional/immutable-data': [
'error',
{
'ignoreIdentifierPattern': '^mut(able|.*)_',
},
],
}

const languageOptions = {
parserOptions: {
project: true,
},
}

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
n.configs['flat/recommended-module'],
unicorn.configs['flat/recommended'],
functional.configs['lite'],
{
ignores: ['*.mjs', 'dist/', 'coverage/', 'report/'],
},
{
languageOptions,
rules: customRules,
},
{
files: ['**/tests/**'],
languageOptions,
rules: {
...customRules,
'no-console': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/consistent-function-scoping': 'off',
},
},
)
Loading

0 comments on commit 585cd73

Please sign in to comment.