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({

View file

@ -36,13 +36,13 @@
"esbuild": "^0.12.15",
"esbuild-register": "^2.5.0",
"npm-run-all": "^4.1.5",
"lodash-es": "^4.17.21",
"typescript": "^4.4.2"
},
"dependencies": {
"@theatre/core": "workspace:*",
"@theatre/react": "workspace:*",
"@theatre/studio": "workspace:*",
"lodash-es": "^4.17.21"
"@theatre/studio": "workspace:*"
},
"peerDependencies": {
"react": "*",