Skip to content

Commit d110dae

Browse files
Update dependencies for coverage package (#22)
* update dependencies and migrate to es modules * fix invalid meow configuration * bump version to 0.1.2 * change versioning to include breaking change * enable ESM in tests * fix tests for convert * adapt tests to use ESM * update GitHub actions: separate checks for coverage and generator because they run on a different node version * Update firebase-rules-coverage/tsconfig.json unify Co-authored-by: Dennis Kugelmann <dennis.kugelmann@simpleclub.com> --------- Co-authored-by: Dennis Kugelmann <dennis.kugelmann@simpleclub.com>
1 parent 7ad763e commit d110dae

File tree

19 files changed

+1803
-3144
lines changed

19 files changed

+1803
-3144
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ updates:
1111
interval: "daily"
1212
reviewers:
1313
- IchordeDionysos
14-
ignore:
15-
- dependency-name: "meow"
16-
# Ignore meow 10.x for now as jest does not work properly with ES modules yet.
17-
versions: [ "10.x" ]
1814
- package-ecosystem: "npm"
1915
directory: "/firebase-rules-generator"
2016
schedule:
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Because new version of firebase-rules-coverage only works
2+
# with Node 16, we can't have the same checks as for the firebase-rules-generator.
3+
name: Lints & Tests
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
paths:
9+
- 'firebase-rules-coverage/**'
10+
push:
11+
branches:
12+
- main
13+
paths:
14+
- 'firebase-rules-coverage/**'
15+
16+
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
name: ${{ matrix.package }} lints on Node ${{ matrix.node_version }}
20+
strategy:
21+
matrix:
22+
package:
23+
- 'firebase-rules-coverage'
24+
node_version:
25+
- '16'
26+
- '18'
27+
fail-fast: false
28+
steps:
29+
- uses: actions/checkout@v2
30+
- uses: actions/setup-node@v2
31+
with:
32+
node-version: ${{ matrix.node_version }}
33+
- name: Install dependencies
34+
run: yarn install --frozen-lockfile
35+
working-directory: ${{ matrix.package }}
36+
- name: Run ESLint
37+
run: yarn lint
38+
working-directory: ${{ matrix.package }}
39+
40+
test:
41+
runs-on: ubuntu-latest
42+
name: ${{ matrix.package }} tests on Node ${{ matrix.node_version }}
43+
strategy:
44+
matrix:
45+
package:
46+
- 'firebase-rules-coverage'
47+
node_version:
48+
- '16'
49+
- '18'
50+
fail-fast: false
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: actions/setup-node@v2
54+
with:
55+
node-version: ${{ matrix.node_version }}
56+
- name: Install dependencies
57+
run: yarn install --frozen-lockfile
58+
working-directory: ${{ matrix.package }}
59+
- name: Run tests
60+
run: yarn test
61+
working-directory: ${{ matrix.package }}
62+
- name: Report coverage
63+
if: ${{ success() || failure() }}
64+
uses: coverallsapp/github-action@master
65+
with:
66+
github-token: ${{ secrets.github_token }}
67+
flag-name: ${{ matrix.package }}-node-${{ matrix.node_version }}
68+
parallel: true
69+
path-to-lcov: './${{ matrix.package }}/coverage/lcov.info'
70+
71+
finish:
72+
needs: test
73+
runs-on: ubuntu-latest
74+
if: ${{ success() || failure() }}
75+
steps:
76+
- name: Finalize coverage reporting
77+
uses: coverallsapp/github-action@master
78+
with:
79+
github-token: ${{ secrets.github_token }}
80+
81+
parallel-finished: true

.github/workflows/checks.yaml renamed to .github/workflows/checks-generator.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ on:
33
pull_request:
44
branches:
55
- main
6+
paths:
7+
- 'firebase-rules-generator/**'
68
push:
79
branches:
810
- main
11+
paths:
12+
- 'firebase-rules-generator/**'
913

1014
jobs:
1115
lint:
@@ -14,11 +18,12 @@ jobs:
1418
strategy:
1519
matrix:
1620
package:
17-
- 'firebase-rules-coverage'
1821
- 'firebase-rules-generator'
1922
node_version:
2023
- '12'
2124
- '14'
25+
- '16'
26+
- '18'
2227
fail-fast: false
2328
steps:
2429
- uses: actions/checkout@v2
@@ -38,11 +43,12 @@ jobs:
3843
strategy:
3944
matrix:
4045
package:
41-
- 'firebase-rules-coverage'
4246
- 'firebase-rules-generator'
4347
node_version:
4448
- '12'
4549
- '14'
50+
- '16'
51+
- '18'
4652
fail-fast: false
4753
steps:
4854
- uses: actions/checkout@v2

.github/workflows/deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
# Publish to NPM
2525
- uses: actions/setup-node@v2
2626
with:
27-
node-version: "12"
27+
node-version: "16"
2828
registry-url: 'https://registry.npmjs.org'
2929

3030
- name: Install dependencies
@@ -40,7 +40,7 @@ jobs:
4040
# Publish to Github packages
4141
- uses: actions/setup-node@v2
4242
with:
43-
node-version: "12"
43+
node-version: "16"
4444
registry-url: 'https://npm.pkg.github.com'
4545

4646
- name: Publish package to GitHub packages
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"extends": "./node_modules/gts/"
2+
"extends": "./node_modules/gts/",
3+
"rules": {
4+
"node/no-unpublished-import": ["error", {
5+
"allowModules": ["ts-jest", "@jest/globals"]
6+
}]
7+
}
38
}

firebase-rules-coverage/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.14.2
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "attach",
10+
"name": "Attach",
11+
"port": 9229
12+
}
13+
]
14+
}

firebase-rules-coverage/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# @simpleclub/firebase-rules-coverage
22

3+
## 1.0.0
4+
5+
- Updates dependencies. It switches to ESM (type: "module")
6+
- **Breaking**: It requires Node.js version 16 or higher
7+
38
## 0.1.1
49

510
- Fixes command `firebase-build-coverage` not being added to the project after installation.
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
module.exports = {
1+
import type {JestConfigWithTsJest} from 'ts-jest';
2+
3+
// This configuration enables ESM
4+
// and is inspired by
5+
// https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
6+
const config: JestConfigWithTsJest = {
27
roots: ['<rootDir>/src/', '<rootDir>/test/'],
38
preset: 'ts-jest',
49
testEnvironment: 'node',
510
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.[jt]sx?$',
611
transform: {
7-
'^.+\\.(ts|tsx)$': 'ts-jest',
12+
'^.+\\.(mt|t|cj|j)s$': ['ts-jest', {useESM: true}],
813
},
914
collectCoverage: true,
1015
collectCoverageFrom: ['src/**/*.ts'],
1116
coverageReporters: ['text', 'text-summary', ['lcov', {projectRoot: '../'}]],
17+
extensionsToTreatAsEsm: ['.ts'],
18+
moduleNameMapper: {
19+
'^(\\.{1,2}/.*)\\.js$': '$1',
20+
},
1221
};
22+
23+
export default config;

0 commit comments

Comments
 (0)