From 688ca5d676cb1217874f82904756a013b095f7f5 Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 16:25:06 -0700 Subject: [PATCH 1/5] modify earl esbuild script to support watch mode --- packages/teraslice-cli/build.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/teraslice-cli/build.js b/packages/teraslice-cli/build.js index af18f76ec1b..813585bb9ff 100644 --- a/packages/teraslice-cli/build.js +++ b/packages/teraslice-cli/build.js @@ -1,6 +1,6 @@ import esbuild from 'esbuild'; -esbuild.build({ +const ctx = await esbuild.context({ entryPoints: ['src/command.ts'], outfile: 'dist/src/ts-cli.js', // Output file path bundle: true, @@ -9,4 +9,11 @@ esbuild.build({ sourcemap: false, inject: ['cjs-to-esm.js'], external: ['esbuild'] -}).catch(() => process.exit(1)); +}); + +if (process.argv.includes('--watch')) { + await ctx.watch(); +} else { + await ctx.rebuild(); + ctx.dispose(); +} From 2003e9347fb4a0d72211a2e55e687535354512e1 Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 16:28:50 -0700 Subject: [PATCH 2/5] update earl package.json to support esbuild watch --- packages/teraslice-cli/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/teraslice-cli/package.json b/packages/teraslice-cli/package.json index b760bdb04ca..0595bdb0f76 100644 --- a/packages/teraslice-cli/package.json +++ b/packages/teraslice-cli/package.json @@ -31,8 +31,9 @@ "dist/src/helpers/esm-shims.js" ], "scripts": { - "build": "tsc --build && node build.js", - "build:watch": "tsc --build --watch", + "build": "tsc --build", + "postbuild": "node build.js", + "build:watch": "tsc --build --watch & node build.js --watch", "test": "ts-scripts test . --", "test:debug": "ts-scripts test --debug . --", "test:watch": "ts-scripts test --watch . --" From 27854a5339b169e0ae6d56d0bde76a0b8c129304 Mon Sep 17 00:00:00 2001 From: sotojn Date: Fri, 13 Dec 2024 16:30:08 -0700 Subject: [PATCH 3/5] fix top level build:watch to work with earl changes --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 13082ac6bdd..e5e955d200d 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,13 @@ ], "scripts": { "prebuild": "./packages/xlucene-parser/scripts/generate-engine.js", - "build": "tsc --build --verbose && yarn workspace teraslice-cli build --verbose", + "postbuild": "yarn workspace teraslice-cli postbuild", + "build": "tsc --build", "build:cleanup": "./scripts/build-cleanup.sh", "build:doctor": "./scripts/build-doctor.sh", "build:fix": "echo '[DEPRECATED], use yarn run build:doctor instead'", "build:pkg": "./scripts/build-pkg.sh", - "build:watch": "yarn run build --watch", + "build:watch": "yarn run build --watch & yarn workspace teraslice-cli node build.js --watch", "bump": "ts-scripts bump", "docker:limit": "./scripts/docker-limit-check.sh", "docker:listImages": "ts-scripts images list", From 0fc2c1cc0f0950bc5f62bb7e39c1c6577fdb1f06 Mon Sep 17 00:00:00 2001 From: sotojn Date: Mon, 16 Dec 2024 10:33:15 -0700 Subject: [PATCH 4/5] fix yarn sync --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5e955d200d..c6ff584afa1 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ ], "scripts": { "prebuild": "./packages/xlucene-parser/scripts/generate-engine.js", - "postbuild": "yarn workspace teraslice-cli postbuild", "build": "tsc --build", + "postbuild": "yarn workspace teraslice-cli postbuild", "build:cleanup": "./scripts/build-cleanup.sh", "build:doctor": "./scripts/build-doctor.sh", "build:fix": "echo '[DEPRECATED], use yarn run build:doctor instead'", From ba6433e17b5f0d69257694585098d816985c16f2 Mon Sep 17 00:00:00 2001 From: sotojn Date: Mon, 16 Dec 2024 16:25:25 -0700 Subject: [PATCH 5/5] add verbose to top level build script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c6ff584afa1..246fe0b0b37 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ ], "scripts": { "prebuild": "./packages/xlucene-parser/scripts/generate-engine.js", - "build": "tsc --build", + "build": "tsc --build --verbose", "postbuild": "yarn workspace teraslice-cli postbuild", "build:cleanup": "./scripts/build-cleanup.sh", "build:doctor": "./scripts/build-doctor.sh",