mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-09 10:36:43 +02:00
Prettier
This commit is contained in:
@@ -6,6 +6,7 @@ import flatmap from 'unist-util-flatmap';
|
||||
import { globby } from 'globby';
|
||||
import { join, dirname } from 'path';
|
||||
import { exec } from 'child_process';
|
||||
import prettier from 'prettier';
|
||||
|
||||
const verify = process.argv.includes('--verify');
|
||||
let fileChanged = false;
|
||||
@@ -47,7 +48,10 @@ const transform = (file: string) => {
|
||||
const transformed = `# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT. Please edit corresponding file in src/docs.\n${remark.stringify(
|
||||
out
|
||||
)}`;
|
||||
verifyAndCopy(file, transformed);
|
||||
verifyAndCopy(
|
||||
file,
|
||||
prettier.format(transformed, { parser: 'markdown', printWidth: 100, singleQuote: true })
|
||||
);
|
||||
};
|
||||
|
||||
(async () => {
|
||||
@@ -64,7 +68,7 @@ const transform = (file: string) => {
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Committing changes to the docs folder');
|
||||
console.log('Adding changes in docs folder to git');
|
||||
exec('git add docs');
|
||||
}
|
||||
})();
|
||||
|
Reference in New Issue
Block a user