Skip to content

Commit

Permalink
refactor: modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
CptSchnitz committed Sep 19, 2024
1 parent 4e1a797 commit 9864064
Show file tree
Hide file tree
Showing 18 changed files with 4,478 additions and 7,860 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"ignorePatterns": ["**/*.js", "dist"],
"extends": ["@map-colonies/eslint-config/jest", "@map-colonies/eslint-config/ts-base"],
"parserOptions": {
"project": "./tsconfig.lint.json"
"project": "./tsconfig.json"
}
}
21 changes: 21 additions & 0 deletions .github/actions/init-npm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: init-npm
description: 'Initialize the repo with npm and install all the dependencies'
inputs:
node-version:
description: 'Node.js version'
required: true
default: '20.x'
runs:
using: composite
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: npm
- name: Install TS Project dependencies
shell: bash
run: npm ci
- name: build
shell: bash
run: npm run build
54 changes: 54 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
# deps
- package-ecosystem: npm
schedule:
interval: weekly
allow:
- dependency-type: production
directory: /
commit-message:
prefix: "build(deps)"
groups:
map-colonies:
patterns:
- "@map-colonies/*"
opentelemetry:
patterns:
- "@opentelemetry/*"
patch:
update-types:
- patch
# dev-deps
- package-ecosystem: npm
schedule:
interval: weekly
allow:
- dependency-type: development
ignore:
- dependency-name: "@map-colonies/schemas"
directory: /
commit-message:
prefix: "build(dev-deps)"
groups:
map-colonies:
patterns:
- "@map-colonies/*"
opentelemetry:
patterns:
- "@opentelemetry/*"
types:
patterns:
- "@types/*"
dev-patch:
update-types:
- patch

# github deps
- package-ecosystem: github-actions
schedule:
interval: weekly
commit-message:
prefix: "ci(deps)"
directory: "/"
29 changes: 0 additions & 29 deletions .github/workflows/lint.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: publish

on:
workflow_dispatch:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # allow GITHUB_TOKEN to publish packages
steps:
- uses: actions/checkout@v4
- name: Init nodejs
uses: ./.github/actions/init-npm
with:
node-version: 20.x
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
55 changes: 0 additions & 55 deletions .github/workflows/publish_package.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: pull_request

on: [pull_request, workflow_dispatch]

jobs:
eslint:
name: Run TS Project eslint
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x, 22.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: ./.github/actions/init-npm
with:
node-version: ${{ matrix.node }}

- name: Run TS Project linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
# Enable linters
eslint: true
prettier: true
eslint_extensions: ts

tests:
name: Run Tests
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x, 22.x]

steps:
- name: Check out TS Project Git repository
uses: actions/checkout@v4

- name: Init nodejs
uses: ./.github/actions/init-npm

- name: Run tests
run: npm run test

- uses: actions/upload-artifact@v4
with:
name: Test Reporters ${{ matrix.node }}
path: ./reports/**
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release-please

on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.GH_PAT }}
# this is a built-in strategy in release-please, see "Action Inputs"
# for more options
release-type: node
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12
v20
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-enum": [2, "always", ["deps", "configurations", "logger"]],
"scope-enum": [2, "always", ["deps", "dev-deps", "configurations", "logger"]],
},
};
Loading

0 comments on commit 9864064

Please sign in to comment.