Skip to content

Commit f6f0dd6

Browse files
Sascha DobschalSascha Dobschal
authored andcommitted
Refactor to use commonjs and ES6 imports correctly
1 parent e54f700 commit f6f0dd6

20 files changed

+972
-3075
lines changed

.eslintrc.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/npm-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy to NPM
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 18
15+
- run: npm ci
16+
- run: npm run lint
17+
- run: npm run test
18+
19+
publish-npm:
20+
needs: test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: 18
27+
registry-url: https://registry.npmjs.org/
28+
- run: npm ci
29+
- run: npm publish --access=public
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
3+
on:
4+
# Trigger workflow on every push to main
5+
push:
6+
branches: [ main ]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
concurrency: # only 1 job per branch should run, older runs should be canceled
12+
group: ${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 15
20+
strategy:
21+
matrix:
22+
node-version: [18.x]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'npm'
31+
cache-dependency-path: package-lock.json
32+
- name: Install NPM dependencies
33+
run: npm ci
34+
- name: Lint the code with ESLint
35+
run: npm run lint
36+
- name: Run tests with Jest
37+
run: npm run test

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
/dist
2-
31
/node_modules
4-
52
/.idea

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.test.js
2+
.idea
3+
.github

eslint.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = [
2+
{
3+
files: ["**/*.js"],
4+
languageOptions: { sourceType: "commonjs" },
5+
rules: {
6+
quotes: ["error", "double"],
7+
semi: ["error", "always"],
8+
indent: ["error", 4]
9+
}
10+
},
11+
];

index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import routeLoader from "./src/routeLoader";
2+
3+
export {routeLoader};

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const routeLoader = require("./src/routeLoader.js");
2+
3+
module.exports = {
4+
routeLoader
5+
};

jest.config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)