Skip to content

Commit

Permalink
feat: Add verification script for MERMAID_RELEASE_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Aug 24, 2024
1 parent c95e997 commit 0bfb42c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/community/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ If the users have no way to know that things have changed, then you haven't real
Likewise, if users don't know that there is a new feature that you've implemented, it will forever remain unknown and unused.

The documentation has to be updated for users to know that things have been changed and added!
If you are adding a new feature, add `(vMERMAID_RELEASE_VERSION+)` in the title or description. It will be replaced automatically with the current version number when the release happens.
If you are adding a new feature, add `(v<MERMAID_RELEASE_VERSION>+)` in the title or description. It will be replaced automatically with the current version number when the release happens.

eg: `# Feature Name (vMERMAID_RELEASE_VERSION+)`
eg: `# Feature Name (v<MERMAID_RELEASE_VERSION>+)`

We know it can sometimes be hard to code _and_ write user documentation.

Expand Down
13 changes: 12 additions & 1 deletion packages/mermaid/scripts/update-release-version.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* So contributors adding new features will only have to add the placeholder and not worry about updating the version number.
*
*/
import { writeFile } from 'fs/promises';
import { readFile, writeFile } from 'fs/promises';
import { posix } from 'path';
import {
getFilesFromGlobs,
Expand All @@ -18,7 +18,18 @@ import {
const verifyOnly: boolean = process.argv.includes('--verify');
const versionPlaceholder = '<MERMAID_RELEASE_VERSION>';

const verifyDocumentation = async () => {
const fileContent = await readFile('./src/docs/community/contributing.md', 'utf-8');
if (!fileContent.includes(versionPlaceholder)) {
console.error(
`The placeholder ${versionPlaceholder} is not present in the contributing.md file.`
);
process.exit(1);
}
};

const main = async () => {
await verifyDocumentation();
const sourceDirGlob = posix.join('.', SOURCE_DOCS_DIR, '**');
const mdFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.md')]);
mdFileGlobs.push('!**/community/contributing.md');
Expand Down
4 changes: 2 additions & 2 deletions packages/mermaid/src/docs/community/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ If the users have no way to know that things have changed, then you haven't real
Likewise, if users don't know that there is a new feature that you've implemented, it will forever remain unknown and unused.

The documentation has to be updated for users to know that things have been changed and added!
If you are adding a new feature, add `(vMERMAID_RELEASE_VERSION+)` in the title or description. It will be replaced automatically with the current version number when the release happens.
If you are adding a new feature, add `(v<MERMAID_RELEASE_VERSION>+)` in the title or description. It will be replaced automatically with the current version number when the release happens.

eg: `# Feature Name (vMERMAID_RELEASE_VERSION+)`
eg: `# Feature Name (v<MERMAID_RELEASE_VERSION>+)`

We know it can sometimes be hard to code _and_ write user documentation.

Expand Down

0 comments on commit 0bfb42c

Please sign in to comment.