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

build: use esbuild to compile #1185

Merged
merged 1 commit into from
Jan 10, 2023
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand Down Expand Up @@ -128,7 +127,9 @@ src/temp*/
.husky/
.vscode/
docs/
src/
.env.template
.esbuild.js
.eslintrc.js
.gitignore
.pm2.config.js
Expand Down
20 changes: 20 additions & 0 deletions .esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const esbuild = require("esbuild");
const { globPlugin } = require("esbuild-plugin-glob");

esbuild.build({
entryPoints: ["src/**/!(*.test).*"],
format: "cjs",
loader: {
".html": "copy",
".ico": "copy",
".png": "copy",
".svg": "copy",
},
logLevel: "info",
minify: true,
outdir: "dist",
packages: "external",
platform: "node",
plugins: [globPlugin()],
target: "node18",
});
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ updates:
include: scope
prefix: build
directory: /
ignore:
- dependency-name: esbuild
- dependency-name: esbuild-plugin-glob
open-pull-requests-limit: 20
schedule:
interval: monthly
5 changes: 4 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ jobs:
cache: npm
node-version: lts/*

- name: Build
run: npm run build

- name: Remove dev values from package.json
run: |
npm pkg delete commitlint devDependencies jest nodemonConfig scripts
Expand All @@ -58,7 +61,7 @@ jobs:
.dockerignore .env.template .pm2.config.js
docker-compose.yml Dockerfile LICENSE
package.json package-lock.json README.md
ocr_lang_data src -x \src\**\*.test.js
dist ocr_lang_data

- name: Upload release asset
uses: actions/upload-release-asset@v1
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ jobs:
parallel: true
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}

build:
name: Build
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: npm
node-version: lts/*

- name: Install
run: npm ci --ignore-scripts

- name: Run esbuild
run: npm run build

lint-docker-file:
name: Lint Dockerfile
if: github.event.pull_request.draft == false
Expand Down
2 changes: 1 addition & 1 deletion .pm2.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
exec_mode: "cluster",
instances: "max",
name,
script: "./src/app.js",
script: "./dist/app.js",
watch: [".env"],
},
],
Expand Down
Loading