semlog 0.6.10 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.editorconfig CHANGED
@@ -1,12 +1,19 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 4
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [*.md]
12
+ trim_trailing_whitespace = false
13
+
14
+ [*.yml]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ [Makefile]
19
+ indent_style = tab
@@ -0,0 +1,55 @@
1
+ name: Build AGENTS
2
+
3
+ on:
4
+ push:
5
+ paths:
6
+ - AGENTS-source.adoc
7
+ - docs/attributes.adoc
8
+ - docs/gesinn-it-docs-master-pub
9
+ - docs/gesinn-it-docs-master-pub/**
10
+ branches:
11
+ - '**'
12
+ workflow_dispatch:
13
+
14
+ jobs:
15
+
16
+ build:
17
+ timeout-minutes: 10
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+ with:
24
+ submodules: 'true'
25
+
26
+ - name: Install tools
27
+ run: |
28
+ sudo apt-get update
29
+ sudo apt-get install -y asciidoctor pandoc
30
+ sudo gem install asciidoctor-reducer --pre
31
+
32
+ - name: Reduce AGENTS source (flatten includes)
33
+ run: asciidoctor-reducer -o AGENTS.adoc AGENTS-source.adoc
34
+
35
+ - name: Convert AsciiDoc to DocBook
36
+ run: asciidoctor -b docbook5 -o AGENTS.xml AGENTS.adoc
37
+
38
+ - name: Convert DocBook to Markdown
39
+ run: pandoc -f docbook -t gfm AGENTS.xml -o AGENTS.md
40
+
41
+ - name: Add autogenerated header (AGENTS)
42
+ run: |
43
+ printf "<!-- THIS FILE IS AUTO-GENERATED. Edit AGENTS-source.adoc instead. -->\n\n" | \
44
+ cat - AGENTS.md > tmp
45
+ mv tmp AGENTS.md
46
+
47
+ - name: Remove intermediate files
48
+ run: rm -f AGENTS.adoc AGENTS.xml
49
+
50
+ - name: Commit generated files
51
+ uses: EndBug/add-and-commit@v8
52
+ with:
53
+ add: AGENTS.md
54
+ pull: '--rebase --autostash'
55
+ message: "docs(ci): update generated AGENTS.md [skip ci]"
@@ -0,0 +1,39 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+
12
+ ci:
13
+ name: "Node ${{ matrix.node }}"
14
+ runs-on: ubuntu-latest
15
+
16
+ strategy:
17
+ matrix:
18
+ node: [20, 22]
19
+
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: ${{ matrix.node }}
28
+
29
+ - name: Install dependencies
30
+ run: npm ci
31
+
32
+ - name: Lint
33
+ run: npm run lint
34
+
35
+ - name: Format check
36
+ run: npm run format:check
37
+
38
+ - name: Test
39
+ run: npm test
@@ -0,0 +1,46 @@
1
+ ## https://github.com/gesinn-it-pub/semlog
2
+
3
+ name: Publish to npm
4
+
5
+ on:
6
+ release:
7
+ types:
8
+ - published
9
+
10
+ jobs:
11
+
12
+ publish:
13
+ name: Publish to npmjs.org
14
+ runs-on: ubuntu-latest
15
+
16
+ permissions:
17
+ contents: read
18
+ id-token: write # Required for npm provenance (OIDC)
19
+
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: 22
28
+ registry-url: 'https://registry.npmjs.org'
29
+
30
+ - name: Upgrade npm (Trusted Publishing requires npm >= 11.5.1)
31
+ run: |
32
+ corepack enable npm
33
+ corepack prepare npm@^11 --activate
34
+ npm --version
35
+
36
+ - name: Install dependencies
37
+ run: npm ci
38
+
39
+ - name: Test
40
+ run: npm test
41
+
42
+ - name: Publish
43
+ run: |
44
+ unset NODE_AUTH_TOKEN
45
+ npm --version
46
+ npm publish --access public
package/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "docs/gesinn-it-docs-master-pub"]
2
+ path = docs/gesinn-it-docs-master-pub
3
+ url = https://github.com/gesinn-it-pub/gesinn-it-docs-master-pub.git
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": true,
4
+ "tabWidth": 4,
5
+ "printWidth": 120,
6
+ "trailingComma": "es5"
7
+ }
@@ -0,0 +1,31 @@
1
+ // ============================================================
2
+ // THIS IS THE SOURCE FILE. Edit this file only.
3
+ // AGENTS.md is AUTO-GENERATED by the GitHub
4
+ // workflow .github/workflows/build-agents.yml.
5
+ // NEVER edit or regenerate AGENTS.md manually.
6
+ // ============================================================
7
+ include::docs/attributes.adoc[]
8
+
9
+ == Coding Conventions
10
+
11
+ include::docs/gesinn-it-docs-master-pub/snippets/{project_type}/coding-conventions.adoc[]
12
+
13
+ == Test Workflow
14
+
15
+ include::docs/gesinn-it-docs-master-pub/snippets/nodejs/ci-npm.adoc[]
16
+
17
+ == Commit Convention
18
+
19
+ include::docs/gesinn-it-docs-master-pub/sections/universal/conventional-commits-policy.adoc[]
20
+
21
+ == Publish Workflow
22
+
23
+ include::docs/gesinn-it-docs-master-pub/snippets/nodejs/ci-publish.adoc[]
24
+
25
+ == Release Workflow
26
+
27
+ include::docs/gesinn-it-docs-master-pub/sections/nodejs/release-workflow.adoc[]
28
+
29
+ == Versioning
30
+
31
+ include::docs/gesinn-it-docs-master-pub/sections/universal/semver-policy.adoc[]
package/AGENTS.md ADDED
@@ -0,0 +1,343 @@
1
+ <!-- THIS FILE IS AUTO-GENERATED. Edit AGENTS-source.adoc instead. -->
2
+
3
+ # Coding Conventions
4
+
5
+ **Coding Conventions — General**
6
+
7
+ All source files regardless of language must follow these baseline
8
+ rules.
9
+
10
+ - Encoding: UTF-8 without BOM
11
+
12
+ - Line endings: Unix-style LF (not CR+LF)
13
+
14
+ - Maximum line length: 120 characters
15
+
16
+ - No trailing whitespace
17
+
18
+ - Newline at end of file
19
+
20
+ **Coding Conventions — JavaScript**
21
+
22
+ Tooling: [ESLint v9](https://eslint.org/) (code quality) +
23
+ [Prettier](https://prettier.io/) (formatting). Run locally:
24
+ `npm run lint` / `npm run format:check` (or `npm test`).
25
+
26
+ Target: Node.js 20+. Declare in `package.json`:
27
+
28
+ ``` json
29
+ "engines": { "node": ">=20.0.0" }
30
+ ```
31
+
32
+ **ESLint — flat config (v9+)**
33
+
34
+ New repositories use [flat
35
+ config](https://eslint.org/docs/latest/use/configure/configuration-files)
36
+ (`eslint.config.js`). Install:
37
+ `npm install --save-dev eslint @eslint/js globals eslint-config-prettier`
38
+
39
+ ``` js
40
+ // eslint.config.js
41
+ import js from '@eslint/js';
42
+ import globals from 'globals';
43
+ import prettier from 'eslint-config-prettier';
44
+
45
+ export default [
46
+ js.configs.recommended,
47
+ {
48
+ languageOptions: {
49
+ globals: globals.node,
50
+ ecmaVersion: 2022,
51
+ },
52
+ rules: {
53
+ 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
54
+ 'no-console': 'off',
55
+ 'prefer-const': 'error',
56
+ },
57
+ },
58
+ prettier, // disables ESLint rules that conflict with Prettier
59
+ ];
60
+ ```
61
+
62
+ <div class="note">
63
+
64
+ Projects with `"type": "commonjs"` in `package.json` must use CJS syntax
65
+ in `eslint.config.js` (`require` / `module.exports`).
66
+
67
+ </div>
68
+
69
+ Run: `npm run lint` (`eslint src/ test/`).
70
+
71
+ **Prettier — code formatting**
72
+
73
+ Formatting (indentation, quotes, line length) is owned by Prettier, not
74
+ ESLint rules. Install: `npm install --save-dev --save-exact prettier`
75
+
76
+ ``` json
77
+ // .prettierrc
78
+ {
79
+ "singleQuote": true,
80
+ "semi": true,
81
+ "tabWidth": 4,
82
+ "printWidth": 120,
83
+ "trailingComma": "es5"
84
+ }
85
+ ```
86
+
87
+ Format: `prettier --write src/ test/`
88
+ Check (CI): `prettier --check src/ test/`
89
+
90
+ **Module system**
91
+
92
+ - New projects: ES Modules (`import` / `export`) with `"type": "module"`
93
+ in `package.json`
94
+
95
+ - Existing CommonJS code (`require` / `module.exports`) does not need to
96
+ migrate
97
+
98
+ - One concern per file; filename reflects its exported symbol
99
+ (`BotRequest.js` for class `BotRequest`)
100
+
101
+ **Naming**
102
+
103
+ - Variables and functions: lowerCamelCase
104
+
105
+ - Constructors / classes: UpperCamelCase
106
+
107
+ - Constants: `ALL_CAPS`
108
+
109
+ - Acronyms as single words: `getHtmlSource`, not `getHTMLSource`
110
+
111
+ **Code style**
112
+
113
+ - `const` and `let` — never `var`
114
+
115
+ - `===` and `!==` always; no Yoda conditions
116
+
117
+ - Arrow functions for callbacks; async/await over raw Promise chains
118
+
119
+ - Optional chaining (`?.`) and nullish coalescing (`??`) over manual
120
+ null checks
121
+
122
+ - Early returns over deeply nested `if` blocks
123
+
124
+ - JSDoc type annotations on public API functions encouraged
125
+
126
+ # Test Workflow
127
+
128
+ **Install dependencies**
129
+
130
+ ``` console
131
+ npm ci
132
+ ```
133
+
134
+ Run all checks (lint + format check + tests):
135
+
136
+ ``` console
137
+ npm test
138
+ ```
139
+
140
+ Run only ESLint:
141
+
142
+ ``` console
143
+ npm run lint
144
+ ```
145
+
146
+ Check formatting (Prettier, non-destructive):
147
+
148
+ ``` console
149
+ npm run format:check
150
+ ```
151
+
152
+ **Pre-commit gate**
153
+
154
+ Run before every commit:
155
+
156
+ ``` console
157
+ make ci 2>&1 | tee /tmp/ci.log; echo "EXIT:$?"
158
+ ```
159
+
160
+ Auto-format source files:
161
+
162
+ ``` console
163
+ npm run format
164
+ ```
165
+
166
+ Run tests with coverage report:
167
+
168
+ ``` console
169
+ npm run test-coverage
170
+ ```
171
+
172
+ # Commit Convention
173
+
174
+ # Conventional Commits Policy
175
+
176
+ Commit messages follow the [Conventional Commits
177
+ specification](https://www.conventionalcommits.org/).
178
+
179
+ Commit format:
180
+
181
+ `type(scope): short description`
182
+
183
+ The scope is optional and should describe the affected subsystem,
184
+ module, or dependency when useful.
185
+
186
+ Examples:
187
+
188
+ - feat(api): add autocomplete endpoint
189
+
190
+ - fix(parser): handle empty token lists
191
+
192
+ - docs(readme): explain input architecture
193
+
194
+ - refactor(parser): simplify token parsing
195
+
196
+ - deps(smw): bump from 5.1.0 to 5.2.0
197
+
198
+ - ci(github): update workflow configuration
199
+
200
+ - test(api): add autocomplete tests
201
+
202
+ Recommended commit types:
203
+
204
+ - `feat` — new functionality
205
+
206
+ - `fix` — bug fixes
207
+
208
+ - `deps` — dependency updates
209
+
210
+ - `docs` — documentation changes
211
+
212
+ - `refactor` — internal code changes without behavioral change
213
+
214
+ - `test` — tests added or updated
215
+
216
+ - `ci` — changes to continuous integration configuration
217
+
218
+ - `chore` — repository maintenance tasks without impact on runtime
219
+ behavior
220
+
221
+ Dependency updates:
222
+
223
+ - Use the `deps` type for dependency upgrades
224
+
225
+ - The scope should identify the dependency being updated
226
+
227
+ - Include the version change when applicable
228
+
229
+ Example:
230
+
231
+ - deps(smw): bump from 5.1.0 to 5.2.0
232
+
233
+ Guidelines:
234
+
235
+ - Use the imperative mood (e.g. "add feature", not "added feature")
236
+
237
+ - Keep the subject line concise
238
+
239
+ - Use the commit body to explain **why**, not only **what**
240
+
241
+ - Scopes should be short, lowercase identifiers (e.g. `api`, `parser`,
242
+ `smw`, `mediawiki`, `docker`)
243
+
244
+ - Use `chore` only for repository maintenance tasks that do not affect
245
+ runtime behavior, dependencies, CI configuration, or tests
246
+
247
+ # Publish Workflow
248
+
249
+ **Publish workflow**
250
+
251
+ Publishing is triggered automatically when a GitHub Release is
252
+ published. The workflow runs all tests before publishing.
253
+
254
+ **Registry:** [npmjs.org](https://www.npmjs.com)
255
+
256
+ Authentication uses [npm
257
+ provenance](https://docs.npmjs.com/generating-provenance-statements) via
258
+ OIDC (OpenID Connect) — no static `NPM_TOKEN` secret is required.
259
+
260
+ The package must be configured as a Trusted Publisher on npmjs.org
261
+ (one-time setup per package): npmjs.org → Package Settings → Publishing
262
+ → Trusted Publishers → add this repository.
263
+
264
+ # Release Workflow
265
+
266
+ # Release Workflow
267
+
268
+ ## Steps
269
+
270
+ 1. Bump version in `package.json` (no git tag, no commit):
271
+
272
+ ``` console
273
+ npm version <major|minor|patch> --no-git-tag-version
274
+ ```
275
+
276
+ 2. Commit:
277
+
278
+ prepared x.x.x [skip ci]
279
+
280
+ 3. Draft release notes (see below) and present for approval.
281
+
282
+ 4. After explicit user approval — push and create GitHub release:
283
+
284
+ ``` console
285
+ git push
286
+ gh release create x.x.x --title "x.x.x" --notes "<release notes>"
287
+ ```
288
+
289
+ Creating the GitHub release triggers the publish workflow
290
+ automatically.
291
+
292
+ ## Release notes
293
+
294
+ List commits since the last release tag as bullet points, grouped by
295
+ type. Include the short commit SHA in parentheses.
296
+
297
+ Present release notes inside a fenced markdown code block for easy
298
+ copying. Wait for explicit user approval before pushing or creating the
299
+ GitHub release.
300
+
301
+ Example:
302
+
303
+ ``` markdown
304
+ ## Features
305
+ - feat(api): add new endpoint for autocomplete (a1b2c3d)
306
+
307
+ ## Fixes
308
+ - fix(parser): handle empty token list (e4f5g6h)
309
+ ```
310
+
311
+ # Versioning
312
+
313
+ # Versioning and Releases
314
+
315
+ This project follows [Semantic Versioning](https://semver.org/).
316
+
317
+ Version numbers follow the format:
318
+
319
+ `MAJOR.MINOR.PATCH`
320
+
321
+ Version increment rules:
322
+
323
+ - MAJOR — incompatible or breaking changes
324
+
325
+ - MINOR — backwards-compatible feature additions
326
+
327
+ - PATCH — backwards-compatible bug fixes
328
+
329
+ Breaking changes include (but are not limited to):
330
+
331
+ - incompatible API changes
332
+
333
+ - removal or renaming of public interfaces
334
+
335
+ - behavior changes that may break existing integrations
336
+
337
+ - increased minimum runtime or dependency requirements
338
+
339
+ - incompatible configuration or data format changes
340
+
341
+ - dependency upgrades that introduce breaking changes for users
342
+
343
+ Breaking changes must always increment the MAJOR version.
package/Makefile ADDED
@@ -0,0 +1,14 @@
1
+ .PHONY: ci
2
+ ci: lint format-check test
3
+
4
+ .PHONY: lint
5
+ lint:
6
+ npm run lint
7
+
8
+ .PHONY: format-check
9
+ format-check:
10
+ npm run format:check
11
+
12
+ .PHONY: test
13
+ test:
14
+ npm test
package/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  [![npm version](https://img.shields.io/npm/v/semlog.svg?style=flat)](https://www.npmjs.com/package/semlog)
2
- [![Dependency Status](https://img.shields.io/david/Fannon/semlog.svg?style=flat)](https://david-dm.org/Fannon/semlog)
3
- [![Build Status](https://img.shields.io/travis/Fannon/semlog.svg?style=flat)](http://travis-ci.org/Fannon/semlog)
4
- [![Code Climate](https://codeclimate.com/github/Fannon/semlog/badges/gpa.svg)](https://codeclimate.com/github/Fannon/semlog)
5
- [![Test Coverage](https://codeclimate.com/github/Fannon/semlog/badges/coverage.svg)](https://codeclimate.com/github/Fannon/semlog)
2
+ [![CI](https://github.com/gesinn-it-pub/semlog/actions/workflows/ci.yml/badge.svg)](https://github.com/gesinn-it-pub/semlog/actions/workflows/ci.yml)
6
3
  > A semantic logger module, that colors / formats automatically
7
4
 
8
5
  ## About
@@ -22,8 +19,8 @@ $ npm install --save semlog
22
19
 
23
20
  ### Import
24
21
  ```javascript
25
- var semlog = require('semlog');
26
- var log = semlog.log; // Optional shortcut for logging
22
+ const semlog = require('semlog');
23
+ const log = semlog.log; // Optional shortcut for logging
27
24
  ```
28
25
 
29
26
  ### Logging
@@ -49,10 +46,10 @@ log('[TODO] todo log entry');
49
46
  ### Logger functions
50
47
  ```javascript
51
48
  // Returns an array with the latest log messages (depending on the config.
52
- var logArchive = semlog.getLogHistory();
49
+ const logArchive = semlog.getLogHistory();
53
50
 
54
51
  // Get current logger config
55
- var config = semlog.getConfig();
52
+ const config = semlog.getConfig();
56
53
 
57
54
  // Change default options:
58
55
  // This will only update the option that are actually given
@@ -69,16 +66,9 @@ semlog.updateConfig({
69
66
  ### Helper Functions and more examples
70
67
  semlog has some built in helper functions like returning nicely formatted dates.
71
68
 
72
- For a complete API Doc, please view the [API docs](https://cdn.rawgit.com/Fannon/semlog/master/doc/).
69
+ For a complete API Doc, please view the [API docs](API.md).
73
70
 
74
- More example can be found in the [unit test](https://github.com/Fannon/semlog/blob/master/test/test.spec.js) file.
71
+ More examples can be found in the [unit test](https://github.com/gesinn-it-pub/semlog/blob/master/test/test.spec.js) file.
75
72
 
76
73
  ## License
77
74
  MIT © [Simon Heimler](http://www.fannon.de)
78
-
79
- [npm-image]: https://badge.fury.io/js/semlog.svg
80
- [npm-url]: https://npmjs.org/package/semlog
81
- [travis-image]: https://travis-ci.org/Fannon/semlog.svg?branch=master
82
- [travis-url]: https://travis-ci.org/Fannon/semlog
83
- [daviddm-image]: https://david-dm.org/Fannon/semlog.svg?theme=shields.io
84
- [daviddm-url]: https://david-dm.org/Fannon/semlog
@@ -0,0 +1,3 @@
1
+ :project_name: semlog
2
+ :project_type: nodejs
3
+ :npm-registry: npmjs
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ const js = require('@eslint/js');
4
+ const globals = require('globals');
5
+ const prettier = require('eslint-config-prettier');
6
+
7
+ module.exports = [
8
+ js.configs.recommended,
9
+ {
10
+ languageOptions: {
11
+ globals: globals.node,
12
+ ecmaVersion: 2022,
13
+ },
14
+ rules: {
15
+ 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
16
+ 'no-console': 'off',
17
+ 'no-var': 'error',
18
+ 'prefer-const': 'error',
19
+ },
20
+ },
21
+ {
22
+ files: ['test/**/*.js'],
23
+ languageOptions: {
24
+ globals: {
25
+ ...globals.node,
26
+ ...globals.mocha,
27
+ },
28
+ },
29
+ },
30
+ prettier,
31
+ ];