{"record":{"id":"4837b4a997c61b42","repo":"microsoft/TypeScript","slug":"n-tsfilepath-was-not-updated-while-configur","errorCode":null,"errorMessage":"\\n  '${tsFilePath}' was not updated while configuring for a prerelease publish for '${tag}'.\\n    Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- \"${tsFilePath}\"'.\\n","messagePattern":"\\\\n  '(.+?)' was not updated while configuring for a prerelease publish for '(.+?)'\\.\\\\n    Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- \"(.+?)\"'\\.\\\\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/configurePrerelease.mjs","lineNumber":54,"sourceCode":"\r\n    // Acquire the version from the package.json file and modify it appropriately.\r\n    const packageJsonFilePath = normalize(args[1]);\r\n    /** @type {PackageJson} */\r\n    const packageJsonValue = JSON.parse(readFileSync(packageJsonFilePath).toString());\r\n\r\n    const { majorMinor, patch } = parsePackageJsonVersion(packageJsonValue.version);\r\n    const prereleasePatch = getPrereleasePatch(tag, patch);\r\n\r\n    // Acquire and modify the source file that exposes the version string.\r\n    const tsFilePath = normalize(args[2]);\r\n    const tsFileContents = readFileSync(tsFilePath).toString();\r\n    const modifiedTsFileContents = updateTsFile(tsFilePath, tsFileContents, majorMinor, patch, prereleasePatch);\r\n\r\n    // Ensure we are actually changing something - the user probably wants to know that the update failed.\r\n    if (tsFileContents === modifiedTsFileContents) {\r\n        let err = `\\n  '${tsFilePath}' was not updated while configuring for a prerelease publish for '${tag}'.\\n    `;\r\n        err += `Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- \"${tsFilePath}\"'.`;\r\n        throw new Error(err + \"\\n\");\r\n    }\r\n\r\n    // Finally write the changes to disk.\r\n    // Modify the package.json structure\r\n    packageJsonValue.version = `${majorMinor}.${prereleasePatch}`;\r\n    writeFileSync(packageJsonFilePath, JSON.stringify(packageJsonValue, undefined, 4));\r\n    writeFileSync(tsFilePath, modifiedTsFileContents);\r\n}\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n/**\r\n * @param {string} tsFilePath\r\n * @param {string} tsFileContents\r\n * @param {string} majorMinor\r\n * @param {string} patch\r\n * @param {string} nightlyPatch\r\n * @returns {string}\r\n */\r","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/scripts/configurePrerelease.mjs#L36-L72","documentation":"updateTsFile regex-replaces the `export const version` line in the TS source. configurePrerelease compares the file before and after; if they're identical the replace didn't apply, meaning either the script already ran (source already at the prerelease version) or the version line shape changed and the regex no longer matches.","triggerScenarios":"Running configurePrerelease twice without reverting the source; the version regex in the source has been edited and no longer matches.","commonSituations":"Re-running a release script after a partial earlier run; a merge conflict resolution that altered the version export line.","solutions":["Revert the source file with `git checkout -- \"<tsFilePath>\"` and re-run the script.","Verify the version export still matches `/export const version(?:: string)? = ...`.","Confirm you haven't already bumped to the prerelease patch."],"exampleFix":"# before (second run of the script fails)\n$ node scripts/configurePrerelease.mjs dev package.json src/compiler/core.ts\n\n# after\n$ git checkout -- src/compiler/core.ts\n$ node scripts/configurePrerelease.mjs dev package.json src/compiler/core.ts","handlingStrategy":"validation","validationCode":"// Verify the source still matches the pre-prerelease shape before running.\nconst src = fs.readFileSync(tsFilePath, \"utf8\");\nif (!/export const version(?:: string)? = `\\$\\{versionMajorMinor\\}\\.\\d(-\\w+)?;/.test(src)) {\n  throw new Error(\"Source already at prerelease version or regex drifted; run `git checkout -- \" + tsFilePath + \"` first.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run configurePrerelease exactly once per release; revert the source before re-running.","Keep the version export line in the canonical shape so the regex stays stable."],"tags":["release","publish","idempotency","prerelease"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}