Skip to content

Commit 263db7c

Browse files
committed
feat: migrate to es build
1 parent 5daaccf commit 263db7c

25 files changed

+1631
-2165
lines changed

Diff for: .eslintrc.cjs

+11
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+
};

Diff for: .eslintrc.js

-78
This file was deleted.

Diff for: .github/workflows/build.yaml

+14-26
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,54 +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

4136
- name: Test
4237
run: npm run test && npm run lcov-report
4338

44-
- name: Coveralls
45-
uses: coverallsapp/github-action@master
39+
- uses: coverallsapp/github-action@master
4640
with:
4741
github-token: ${{ secrets.GITHUB_TOKEN }}
4842

4943
image:
50-
runs-on: ubuntu-20.04
44+
runs-on: ubuntu-22.04
5145
needs: build
5246
steps:
53-
- name: Checkout
54-
uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
5548

56-
- name: Setup buildx
57-
uses: docker/setup-buildx-action@v1
49+
- uses: docker/setup-buildx-action@v3
5850

5951
- name: Set variables
6052
id: vars
6153
run: |
6254
echo ::set-output name=version_tag::$(echo ${GITHUB_REF#refs/*/})
6355
echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/*})
6456
65-
- name: Build
66-
uses: docker/build-push-action@v2
57+
- uses: docker/build-push-action@v5
6758
with:
68-
context: .
69-
file: ./Dockerfile
7059
platforms: linux/amd64
71-
push: false
7260
build-args: |
7361
APP_HOME=/home/node/${{ steps.vars.outputs.repo_name }}
7462
cache-from: |

Diff for: .github/workflows/pr-lint.yaml

+20
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 }}

Diff for: .github/workflows/release.yaml

+32-30
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 }}

Diff for: .mocharc.json

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

Diff for: .nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.8

Diff for: CONTRIBUTING.md

+23
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)

Diff for: Dockerfile

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
### Base
2-
FROM node:20.8.0-alpine3.18 as base
1+
### Build
2+
FROM node:20.8.0-alpine3.18 as build
33
ENV NO_UPDATE_NOTIFIER=true
44

5-
RUN apk add --no-cache git
6-
RUN apk add g++ make python3
7-
85
USER node
9-
ARG APP_HOME=/home/node/scheduling-srv
6+
ARG APP_HOME=/home/node/srv
107
WORKDIR $APP_HOME
118

129
COPY package.json package.json
1310
COPY package-lock.json package-lock.json
1411

15-
16-
### Build
17-
FROM base as build
18-
1912
RUN npm ci
2013

2114
COPY --chown=node:node . .
@@ -24,9 +17,16 @@ RUN npm run build
2417

2518

2619
### Deployment
27-
FROM base as deployment
20+
FROM node:20.8.0-alpine3.18 as deployment
21+
22+
ENV NO_UPDATE_NOTIFIER=true
23+
24+
USER node
25+
ARG APP_HOME=/home/node/srv
26+
WORKDIR $APP_HOME
2827

29-
RUN npm ci --only=production
28+
COPY package.json package.json
29+
COPY package-lock.json package-lock.json
3030

3131
COPY --chown=node:node . $APP_HOME
3232
COPY --chown=node:node --from=build $APP_HOME/lib $APP_HOME/lib

Diff for: README.adoc

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ Please consult the documentation for using it:
1212
- *link:https://docs.restorecommerce.io/architecture/index.html[General Architecture]*
1313
1414
Part of link:https://github.com/restorecommerce[Restorecommerce].
15+
16+
== Contributing
17+
18+
Read more in link:{docdir}/CONTRIBUTING.md[CONTRIBUTING.md]

0 commit comments

Comments
 (0)