1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
# browser
rm -rf dist
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/browser/*.ts ./src/runtime
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0 | xargs -0 esbuild --log-level=warning --target=es2018 --outdir=dist/browser --format=esm && echo '{"type": "module"}'> dist/browser/package.json
esbuild --bundle dist/browser/index.js --format=esm --target=es2018 --outfile=dist/browser/index.bundle.js
esbuild --minify --bundle dist/browser/index.js --format=esm --target=es2018 --outfile=dist/browser/index.bundle.min.js
# deno
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/browser/*.ts ./src/runtime
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
mkdir -p dist/deno && cp -r src/. dist/deno && rm -rf dist/deno/runtime/browser dist/deno/runtime/node
find dist/deno -name '*.ts' -type f -print0 | xargs -0 sed -i -e "s/@deno\-expect\-error/@ts-ignore/g" -e "s/\.js'/.ts'/g" -e "s/\.d'/.d.ts'/g"
# node-cjs
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/node/*.ts ./src/runtime
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0 | xargs -0 esbuild --log-level=warning --platform=node --target=node12 --outdir=dist/node/cjs --format=cjs
# node-esm
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/node/*.ts ./src/runtime
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0 | xargs -0 esbuild --log-level=warning --platform=node --target=node12 --outdir=dist/node/esm --format=esm && echo '{"type": "module"}'> dist/node/esm/package.json
# node-webcrypto-cjs
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/browser/*.ts ./src/runtime
cp ./src/runtime/node/webcrypto.ts ./src/runtime/ && cp ./src/runtime/node/fetch_jwks.ts ./src/runtime/ && cp ./src/runtime/node/base64url.ts ./src/runtime/ && cp ./src/runtime/node/zlib.ts ./src/runtime/
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0 | xargs -0 esbuild --log-level=warning --platform=node --target=esnext --outdir=dist/node/webcrypto/cjs --format=cjs
# node-webcrypto-esm
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 rm -f
cp ./src/runtime/browser/*.ts ./src/runtime
cp ./src/runtime/node/webcrypto.ts ./src/runtime/ && cp ./src/runtime/node/fetch_jwks.ts ./src/runtime/ && cp ./src/runtime/node/base64url.ts ./src/runtime/ && cp ./src/runtime/node/zlib.ts ./src/runtime/
find src/runtime -maxdepth 1 -not -name '*.d.ts' -type f -print0 | xargs -0 sed -i -e "s/'\.\.\//'\.\//g" -e "s/'\.\/\.\./'../g"
find src -type f -name '*.ts' -not -path '*/runtime/*/*' -not -name '*.d.ts' -print0 | xargs -0 esbuild --log-level=warning --platform=node --target=esnext --outdir=dist/node/webcrypto/esm --format=esm && echo '{"type": "module"}'> dist/node/webcrypto/esm/package.json
|