Skip to content

Commit

Permalink
optimise the npm package structure
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
mi-skam committed Nov 1, 2023
1 parent 9b36be9 commit 1cc73db
Show file tree
Hide file tree
Showing 8 changed files with 1,201 additions and 40 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
23 changes: 0 additions & 23 deletions .github/workflows/npm-publish.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish packages

on:
release:
types: [created]
workflow_dispatch:

jobs:
build:
name: Build bundle and publish to npmjs.com
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ matrix.node }}
uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache dependencies ${{ matrix.node }}
uses: action/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-$ {{ matrix.node }}
run: |
npm ci
npm run build
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
56 changes: 56 additions & 0 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test suite

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lintjs:
name: Javascript standard lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint

unittest:
name: unit tests
runs-on: ubuntu-latest
needs: [lintjs]
strategy:
matrix:
node: [16, 18, 20]
steps:
- name: Checkout ${{ matrix.node }}
uses: actions/checkout@v3

- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Cache dependencies ${{ matrix.node }}
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}
- run: npm ci
- run: npm run test
Loading

0 comments on commit 1cc73db

Please sign in to comment.