mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Add files only when running from lint-staged
This commit is contained in:
parent
0caf372685
commit
85dc16df0a
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"src/docs/**": ["yarn docs:build"],
|
"src/docs/**": ["GIT=true yarn docs:build"],
|
||||||
"*.{ts,js,json,html,md}": ["eslint --fix", "prettier --write"]
|
"*.{ts,js,json,html,md}": ["eslint --fix", "prettier --write"]
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import { exec } from 'child_process';
|
|||||||
import prettier from 'prettier';
|
import prettier from 'prettier';
|
||||||
|
|
||||||
const verify = process.argv.includes('--verify');
|
const verify = process.argv.includes('--verify');
|
||||||
|
const git = process.env.GIT === 'true';
|
||||||
let fileChanged = false;
|
let fileChanged = false;
|
||||||
// Possible Improvement: combine with lint-staged to only copy files that have changed
|
// Possible Improvement: combine with lint-staged to only copy files that have changed
|
||||||
const prepareOutFile = (file: string): string => {
|
const prepareOutFile = (file: string): string => {
|
||||||
@ -76,6 +77,8 @@ const transform = (file: string) => {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
console.log('Adding changes in docs folder to git');
|
console.log('Adding changes in docs folder to git');
|
||||||
exec('git add docs');
|
if (git) {
|
||||||
|
exec('git add docs');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user