Skip to content

Commit

Permalink
Merge pull request #2 from RobotsAndPencils/losandes/chore/upgrade-de…
Browse files Browse the repository at this point in the history
…pendencies

chore: upgrades dependencies and actions
  • Loading branch information
losandes committed Mar 3, 2023
2 parents 8c61b39 + d5a205b commit b4e0436
Show file tree
Hide file tree
Showing 8 changed files with 914 additions and 1,107 deletions.
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
"comma-dangle": ["error", "always-multiline"],
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
"no-console": "error"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".cjs", ".mjs"]
}
}
}
}
68 changes: 68 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will publish the npm package when a release is created

name: NPM publish

on:
release:
# This specifies that the build will be triggered when we publish a release
types: [published]

jobs:
build:

# Run on latest version of ubuntu
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
# "ref" specifies the branch to check out.
# "github.event.release.target_commitish" is a global variable and specifies the branch the release targeted
ref: ${{ github.event.release.target_commitish }}
# install Node.js
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
# Specifies the registry, this field is required for publishing below!
registry-url: https://registry.npmjs.org/

- name: ENVVARS
env:
EVENT_CONTEXT: ${{ toJson(github.event) }}
run: |
git config --global user.name "losandes cicd"
git config --global user.email "andes.collab+ghcicd@gmail.com"
echo "node: $(node --version)"
echo "npm: $(npm --version)"
# echo "EVENT_CONTEXT:"
# echo "$EVENT_CONTEXT"

- name: Install packages
run: |
npm i -g pnpm
pnpm install
- name: Run tests
env:
CI: true
run: pnpm run test:ci

# upgrade npm version in package.json to the tag used in the release.
- name: Set package version
run: npm version ${{ github.event.release.tag_name }}

# publish the package to NPM and set the tag name to the branch name that
# the release is targeting (i.e. latest, latest-v1, etc.)
# Note that npm publish commits a tag to git
# alsosee: https://michaelzanggl.com/articles/github-actions-cd-setup/
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --tag ${{ github.event.release.target_commitish }}

- name: Push version change to latest
env:
# The secret is passed automatically. Nothing to configure.
github-token: ${{ secrets.GITHUB_TOKEN }}
run: git push
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# This workflow will do a clean install of node dependencies,
# build the source code and run tests across different versions of node
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: tests

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

jobs:
build:
Expand All @@ -17,12 +16,12 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -39,9 +38,14 @@ jobs:
run: pnpm run lint

- name: Run tests
env:
CI: true
run: pnpm run test:coverage:ci

- name: Produce coverage report
env:
CI: true
run: pnpm run coverage:ci

- name: Coveralls
uses: coverallsapp/github-action@master
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
# koa-errors

[![tests](https://github.com/RobotsAndPencils/koa-errors/actions/workflows/pr-check.yml/badge.svg)](https://github.com/RobotsAndPencils/koa-errors/actions/workflows/pr-check.yml)
[![Coverage Status](https://coveralls.io/repos/github/RobotsAndPencils/koa-errors/badge.svg?branch=main)](https://coveralls.io/github/RobotsAndPencils/koa-errors?branch=main)
[![tests](https://github.com/RobotsAndPencils/koa-errors/actions/workflows/pull-request.yml/badge.svg)](https://github.com/RobotsAndPencils/koa-errors/actions/workflows/pull-request.yml)
[![Coverage Status](https://coveralls.io/repos/github/RobotsAndPencils/koa-errors/badge.svg?branch=latest)](https://coveralls.io/github/RobotsAndPencils/koa-errors?branch=latest)

`@robotsandpencils/koa-errors` is a simple koa middleware for handling error states (i.e. 500 errors). It's primary usage is to produce human, and program readable 500 errors that only include stack traces in development environments.

## Usage

Using pnpm:

```Shell
$ pnpm add @robotsandpencils/koa-errors
```

Using npm:

```Shell
$ npm install --save @robotsandpencils/koa-errors
```

Using yarn:

```Shell
$ yarn add @robotsandpencils/koa-errors
```

```JavaScript
const { e500 } = require('@robotsandpencils/koa-errors')
const Koa = require('koa')
Expand Down
49 changes: 26 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
"description": "Error handler middleware for koa",
"main": "index.js",
"scripts": {
"// lint": "json comment =============================================",
"lint": "eslint .",
"pre-push": "node pre-push.js",
"test": "node test.js",
"test:coverage": "nyc node test.js",
"test:coverage:ci": "mkdir -p ./coverage && touch ./coverage/lcov.info && nyc pnpm run test:ci && nyc report --reporter=text-lcov > ./coverage/lcov.info",
"test:coveralls": "nyc pnpm run test:ci && nyc report --reporter=text-lcov | coveralls",
"test:ci": "node test.js -r tap,summary"
"lint:fix": "eslint . --fix",
"// test": "json comment =============================================",
"dev": "nodemon -e js --exec 'pnpm run test'",
"test": "node test.js -r nyan",
"test:ci": "node test.js -r tap,summary --no-color",
"// coverage": "json comment =============================================",
"test:coverage:ci": "c8 --reporter=text --reporter=text-summary pnpm run test:ci",
"coverage:ci": "mkdir -p ./coverage/tmp && touch ./coverage/lcov.info; c8 report --reporter=text-lcov > ./coverage/lcov.info"
},
"pre-push": [
"lint",
"test",
"pre-push"
"test:ci"
],
"repository": {
"type": "git",
Expand All @@ -32,21 +34,22 @@
"error",
"middleware"
],
"devDependencies": {
"@polyn/logger": "~0.5.2",
"coveralls": "~3.1.1",
"eslint": "~8.1.0",
"eslint-config-standard": "~16.0.3",
"eslint-plugin-import": "~2.25.2",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~5.1.1",
"nyc": "~15.0.1",
"pre-push": "~0.1.1",
"supposed": "~1.1.1",
"unexpected": "~11.14.0"
},
"dependencies": {
"@polyn/blueprint": "~2.5.4",
"@polyn/immutable": "~1.0.11"
"@polyn/blueprint": "^2.7.0",
"@polyn/immutable": "^1.1.2"
},
"devDependencies": {
"@polyn/logger": "^1.0.2",
"c8": "^7.13.0",
"coveralls": "^3.1.1",
"eslint": "^8.35.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"pre-push": "^0.1.4",
"supposed": "^1.3.3",
"unexpected": "^13.1.0"
}
}

0 comments on commit b4e0436

Please sign in to comment.