Merge pull request #10714 from Budibase/build_worker_using_esbuild_script

Build worker using esbuild script
This commit is contained in:
Adria Navarro 2023-05-26 14:13:05 +02:00 committed by GitHub
commit d20287c061
8 changed files with 11 additions and 75 deletions

View File

@ -44,7 +44,10 @@ jobs:
node-version: 14.x
cache: "yarn"
- run: yarn
- run: yarn nx run-many -t=build --configuration=production
# Run build all the projects
- run: yarn build
# Check the types of the projects built via esbuild
- run: yarn check:types
test-libraries:
runs-on: ubuntu-latest

View File

@ -4,7 +4,6 @@
"devDependencies": {
"@esbuild-plugins/node-resolve": "^0.2.2",
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
"@nx/esbuild": "16.2.1",
"@nx/js": "16.2.1",
"@rollup/plugin-json": "^4.0.2",
"@typescript-eslint/parser": "5.45.0",
@ -34,6 +33,7 @@
"bootstrap": "./scripts/link-dependencies.sh && echo '***BOOTSTRAP ONLY REQUIRED FOR USE WITH ACCOUNT PORTAL***'",
"build": "yarn nx run-many -t=build",
"build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput",
"check:types": "lerna run check:types --skip-nx-cache",
"backend:bootstrap": "./scripts/scopeBackend.sh && yarn run bootstrap",
"backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'",
"build:sdk": "lerna run --stream build:sdk",

View File

@ -11,6 +11,7 @@
"scripts": {
"prebuild": "rimraf dist/",
"build": "node ./scripts/build.js",
"check:types": "tsc -p tsconfig.build.json --noEmit",
"postbuild": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",

View File

@ -1,3 +1,4 @@
*
!/dist/
!/docker_run.sh
!/docker_run.sh
!/package.json

View File

@ -12,7 +12,7 @@ RUN apk add --no-cache --virtual .gyp python3 make g++
RUN yarn global add pm2
COPY dist/package.json .
COPY package.json .
RUN yarn install --frozen-lockfile --production=true
# Remove unneeded data from file system to reduce image size
RUN apk del .gyp \

View File

@ -13,7 +13,8 @@
],
"scripts": {
"prebuild": "rimraf dist/",
"build": "cd ../.. && nx build @budibase/worker",
"build": "node ../../scripts/build.js",
"check:types": "tsc -p tsconfig.build.json --noEmit",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"run:docker": "node dist/index.js",
"debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js",

View File

@ -1,48 +0,0 @@
{
"name": "@budibase/worker",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"main": "packages/worker/src/index.ts",
"outputPath": "packages/worker/dist",
"outputFileName": "index.js",
"tsConfig": "packages/worker/tsconfig.build.json",
"assets": [
{
"glob": "**/*.hbs",
"input": "packages/worker/src/constants/templates",
"output": "."
}
],
"external": ["graphql/*", "deasync", "mock-aws-s3", "nock"],
"format": ["cjs"],
"esbuildOptions": {
"outExtension": {
".js": ".js"
},
"sourcemap": true
},
"minify": true,
"generatePackageJson": true,
"skipTypeCheck": true
},
"configurations": {
"production": {
"skipTypeCheck": false,
"esbuildOptions": {
"sourcemap": false
}
}
},
"dependsOn": [
{
"projects": ["@budibase/types", "@budibase/string-templates"],
"target": "build"
}
]
}
}
}

View File

@ -3780,13 +3780,6 @@
dependencies:
"@nx/devkit" "16.2.2"
"@nrwl/esbuild@16.2.1":
version "16.2.1"
resolved "https://registry.yarnpkg.com/@nrwl/esbuild/-/esbuild-16.2.1.tgz#83f8fbf2c7c541c220ccfff8be17a0e542aa7d01"
integrity sha512-qyNpdtPAzk2IhYmK5Qzn9gM1cvEtWFp6vJfgdbCKQngdqioYcJpGtdKhRm6Vcj8mFXF7zDgtUd2ecqJSiJU6VA==
dependencies:
"@nx/esbuild" "16.2.1"
"@nrwl/js@16.2.1":
version "16.2.1"
resolved "https://registry.yarnpkg.com/@nrwl/js/-/js-16.2.1.tgz#6eacfa1f0658ca1e288da86b6c38be4846f2779a"
@ -3839,21 +3832,6 @@
tmp "~0.2.1"
tslib "^2.3.0"
"@nx/esbuild@16.2.1":
version "16.2.1"
resolved "https://registry.yarnpkg.com/@nx/esbuild/-/esbuild-16.2.1.tgz#157a408a617b5095ba1372ec27b03d6c9aa3b78c"
integrity sha512-jG4zsGc1EN+SfEBUky44+4cpj7M0Sf0v3pGWsw4hCOuBeLl6qW+eAcFypDXecDosS7ct/M2nEtlZP45IVDMZgQ==
dependencies:
"@nrwl/esbuild" "16.2.1"
"@nx/devkit" "16.2.1"
"@nx/js" "16.2.1"
chalk "^4.1.0"
dotenv "~10.0.0"
fast-glob "3.2.7"
fs-extra "^11.1.0"
tsconfig-paths "^4.1.2"
tslib "^2.3.0"
"@nx/js@16.2.1":
version "16.2.1"
resolved "https://registry.yarnpkg.com/@nx/js/-/js-16.2.1.tgz#41c8c2d610131fa064bbb2b6bb25bd67ed06be79"