From 371086643061a1a323661b316e2c4e72857fb392 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 8 Feb 2023 09:46:26 -0300 Subject: [PATCH] replace package.json scripts with just. --- .github/workflows/npm-publish.yml | 6 +++--- .github/workflows/test.yml | 6 +++--- justfile | 19 +++++++++++++++++++ package.json | 5 ----- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 justfile diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index a0f8f16..fe6ac1a 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -12,9 +12,9 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - run: yarn --ignore-engines - - run: node build.js - - run: yarn test + - uses: extractions/setup-just@v1 + - run: just install-and-build + - run: just test - uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25803c5..221feaa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - run: yarn --ignore-engines - - run: node build.js - - run: yarn test + - uses: extractions/setup-just@v1 + - run: just install-and-build + - run: just test diff --git a/justfile b/justfile new file mode 100644 index 0000000..b7ede50 --- /dev/null +++ b/justfile @@ -0,0 +1,19 @@ +export PATH := "./node_modules/.bin:" + env_var('PATH') + +install-dependencies: + yarn --ignore-engines + +deps-installed := `ls node_modules` + +install-and-build: + if deps-installed != "node_modules" { install-dependencies } + build + +build: + node build.js + +test: build + jest + +testOnly file: build + jest {{file}} diff --git a/package.json b/package.json index b5a763f..a739ff6 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,5 @@ "tsd": "^0.22.0", "typescript": "^4.9.4", "websocket-polyfill": "^0.0.3" - }, - "scripts": { - "build": "node build.js", - "pretest": "node build.js", - "test": "jest" } }