@nice-move/cli 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cmd/git-hooks.mjs +38 -0
- package/index.mjs +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import isGitRepo from 'is-git-repository';
|
|
3
|
+
|
|
4
|
+
export const command = 'git';
|
|
5
|
+
|
|
6
|
+
export const description = '';
|
|
7
|
+
|
|
8
|
+
export async function gitSupport() {
|
|
9
|
+
try {
|
|
10
|
+
const { stdout } = await execa('git', ['--version']);
|
|
11
|
+
|
|
12
|
+
return Boolean(stdout);
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function builder(cli) {
|
|
19
|
+
cli.command('hooks', 'Set .githooks as git.hooksPath', {}, () => {
|
|
20
|
+
gitSupport()
|
|
21
|
+
.then((support) => {
|
|
22
|
+
if (support && isGitRepo()) {
|
|
23
|
+
// eslint-disable-next-line promise/no-nesting
|
|
24
|
+
execa('git config core.hooksPath .githooks')
|
|
25
|
+
.then(() => {
|
|
26
|
+
console.log('Done: set .githooks');
|
|
27
|
+
})
|
|
28
|
+
.catch((error) => {
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
console.error('Error:', error.message);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.catch(() => {});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
cli.demandCommand(1, 'Typing `hooks`');
|
|
38
|
+
}
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-move/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Frontend develop helper for frontend development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@nice-move/lint": "^0.6.0",
|
|
38
38
|
"cheetor": "^0.13.0",
|
|
39
39
|
"execa": "^6.1.0",
|
|
40
|
+
"is-git-repository": "^2.0.0",
|
|
40
41
|
"settingz": "^0.2.0"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|