@emartech/json-logger 7.0.2 → 7.1.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/.github/workflows/_init.yml +55 -0
- package/.github/workflows/_release.yml +46 -0
- package/.github/workflows/_test.yml +39 -0
- package/.github/workflows/main.yml +21 -25
- package/README.md +1 -0
- package/main.yml +30 -0
- package/package.json +4 -9
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Initialize build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
outputs:
|
|
7
|
+
NODE_VERSION:
|
|
8
|
+
value: ${{ jobs.init.outputs.NODE_VERSION }}
|
|
9
|
+
NODE_CACHE_KEY:
|
|
10
|
+
value: ${{ jobs.init.outputs.NODE_CACHE_KEY }}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
init:
|
|
14
|
+
name: Initialize build
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
outputs:
|
|
18
|
+
NODE_VERSION: ${{ steps.node-version.outputs.NODE_VERSION }}
|
|
19
|
+
NODE_CACHE_KEY: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout code
|
|
23
|
+
uses: actions/checkout@v3
|
|
24
|
+
with:
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
|
|
27
|
+
- name: Get node version
|
|
28
|
+
id: node-version
|
|
29
|
+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
30
|
+
|
|
31
|
+
- name: Get node cache key
|
|
32
|
+
id: node-cache-key
|
|
33
|
+
run: echo ::set-output name=NODE_CACHE_KEY::npm-${{ steps.node-version.outputs.NODE_VERSION }}-${{ hashFiles('**/package.json') }}
|
|
34
|
+
|
|
35
|
+
- name: Cache dependencies
|
|
36
|
+
id: cache-node-modules
|
|
37
|
+
uses: actions/cache@v3
|
|
38
|
+
with:
|
|
39
|
+
path: node_modules
|
|
40
|
+
key: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}
|
|
41
|
+
|
|
42
|
+
- name: Setup node
|
|
43
|
+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
44
|
+
uses: actions/setup-node@v3
|
|
45
|
+
with:
|
|
46
|
+
node-version: '${{ steps.node-version.outputs.NODE_VERSION }}'
|
|
47
|
+
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
|
|
50
|
+
run: npm install
|
|
51
|
+
|
|
52
|
+
- name: Log results
|
|
53
|
+
run: |
|
|
54
|
+
echo "NODE_VERSION: ${{ steps.node-version.outputs.NODE_VERSION }}"
|
|
55
|
+
echo "NODE_CACHE_KEY: ${{ steps.node-cache-key.outputs.NODE_CACHE_KEY }}"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Release package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
NODE_VERSION:
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
NODE_CACHE_KEY:
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
secrets:
|
|
14
|
+
SEMANTIC_RELEASE_NPM_TOKEN:
|
|
15
|
+
required: true
|
|
16
|
+
SEMANTIC_RELEASE_GH_TOKEN:
|
|
17
|
+
required: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
name: Release package
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout code
|
|
26
|
+
uses: actions/checkout@v3
|
|
27
|
+
|
|
28
|
+
- name: Load dependencies from cache
|
|
29
|
+
uses: actions/cache@v3
|
|
30
|
+
with:
|
|
31
|
+
path: node_modules
|
|
32
|
+
key: ${{ inputs.NODE_CACHE_KEY }}
|
|
33
|
+
|
|
34
|
+
- name: Setup node
|
|
35
|
+
uses: actions/setup-node@v3
|
|
36
|
+
with:
|
|
37
|
+
node-version: '${{ inputs.NODE_VERSION }}'
|
|
38
|
+
|
|
39
|
+
- name: Run build
|
|
40
|
+
run: npm run build
|
|
41
|
+
|
|
42
|
+
- name: Run release
|
|
43
|
+
run: npm run release
|
|
44
|
+
env:
|
|
45
|
+
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
|
46
|
+
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Run tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
NODE_VERSION:
|
|
7
|
+
type: string
|
|
8
|
+
required: true
|
|
9
|
+
NODE_CACHE_KEY:
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: Run tests
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
test: [lint, test]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout code
|
|
25
|
+
uses: actions/checkout@v3
|
|
26
|
+
|
|
27
|
+
- name: Load dependencies from cache
|
|
28
|
+
uses: actions/cache@v3
|
|
29
|
+
with:
|
|
30
|
+
path: node_modules
|
|
31
|
+
key: ${{ inputs.NODE_CACHE_KEY }}
|
|
32
|
+
|
|
33
|
+
- name: Setup node
|
|
34
|
+
uses: actions/setup-node@v3
|
|
35
|
+
with:
|
|
36
|
+
node-version: '${{ inputs.NODE_VERSION }}'
|
|
37
|
+
|
|
38
|
+
- name: Run ${{ matrix.test }} test
|
|
39
|
+
run: npm run ${{ matrix.test }}
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Test and Release
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches: [ master, main ]
|
|
6
6
|
|
|
7
|
-
env:
|
|
8
|
-
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
|
9
|
-
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
|
|
10
|
-
|
|
11
7
|
jobs:
|
|
8
|
+
init:
|
|
9
|
+
name: Init
|
|
10
|
+
uses: ./.github/workflows/_init.yml
|
|
11
|
+
|
|
12
12
|
test:
|
|
13
|
-
|
|
13
|
+
name: Test
|
|
14
|
+
uses: ./.github/workflows/_test.yml
|
|
15
|
+
needs: [ init ]
|
|
16
|
+
with:
|
|
17
|
+
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
|
|
18
|
+
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
run: npm install
|
|
26
|
-
- name: Lint
|
|
27
|
-
run: npm run lint
|
|
28
|
-
- name: Test
|
|
29
|
-
run: npm run test
|
|
30
|
-
- name: Build
|
|
31
|
-
run: npm run build
|
|
32
|
-
- name: Release
|
|
33
|
-
run: npm run semantic-release
|
|
20
|
+
release:
|
|
21
|
+
name: Release
|
|
22
|
+
uses: ./.github/workflows/_release.yml
|
|
23
|
+
needs: [ init, test ]
|
|
24
|
+
with:
|
|
25
|
+
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
|
|
26
|
+
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
|
|
27
|
+
secrets:
|
|
28
|
+
SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
|
29
|
+
SEMANTIC_RELEASE_GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
|
package/README.md
CHANGED
package/main.yml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Test and Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master, main ]
|
|
6
|
+
|
|
7
|
+
env:
|
|
8
|
+
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
|
9
|
+
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
init:
|
|
13
|
+
name: Init
|
|
14
|
+
uses: ./.github/workflows/_init.yml
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
name: Test
|
|
18
|
+
uses: ./.github/workflows/_test.yml
|
|
19
|
+
needs: [ init ]
|
|
20
|
+
with:
|
|
21
|
+
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
|
|
22
|
+
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
|
|
23
|
+
|
|
24
|
+
deploy:
|
|
25
|
+
name: Test
|
|
26
|
+
uses: ./.github/workflows/_deploy.yml
|
|
27
|
+
needs: [ init, test ]
|
|
28
|
+
with:
|
|
29
|
+
NODE_VERSION: ${{ needs.init.outputs.NODE_VERSION }}
|
|
30
|
+
NODE_CACHE_KEY: ${{ needs.init.outputs.NODE_CACHE_KEY }}
|
package/package.json
CHANGED
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
"test:watch": "mocha --require ts-node/register ./src --recursive --watch",
|
|
8
8
|
"lint": "eslint ./src/**/*.{ts,js}",
|
|
9
9
|
"build": "rm -rf dist && tsc --project ./tsconfig.json",
|
|
10
|
-
"
|
|
10
|
+
"release": "CI=true semantic-release",
|
|
11
11
|
"example-js": "DEBUG=* node examples/index-js.js",
|
|
12
|
-
"example-ts": "DEBUG=* ts-node examples/index-ts.ts"
|
|
13
|
-
"koa-example": "DEBUG=* node examples/koa.js",
|
|
14
|
-
"express-example": "DEBUG=* node examples/express.js"
|
|
12
|
+
"example-ts": "DEBUG=* ts-node examples/index-ts.ts"
|
|
15
13
|
},
|
|
16
14
|
"publishConfig": {
|
|
17
15
|
"access": "public"
|
|
@@ -29,7 +27,6 @@
|
|
|
29
27
|
],
|
|
30
28
|
"dependencies": {},
|
|
31
29
|
"devDependencies": {
|
|
32
|
-
"@emartech/cls-adapter": "1.3.0",
|
|
33
30
|
"@types/node": "18.7.14",
|
|
34
31
|
"@typescript-eslint/parser": "5.36.1",
|
|
35
32
|
"chai": "4.3.6",
|
|
@@ -37,14 +34,12 @@
|
|
|
37
34
|
"eslint-config-emarsys": "5.1.0",
|
|
38
35
|
"eslint-plugin-no-only-tests": "3.0.0",
|
|
39
36
|
"eslint-plugin-security": "1.5.0",
|
|
40
|
-
"express": "4.18.1",
|
|
41
|
-
"koa": "2.13.4",
|
|
42
37
|
"mocha": "10.0.0",
|
|
43
38
|
"semantic-release": "19.0.5",
|
|
44
39
|
"sinon": "14.0.0",
|
|
45
40
|
"sinon-chai": "3.7.0",
|
|
46
41
|
"ts-node": "10.9.1",
|
|
47
|
-
"typescript": "4.8.
|
|
42
|
+
"typescript": "4.8.3"
|
|
48
43
|
},
|
|
49
44
|
"repository": {
|
|
50
45
|
"type": "git",
|
|
@@ -54,5 +49,5 @@
|
|
|
54
49
|
"url": "https://github.com/emartech/json-logger-js/issues"
|
|
55
50
|
},
|
|
56
51
|
"homepage": "https://github.com/emartech/json-logger-js#readme",
|
|
57
|
-
"version": "7.0
|
|
52
|
+
"version": "7.1.0"
|
|
58
53
|
}
|