Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
otherguy committed Oct 24, 2023
0 parents commit 295a7cc
Show file tree
Hide file tree
Showing 25 changed files with 452 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .depfu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
update_strategy: security
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto
*.js eol=lf
*.json eol=lf
*.proto eol=lf
*.md eol=lf
*.ts eol=lf
*.tsx eol=lf
*.yml eol=lf
*.7z filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GitHub Code Owners

* @otherguy
15 changes: 15 additions & 0 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: autoupdate
on:
push:
branches:
- main
jobs:
autoupdate:
name: autoupdate
runs-on: ubuntu-latest
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_CONFLICT_ACTION: "ignore"
MERGE_MSG: "🔀 Update branch"
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: build
on:
pull_request:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.7
- run: bun install
- run: bun lint
- run: bun test:coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: publish
on:
push:
tags:
- '\d+\.\d+\.\d+'
jobs:
release:
runs-on: ubuntu-latest
steps:
# Checkout project repository
- name: Checkout
uses: actions/checkout@v4

# Setup Bun environment
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.7

- uses: actions/setup-node@v3

- run: bun install


- run: |
sudo tee .npmrc > /dev/null <<EOT
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
EOT
yarn publish --registry https://registry.npmjs.org/ --access=public --tag ${GITHUB_REF_NAME}
yarn publish --registry https://npm.pkg.github.com --access=public --tag ${GITHUB_REF_NAME}
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Update CHANGELOG.md section with new version
- name: Update CHANGELOG.md
uses: smartlyio/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Configure Git and commit changes
# See https:/orgs/community/discussions/26560
- name: Push CHANGELOG.md
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git checkout main
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md for ${GITHUB_REF_NAME}" -m "[skip ci]"
git push origin
# Push repository changes
- name: Push changes to repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin && git push --tags
# Read version changelog
- id: get-changelog
name: Get version changelog
uses: superfaceai/release-changelog-action@v1
with:
path-to-changelog: CHANGELOG.md
version: ${{ env.GITHUB_REF_NAME }}
operation: read

# Update GitHub release with changelog
- name: Update GitHub release documentation
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.GITHUB_REF_NAME }}
body: ${{ steps.get-changelog.outputs.changelog }}
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage
*.lcov

# Dependency directories
node_modules/

# Optional eslint cache
.eslintcache

# dotenv environment variable files
.env
.env.*.local
.env.local

# Bun build directory
build/*
!build/.gitkeep

# Jest coverage directory
reports/*
!reports/.gitkeep

# Proto build directory
src/proto/*
!src/proto/.gitkeep

.yarn-error.log
19 changes: 19 additions & 0 deletions .grenrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"dataSource": "prs",
"prefix": "",
"onlyMilestones": false,
"groupBy": {
"🚀 Enhancements:": ["enhancement", "feature"],
"🐞 Bugfixes:": ["bug", "fix"],
"🔧 Changes:": ["closed", "documentation"],
"🚨 Security": ["🚨 security", "security"],
"🔀 Dependencies": ["dependencies", "depfu"]
},
"template": {
"noLabel": "closed",
"changelogTitle": "# Changelog\n\n",
"release": "## {{release}} ({{date}})\n{{body}}",
"issue": "- {{name}} [{{text}}]({{url}})"
},
"changelogFilename": "CHANGELOG.md"
}
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.gitignore
.gitattributes
.github
bun.lockb
node_modules
tsconfig.json
examples
spec
CHANGELOG.md
sonar-project.properties
bunfig.toml
.npmrc
.grenrc.json
.editorconfig
.vscode
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bun 1.0.7
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
25 changes: 25 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
The MIT License (MIT)
=====================

Copyright © 2019–2024 [Alexansder Graf](https:/otherguy/)

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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @otherguy/elysia-logging
Binary file added bun.lockb
Binary file not shown.
7 changes: 7 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[install]
optional = true
dev = true
peer = false
production = false
frozenLockfile = false
dryRun = false
20 changes: 20 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Config } from "jest";

const config: Config = {
verbose: true,
roots: ["spec"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"],
testPathIgnorePatterns: ["<rootDir>[/\\\\](node_modules)[/\\\\]"],
coverageReporters: ["text", "json", "lcov", "json-summary"],
reporters: [
"default",
["jest-junit", { outputDirectory: "reports", addFileAttribute: "true" }],
["jest-sonar", { outputDirectory: "reports" }],
],
coverageDirectory: "reports",
collectCoverage: true,
collectCoverageFrom: ["src/**/*.{js,jsx,tsx}"],
};

module.exports = config;
70 changes: 70 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "@otherguy/elysia-logging",
"description": "A flexible logging library for Elysia.js",
"author": {
"name": "otherguy",
"url": "https:/otherguy",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https:/otherguy/elysia-logging"
},
"type": "module",
"main": "./dist/index.js",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.js",
"node": "./dist/index.js",
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./types": {
"types": "./dist/types.d.ts"
}
},
"types": "./src/index.ts",
"scripts": {
"build": "rm -rf dist && tsc --project tsconfig.esm.json",
"dev": "bun run --watch src/index.ts | pino-pretty",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"validate": "tsc --noEmit --skipLibCheck",
"lint": "eslint --ext .ts src",
"bundle": "bun build --minify --compile src --outfile=build/api",
"release": "yarn publish --access public"
},
"jestSonar": {
"reportPath": "reports",
"reportFile": "test-report.xml"
},
"dependencies": {
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
"elysia": ">= 0.7.17"
},
"peerDependencies": {
"elysia": ">= 0.7.17"
},
"devDependencies": {
"@types/jest": "^29.5.6",
"bun-types": "^1.0.7",
"eslint": "^8.52.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-sonar": "^0.2.16",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"homepage": "https:/otherguy/elysia-logging",
"bugs": "https:/otherguy/elysia-logging/issues",
"license": "MIT",
"keywords": [
"elysia",
"logging",
"logger"
],
"version": "0.0.2"
}
20 changes: 20 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sonar.host.url=https://sonarcloud.io

sonar.organization=otherguy
sonar.projectKey=elysia-logging
sonar.projectName=elysia-logging
sonar.projectVersion=

sonar.pullrequest.provider=GitHub
sonar.pullrequest.github.repository=otherguy/elysia-logging

sonar.sourceEncoding=UTF-8

sonar.sources=src
sonar.tests=spec
sonar.exclusions=test,reports
sonar.test.inclusions=**/*.spec.ts
sonar.javascript.lcov.reportPaths=./reports/lcov.info
sonar.testExecutionReportPaths=./reports/sonar-report.xml

sonar.links.scm=https:/otherguy/elysia-logging/
9 changes: 9 additions & 0 deletions spec/tbd.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe("arithmetic", () => {
test("2 + 2", () => {
expect(2 + 2).toBe(4);
});

test("2 * 2", () => {
expect(2 * 2).toBe(4);
});
});
Loading

0 comments on commit 295a7cc

Please sign in to comment.