Skip to content

Commit 585cd73

Browse files
authored
Merge pull request #78 from inaiat/feat/v7
feat: v7
2 parents 9a08aa5 + 33dfd84 commit 585cd73

25 files changed

+5724
-19451
lines changed

.github/workflows/publish.yaml

+33-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
1-
name: Publish Package to npmjs
1+
name: Publish
22
on:
3-
release:
4-
types: [created]
3+
push:
4+
branches:
5+
- main
6+
57
jobs:
6-
build:
8+
publish:
79
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
815
steps:
9-
- uses: actions/checkout@v3
10-
# Setup .npmrc file to publish to npm
11-
- uses: actions/setup-node@v3
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v2
1220
with:
13-
node-version: '16.x'
21+
node-version: '20'
1422
registry-url: 'https://registry.npmjs.org'
15-
- run: npm ci
16-
- run: npm publish --access public
23+
24+
- name: Install corepack
25+
run: npm install -g corepack && corepack enable
26+
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: Build and test
31+
run: pnpm build && pnpm test
32+
33+
- name: Publish package
34+
run: npm publish --access public
1735
env:
18-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
# - name: Publish package on JSR
39+
# run: pnpm dlx jsr publish
40+

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm check-commit

BUILD_SHA

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a5a6e7962f19d4d754db2afff78546e392f79b5c
1+
739aa6efb9c96e31554306b4761349550825fb2e

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const userSchema = schema({
2626
const userIndexes = [{ key: { name: 1 } }]
2727

2828
declare module 'fastify' {
29-
interface PaprModels {
30-
user: Model<typeof userSchema[0], Partial<typeof userSchema[1]>>
29+
interface FastifyPapr {
30+
user: user: Model<typeof userSchema[0], Partial<typeof userSchema[1]>>
3131
}
3232
}
3333

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

4040
await fastify.register(fastifyPaprPlugin, {
4141
db: fastify.mongo.client.db('test'),
42-
models: { user: asCollection('user', userSchema, userIndexes) },
42+
models: {
43+
user: asCollection('user', userSchema, userIndexes)
44+
},
4345
})
4446
},
4547
{ name: 'papr' },

dprint.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"lineWidth": 120,
3+
"typescript": {
4+
"quoteStyle": "preferSingle",
5+
"semiColons": "asi",
6+
"binaryExpression.operatorPosition": "sameLine",
7+
"newLineKind": "auto"
8+
},
9+
"json": {},
10+
"markdown": {},
11+
"includes": [
12+
"**/*.{ts,mjs,js,json}"
13+
],
14+
"excludes": [
15+
"**/coverage",
16+
"**/report",
17+
"**/node_modules",
18+
"**/*-lock.json",
19+
"**/dist"
20+
],
21+
"plugins": [
22+
"https://plugins.dprint.dev/typescript-0.90.4.wasm",
23+
"https://plugins.dprint.dev/json-0.19.2.wasm",
24+
"https://plugins.dprint.dev/markdown-0.17.0.wasm"
25+
]
26+
}

eslint.config.mjs

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import eslint from '@eslint/js'
2+
import functional from 'eslint-plugin-functional/flat'
3+
import n from 'eslint-plugin-n'
4+
import unicorn from 'eslint-plugin-unicorn'
5+
import tseslint from 'typescript-eslint'
6+
7+
const customRules = {
8+
'@typescript-eslint/consistent-type-exports': 'error',
9+
'@typescript-eslint/consistent-type-imports': 'error',
10+
'@typescript-eslint/no-unused-vars': 'error',
11+
'no-console': 'error',
12+
13+
'capitalized-comments': 'off',
14+
'new-cap': 'off',
15+
'n/no-missing-import': 'off',
16+
'unicorn/prevent-abbreviations': 'off',
17+
18+
'@typescript-eslint/consistent-type-definitions': 'off',
19+
'@typescript-eslint/member-delimiter-style': 'off',
20+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
21+
'@typescript-eslint/naming-convention': 'off',
22+
'@typescript-eslint/no-unsafe-assignment': 'warn',
23+
'@typescript-eslint/object-curly-spacing': 'off',
24+
25+
'n/no-unpublished-import': 'off',
26+
'unicorn/import-style': 'off',
27+
'unicorn/no-array-method-this-argument': 'off',
28+
'unicorn/no-array-callback-reference': 'off',
29+
30+
'functional/prefer-readonly-type': 'off',
31+
'functional/no-classes': 'off',
32+
'functional/no-return-void': 'off',
33+
'functional/no-let': [
34+
'error',
35+
{
36+
'ignoreIdentifierPattern': '^mut(able|.*)_',
37+
},
38+
],
39+
'functional/immutable-data': [
40+
'error',
41+
{
42+
'ignoreIdentifierPattern': '^mut(able|.*)_',
43+
},
44+
],
45+
}
46+
47+
const languageOptions = {
48+
parserOptions: {
49+
project: true,
50+
},
51+
}
52+
53+
export default tseslint.config(
54+
eslint.configs.recommended,
55+
...tseslint.configs.recommended,
56+
...tseslint.configs.recommendedTypeChecked,
57+
n.configs['flat/recommended-module'],
58+
unicorn.configs['flat/recommended'],
59+
functional.configs['lite'],
60+
{
61+
ignores: ['*.mjs', 'dist/', 'coverage/', 'report/'],
62+
},
63+
{
64+
languageOptions,
65+
rules: customRules,
66+
},
67+
{
68+
files: ['**/tests/**'],
69+
languageOptions,
70+
rules: {
71+
...customRules,
72+
'no-console': 'off',
73+
'unicorn/no-await-expression-member': 'off',
74+
'unicorn/consistent-function-scoping': 'off',
75+
},
76+
},
77+
)

0 commit comments

Comments
 (0)