Skip to content

Commit 5fa7708

Browse files
fix json-schema-to-typescript build
Inspired from the script in the browser-sdk repo
1 parent 93298ca commit 5fa7708

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

scripts/generate.mjs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,21 @@ async function getJsonSchemaToTypescript() {
7474

7575
execSync(
7676
`
77-
set -eu
77+
set -eux
78+
7879
cd ./node_modules/json-schema-to-typescript
7980
rm -rf dist
80-
# due to installation on node_modules, some of these steps can fail
81-
# built version still behaves correctly though
82-
set +e
83-
yarn
84-
yarn run clean
85-
yarn run build:server
86-
set -e
81+
82+
npm install
83+
npm run clean
84+
85+
# With yarn 3, the 'test/' folder is not present, so all built files are put directly in the
86+
# 'dist/' folder instead of 'dist/src/'.
87+
#
88+
# Using an explicit '--rootDir' fixes this issue.
89+
#
90+
# Also, tsc fails with type errors, but the built files are fine.
91+
npm exec -- tsc --declaration --rootDir . || true
8792
`,
8893
{
8994
stdio: 'inherit',

0 commit comments

Comments
 (0)