Skip to content

Commit

Permalink
initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe-codez committed Aug 14, 2024
0 parents commit 2c499cc
Show file tree
Hide file tree
Showing 20 changed files with 10,171 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

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

[*.md]
max_line_length = off
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# node_modules
122 changes: 122 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"env": {
"es6": true,
"node": true
},
"plugins": [
"import",
"jsonc",
"no-unsanitized",
"sonarjs",
"simple-import-sort",
"sort-keys-fix",
"unicorn",
"prettier"
],
"overrides": [
{
"files": [
"src/**/*.ts"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:jsonc/recommended-with-jsonc",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended",
"plugin:prettier/recommended",
"plugin:@cspell/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"tsconfig.json"
]
},
"rules": {
"prettier/prettier": "error",
"unicorn/switch-case-braces": "off",
"unicorn/prefer-module": "off",
"@typescript-eslint/no-magic-numbers": "warn",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-null": "off",
"unicorn/no-empty-file": "off",
"sonarjs/prefer-single-boolean-return": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-useless-undefined": "off",
"@typescript-eslint/unbound-method": "error",
"import/no-extraneous-dependencies": [
"error",
{
"packageDir": "./"
}
],
"sonarjs/prefer-immediate-return": "off",
"unicorn/prevent-abbreviations": [
"error",
{
"replacements": {
"docs": false,
"e": false,
"dir": false,
"i": false,
"params": false,
"props": false,
"ref": false,
"temp": false
}
}
],
"no-case-declarations": "off",
"no-async-promise-executor": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/no-array-for-each": "off",
"unicorn/import-style": "off",
"sonarjs/cognitive-complexity": "off",
"sort-keys-fix/sort-keys-fix": "warn",
"unicorn/prefer-event-target": "off",
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"no-console": [
"error"
],
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"varsIgnorePattern": "_|logger"
}
],
"@typescript-eslint/no-explicit-any": "error"
}
},
{
"files": ["*.spec.ts"],
"env": {
"jest": true
},
"rules": {
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-magic-numbers": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-unused-collection": "warn",
"unicorn/consistent-function-scoping": "off"
}
},
{
"files": [
"metrics.helper.ts",
"*.module.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"tsconfig.json"
]
},
"rules": {
"@typescript-eslint/no-magic-numbers": "off"
}
}
]
}
22 changes: 22 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pull Request Checks

on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
lint-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '20'
- run: corepack enable
- run: yarn config set enableImmutableInstalls false
- run: yarn
- run: yarn lint
- run: yarn build
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
- run: corepack enable
- run: yarn config set enableImmutableInstalls false
- run: yarn
- run: yarn build
- run: yarn lint
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
126 changes: 126 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# compiled output
/dist
/build
/tmp
/backup
/out-tsc
.VSCodeCounter
apps/**/yarn.lock
# Private keys
**/*vsix

# dependencies
**/node_modules
config.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

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

# misc
.nx
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
/*.tar

# System Files
.DS_Store
.npmrc
Thumbs.db
globalConfig.json
report.*.json

# tools/security
tools/security/*pem
.gitsecret/keys/random_seed

# React Native

## Xcode

**/ios/**/build/
**/ios/**/*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

## Android

**/android/**/build/
**/android/**/.gradle
**/android/**/local.properties
**/android/**/*.iml

## BUCK

buck-out/
\.buckd/
*.keystore
!debug.keystore

## fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
#
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

## Bundle artifact
*.jsbundle

## CocoaPods
**/ios/Pods/
/

apps/**/artifacts
.config
/.*rc
!/.auto-config-testrc
!/.prettierrc
!/.entity-creationrc
!/.scene-managerrc
!/.pino-prettyrc
/.storage
docker/homeassistant/config
docker/homeassistant/config
bin/


.nx/cache
review.zip
dynamic.d.ts
/obsidian/.obsidian
.yarn/install-state.gz
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": false,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 100,
"arrowParens": "avoid"
}
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
compressionLevel: mixed

nodeLinker: node-modules
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 Zoe

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.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 📨 Welcome to the Fastify Adapter Library

- [Extended docs](https://docs.digital-alchemy.app)
- [Discord](https://discord.gg/JkZ35Gv97Y)

This library acts as a simple wrapper for Fastify, allowing it to be configured and loaded by @digital-alchemy workflows

## 🥡 Import Code

Add as a dependency, and add to your imports. Nice and easy

```bash
npm i @digital-alchemy/fastify-extension
```

> **Add to code**
```typescript
import { LIB_FASTIFY } from "@digital-alchemy/fastify-extension";

// application
const MY_APP = CreateApplication({
libraries: [LIB_FASTIFY],
name: "home_automation",
})

// library
export const MY_LIBRARY = CreateLibrary({
depends: [LIB_FASTIFY],
name: "special_logic",
})
```

## 🧲 Usage

```typescript
export function Example({ fastify }: TServiceParams) {
fastify.routes((fastify: FastifyInstance) => {
fastify.post("/a", () => { /*...*/ });
fastify.get("/b", () => { /*...*/ });
});
}
```
Loading

0 comments on commit 2c499cc

Please sign in to comment.