Add theatric to the release scripts and fix compat issues

This commit is contained in:
Aria Minaei 2023-01-22 18:51:55 +01:00
parent 246e75ccb5
commit 164442a6ea
10 changed files with 112 additions and 4 deletions

View file

@ -26,6 +26,14 @@ const definedGlobals = {
function createBundles(watch: boolean) {
const pathToPackage = path.join(__dirname, '../')
const pkgJson = require(path.join(pathToPackage, 'package.json'))
const listOfDependencies = Object.keys(pkgJson.dependencies || {})
const listOfPeerDependencies = Object.keys(pkgJson.peerDependencies || {})
const listOfAllDependencies = [
...listOfDependencies,
...listOfPeerDependencies,
]
const esbuildConfig: Parameters<typeof build>[0] = {
entryPoints: [path.join(pathToPackage, 'src/index.ts')],
bundle: true,
@ -36,7 +44,12 @@ function createBundles(watch: boolean) {
mainFields: ['browser', 'module', 'main'],
target: ['firefox57', 'chrome58'],
conditions: ['browser', 'node'],
plugins: [externalPlugin([/^[\@a-zA-Z]+/])],
plugins: [
externalPlugin([
// if a dependency is listed in the package.json, it should be external
...listOfAllDependencies.map((d) => new RegExp(`^${d}`)),
]),
],
}
build({