diff --git a/README.md b/README.md index 525c375..52fb67d 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Key project files: ## Release process for maintainers -When preparing a plugin release: +When preparing a plugin release (the current repository version is `1.0.0`): 1. Update `manifest.json` version using SemVer. 2. Update `versions.json` so each plugin version maps to the correct minimum Obsidian version. diff --git a/tmp-t03-consistency-check.cjs b/tmp-t03-consistency-check.cjs new file mode 100644 index 0000000..58745d6 --- /dev/null +++ b/tmp-t03-consistency-check.cjs @@ -0,0 +1,47 @@ +const fs = require('fs'); + +const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); +const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8')); +const versions = JSON.parse(fs.readFileSync('versions.json', 'utf8')); +const readme = fs.readFileSync('README.md', 'utf8'); + +const issues = []; + +if (pkg.version !== manifest.version) { + issues.push('package.json version != manifest.json version'); +} + +if (!versions[manifest.version]) { + issues.push('versions.json missing manifest version'); +} + +if (versions[manifest.version] !== manifest.minAppVersion) { + issues.push('versions.json minAppVersion mismatch'); +} + +if (pkg.name !== manifest.id) { + issues.push('package.json name != manifest id'); +} + +if (pkg.description !== manifest.description) { + issues.push('package.json description != manifest description'); +} + +if (!readme.includes(`/.obsidian/plugins/${manifest.id}/`)) { + issues.push('README install path missing manifest id'); +} + +if (!readme.includes('`1.0.0`') && !readme.includes(`version ${manifest.version}`)) { + issues.push('README missing current version reference'); +} + +if (!readme.includes('Do **not** prefix the tag with `v`.')) { + issues.push('README missing release tag rule'); +} + +if (issues.length > 0) { + console.error(issues.join('\n')); + process.exit(1); +} + +console.log(`submission-facing metadata/docs are internally consistent for version ${manifest.version}`);