@nice-move/cli 0.7.1 → 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.
@@ -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
@@ -8,8 +8,7 @@ process.on('SIGINT', () => {});
8
8
 
9
9
  new Cheetor('./package.json', import.meta.url)
10
10
  .website('https://www.npmjs.com/org/nice-move')
11
- .commandSafe('@nice-move/lint/cmd/commit.mjs')
12
- .commandSafe('@nice-move/lint/cmd/staged.mjs')
13
- .commandSafe('@nice-move/lint/cmd/all.mjs')
11
+ .commandSafe('@nice-move/lint/dist/index.mjs')
12
+ .commandSafe('../cmd/git-hooks.mjs')
14
13
  .commandSmart(svgoCaller)
15
14
  .setup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-move/cli",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "Frontend develop helper for frontend development",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -34,13 +34,14 @@
34
34
  "nice-move": "index.mjs"
35
35
  },
36
36
  "dependencies": {
37
- "@nice-move/lint": "^0.4.1",
38
- "cheetor": "^0.12.5",
37
+ "@nice-move/lint": "^0.6.0",
38
+ "cheetor": "^0.13.0",
39
39
  "execa": "^6.1.0",
40
- "settingz": "^0.1.7"
40
+ "is-git-repository": "^2.0.0",
41
+ "settingz": "^0.2.0"
41
42
  },
42
43
  "engines": {
43
- "node": "^14.17.0 || >=16.13.0"
44
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public",