Skip to content

Commit 94fe722

Browse files
committed
Merge branch 'release/0.1.0'
2 parents c4df0b5 + 89200f3 commit 94fe722

File tree

12 files changed

+632
-123
lines changed

12 files changed

+632
-123
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 22.6.0
1+
nodejs 22.7.0

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [0.1.0] - 2024-09-03
6+
7+
### 🚀 Features
8+
9+
- *(vitest)* Setup spec folder
10+
- *(ci)* Add test and coverage workflows
11+
- *(logger)* Add base class with logger property
12+
- *(logger)* Add name and level property
13+
- *(logger)* Add log method for all levels
14+
- Add changelog with git-cliff
15+
16+
### 🐛 Bug Fixes
17+
18+
- [**breaking**] Remove base class since it was causing runtime error
19+
20+
### 🚜 Refactor
21+
22+
- *(logger)* Switch to enum to have a numeric comparison when checking log level
23+
24+
### 📚 Documentation
25+
26+
- Use shields.io for badges
27+
- Add instructions on how to temporary type a property added by a decorator
28+
29+
### 🧪 Testing
30+
31+
- *(logger)* Ensure name is set when provided
32+
33+
### ⚙️ Miscellaneous Tasks
34+
35+
- Add gitignore
36+
- Init boilerplate project
37+
- Init index
38+
- Init tsconfig.json
39+
- Add prettier
40+
- Add test script
41+
- Add build script
42+
- Add start script with ts-node
43+
- Add nodemon for dev task with watch support
44+
- [**breaking**] Rename project to simplelog
45+
- Add GH and codecov badges
46+
- Remove useless nodemon.json
47+
- *(renovate)* Add major approval and develop as base branch
48+
- *(renovate)* Schedule run during night every weekday
49+
- Add typing to specs
50+
- Enable experimentalDecorators
51+
- Build with specific tsconfig.build
52+
- *(ts)* Add js extension for nodenext path resolution
53+
- [**breaking**] Switch to tsx to support ts out of the box
54+
55+
<!-- generated by git-cliff -->

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,19 @@
44
![Codecov](https://img.shields.io/codecov/c/github/devsheva/simplelog)
55

66
A simple logger decorator amplify like
7+
8+
## Important
9+
10+
**Experimental decorators** are used for this package implementation and since experimental it has some bugs like unsafe typing.
11+
TypeScript compiler complains when it finds out a property used inside a class that calls a decorator cause it cannot infer it, so as a temporary workaround simply declare an interface
12+
13+
```ts
14+
interface Example {logger: any}
15+
16+
@Logger()
17+
class Example {
18+
hello() {
19+
this.logger.debug() // THIS IS VALID
20+
}
21+
}
22+
```

cliff.toml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# git-cliff ~ default configuration file
2+
# https://git-cliff.org/docs/configuration
3+
#
4+
# Lines starting with "#" are comments.
5+
# Configuration options are organized into tables and keys.
6+
# See documentation for more information on available options.
7+
8+
[changelog]
9+
# template for the changelog header
10+
header = """
11+
# Changelog\n
12+
All notable changes to this project will be documented in this file.\n
13+
"""
14+
# template for the changelog body
15+
# https://keats.github.io/tera/docs/#introduction
16+
body = """
17+
{% if version %}\
18+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19+
{% else %}\
20+
## [unreleased]
21+
{% endif %}\
22+
{% for group, commits in commits | group_by(attribute="group") %}
23+
### {{ group | striptags | trim | upper_first }}
24+
{% for commit in commits %}
25+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
26+
{% if commit.breaking %}[**breaking**] {% endif %}\
27+
{{ commit.message | upper_first }}\
28+
{% endfor %}
29+
{% endfor %}\n
30+
"""
31+
# template for the changelog footer
32+
footer = """
33+
<!-- generated by git-cliff -->
34+
"""
35+
# remove the leading and trailing s
36+
trim = true
37+
# postprocessors
38+
postprocessors = [
39+
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
40+
]
41+
42+
[git]
43+
# parse the commits based on https://www.conventionalcommits.org
44+
conventional_commits = true
45+
# filter out the commits that are not conventional
46+
filter_unconventional = true
47+
# process each line of a commit as an individual commit
48+
split_commits = false
49+
# regex for preprocessing the commit messages
50+
commit_preprocessors = [
51+
# Replace issue numbers
52+
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
53+
# Check spelling of the commit with https://github.com/crate-ci/typos
54+
# If the spelling is incorrect, it will be automatically fixed.
55+
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
56+
]
57+
# regex for parsing and grouping commits
58+
commit_parsers = [
59+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
60+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
61+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
62+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
63+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
64+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
65+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
66+
{ message = "^chore\\(release\\): prepare for", skip = true },
67+
{ message = "^chore\\(deps.*\\)", skip = true },
68+
{ message = "^chore\\(pr\\)", skip = true },
69+
{ message = "^chore\\(pull\\)", skip = true },
70+
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
71+
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
72+
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
73+
]
74+
# filter out the commits that are not matched by commit parsers
75+
filter_commits = false
76+
# sort the tags topologically
77+
topo_order = false
78+
# sort the commits inside sections by oldest/newest order
79+
sort_commits = "oldest"

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "simplelog",
3+
"type": "module",
34
"description": "A simple logging library",
45
"devDependencies": {
56
"@vitest/coverage-v8": "^2.0.5",
67
"nodemon": "^3.1.4",
78
"prettier": "3.3.3",
8-
"ts-node": "^10.9.2",
9+
"tsx": "^4.19.0",
910
"typescript": "^5.5.4",
1011
"vitest": "^2.0.5"
1112
},
1213
"scripts": {
13-
"start": "pnpm ts-node src/index.ts",
14-
"dev": "pnpm nodemon src/index.ts",
15-
"build": "tsc",
14+
"start": "pnpm tsx src/index.ts",
15+
"dev": "pnpm tsx watch src/index.ts",
16+
"build": "tsc --build tsconfig.build.json",
1617
"test": "vitest",
1718
"coverage": "vitest run --coverage"
1819
}

0 commit comments

Comments
 (0)