Skip to content

Commit

Permalink
chore(internal): allow the build script to be run without yarn instal…
Browse files Browse the repository at this point in the history
…led (#173)
  • Loading branch information
stainless-bot authored and cleb11 committed Aug 1, 2023
1 parent 2efa6bd commit c57d134
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ set -exuo pipefail

node scripts/check-version.cjs

yarn tsc
RUNNER="yarn"
if ! command -v yarn &> /dev/null; then
RUNNER="npx"
fi

$RUNNER tsc

# Build into dist and will publish the package from there,
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
Expand All @@ -23,10 +28,10 @@ done
node scripts/make-dist-package-json.cjs > dist/package.json

# build to .js/.mjs/.d.ts files
tsc-multi
$RUNNER tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs} dist/_shims
tsc-alias -p tsconfig.build.json
$RUNNER tsc-alias -p tsconfig.build.json
# we need to add exports = module.exports = Modern Treasury Node to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
Expand All @@ -46,7 +51,7 @@ else
find dist -type f -exec sed -i "${REFERENCE_SUBS}" {} +
fi

yarn prettier --loglevel=warn --write .
$RUNNER prettier --loglevel=warn --write .

# make sure that nothing crashes when we require the output CJS or
# import the output ESM
Expand Down

0 comments on commit c57d134

Please sign in to comment.