Skip to content

Commit

Permalink
Initial setup (#1)
Browse files Browse the repository at this point in the history
* Add project config

* Add Timestamp class

* Add LogEntry and Logger

* Update coverage threshold for branches
  • Loading branch information
CasperSocio committed Dec 12, 2023
1 parent 1776ad9 commit c26bc13
Show file tree
Hide file tree
Showing 24 changed files with 6,044 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reports build status after each push to main

name: build

on:
push:
branches:
- main
paths:
- '__tests__/**'
- 'src/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
-
name: Install dependencies
run: npm ci
-
name: Build
run: npm run build
34 changes: 34 additions & 0 deletions .github/workflows/coverage-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reports test coverage after each push to main

name: test coverage

on:
push:
branches:
- main
paths:
- '__tests__/**'
- 'src/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
test-coverage:
name: Test - Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
-
name: Install dependencies
run: npm ci
-
name: Test
run: npm run test
48 changes: 48 additions & 0 deletions .github/workflows/pr-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Reports build and test status for each pull request

name: PR - Build and Test

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
-
name: Install dependencies
run: npm ci
-
name: Build
run: npm run build
test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
-
name: Install dependencies
run: npm ci
-
name: Test
run: npm run test:ci
34 changes: 34 additions & 0 deletions .github/workflows/test-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reports test status after each push to main

name: tests

on:
push:
branches:
- main
paths:
- '__tests__/**'
- 'src/**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
-
name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
-
name: Install dependencies
run: npm ci
-
name: Test
run: npm run test:ci
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

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

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

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

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Development environment
sandbox
sandboxes
sandbox.ts
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run test
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.github
.husky
.vscode
coverage
dist
node_modules

**/*.json
**/*.md

.gitignore
.prettierignore
.prettierrc

LICENSE
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 80,
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"parser": "typescript",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"prettier.configPath": ".prettierrc",
"prettier.ignorePath": ".prettierignore"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Socio
Copyright (c) 2023-present Casper Tollefsen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# logger
<p align="center">
<a href="https://github.com/Socio-Development/logger">
<img src="https://raw.githubusercontent.com/Socio-Development/generator/66b1ed38bb1f886c5250e69edf8885b3c4656971/docs/assets/socio-full.svg" alt="Socio logo" width="400px">
</a>
</p>
<br />
<p align="center">
<a href="https://github.com/Socio-Development/logger/actions/workflows/build-status.yml"><img src="https://github.com/Socio-Development/logger/actions/workflows/build-status.yml/badge.svg?branch=main" alt="build status"></a>
<a href="https://github.com/Socio-Development/logger/actions/workflows/test-status.yml"><img src="https://github.com/Socio-Development/logger/actions/workflows/test-status.yml/badge.svg?branch=main" alt="test status"></a>
<a href="https://github.com/Socio-Development/logger/actions/workflows/coverage-status.yml"><img src="https://github.com/Socio-Development/logger/actions/workflows/coverage-status.yml/badge.svg?branch=main" alt="test coverage status"></a>
</p>
<br />

# Logger

This repository contains the Logger class, a utility for managing and displaying logs in a structured manner. The Logger class provides static methods for adding logs with varying levels of indentation, representing nested processes.

## Getting started

Run `npm i -D @socio-development/logger`
Loading

0 comments on commit c26bc13

Please sign in to comment.