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

refactor: modernize package #12

Merged
merged 11 commits into from
Sep 24, 2024
Merged
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
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"
}
}
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -23,6 +23,5 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.


**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
21 changes: 11 additions & 10 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
Make sure you've read the contributing guidelines (CONTRIBUTING.md)
-->

| Question | Answer |
| ---------------- | -------------------------------------------------------------------------- |
| Bug fix | ✔/✖ |
| New feature | ✔/✖ |
| Breaking change | ✔/✖ |
| Deprecations | ✔/✖ |
| Documentation | ✔/✖ |
| Tests added | ✔/✖ |
| Chore | ✔/✖ |
| Question | Answer |
| --------------- | ------ |
| Bug fix | ✔/✖ |
| New feature | ✔/✖ |
| Breaking change | ✔/✖ |
| Deprecations | ✔/✖ |
| Documentation | ✔/✖ |
| Tests added | ✔/✖ |
| Chore | ✔/✖ |

Related issues: #XXX , #XXX ...
Closes #XXX ...

Further information:
Further information:

<!--
Here you can provide more information regarding any of the questions written above.
In addition, you can add screenshots, ask the maintainers questions.
Expand Down
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
53 changes: 53 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
version: 2
updates:
# deps
- package-ecosystem: npm
target-branch: 'master'
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
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: '/'
41 changes: 0 additions & 41 deletions .github/workflows/codeql.yml

This file was deleted.

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 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

name: release-please

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
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pretty-quick --staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12
v20
6 changes: 0 additions & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
dist
.github
.gitignore
CHANGELOG.md
commitlint.config.js
package-lock.json
package.json
README.md
tsbuildconfig.json
tsconfig.json
coverage
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@map-colonies/prettier-config"
Loading
Loading