Add verification log

This commit is contained in:
Sidharth Vinod
2022-09-20 22:31:53 +05:30
parent 2ada935842
commit c343e4a1e3
5 changed files with 59 additions and 76 deletions

View File

@@ -660,14 +660,27 @@ It is also possible to attach a class to a list of nodes in one statement:
A shorter form of adding a class is to attach the classname to the node using the `:::` operator: A shorter form of adding a class is to attach the classname to the node using the `:::` operator:
```mmd ```mermaid-example
classDiagram
class Animal:::cssClass
```
```mermaid
classDiagram classDiagram
class Animal:::cssClass class Animal:::cssClass
``` ```
Or: Or:
```mmd ```mermaid-example
classDiagram
class Animal:::cssClass {
-int sizeInFeet
-canEat()
}
```
```mermaid
classDiagram classDiagram
class Animal:::cssClass { class Animal:::cssClass {
-int sizeInFeet -int sizeInFeet

View File

@@ -5,7 +5,7 @@
1. [How to add title to flowchart?](https://github.com/knsv/mermaid/issues/556#issuecomment-363182217) 1. [How to add title to flowchart?](https://github.com/knsv/mermaid/issues/556#issuecomment-363182217)
2. [How to specify custom CSS file?](https://github.com/mermaidjs/mermaid.cli/pull/24#issuecomment-373402785) 2. [How to specify custom CSS file?](https://github.com/mermaidjs/mermaid.cli/pull/24#issuecomment-373402785)
3. [How to fix tooltip misplacement issue?](https://github.com/knsv/mermaid/issues/542#issuecomment-3343564621) 3. [How to fix tooltip misplacement issue?](https://github.com/knsv/mermaid/issues/542#issuecomment-3343564621)
4. [How to specify gantt diagram x Axis format?](https://github.com/knsv/mermaid/issues/269#issuecomment-373229136) 4. [How to specify gantt diagram xAxis format?](https://github.com/knsv/mermaid/issues/269#issuecomment-373229136)
5. [How to bind an event?](https://github.com/knsv/mermaid/issues/372) 5. [How to bind an event?](https://github.com/knsv/mermaid/issues/372)
6. [How to add newline in the text?](https://github.com/knsv/mermaid/issues/384#issuecomment-281339381) 6. [How to add newline in the text?](https://github.com/knsv/mermaid/issues/384#issuecomment-281339381)
7. [How to have special characters in link text?](https://github.com/knsv/mermaid/issues/407#issuecomment-329944735) 7. [How to have special characters in link text?](https://github.com/knsv/mermaid/issues/407#issuecomment-329944735)

View File

@@ -393,44 +393,6 @@ Let see an example:
commit id:"C" commit id:"C"
``` ```
By default, the cherry-picked commit from commit with id `A` will be labeled `cherry-pick:A`. You can provide your own custom tag instead to override this behavior, using the same syntax as the `commit` keyword:
```mermaid-example
gitGraph
commit id: "ZERO"
branch develop
commit id:"A"
checkout main
commit id:"ONE"
checkout develop
commit id:"B"
checkout main
commit id:"TWO"
cherry-pick id:"A" tag:"fix"
commit id:"THREE"
checkout develop
commit id:"C"
```
```mermaid
gitGraph
commit id: "ZERO"
branch develop
commit id:"A"
checkout main
commit id:"ONE"
checkout develop
commit id:"B"
checkout main
commit id:"TWO"
cherry-pick id:"A" tag:"fix"
commit id:"THREE"
checkout develop
commit id:"C"
```
To suppress the tag entirely, use `tag:""` (empty string).
## Gitgraph specific configuration options ## Gitgraph specific configuration options
In Mermaid, you have the option to configure the gitgraph diagram. You can configure the following options: In Mermaid, you have the option to configure the gitgraph diagram. You can configure the following options:

View File

@@ -15,6 +15,7 @@
name="viewport" name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/> />
<!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> -->
<link rel="stylesheet" href="theme.css" /> <link rel="stylesheet" href="theme.css" />
<link <link
rel="stylesheet" rel="stylesheet"
@@ -146,6 +147,14 @@
if (isDarkMode) conf.theme = 'dark'; if (isDarkMode) conf.theme = 'dark';
mermaid.initialize(conf); mermaid.initialize(conf);
</script> </script>
<script>
window.onhashchange = function (a) {
//code
if (location) {
ga('send', 'pageview', location.hash);
}
};
</script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script> <script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script> <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script> <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script>

View File

@@ -1,11 +1,10 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
/** /**
* @file Transform documentation source files into files suitable for publishing * @file Transform documentation source files into files suitable for publishing and optionally copy
* and optionally copy the transformed files from the source directory to the * the transformed files from the source directory to the directory used for the final, published
* directory used for the final, published documentation directory. The list * documentation directory. The list of files transformed and copied to final documentation
* of files transformed and copied to final documentation directory are logged * directory are logged to the console. If a file in the source directory has the same contents in
* to the console. If a file in the source directory has the same contents in
* the final directory, nothing is done (the final directory is up-to-date). * the final directory, nothing is done (the final directory is up-to-date).
* @example * @example
* docs * docs
@@ -24,12 +23,12 @@
* If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully * If the --git option is used, the command `git add docs` will be run after all transformations (and/or verifications) have completed successfully
* If not files were transformed, the git command is not run. * If not files were transformed, the git command is not run.
* *
* @todo Ensure that the documentation source and final paths are correct by * @todo Ensure that the documentation source and final paths are correct by using process.cwd() to
* using process.cwd() to get their absolute paths. Ensures that the location * get their absolute paths. Ensures that the location of those 2 directories is not dependent on
* of those 2 directories is not dependent on where this file resides. * where this file resides.
* *
* @todo Write a test file for this. (Will need to be able to deal .mts file. * @todo Write a test file for this. (Will need to be able to deal .mts file. Jest has trouble with
* Jest has trouble with it.) * it.)
*/ */
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs'; import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
import { exec } from 'child_process'; import { exec } from 'child_process';
@@ -68,14 +67,13 @@ const prettierConfig: prettier.Config = {
let filesWereTransformed = false; let filesWereTransformed = false;
/** /**
* Given a source file name and path, return the documentation destination full * Given a source file name and path, return the documentation destination full path and file name
* path and file name Create the destination path if it does not already exist. * Create the destination path if it does not already exist.
* *
* @param {string} file - Name of the file (including full path) * @param {string} file - Name of the file (including full path)
* @returns {string} Name of the file with the path changed from the source * @returns {string} Name of the file with the path changed from the source directory to final
* directory to final documentation directory * documentation directory
* @todo Possible Improvement: combine with lint-staged to only copy files that * @todo Possible Improvement: combine with lint-staged to only copy files that have changed
* have changed
*/ */
const changeToFinalDocDir = (file: string): string => { const changeToFinalDocDir = (file: string): string => {
const newDir = file.replace(SOURCE_DOCS_DIR, FINAL_DOCS_DIR); const newDir = file.replace(SOURCE_DOCS_DIR, FINAL_DOCS_DIR);
@@ -84,8 +82,8 @@ const changeToFinalDocDir = (file: string): string => {
}; };
/** /**
* Log messages to the console showing if the transformed file copied to the * Log messages to the console showing if the transformed file copied to the final documentation
* final documentation directory or still needs to be copied. * directory or still needs to be copied.
* *
* @param {string} filename Name of the file that was transformed * @param {string} filename Name of the file that was transformed
* @param {boolean} wasCopied Whether or not the file was copied * @param {boolean} wasCopied Whether or not the file was copied
@@ -101,14 +99,13 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
}; };
/** /**
* If the file contents were transformed, set the _filesWereTransformed_ flag to * If the file contents were transformed, set the _filesWereTransformed_ flag to true and copy the
* true and copy the transformed contents to the final documentation directory * transformed contents to the final documentation directory if the doCopy flag is true. Log
* if the doCopy flag is true. Log messages to the console. * messages to the console.
* *
* @param {string} filename Name of the file that will be verified * @param {string} filename Name of the file that will be verified
* @param {boolean} [doCopy=false] Whether we should copy that * @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final
* transformedContents to the final documentation directory. Default is * documentation directory. Default is `false`. Default is `false`
* `false`. Default is `false`
* @param {string} [transformedContent] New contents for the file * @param {string} [transformedContent] New contents for the file
*/ */
const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => { const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => {
@@ -133,15 +130,14 @@ const readSyncedUTF8file = (filename: string): string => {
}; };
/** /**
* Transform a markdown file and write the transformed file to the directory for * Transform a markdown file and write the transformed file to the directory for published
* published documentation * documentation
* *
* 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the * 1. Add a `mermaid-example` block before every `mermaid` or `mmd` block On the docsify site (one
* docsify site (one place where the documentation is published), this will * place where the documentation is published), this will show the code used for the mermaid
* show the code used for the mermaid diagram * diagram
* 2. Add the text that says the file is automatically generated * 2. Add the text that says the file is automatically generated
* 3. Use prettier to format the file Verify that the file has been changed and * 3. Use prettier to format the file Verify that the file has been changed and write out the changes
* write out the changes
* *
* @param file {string} name of the file that will be verified * @param file {string} name of the file that will be verified
*/ */
@@ -168,11 +164,11 @@ const transformMarkdown = (file: string) => {
}; };
/** /**
* Transform an HTML file and write the transformed file to the directory for * Transform an HTML file and write the transformed file to the directory for published
* published documentation * documentation
* *
* - Add the text that says the file is automatically generated Verify that the * - Add the text that says the file is automatically generated Verify that the file has been changed
* file has been changed and write out the changes * and write out the changes
* *
* @param filename {string} name of the HTML file to transform * @param filename {string} name of the HTML file to transform
*/ */
@@ -204,6 +200,9 @@ const transformHtml = (filename: string) => {
/** Main method (entry point) */ /** Main method (entry point) */
(async () => { (async () => {
if (verifyOnly) {
console.log('Verifying that all files are in sync with the source files');
}
const sourceDirGlob = join('.', SOURCE_DOCS_DIR, '**'); const sourceDirGlob = join('.', SOURCE_DOCS_DIR, '**');
const includeFilesStartingWithDot = true; const includeFilesStartingWithDot = true;