ccommand 1.0.1 → 1.0.2

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
@@ -1,17 +1,27 @@
1
- ## ccommand
2
- 用命令选择需要执行的script, 支持直接选择子目录下的script来执行
3
-
4
-
5
- ## 安装
6
- ```bash
7
- npm i -g ccommand
8
- ```
9
-
10
- ## 使用
11
- - ccommand # 默认当前目录
12
-
13
- ![img](./assets/kv.jpg)
14
-
15
- - ccommand ./playground # 执行子目录 playground 下的 script
16
-
17
- ![img](./assets/kv1.jpg)
1
+ ## ccommand
2
+ 用命令选择需要执行的script, 支持直接选择子目录下的script来执行
3
+
4
+ ## feature
5
+ 兼容了yarn和npm的命令行工具
6
+
7
+ ## warning
8
+ 依赖 [gum](https://github.com/charmbracelet/gum), 需要全局安装gum才可生效
9
+
10
+ ## 安装gum
11
+ ```bash
12
+ npm i -g gum
13
+ ```
14
+
15
+ ## 安装
16
+ ```bash
17
+ npm i -g ccommand
18
+ ```
19
+
20
+ ## 使用
21
+ - ccommand # 默认当前目录
22
+
23
+ ![img](./assets/kv.jpg)
24
+
25
+ - ccommand ./playground # 执行子目录 playground 下的 script
26
+
27
+ ![img](./assets/kv1.jpg)
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var d=require("child_process"),p=require("fs"),h=require("path"),_=require("simon-js-tool");function r(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var c=r(d),o=r(p),v=r(h);async function u(){const e=process.argv[2]||".";let a=!1;try{o.default.accessSync(v.default.resolve(e,"./yarn.lock"),o.default.constants.F_OK),a=!0}catch{}const{scripts:s}=await _.getPkg(`${e}/package.json`),i=c.default.spawnSync(`gum choose ${Object.keys(s).reduce((t,n)=>{const f=s[n];return t+=`"${n}: ${f}" `,t},"")}`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];c.default.spawnSync(`${a?"yarn":"npm"} run ${l(i)} --prefix ${e}`,{shell:!0,stdio:"inherit"});function l(t){return t.slice(0,t.lastIndexOf(":"))}}u(),exports.ccommand=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var h=require("child_process"),_=require("fs"),a=require("simon-js-tool");function o(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var i=o(h),u=o(_);async function l(){const e=process.argv[2]||".";let s=!1;try{u.default.accessSync(a.getResolvedPath("./yarn.lock"),u.default.constants.F_OK),s=!0}catch{}const{scripts:n}=await a.getPkg(`${e}/package.json`),c=[],d=i.default.spawnSync(`gum choose ${Object.keys(n).reduce((t,r)=>{const p=n[r];return c.push(r),t+=`"${r}: ${p}" `,t},"")}`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];i.default.spawnSync(`${s?"yarn":"npm"} run ${f(d)} --prefix ${e}`,{shell:!0,stdio:"inherit"});function f(t){return c.find(r=>t.startsWith(r))}}l(),exports.ccommand=l;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import s from"child_process";import c from"fs";import u from"path";import{getPkg as f}from"simon-js-tool";async function i(){const t=process.argv[2]||".";let n=!1;try{c.accessSync(u.resolve(t,"./yarn.lock"),c.constants.F_OK),n=!0}catch{}const{scripts:e}=await f(`${t}/package.json`),a=s.spawnSync(`gum choose ${Object.keys(e).reduce((r,o)=>{const m=e[o];return r+=`"${o}: ${m}" `,r},"")}`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];s.spawnSync(`${n?"yarn":"npm"} run ${p(a)} --prefix ${t}`,{shell:!0,stdio:"inherit"});function p(r){return r.slice(0,r.lastIndexOf(":"))}}i();export{i as ccommand};
2
+ import o from"child_process";import i from"fs";import{getResolvedPath as f,getPkg as h}from"simon-js-tool";async function a(){const n=process.argv[2]||".";let s=!1;try{i.accessSync(f("./yarn.lock"),i.constants.F_OK),s=!0}catch{}const{scripts:e}=await h(`${n}/package.json`),c=[],p=o.spawnSync(`gum choose ${Object.keys(e).reduce((t,r)=>{const m=e[r];return c.push(r),t+=`"${r}: ${m}" `,t},"")}`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];o.spawnSync(`${s?"yarn":"npm"} run ${u(p)} --prefix ${n}`,{shell:!0,stdio:"inherit"});function u(t){return c.find(r=>t.startsWith(r))}}a();export{a as ccommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccommand",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "packageManager": "pnpm@6.32.3",
5
5
  "description": "ccommand",
6
6
  "author": "Simon He",
@@ -53,7 +53,7 @@
53
53
  "vue": "^3.2.36"
54
54
  },
55
55
  "devDependencies": {
56
- "@antfu/eslint-config": "^0.25.2",
56
+ "@antfu/eslint-config": "^0.26.1",
57
57
  "@types/node": "^17.0.38",
58
58
  "@vitejs/plugin-vue": "^3.0.1",
59
59
  "bumpp": "^7.1.1",
@@ -67,4 +67,4 @@
67
67
  "eslintConfig": {
68
68
  "extends": "@antfu"
69
69
  }
70
- }
70
+ }