Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idea: support KoaJS, add some automation #139

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
31 changes: 31 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Coverage
on:
pull_request:
types: [opened, synchronize]

jobs:
checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ ^16, ^18, ^20 ]

steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Install dependencies
run: |
npm ci
npx lerna bootstrap

- name: Run tests # Run Coverage for of all packages
run: npx lerna exec npm run coverage
65 changes: 65 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish
permissions:
packages: write
contents: write
pull-requests: read
issues: write
on:
pull_request:
types: [closed]
branches:
- dev
- master
workflow_dispatch:

jobs:
publish:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
permissions:
packages: write
contents: read
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}

- name: "Use NodeJS LTS"
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: https://npm.pkg.github.com/
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: "Setup npm"
run: |
npm set @${{github.repository_owner}}:registry=https://npm.pkg.github.com/${{github.repository_owner}}
npm set "//npm.pkg.github.com/:_authToken=${{ secrets.PAT }}"
- name: "Check token permissions"
uses: actions-cool/check-user-permission@v2
with:
token: ${{ secrets.PAT }}

- name: "Version and publish"
env:
GH_TOKEN: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ secrets.PAT }}
NODE_AUTH_TOKEN: ${{ github.token }}
run: |
git config user.name "${{github.actor}}"
git config user.email "${{github.actor}}@users.noreply.github.com"

# Add Release candidate incase PR finished in dev.
if [ ${{ github.base_ref }} = dev ] || [ ${{github.ref_name}} = dev ]; then
npx lerna version --conventional-commits --conventional-prerelease --preid rc --yes
else
npx lerna version --conventional-commits --conventional-graduate --yes
fi

# Do not git reset these changes, but do not commit them either.
npx lerna publish from-git --yes
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
.dccache
.DS_Store
.idea
.vscode
node_modules
.log
.nyc_output
coverage
node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit
4 changes: 4 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

exec < /dev/tty && git cz --hook || true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Resource.js - A simple Express library to reflect Mongoose models to a REST inte
==============================================================
[![NPM version][npm-image]][npm-url]
[![NPM download][download-image]][download-url]
[![Build Status](https://travis-ci.org/travist/resourcejs.svg?branch=master)](https://travis-ci.org/travist/resourcejs)
![Build Status: master](https://github.com/Sefriol/resourcejs/actions/workflows/main.yml/badge.svg?branch=master)
![Build Status: dev](https://github.com/Sefriol/resourcejs/actions/workflows/main.yml/badge.svg?branch=dev)
[![Coverage Status](https://coveralls.io/repos/github/Sefriol/resourcejs/badge.svg?branch=master)](https://coveralls.io/github/Sefriol/resourcejs?branch=master)

[npm-image]: https://img.shields.io/npm/v/resourcejs.svg?style=flat-square
Expand Down
16 changes: 16 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "independent",
"command": {
"publish": {
"conventionalCommits": true,
"registry": "https://npm.pkg.github.com"
},
"version": {
"conventionalCommits": true,
"createRelease": "github",
"message": "chore(release): publish new version"
}
}
}
File renamed without changes.
8 changes: 8 additions & 0 deletions lib/resourcejs-express/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.dccache
.DS_Store
.idea
.vscode
node_modules
.log
.nyc_output
coverage
File renamed without changes.
8 changes: 3 additions & 5 deletions .travis.yml → lib/resourcejs-express/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- "13"
- "12"
- "10"
- "16"
- "18"
- "20"

script:
- echo "Running tests against $(node -v)..."
Expand All @@ -12,5 +12,3 @@ after_script:
- npm run coverage
- cat ./coverage/lcov.info | coveralls

services:
- mongodb
8 changes: 8 additions & 0 deletions lib/resourcejs-express/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# 2.6.0-rc.2 (2023-04-26)

**Note:** Version bump only for package @sefriol/resourcejs-express
File renamed without changes.
Loading