Skip to content

Commit

Permalink
chore: initial template
Browse files Browse the repository at this point in the history
  • Loading branch information
matteosacchetto committed Dec 19, 2023
0 parents commit 85baae6
Show file tree
Hide file tree
Showing 30 changed files with 2,521 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"include": ["src/**/*.ts"]
}
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG VARIANT="18-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y \
gnupg2
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@pippo/api",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": ["biomejs.biome"]
}
},
"postCreateCommand": "bash -i -c 'nvm install && nvm use' && npm install",
"remoteUser": "node"
}
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Current code owner of the repo
* @matteosacchetto
59 changes: 59 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
version: 2
updates:
# GitHub actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
# Run on monday at 11:00 (CEST)
day: "monday"
time: "11:00"
timezone: "Europe/Rome"
open-pull-requests-limit: 10
commit-message:
include: scope
prefix: ci
labels:
- "type: deps"
- "type: ci"

# NPM
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
# Run on monday at 11:00 (CEST)
day: "monday"
time: "11:00"
timezone: "Europe/Rome"
open-pull-requests-limit: 10
commit-message:
include: scope
prefix: build
labels:
- "type: deps"
ignore:
# Allow only minor and patch
- dependency-name: "@types/node"
update-types: ["version-update:semver-major"]

groups:
dependencies:
patterns:
- "*"
dependency-type: "production"
update-types:
- "minor"
- "patch"
dev-dependencies:
patterns:
- "*"
dependency-type: "development"
update-types:
- "minor"
- "patch"
new-dependencies-major-version:
patterns:
- "*"
update-types:
- "major"
69 changes: 69 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
- color: d73a4a
description: Something isn't working!
name: 'type: bug'
- color: 0075ca
description: Improvements or additions to documentation
name: 'type: docs'
- color: cfd3d7
description: This issue or pull request already exists
name: 'type: duplicate'
- color: a2eeef
description: New feature or request
name: 'type: feature'
- color: 094ee3
description: Fix some misbehaving part
name: 'type: fix'
- color: '09e385'
description: Refactor code
name: 'type: refactor'
- color: 02bf51
description: Performance optimization
name: 'type: perf'
- color: 7057ff
description: Good for newcomers
name: 'type: good first issue'
- color: '008672'
description: Extra attention is needed
name: 'type: help wanted'
- color: e4e669
description: This doesn't seem right
name: 'type: invalid'
- color: d876e3
description: Further information is requested
name: 'type: question'
- color: ffffff
description: This will not be worked on
name: 'type: wontfix'
- color: bf0404
description: Priority 1
name: 'priority: 1'
- color: bf4504
description: Priority 2
name: 'priority: 2'
- color: f0d005
description: Priority 3
name: 'priority: 3'
- color: 055ff0
description: Priority 4
name: 'priority: 4'
- color: 4f4f4f
description: Dependencies
name: 'type: deps'
- color: f542e0
description: CI
name: 'type: ci'
- color: ff6978
description: Major change
name: 'semver: major'
- color: fffcf9
description: Minor change
name: 'semver: minor'
- color: b1ede8
description: Patch change
name: 'semver: patch'
- color: ededed
description: Pending release by release-please
name: 'autorelease: pending'
- color: ededed
description: Created release by release-please
name: 'autorelease: tagged'
10 changes: 10 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"release-type": "node"
}
}
}
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'ci'

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
pull_request:
branches:
- main
- dev
paths-ignore:
- '.devcontainer/**'
- '.github/**'
- '.vscode/**'
- '.gitignore'
- '.npmignore'
- 'LICENSE'
- 'README.md'
push:
paths-ignore:
- '.devcontainer/**'
- '.github/**'
- '.vscode/**'
- '.gitignore'
- '.npmignore'
- 'LICENSE'
- 'README.md'

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup NodeJS 18.18.2
uses: actions/setup-node@v4
with:
node-version: 18.18.2

- name: Install dependencies
run: npm ci

- name: Test
run: npm test --if-present

- name: Build
run: npm run build --if-present

- name: Check style
run: npm run style-check --if-present
if: github.event_name == 'pull_request'
22 changes: 22 additions & 0 deletions .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pr-linter

on:
pull_request:
types:
- opened
- edited
- reopened

permissions:
contents: read
pull-requests: write
issues: read

jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Lint pull request title
uses: jef/conventional-commits-pr-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: release

on:
workflow_run:
workflows: [ci]
types:
- completed
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
release-please:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Package name
id: name
run: echo "::set-output name=name::$(jq -r .name package.json)"

- name: Create release PR
uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node
config-file: .github/release-please-config.json
target-branch: main

upload-artifact:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup NodeJS 18.18.2
uses: actions/setup-node@v4
with:
node-version: 18.18.2
cache: npm
cache-dependency-path: package-lock.json

- name: Install dependencies
run: npm ci

- name: Save archive
run: echo "archive=$(npm pack 2>/dev/null | tail -1)" >> $GITHUB_ENV

- name: Upload ${{ env.archive }} to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: refs/tags/${{ needs.release-please.outputs.tag_name }}
file: ${{ env.archive }}
27 changes: 27 additions & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: sync-labels

on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/labels.yml

jobs:
labels:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Sync labels
uses: EndBug/label-sync@v2
with:
config-file: .github/labels.yml
delete-other-labels: true
Loading

0 comments on commit 85baae6

Please sign in to comment.