husky
Advanced tools
Comparing version 5.0.0-alpha.0 to 5.0.0-alpha.1
@@ -7,5 +7,9 @@ "use strict"; | ||
exports.install = void 0; | ||
const os_1 = __importDefault(require("os")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
const child_process_1 = __importDefault(require("child_process")); | ||
function copyScript(scriptName, destDir) { | ||
fs_1.default.copyFileSync(path_1.default.join(__dirname, '../../scripts', scriptName), path_1.default.join(destDir, scriptName)); | ||
} | ||
function install({ cwd, pathToPackageDir = '.', }) { | ||
@@ -22,11 +26,15 @@ const absoluteHooksDir = path_1.default.resolve(cwd, pathToPackageDir); | ||
} | ||
const preCommitDir = path_1.default.join(__dirname, '../../scripts'); | ||
const preCommitFilename = path_1.default.join(preCommitDir, 'pre-commit'); | ||
fs_1.default.chmodSync(preCommitFilename, 0o0755); | ||
child_process_1.default.spawnSync('git', ['config', 'core.hooksPath', preCommitDir]); | ||
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'husky-')); | ||
copyScript('husky.sh', tmpDir); | ||
copyScript('pre-commit', tmpDir); | ||
fs_1.default.chmodSync(path_1.default.join(tmpDir, 'pre-commit'), 0o0755); | ||
child_process_1.default.spawnSync('git', ['config', 'core.hooksPath', tmpDir]); | ||
child_process_1.default.spawnSync('git', ['commit'], { | ||
stdio: 'inherit', | ||
env: { ...process.env, husky_dir: path_1.default.join(absoluteHooksDir, '.husky') }, | ||
env: { | ||
...process.env, | ||
husky_dir: path_1.default.join(absoluteHooksDir, '.husky'), | ||
}, | ||
}); | ||
} | ||
exports.install = install; |
{ | ||
"name": "husky", | ||
"version": "5.0.0-alpha.0", | ||
"version": "5.0.0-alpha.1", | ||
"description": "Git hooks made easy", | ||
@@ -39,2 +39,3 @@ "bin": "lib/bin.js", | ||
"postpack": "pinst --enable", | ||
"postversion": "git push --tags", | ||
"prepublish": "pinst --disable", | ||
@@ -41,0 +42,0 @@ "postpublish": "pinst --enable", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16459
129
2