diff --git a/.github/workflows/pr-file-check.yml b/.github/workflows/pr-file-check.yml index be55f4ad2f3b..30edb152b215 100644 --- a/.github/workflows/pr-file-check.yml +++ b/.github/workflows/pr-file-check.yml @@ -42,3 +42,6 @@ jobs: .github/test_plan.md skip-label: 'skip tests' failure-message: 'TypeScript code was edited without also editing a ${file-pattern} file; see the Testing page in our wiki on testing guidelines (the ${skip-label} label can be used to pass this check)' + + - name: 'Check for proposed API changes' + run: npm run check-proposed-api diff --git a/package.json b/package.json index c8fe74cc8255..51e708d7e3f2 100644 --- a/package.json +++ b/package.json @@ -1552,7 +1552,8 @@ "addExtensionPackDependencies": "gulp addExtensionPackDependencies", "updateBuildNumber": "gulp updateBuildNumber", "verifyBundle": "gulp verifyBundle", - "webpack": "webpack" + "webpack": "webpack", + "check-proposed-api": "node ./src/check-proposed-api.js" }, "dependencies": { "@iarna/toml": "^2.2.5", diff --git a/src/check-proposed-api.js b/src/check-proposed-api.js new file mode 100644 index 000000000000..a639538fae55 --- /dev/null +++ b/src/check-proposed-api.js @@ -0,0 +1,22 @@ +const fs = require('fs'); + +const packageJsonPath = './package.json'; + +function checkProposedApiChanges() { + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + + const { enabledApiProposals, engines } = packageJson; + const vscodeEngineVersion = engines.vscode; + + const originalPackageJson = JSON.parse(fs.readFileSync(packageJsonPath + '.original', 'utf8')); + const originalEnabledApiProposals = originalPackageJson.enabledApiProposals; + const originalVscodeEngineVersion = originalPackageJson.engines.vscode; + + if (JSON.stringify(enabledApiProposals) !== JSON.stringify(originalEnabledApiProposals) && + vscodeEngineVersion === originalVscodeEngineVersion) { + console.error('Error: `enabledApiProposals` was modified but `vscode` engine version was not updated.'); + process.exit(1); + } +} + +checkProposedApiChanges();