Skip to content

Commit

Permalink
better code esm generation
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Apr 4, 2024
1 parent 8140ce7 commit e3da2cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ jobs:
run: pnpm run lint

- name: Build
run: pnpm run build
run: >
TEST262_ESM=${{ matrix.TEST262_ESM }}
pnpm run build
- name: Test
run: >
Expand Down
13 changes: 2 additions & 11 deletions packages/temporal-polyfill/scripts/test262.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,13 @@ yargs(hideBin(process.argv))
expectedFailureFiles.push('expected-failures-node-gte18.txt')
}

let { esm, min } = options

// Let CI decide. Try all permutations based on Node LTS version
if (process.env.CI) {
esm = esm || Boolean(Math.floor(currentNodeMajorVersion / 4) % 2)
min = min || Boolean(Math.floor(currentNodeMajorVersion / 2) % 2)
}

const esmOpt = process.env.TEST262_ESM
const esmOptIsMin = esmOpt === 'terser' || esmOpt === 'swc'

// from package root
const polyfillPath = esmOpt
? './dist/.bundled/global' +
(esmOpt === 'terser' || esmOpt === 'swc'
? '.' + esmOpt + extensions.iifeMin
: extensions.iife)
(esmOptIsMin ? '.' + esmOpt + extensions.iifeMin : extensions.iife)
: './dist/global' + extensions.iife

console.log(`Testing ${polyfillPath} with Node ${currentNodeVersion} ...`)
Expand Down

0 comments on commit e3da2cd

Please sign in to comment.