diff --git a/cmd/check-version.js b/cmd/check-version.js new file mode 100644 index 00000000..55c6ed41 --- /dev/null +++ b/cmd/check-version.js @@ -0,0 +1,5 @@ +const { version } = require('../package'); +const changelog = String(require('fs').readFileSync('CHANGELOG.md')).split('\n'); +if (!changelog.find(line => line.startsWith('### ' + version))) { + throw new Error(`The package.json version ${version} does not seem to have a matching heading in CHANGELOG.json`); +} diff --git a/package.json b/package.json index 076b4390..ca3d8698 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,11 @@ ], "main": "./out/src/extension", "scripts": { - "vscode:prepublish": "npm run lint && npm run compile", + "vscode:prepublish": "npm run check:version && npm run lint && npm run compile", "compile": "tsc -p ./", "watch": "tsc -watch -p ./", "lint": "tslint --config ./tslint.json './src/**/*.ts'", + "check:version": "node cmd/check-version.js", "postinstall": "node ./node_modules/vscode/bin/install" }, "dependencies": {