fix make compat-table to install dependencies

This commit is contained in:
Evan Wallace
2025-12-16 14:20:18 -05:00
parent 3be1912877
commit 29f2d460f0
2 changed files with 19 additions and 9 deletions
+4 -1
View File
@@ -692,7 +692,7 @@ scripts/browser/node_modules:
################################################################################
# This generates browser support mappings
compat-table: esbuild
compat-table: esbuild | compat-table/node_modules
./esbuild compat-table/src/index.ts --bundle --platform=node --external:./compat-table/repos/* --outfile=compat-table/out.js --log-level=warning --sourcemap
node --enable-source-maps compat-table/out.js
@@ -701,6 +701,9 @@ update-compat-table: esbuild
./esbuild compat-table/src/index.ts --bundle --platform=node --external:./compat-table/repos/* --outfile=compat-table/out.js --log-level=warning --sourcemap
node --enable-source-maps compat-table/out.js --update
compat-table/node_modules:
cd compat-table && npm ci
################################################################################
# This runs the test262 official JavaScript test suite through esbuild
+15 -8
View File
@@ -302,7 +302,8 @@ const supportMapToVersionRanges = <F extends string>(supportMap: SupportMap<F>):
return [versionRangeMap, whyNotMap]
}
const updateGithubDependencies = (): void => {
const installGitHubDependencies = (): void => {
const updateCommits = process.argv.includes('--update')
const jsonPath = path.join(__dirname, 'package.json')
const jsonData = JSON.parse(fs.readFileSync(jsonPath, 'utf8'))
@@ -314,18 +315,24 @@ const updateGithubDependencies = (): void => {
}
child_process.execFileSync('git', ['fetch'], { cwd: fullPath, stdio: 'inherit' })
child_process.execFileSync('git', ['reset', '--hard', '--quiet', 'origin/gh-pages'], { cwd: fullPath, stdio: 'inherit' })
const commit = child_process.execFileSync('git', ['rev-parse', 'HEAD'], { cwd: fullPath }).toString().trim()
jsonData.githubDependencies[repo] = commit
if (updateCommits) {
child_process.execFileSync('git', ['reset', '--hard', '--quiet', 'origin/gh-pages'], { cwd: fullPath, stdio: 'inherit' })
const commit = child_process.execFileSync('git', ['rev-parse', 'HEAD'], { cwd: fullPath }).toString().trim()
jsonData.githubDependencies[repo] = commit
} else {
const commit = jsonData.githubDependencies[repo]
child_process.execFileSync('git', ['reset', '--hard', '--quiet', commit], { cwd: fullPath, stdio: 'inherit' })
}
})
fs.writeFileSync(jsonPath, JSON.stringify(jsonData, null, 2) + '\n')
if (updateCommits) {
fs.writeFileSync(jsonPath, JSON.stringify(jsonData, null, 2) + '\n')
}
}
if (process.argv.includes('--update')) {
updateGithubDependencies()
}
// These dependencies are not published on npm and are instead pulled from GitHub (but pinned to a specific commit)
installGitHubDependencies()
import('./kangax').then(kangax => {
const js: SupportMap<JSFeature> = {} as SupportMap<JSFeature>