Build shared-core
This commit is contained in:
parent
790f7bf3aa
commit
d7f7ad5b5f
|
@ -16,6 +16,7 @@
|
|||
"kill-port": "^1.6.1",
|
||||
"lerna": "^6.6.1",
|
||||
"madge": "^6.0.0",
|
||||
"minimist": "^1.2.8",
|
||||
"prettier": "^2.3.1",
|
||||
"prettier-plugin-svelte": "^2.3.0",
|
||||
"rimraf": "^3.0.2",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist/",
|
||||
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig-cjs.build.json",
|
||||
"build": "node ../../scripts/build.js -p tsconfig.build.json --outdir dist/mjs/src && node ../../scripts/build.js -p tsconfig-cjs.build.json --outdir dist/cjs/src",
|
||||
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
||||
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
|
||||
},
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
"declaration": true,
|
||||
"types": ["node"],
|
||||
"outDir": "dist",
|
||||
"skipLibCheck": true
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@budibase/types": ["../types/src"]
|
||||
}
|
||||
},
|
||||
"include": ["**/*.js", "**/*.ts"],
|
||||
"exclude": [
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"extends": "./tsconfig-base.build.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "dist/cjs/src",
|
||||
"target": "es2015"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
"extends": "./tsconfig-base.build.json",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"outDir": "dist/mjs/src",
|
||||
"target": "esnext"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,16 @@ const sveltePlugin = require("esbuild-svelte")
|
|||
|
||||
const { default: NodeResolve } = require("@esbuild-plugins/node-resolve")
|
||||
|
||||
var argv = require("minimist")(process.argv.slice(2))
|
||||
|
||||
function runBuild(entry, outfile) {
|
||||
const isDev = process.env.NODE_ENV !== "production"
|
||||
|
||||
const sharedConfig = {
|
||||
entryPoints: [entry],
|
||||
bundle: true,
|
||||
minify: true,
|
||||
tsconfig: `tsconfig.build.json`,
|
||||
minify: !isDev,
|
||||
tsconfig: argv["p"] || `tsconfig.build.json`,
|
||||
plugins: [
|
||||
sveltePlugin(),
|
||||
NodeResolve({
|
||||
|
@ -33,12 +37,15 @@ function runBuild(entry, outfile) {
|
|||
],
|
||||
target: "node14",
|
||||
preserveSymlinks: true,
|
||||
external: isDev ? ["@budibase/client"] : [],
|
||||
}
|
||||
|
||||
const outdir = argv["outdir"]
|
||||
build({
|
||||
...sharedConfig,
|
||||
platform: "node",
|
||||
outfile,
|
||||
outdir,
|
||||
outfile: outdir ? undefined : outfile,
|
||||
}).then(() => {
|
||||
glob(`${process.cwd()}/src/**/*.hbs`, {}, (err, files) => {
|
||||
for (const file of files) {
|
||||
|
@ -54,7 +61,7 @@ function runBuild(entry, outfile) {
|
|||
}
|
||||
|
||||
if (require.main === module) {
|
||||
const entry = process.argv[2] || "./src/index.ts"
|
||||
const entry = argv["e"] || "./src/index.ts"
|
||||
const outfile = `dist/${entry.split("/").pop().replace(".ts", ".js")}`
|
||||
runBuild(entry, outfile)
|
||||
} else {
|
||||
|
|
14
yarn.lock
14
yarn.lock
|
@ -17538,7 +17538,7 @@ minimist-options@4.1.0:
|
|||
is-plain-obj "^1.1.0"
|
||||
kind-of "^6.0.3"
|
||||
|
||||
minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.3, minimist@^1.2.7:
|
||||
minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.3, minimist@^1.2.7, minimist@^1.2.8:
|
||||
version "1.2.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
|
||||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
|
||||
|
@ -24972,7 +24972,7 @@ vlq@^0.2.2:
|
|||
resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"
|
||||
integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==
|
||||
|
||||
vm2@3.9.17, vm2@^3.9.15:
|
||||
vm2@3.9.17:
|
||||
version "3.9.17"
|
||||
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.17.tgz#251b165ff8a0e034942b5181057305e39570aeab"
|
||||
integrity sha512-AqwtCnZ/ERcX+AVj9vUsphY56YANXxRuqMb7GsDtAr0m0PcQX3u0Aj3KWiXM0YAHy7i6JEeHrwOnwXbGYgRpAw==
|
||||
|
@ -24980,7 +24980,15 @@ vm2@3.9.17, vm2@^3.9.15:
|
|||
acorn "^8.7.0"
|
||||
acorn-walk "^8.2.0"
|
||||
|
||||
vm2@^3.9.4, vm2@^3.9.8:
|
||||
vm2@^3.9.15:
|
||||
version "3.9.16"
|
||||
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.16.tgz#0fbc2a265f7bf8b837cea6f4a908f88a3f93b8e6"
|
||||
integrity sha512-3T9LscojNTxdOyG+e8gFeyBXkMlOBYDoF6dqZbj+MPVHi9x10UfiTAJIobuchRCp3QvC+inybTbMJIUrLsig0w==
|
||||
dependencies:
|
||||
acorn "^8.7.0"
|
||||
acorn-walk "^8.2.0"
|
||||
|
||||
vm2@^3.9.8:
|
||||
version "3.9.14"
|
||||
resolved "https://registry.yarnpkg.com/vm2/-/vm2-3.9.14.tgz#964042b474cf1e6e4f475a39144773cdb9deb734"
|
||||
integrity sha512-HgvPHYHeQy8+QhzlFryvSteA4uQLBCOub02mgqdR+0bN/akRZ48TGB1v0aCv7ksyc0HXx16AZtMHKS38alc6TA==
|
||||
|
|
Loading…
Reference in New Issue