From 29df48e52b43c5e515671a90f7919debe6f44751 Mon Sep 17 00:00:00 2001 From: maplexu Date: Wed, 24 Jun 2026 17:02:05 -0400 Subject: [PATCH] Fix pre-push hook crash from orphaned ci.yml updater copy-shared-files.mjs rewrote a jobs.test-individual.strategy.matrix.project node in ci.yml that #461 removed, so it threw a TypeError on every push that changed a shared file or added a sample. The CI sample list is hand-maintained now, so drop the dead block and the two imports it was the sole user of. Co-Authored-By: Claude Opus 4.8 (1M context) --- .scripts/copy-shared-files.mjs | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.scripts/copy-shared-files.mjs b/.scripts/copy-shared-files.mjs index 8192dd7b..7d3be574 100644 --- a/.scripts/copy-shared-files.mjs +++ b/.scripts/copy-shared-files.mjs @@ -1,10 +1,6 @@ // Run with https://github.com/google/zx -const { readFileSync } = require('fs'); - const STORED_SAMPLES = new Set(require('./list-of-samples.json').samples); -const yaml = require('yaml'); - const NON_SAMPLES = ['node_modules']; const ADDITIONAL_SAMPLES = []; @@ -201,35 +197,6 @@ for (const sample of samples) { await copyAndAdd(sample, '.nvmrc'); } -process.stdout.write('Updating GitHub workflows...'); - -const ciConfig = yaml.parseDocument(await fs.readFile('.github/workflows/ci.yml', 'utf8')); -const jobsNode = ciConfig.contents.items.find((i) => i.key.value === 'jobs'); -const testNode = jobsNode.value.items.find((i) => i.key.value === 'test-individual'); -const testProjectsNode = testNode.value.items - .find((i) => i.key.value === 'strategy') - .value.items.find((i) => i.key.value === 'matrix') - .value.items.find((i) => i.key.value === 'project'); - -testProjectsNode.value.items = []; - -for (const sample of samples) { - // Don't use require, because it won't work with ESM samples - const packageJson = JSON.parse(readFileSync(`./${sample}/package.json`)); - const hasTestScript = !!packageJson.scripts.test; - - if (hasTestScript) { - testProjectsNode.value.items.push(sample); - } else { - const index = testProjectsNode.value.items.indexOf(sample); - if (index >= 0) { - testProjectsNode.value.items.splice(index, 1); - } - } -} - -await fs.writeFile('.github/workflows/ci.yml', ciConfig.toString()); - console.log(' done.'); async function copyAndAdd(sample, file) {