diff --git a/tools/ci/project-shells.mjs b/tools/ci/project-shells.mjs index 635c3c09..6dcdb972 100755 --- a/tools/ci/project-shells.mjs +++ b/tools/ci/project-shells.mjs @@ -4,6 +4,11 @@ * a project and `POST` hands out a random id, so a fresh CI checkout has to put the shells with * the known ids in place itself. The playground is left out – no tool may touch it. * + * A file that is already there is left alone. Overwriting it used to cost a development machine + * the project's whole revision history and its name: the shell carries the key from PROJECTS as + * its name, and the seeders keep whatever name they find, so "Jump and Run" came back as + * "jumpRun". Only CI ever needs the shells, and there the directory is empty. + * * Usage: node tools/ci/project-shells.mjs [dataDir] */ import { mkdir, writeFile } from 'node:fs/promises'; @@ -24,6 +29,11 @@ for (const [name, id] of Object.entries(PROJECTS)) { updatedAt: '1970-01-01T00:00:00Z', project: {}, }; - await writeFile(resolve(dir, `${id}.json`), `${JSON.stringify(doc)}\n`); - console.log(`shell ${name} ${id}`); + try { + await writeFile(resolve(dir, `${id}.json`), `${JSON.stringify(doc)}\n`, { flag: 'wx' }); + console.log(`shell ${name} ${id}`); + } catch (err) { + if (err.code !== 'EEXIST') throw err; + console.log(`kept ${name} ${id}`); + } }