Skip to content

Commit

Permalink
fix: refactor and update dependencies (#128)
Browse files Browse the repository at this point in the history
* fix: use the ts-rollup-esbuild-node-template template, update dependencies

* chore: update version to 0.5.1
  • Loading branch information
matteosacchetto committed Jun 21, 2024
1 parent b7cc473 commit 0738d6a
Show file tree
Hide file tree
Showing 48 changed files with 1,673 additions and 5,604 deletions.
6 changes: 2 additions & 4 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"include": [
"src/**/*.ts"
]
}
"include": ["src/**/*.ts"]
}
11 changes: 0 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/javascript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
ARG VARIANT="18-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y \
gnupg2

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# [Optional] Uncomment if you want to install more global node modules
# RUN su node -c "npm install -g <your-package-list-here>"
22 changes: 2 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/javascript-node
{
"name": "server-main-dev",
"name": "@matteosacchetto/ts-rollup-esbuild-node-template",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 18, 16, 14.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"args": { "VARIANT": "18-bullseye" }
"dockerfile": "Dockerfile"
},

// Set *default* container specific settings.json values on container create.
// "settings": {}, // If uncommented it overrides the properties in settings.json

// Add the IDs of extensions you want installed when the container is created.
"customizations": {
"vscode": {
"extensions": ["biomejs.biome"]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash -i -c 'nvm install && nvm use' && npm install",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
29 changes: 14 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
version: 2
updates:
# GitHub actions
- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
# Run on monday at 11:00 (CEST)
day: 'monday'
time: '11:00'
timezone: 'Europe/Rome'
day: "monday"
time: "11:00"
timezone: "Europe/Rome"
open-pull-requests-limit: 10
commit-message:
include: scope
prefix: ci
labels:
- 'type: deps'
- 'type: ci'
- "type: deps"
- "type: ci"

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

groups:
dependencies:
patterns:
Expand All @@ -56,5 +55,5 @@ updates:
new-dependencies-major-version:
patterns:
- "*"
update-types:
update-types:
- "major"
2 changes: 1 addition & 1 deletion .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@
name: 'autorelease: pending'
- color: ededed
description: Created release by release-please
name: 'autorelease: tagged'
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"
}
}
}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup NodeJS 18.19.0
- name: Setup NodeJS version (from .nvmrc)
uses: actions/setup-node@v4
with:
node-version: 18.19.0
node-version-file: .nvmrc

- name: Install dependencies
run: npm ci
Expand All @@ -55,5 +55,5 @@ jobs:
run: npm run build --if-present

- name: Check style
run: npm run style-check --if-present
if: github.event_name == 'pull_request'
run: npm run style:check --if-present
if: github.event_name == 'pull_request'
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: Lint pull request title
uses: jef/conventional-commits-pr-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
62 changes: 29 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
permissions:
contents: write
pull-requests: write

jobs:
release-please:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
Expand All @@ -23,46 +23,42 @@ jobs:
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@v3
uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node
package-name: ${{ steps.name.outputs.name }}
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true

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 }}
if: ${{ needs.release-please.outputs.release_created == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup NodeJS 18.19.0
uses: actions/setup-node@v4
with:
node-version: 18.19.0
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 }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup NodeJS version (from .nvmrc)
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- 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
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.release.outputs.tag_name }} ${{ env.archive }}
4 changes: 2 additions & 2 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
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
delete-other-labels: true
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,13 @@ dist
.pnp.*

# Rollup build dir
dist

# Tap dir
.nyc_output/
.tap/
dist/

# c8 dir
coverage/

# Docs dir
docs
# Archives
*.zip
*.tar
*.tar.gz
*.tgz
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
!dist/**/*
!LICENSE
!README.md
!bash-completion.sh
!bash-completion.sh
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.19.0
18.20.3
8 changes: 2 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@

{
"recommendations": [
"biomejs.biome",
"ms-vscode-remote.remote-containers"
]
}
"recommendations": ["biomejs.biome", "ms-vscode-remote.remote-containers"]
}
35 changes: 17 additions & 18 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Main",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "npm: build:debug",
"outFiles": ["${workspaceFolder}/dist/**/*.mjs"],
"console": "externalTerminal"
}
]
}

// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Main",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "npm: build:debug",
"outFiles": ["${workspaceFolder}/dist/**/*.mjs"],
"console": "externalTerminal"
}
]
}
19 changes: 7 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"editor.tabSize": 2,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"editor.defaultFormatter": "biomejs.biome",
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": false
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": false
"editor.defaultFormatter": "biomejs.biome"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": false
}
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"tasks": [
{
"type": "npm",
"script": "build:debug",
"script": "build:debug"
}
]
}
Loading

0 comments on commit 0738d6a

Please sign in to comment.