1
0
Fork 0

feat(build): bundle with esbuild

This commit is contained in:
Sean Sube 2022-02-03 08:22:29 -06:00
parent 07cd12bed5
commit 41884525da
5 changed files with 157 additions and 1 deletions

28
config/esbuild.mjs Normal file
View File

@ -0,0 +1,28 @@
import { build } from 'esbuild';
import IgnorePlugin from 'esbuild-plugin-ignore';
import { join } from 'path';
const root = process.cwd();
build({
bundle: true,
entryPoints: [
join(root, 'out/src/index.js'),
],
format: 'cjs',
keepNames: true,
outdir: 'out/bundle/',
outExtension: {
'.js': '.cjs',
},
platform: 'node',
plugins: [
IgnorePlugin([{
resourceRegExp: /(dtrace-provider|ink|mv|node-fetch)/,
contextRegExp: /node_modules/,
}]),
],
}).catch((err) => {
console.error(err);
process.exit(1);
});

View File

@ -15,6 +15,9 @@ build: ## build the app
build: node_modules
yarn tsc
bundle: build
node config/esbuild.mjs
clean-deps: ## clean up the node_modules directory
rm -rf node_modules/

View File

@ -61,6 +61,8 @@
"chai": "4.3.6",
"chai-as-promised": "7.1.1",
"deep-diff": "1.0.2",
"esbuild": "^0.14.18",
"esbuild-plugin-ignore": "^1.1.1",
"eslint": "8.8.0",
"eslint-plugin-chai": "0.0.1",
"eslint-plugin-chai-expect": "3.0.0",

View File

@ -23,7 +23,11 @@ export interface ConfigData {
* Path to project root directory.
*/
export function dirName(): string {
return join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
if (doesExist(import.meta) && doesExist(import.meta.url)) {
return join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
} else {
return process.cwd();
}
}
/**

119
yarn.lock
View File

@ -1439,6 +1439,125 @@ es6-error@^4.0.1:
resolved "https://artifacts.apextoaster.com/repository/group-npm/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
esbuild-android-arm64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-android-arm64/-/esbuild-android-arm64-0.14.18.tgz#027a1cd57e57c6219341e116c4ac41a9952d69d1"
integrity sha512-AuE8vIwc6QLquwykyscFk0Ji3RFczoOvjka64FJlcjLLhD6VsS584RYlQrSnPpRkv69PunUvyrBoEF7JFTJijg==
esbuild-darwin-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-darwin-64/-/esbuild-darwin-64-0.14.18.tgz#a219c50aa98b5bc08d7ce3677f5bae4b8aa5101b"
integrity sha512-nN1XziZtDy8QYOggaXC3zu0vVh8YJpS8Bol7bHaxx0enTLDSFBCXUUJEKYpmAAJ4OZRPgjXv8NzEHHQWQvLzXg==
esbuild-darwin-arm64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.18.tgz#eb2d17d33c5991c183c99843698182bb702eb592"
integrity sha512-v0i2n6TCsbxco/W1fN8RgQt3RW00Q9zJO2eqiAdmLWg6Hx0HNHloZyfhF11i7nMUUgW8r5n++ZweIXjAFPE/gQ==
esbuild-freebsd-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.18.tgz#de06b6ce361bdf51fb66e59b220f67c4124cc728"
integrity sha512-XLyJZTWbSuQJOqw867tBxvto6GjxULvWZYKs6RFHYQPCqgQ0ODLRtBmp4Fqqpde52yOe45npaaoup9IXNfr32A==
esbuild-freebsd-arm64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.18.tgz#59bb55cd6ac1b2b3c43536c067d8356f4ae7e310"
integrity sha512-0ItfrR8hePnDcUXxUQxY+VfICcBfeMJCdK6mcNUXnXw6LyHjyUYXWpFXF+J18pg1/YUWRWO1HbsJ7FEwELcQIA==
esbuild-linux-32@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-32/-/esbuild-linux-32-0.14.18.tgz#ff68f7ec7c8b8c7dddab4d6e65f1a1d0ff3ab0b9"
integrity sha512-mnG84D9NsEsoQdBpBT0IsFjm5iAwnd81SP4tRMXZLl09lPvIWjHHSq6LDlb4+L5H5K5y68WC//X5Dr2MtNY3DQ==
esbuild-linux-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-64/-/esbuild-linux-64-0.14.18.tgz#d4083d9833580090452a095cd2216100d86f3c7a"
integrity sha512-HvExRtkeA8l/p+7Lf6aBrnLH+jTCFJTUMJxGKExh2RD8lCXGTeDJFyP+BOEetP80fuuH+Syj79+LVQ9MihdBsg==
esbuild-linux-arm64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.18.tgz#8ce21e188ab9fcdb512f4ada9a637014c1294bec"
integrity sha512-CCWmilODE1ckw+M7RVqoqKWA4UB0alCyK2bv0ikEeEAwkzinlJeoe94t9CnT/ECSQ2sL+C16idsr+aUviGp7sg==
esbuild-linux-arm@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-arm/-/esbuild-linux-arm-0.14.18.tgz#a5e1d684c451f379b1dfef7b5a2dcad84cce3f79"
integrity sha512-+ZL8xfXVNaeaZ2Kxqlw2VYZWRDZ7NSK4zOV9GKNAtkkWURLsPUU84aUOBatRe9BH1O5FDo3LLQSlaA04ed6lhA==
esbuild-linux-mips64le@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.18.tgz#c3890f178745a9c65bad64322be2b3611c240041"
integrity sha512-8LjO4+6Vxz5gbyCHO4OONYMF689nLderCtzb8lG1Bncs4ZXHpo6bjvuWeTMRbGUkvAhp+P6hMTzia7RHOC53wQ==
esbuild-linux-ppc64le@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.18.tgz#a355f515ca84839f5301f8ef745a2b329105e232"
integrity sha512-0OJk/6iYEmF1J7LXY6+cqf6Ga5vG4an7n1nubTKce7kYqaTyNGfYcTjDZce6lnDVlZTJtwntIMszq1+ZX7Kenw==
esbuild-linux-s390x@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.18.tgz#81721c22387912778c67495d0a34527f7a2cde66"
integrity sha512-UNY7YKZHjY31KcNanJK4QaT2/aoIQyS+jViP3QuDRIoYAogRnc6WydylzIkkEzGMaC4fzaXOmQ8fxwpLAXK4Yg==
esbuild-netbsd-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.18.tgz#eaee109d527a58b582f8fa933d9cadf8840758c2"
integrity sha512-wE/2xT9KNzLCfEBw24YbVmMmXH92cFIzrRPUlwWH9dIizjvEYYcyQ+peTMVkqzUum7pdlVLZ2CDDqAaZo/nW/w==
esbuild-openbsd-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.18.tgz#96a42615f5548529b7bb32d024bb9c6fb542778c"
integrity sha512-vdymE2jyuH/FRmTvrguCYSrq81/rUwuhMYyvt/6ibv9ac7xQ674c8qTdT+RH73sR9/2WUD/NsYxrBA/wUVTxcg==
esbuild-plugin-ignore@^1.1.1:
version "1.1.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-plugin-ignore/-/esbuild-plugin-ignore-1.1.1.tgz#a83be27a9a1b742700b547c1e50a9f2ec3775f02"
integrity sha512-RVh45nlpiFiBJuw687Qh935VQvSzIA4rkBBytYYb5M3bTQcxokULQFQW6Sj0YHbFR6thNWmQYFkBghEQt5D3jg==
esbuild-sunos-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-sunos-64/-/esbuild-sunos-64-0.14.18.tgz#869723d73a5f35ba2a4a6c043694d952bd4f831b"
integrity sha512-X/Tesy6K1MdJF1d5cbzFDxrIMMn0ye+VgTQRI8P5Vo2CcKxOdckwsKUwpRAvg+VDZ6MxrSOTYS9OOoggPUjxTg==
esbuild-windows-32@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-windows-32/-/esbuild-windows-32-0.14.18.tgz#197c8833ed0f6a82055ab63861777749d0ce95c0"
integrity sha512-glG23I/JzCL4lu7DWFUtVwqFwNwlL0g+ks+mcjjUisHcINoSXTeCNToUN0bHhzn6IlXXnggNQ38Ew/idHPM8+g==
esbuild-windows-64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-windows-64/-/esbuild-windows-64-0.14.18.tgz#569832a99d87fc931a081fe7761c100578275be0"
integrity sha512-zEiFKHgV/3z14wsVamV98/5mxeOwz+ecyg0pD3fWcBz9j4EOIT1Tg47axypD4QLwiKFvve9mUBYX1cD99qxOyw==
esbuild-windows-arm64@0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.18.tgz#c1991848fca7b051d1d036d0723406da9696105d"
integrity sha512-Mh8lZFcPLat13dABN7lZThGUOn9YxoH5RYkhBq0U3WqQohHzKRhllYh7ibFixnkpMLnv8OZEbl8bGLMy03MpfA==
esbuild@^0.14.18:
version "0.14.18"
resolved "https://artifacts.apextoaster.com/repository/group-npm/esbuild/-/esbuild-0.14.18.tgz#9c5f58c506ec9e0ec335d20bcb3f9dbd086d0648"
integrity sha512-vCUoISSltnX7ax01w70pWOSQT+e55o+2P/a+A9MSTukJAt3T4aDZajcjeG4fnZbkvOEv+dkKgdkvljz6vVQD4A==
optionalDependencies:
esbuild-android-arm64 "0.14.18"
esbuild-darwin-64 "0.14.18"
esbuild-darwin-arm64 "0.14.18"
esbuild-freebsd-64 "0.14.18"
esbuild-freebsd-arm64 "0.14.18"
esbuild-linux-32 "0.14.18"
esbuild-linux-64 "0.14.18"
esbuild-linux-arm "0.14.18"
esbuild-linux-arm64 "0.14.18"
esbuild-linux-mips64le "0.14.18"
esbuild-linux-ppc64le "0.14.18"
esbuild-linux-s390x "0.14.18"
esbuild-netbsd-64 "0.14.18"
esbuild-openbsd-64 "0.14.18"
esbuild-sunos-64 "0.14.18"
esbuild-windows-32 "0.14.18"
esbuild-windows-64 "0.14.18"
esbuild-windows-arm64 "0.14.18"
escalade@^3.1.1:
version "3.1.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"