@nice-move/cli 0.5.31 → 0.6.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/README.md CHANGED
@@ -26,20 +26,6 @@ npx --no-install nice-move <command>
26
26
 
27
27
  ## Commands
28
28
 
29
- ### init
30
-
31
- Initialize your frontend workspaces.
32
-
33
- - Confirm when workspace not empty or repository not clean
34
- - Run `git init` when workspace not a git project
35
- - Run a better `npm init` / `yarn init` command when needed
36
- - Create or overwrite `.gitignore` / `.gitattributes`
37
- - Create or overwrite `LICENSE` / `.editorconfig`
38
- - Create `README.md` when it not exists
39
- - Set registry to China mirror in `.npmrc` / `.yarnrc`
40
- - Add or reset project dependencies by interactive
41
- - Run `npm` / `yarn` install command
42
-
43
29
  ### lint
44
30
 
45
31
  Lint and format everything.
@@ -1,32 +1,20 @@
1
- 'use strict';
1
+ import { createRequire } from 'module';
2
2
 
3
- function isModuleInstall(moduleId) {
4
- try {
5
- require.resolve(moduleId);
6
- return true;
7
- } catch (error) {
8
- if (
9
- error.code === 'MODULE_NOT_FOUND' &&
10
- error.requireStack &&
11
- error.requireStack[0] === __filename
12
- ) {
13
- return false;
14
- }
15
- throw error;
16
- }
17
- }
3
+ import { execa } from 'execa';
4
+ import { isReachable } from 'settingz';
18
5
 
19
6
  // eslint-disable-next-line consistent-return
20
- module.exports = function svgoCaller() {
7
+ export function svgoCaller() {
21
8
  if (
22
- isModuleInstall('svgo/package.json') &&
23
- isModuleInstall('svgo-config/package.json')
9
+ isReachable('svgo/package.json') &&
10
+ isReachable('svgo-config/package.json')
24
11
  ) {
25
12
  return {
26
13
  command: 'svgo',
27
14
  describe: 'Run `svgo` to optimize `*.svg`',
28
15
  handler({ _: [_, path = './'] }) {
29
- const execa = require('execa');
16
+ const require = createRequire(import.meta.url);
17
+
30
18
  execa('svgo', [
31
19
  '-r',
32
20
  '-q',
@@ -34,7 +22,7 @@ module.exports = function svgoCaller() {
34
22
  '--indent',
35
23
  '2',
36
24
  '--config',
37
- 'node_modules/svgo-config/config.json',
25
+ require.resolve('svgo-config'),
38
26
  '-f',
39
27
  path,
40
28
  ])
@@ -48,4 +36,4 @@ module.exports = function svgoCaller() {
48
36
  },
49
37
  };
50
38
  }
51
- };
39
+ }
package/index.mjs CHANGED
@@ -2,13 +2,12 @@
2
2
 
3
3
  import { Cheetor } from 'cheetor';
4
4
 
5
- import svgoCaller from './cmd/svgo.cjs';
5
+ import { svgoCaller } from './cmd/svgo.mjs';
6
6
 
7
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
- .commandFrom('../cmd/init.mjs')
12
11
  .commandFrom('../cmd/lint.mjs')
13
12
  .commandSmart(svgoCaller)
14
13
  .setup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-move/cli",
3
- "version": "0.5.31",
3
+ "version": "0.6.1",
4
4
  "description": "Frontend develop helper for frontend development",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -34,13 +34,13 @@
34
34
  "nice-move": "index.mjs"
35
35
  },
36
36
  "dependencies": {
37
- "@nice-move/init": "^0.3.8",
38
- "@nice-move/lint": "^0.3.3",
39
- "cheetor": "^0.12.1",
40
- "execa": "^5.1.1"
37
+ "@nice-move/lint": "^0.3.5",
38
+ "cheetor": "^0.12.2",
39
+ "execa": "^6.0.0",
40
+ "settingz": "^0.1.5"
41
41
  },
42
42
  "engines": {
43
- "node": "^12.22.0 || ^14.17.0 || ^16.13.0"
43
+ "node": "^12.22.0 || ^14.17.0 || >=16.13.0"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",
package/cmd/init.mjs DELETED
@@ -1,11 +0,0 @@
1
- import { createRequire } from 'module';
2
-
3
- const requireJson = createRequire(import.meta.url);
4
-
5
- const { description } = requireJson('@nice-move/init/package.json');
6
-
7
- export const command = 'init';
8
-
9
- export const describe = description;
10
-
11
- export { init as handler } from '@nice-move/init';