chore: git add formatted files
This commit is contained in:
parent
df9dda16a0
commit
d3e7173aff
|
|
@ -3,6 +3,8 @@ const sgf = require('staged-git-files');
|
|||
const path = require('path');
|
||||
const sortByHeading = require('./sortByHeading');
|
||||
const chineseFormat = require('./chineseFormat');
|
||||
const util = require('util');
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
/**
|
||||
* Processors are objects contains two methods:
|
||||
|
|
@ -104,7 +106,8 @@ const buildStagedList = async () => {
|
|||
processor.rules(fileList).map(async (e) => {
|
||||
let formatted = await file.readFile(e.path);
|
||||
formatted = await processor.handler(formatted);
|
||||
return file.writeFile(e.path, formatted);
|
||||
await file.writeFile(e.path, formatted);
|
||||
await exec(`git add ${e.path}`);
|
||||
})
|
||||
).catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
|||
Loading…
Reference in New Issue