From c95e997f8ff42fdd18987bf93b5e126b9facc4eb Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 17:31:37 +0530 Subject: [PATCH 1/2] fix: Revert accidental change of MERMAID_RELEASE_VERSION --- docs/community/contributing.md | 4 ++-- packages/mermaid/scripts/update-release-version.mts | 10 +++++----- packages/mermaid/src/docs/community/contributing.md | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/community/contributing.md b/docs/community/contributing.md index c78a3cb40..9f0bbfb49 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -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 `(v10.8.0+)` 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 `(vMERMAID_RELEASE_VERSION+)` in the title or description. It will be replaced automatically with the current version number when the release happens. -eg: `# Feature Name (v10.8.0+)` +eg: `# Feature Name (vMERMAID_RELEASE_VERSION+)` We know it can sometimes be hard to code _and_ write user documentation. diff --git a/packages/mermaid/scripts/update-release-version.mts b/packages/mermaid/scripts/update-release-version.mts index a5943b37b..970bef1d3 100644 --- a/packages/mermaid/scripts/update-release-version.mts +++ b/packages/mermaid/scripts/update-release-version.mts @@ -5,15 +5,15 @@ * 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 { posix } from 'path'; import { - getGlobs, getFilesFromGlobs, - SOURCE_DOCS_DIR, - readSyncedUTF8file, + getGlobs, MERMAID_RELEASE_VERSION, + readSyncedUTF8file, + SOURCE_DOCS_DIR, } from './docs.mjs'; -import { writeFile } from 'fs/promises'; const verifyOnly: boolean = process.argv.includes('--verify'); const versionPlaceholder = ''; @@ -21,7 +21,7 @@ const versionPlaceholder = ''; const main = async () => { const sourceDirGlob = posix.join('.', SOURCE_DOCS_DIR, '**'); const mdFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.md')]); - mdFileGlobs.push('!**/community/development.md', '!**/community/code.md'); + mdFileGlobs.push('!**/community/contributing.md'); const mdFiles = await getFilesFromGlobs(mdFileGlobs); mdFiles.sort(); const mdFilesWithPlaceholder: string[] = []; diff --git a/packages/mermaid/src/docs/community/contributing.md b/packages/mermaid/src/docs/community/contributing.md index 71048d095..1521c7ace 100644 --- a/packages/mermaid/src/docs/community/contributing.md +++ b/packages/mermaid/src/docs/community/contributing.md @@ -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 `(v10.8.0+)` 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 `(vMERMAID_RELEASE_VERSION+)` in the title or description. It will be replaced automatically with the current version number when the release happens. -eg: `# Feature Name (v10.8.0+)` +eg: `# Feature Name (vMERMAID_RELEASE_VERSION+)` We know it can sometimes be hard to code _and_ write user documentation. From 0bfb42c68f27862455407ae9566b3711caf62c7e Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 17:57:36 +0530 Subject: [PATCH 2/2] feat: Add verification script for MERMAID_RELEASE_VERSION --- docs/community/contributing.md | 4 ++-- packages/mermaid/scripts/update-release-version.mts | 13 ++++++++++++- packages/mermaid/src/docs/community/contributing.md | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/community/contributing.md b/docs/community/contributing.md index 9f0bbfb49..792c90a98 100644 --- a/docs/community/contributing.md +++ b/docs/community/contributing.md @@ -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+)` 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+)` We know it can sometimes be hard to code _and_ write user documentation. diff --git a/packages/mermaid/scripts/update-release-version.mts b/packages/mermaid/scripts/update-release-version.mts index 970bef1d3..0459d3444 100644 --- a/packages/mermaid/scripts/update-release-version.mts +++ b/packages/mermaid/scripts/update-release-version.mts @@ -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, @@ -18,7 +18,18 @@ import { const verifyOnly: boolean = process.argv.includes('--verify'); const versionPlaceholder = ''; +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'); diff --git a/packages/mermaid/src/docs/community/contributing.md b/packages/mermaid/src/docs/community/contributing.md index 1521c7ace..4cd649563 100644 --- a/packages/mermaid/src/docs/community/contributing.md +++ b/packages/mermaid/src/docs/community/contributing.md @@ -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+)` 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+)` We know it can sometimes be hard to code _and_ write user documentation.