aboutsummaryrefslogtreecommitdiffstats
path: root/packages/service-shared
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 12:05:27 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-30 12:05:27 +0100
commit62d816402c6ddccf22c9ac68822cf100f61662d6 (patch)
tree3963ce347ea0278e22f63eb16615ef3a23c23bf9 /packages/service-shared
parentbuild: Simplify clean script (diff)
downloadsophie-62d816402c6ddccf22c9ac68822cf100f61662d6.tar.gz
sophie-62d816402c6ddccf22c9ac68822cf100f61662d6.tar.zst
sophie-62d816402c6ddccf22c9ac68822cf100f61662d6.zip
build: Use shared packages through modules
By running the build for the shared packages only once, errors in them are reported only once in watch mode. We still have to point jest to the original source files (and rebuild the shared source files as part of the test), because it won't load the "module" entry of the shared packages. However, as a benefit, jest can now run even if the shared packages haven't been built yet.
Diffstat (limited to 'packages/service-shared')
-rw-r--r--packages/service-shared/esbuild.config.js21
-rw-r--r--packages/service-shared/package.json2
2 files changed, 22 insertions, 1 deletions
diff --git a/packages/service-shared/esbuild.config.js b/packages/service-shared/esbuild.config.js
new file mode 100644
index 0000000..ce57cd7
--- /dev/null
+++ b/packages/service-shared/esbuild.config.js
@@ -0,0 +1,21 @@
1// @ts-check
2
3const { chrome } = require('../../config/build-common');
4const { getConfig } = require('../../config/esbuild-config');
5
6module.exports = getConfig({
7 absWorkingDir: __dirname,
8 entryPoints: [
9 'src/index.ts',
10 ],
11 outfile: 'dist/index.mjs',
12 format: 'esm',
13 // The package that includes this one will have a header comment,
14 // no need to have an additional one here.
15 banner: {},
16 platform: 'node',
17 target: chrome,
18 external: [
19 'zod',
20 ],
21});
diff --git a/packages/service-shared/package.json b/packages/service-shared/package.json
index 6f34a9d..e812e4a 100644
--- a/packages/service-shared/package.json
+++ b/packages/service-shared/package.json
@@ -3,7 +3,7 @@
3 "version": "0.1.0", 3 "version": "0.1.0",
4 "private": true, 4 "private": true,
5 "sideEffects": false, 5 "sideEffects": false,
6 "main": "src/index.ts", 6 "module": "dist/index.mjs",
7 "types": "dist/index.d.ts", 7 "types": "dist/index.d.ts",
8 "scripts": { 8 "scripts": {
9 "typecheck": "tsc" 9 "typecheck": "tsc"