Skip to content

Commit cd48a0d

Browse files
committed
feat: migrate to esbuild
1 parent 48ec2c3 commit cd48a0d

22 files changed

+2856
-3188
lines changed

.eslintrc.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
extends: './node_modules/@restorecommerce/dev/.eslintrc.cjs',
3+
parserOptions: {
4+
project: [
5+
'tsconfig.json',
6+
],
7+
},
8+
rules: {
9+
'@typescript-eslint/consistent-type-imports': 0
10+
}
11+
};

.eslintrc.js

Lines changed: 0 additions & 80 deletions
This file was deleted.

.github/workflows/build.yaml

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ on: push
44

55
jobs:
66
build:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-22.04
88
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1110

12-
- name: Setup NodeJS
13-
uses: actions/setup-node@v1
11+
- uses: actions/setup-node@v4
1412
with:
15-
node-version: '20.8.0'
13+
node-version-file: '.nvmrc'
1614

1715
- name: Install Dependencies
1816
run: npm ci
@@ -21,69 +19,44 @@ jobs:
2119
run: npm run build
2220

2321
test:
24-
runs-on: ubuntu-20.04
22+
runs-on: ubuntu-22.04
2523
needs: build
2624
steps:
27-
- name: Checkout
28-
uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2926

30-
- name: Setup NodeJS
31-
uses: actions/setup-node@v1
27+
- uses: actions/setup-node@v4
3228
with:
33-
node-version: '20.8.0'
29+
node-version-file: '.nvmrc'
3430

35-
- name: Setup System
36-
uses: restorecommerce/setup-system-action@v1
31+
- uses: restorecommerce/setup-system-action@v1
3732

3833
- name: Install Dependencies
3934
run: npm ci
4035

41-
- name: Set up Ruby 2.7
42-
uses: actions/setup-ruby@v1
43-
with:
44-
ruby-version: 2.7
45-
46-
- name: Install ruby dependencies
47-
working-directory: scripts
48-
run: gem install bundler && bundle install --jobs 4 --retry 3
49-
5036
- name: Test
5137
run: npm run test && npm run lcov-report
52-
env:
53-
payments__gateways__PayPalExpressCheckout__login: ${{ secrets.PAYMENTS__GATEWAYS__PAYPALEXPRESSCHECKOUT__LOGIN }}
54-
payments__gateways__PayPalExpressCheckout__password: ${{ secrets.PAYMENTS__GATEWAYS__PAYPALEXPRESSCHECKOUT__PASSWORD }}
55-
payments__gateways__PayPalExpressCheckout__signature: ${{ secrets.PAYMENTS__GATEWAYS__PAYPALEXPRESSCHECKOUT__SIGNATURE }}
56-
payments__tests__PayPalExpressCheckout__email: ${{ secrets.PAYMENTS__TESTS__PAYPALEXPRESSCHECKOUT__EMAIL }}
57-
payments__tests__PayPalExpressCheckout__password: ${{ secrets.PAYMENTS__TESTS__PAYPALEXPRESSCHECKOUT__PASSWORD }}
5838

59-
- name: Coveralls
60-
uses: coverallsapp/github-action@master
39+
- uses: coverallsapp/github-action@master
6140
with:
6241
github-token: ${{ secrets.GITHUB_TOKEN }}
6342

6443
image:
65-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-22.04
6645
needs: build
6746
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
7048

71-
- name: Setup buildx
72-
uses: docker/setup-buildx-action@v1
49+
- uses: docker/setup-buildx-action@v3
7350

7451
- name: Set variables
7552
id: vars
7653
run: |
7754
echo ::set-output name=version_tag::$(echo ${GITHUB_REF#refs/*/})
7855
echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/*})
7956
80-
- name: Build
81-
uses: docker/build-push-action@v2
57+
- uses: docker/build-push-action@v5
8258
with:
83-
context: .
84-
file: ./Dockerfile
8559
platforms: linux/amd64
86-
push: false
8760
build-args: |
8861
APP_HOME=/home/node/${{ steps.vars.outputs.repo_name }}
8962
cache-from: |

.github/workflows/pr-lint.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Lint PR"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: pr-lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yaml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1-
name: release
1+
name: Release
22

33
on:
44
push:
5-
tags:
6-
- v*
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: read
710

811
jobs:
912
release:
10-
runs-on: ubuntu-20.04
13+
permissions:
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
runs-on: ubuntu-22.04
1118
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
1420

15-
- name: Login to DockerHub
16-
uses: docker/login-action@v1
21+
- uses: docker/login-action@v3
1722
with:
1823
username: ${{ secrets.DOCKERHUB_USERNAME }}
1924
password: ${{ secrets.DOCKERHUB_TOKEN }}
2025

21-
- name: Login to GitHub Container Registry
22-
uses: docker/login-action@v1
26+
- uses: docker/login-action@v3
2327
with:
2428
registry: ghcr.io
2529
username: ${{ github.repository_owner }}
2630
password: ${{ secrets.CR_PAT }}
2731

28-
- uses: docker/setup-buildx-action@v1
32+
- uses: docker/setup-buildx-action@v3
2933
with:
3034
install: true
3135

@@ -34,28 +38,26 @@ jobs:
3438
run: |
3539
echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/*})
3640
37-
- name: Docker meta
41+
- uses: docker/metadata-action@v5
3842
id: docker_meta
39-
uses: crazy-max/ghaction-docker-meta@v1
4043
with:
41-
images: |
42-
${{ github.repository }}
43-
ghcr.io/${{ github.repository }}
44-
tag-sha: true
45-
tag-semver: |
46-
{{version}}
47-
{{major}}.{{minor}}
48-
49-
- name: Build and push
50-
uses: docker/build-push-action@v2
44+
images: ${{ github.repository }}
45+
46+
- uses: docker/build-push-action@v5
5147
with:
52-
context: .
53-
file: ./Dockerfile
54-
platforms: linux/amd64
55-
push: true
48+
load: true
5649
build-args: |
5750
APP_HOME=/home/node/${{ steps.vars.outputs.repo_name }}
58-
cache-from: |
59-
${{ github.repository }}:latest
60-
tags: ${{ steps.docker_meta.outputs.tags }}
51+
tags: ${{ github.repository }}
6152
labels: ${{ steps.docker_meta.outputs.labels }}
53+
54+
- uses: actions/setup-node@v4
55+
with:
56+
node-version-file: '.nvmrc'
57+
58+
- name: Install Dependencies
59+
run: npm clean-install
60+
61+
- run: npx [email protected]
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
coverage/
23
.project
34
.settings
45
.directory

.mocharc.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"extension": ["ts"],
2+
"extension": [
3+
"ts"
4+
],
35
"spec": "test/**/*.spec.ts",
4-
"require": "ts-node/register"
5-
}
6+
"require": "ts-node/register",
7+
"node-option": [
8+
"experimental-specifier-resolution=node",
9+
"loader=ts-node/esm"
10+
]
11+
}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.8

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing Guidelines
2+
3+
## Commit Messages
4+
5+
This repository uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [commitlint](https://commitlint.js.org)
6+
to standardize the commit messages.
7+
8+
## Development Flow
9+
10+
This repository follows a gitflow-style development.
11+
12+
The `main`/`master` branch is locked, and only allows pull requests.
13+
Any change in the `main`/`master` branch gets automatically released via [semantic-release](https://github.com/semantic-release/semantic-release).
14+
15+
The `next` branch gets merged into `main`/`master` on an unscheduled basis.
16+
17+
Any change to the repository requires a new branch from the `next` branch, which then gets merged back into it with a pull request.
18+
19+
The pull request title must follow the same rules as commit messages and it gets linted.
20+
21+
The following diagram visualizes the development flow:
22+
23+
![development flow](./.github/development-flow.png)

0 commit comments

Comments
 (0)