create-app-setup
Version:
A CLI tool to quickly set up frontend & backend projects with various frameworks.
38 lines (37 loc) • 1.49 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.huskyConfig = void 0;
const cross_spawn_1 = __importDefault(require("cross-spawn"));
const executeCommand = (packageManager) => {
switch (packageManager?.toLocaleLowerCase()) {
case "pnpm":
return "pnpm exec husky init";
case "bun":
return "bunx husky init";
default:
return "npx husky init";
}
};
const huskyConfig = (props) => {
const { packageManager = "npm", destinationPath } = props;
(0, cross_spawn_1.default)("npx husky init", {
cwd: destinationPath,
stdio: "pipe",
shell: true,
});
// const { destinationPath, pkgJson, TEMPLATES_DIR, projectName } = props;
// const huskyFilePath = path.join(destinationPath, ".husky");
// const huskyTemplatePath = path.join(TEMPLATES_DIR, "husky");
// copyTemplate({ sourceDir: huskyTemplatePath, destinationDir: huskyFilePath });
// const packageJsonPath = path.resolve(pkgJson);
// const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
// packageJson.scripts = {
// ...packageJson.scripts,
// husky: "prepare",
// };
// gitignoreConfig({ path: `${projectName}/.husky/_/gitignore` });
};
exports.huskyConfig = huskyConfig;
;