Skip to content

Commit 1cc73db

Browse files
committed
optimise the npm package structure
Fixes #8
1 parent 9b36be9 commit 1cc73db

8 files changed

Lines changed: 1201 additions & 40 deletions

File tree

.github/workflows/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10

.github/workflows/npm-publish.yml

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

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Publish packages
5+
6+
on:
7+
release:
8+
types: [created]
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build bundle and publish to npmjs.com
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout ${{ matrix.node }}
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Node.js ${{ matrix.node }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 18
23+
24+
- name: Cache dependencies ${{ matrix.node }}
25+
uses: action/cache@v3
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-$ {{ matrix.node }}
31+
run: |
32+
npm ci
33+
npm run build
34+
npm publish --access public
35+
env:
36+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test-suite.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test suite
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lintjs:
11+
name: Javascript standard lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: checkout
15+
uses: actions/checkout@v3
16+
17+
- name: setup node
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
22+
- name: cache dependencies
23+
uses: actions/cache@v3
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-
29+
- run: npm ci
30+
- run: npm run lint
31+
32+
unittest:
33+
name: unit tests
34+
runs-on: ubuntu-latest
35+
needs: [lintjs]
36+
strategy:
37+
matrix:
38+
node: [16, 18, 20]
39+
steps:
40+
- name: Checkout ${{ matrix.node }}
41+
uses: actions/checkout@v3
42+
43+
- name: Setup node ${{ matrix.node }}
44+
uses: actions/setup-node@v3
45+
with:
46+
node-version: ${{ matrix.node }}
47+
48+
- name: Cache dependencies ${{ matrix.node }}
49+
uses: actions/cache@v3
50+
with:
51+
path: ~/.npm
52+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
53+
restore-keys: |
54+
${{ runner.os }}-node-${{ matrix.node }}
55+
- run: npm ci
56+
- run: npm run test

0 commit comments

Comments
 (0)