mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
27 lines
657 B
JavaScript
27 lines
657 B
JavaScript
const escape = require("shell-quote").quote;
|
|
|
|
module.exports = {
|
|
"*.{json,css,md}": escapeFileNames([
|
|
"prettier --write --with-node-modules",
|
|
"git add",
|
|
]),
|
|
"*.{js,ts}": escapeFileNames([
|
|
"eslint --fix",
|
|
"prettier --write --with-node-modules",
|
|
"git add",
|
|
]),
|
|
};
|
|
|
|
function escapeFileNames(commands) {
|
|
return (filenames) => {
|
|
const allFiles = filenames.join(" ");
|
|
const allFilesEscaped = filenames
|
|
.map((filename) => `"${escape([filename]).replace(/\\@/g, "@")}"`)
|
|
.join(" ");
|
|
return commands.map(
|
|
(command) =>
|
|
`${command} ${command === "eslint" ? allFiles : allFilesEscaped}`
|
|
);
|
|
};
|
|
}
|