ccommand 1.0.2 → 1.0.4

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,27 +1,26 @@
1
- ## ccommand
2
- 用命令选择需要执行的script, 支持直接选择子目录下的script来执行
1
+ <span><div align="center">![kv](/assets/kv.png)</div></span>
3
2
 
4
- ## feature
5
- 兼容了yarn和npm的命令行工具
3
+ 高效的执行命令行工具 | Efficient execution of command-line tools
6
4
 
7
- ## warning
8
- 依赖 [gum](https://github.com/charmbracelet/gum), 需要全局安装gum才可生效
5
+ ## 介绍 | Introduction
6
+ 支持yarn、pnpm、npm、bun
9
7
 
10
- ## 安装gum
8
+ ## 依赖 | Dependencies
9
+ - 需要安装[gum](https://github.com/charmbracelet/gum#installation)
10
+ # 安装 | Install
11
11
  ```bash
12
- npm i -g gum
12
+ brew install gum # 安装gum
13
+ npm install -g ccommand # 安装ccommand
13
14
  ```
14
15
 
15
- ## 安装
16
- ```bash
17
- npm i -g ccommand
18
- ```
19
-
20
- ## 使用
21
- - ccommand # 默认当前目录
16
+ # 使用 | Usage
17
+ - ccommand 选取当前目录下的package.json文件中的scripts中的命令
18
+ - ccommand playground 选取当前目录下的playground文件夹下的package.json文件中的scripts中的命令
19
+ - ccommand playground -silent 支持额外的参数传参
22
20
 
23
- ![img](./assets/kv.jpg)
21
+ ![img](/assets/show.gif)
24
22
 
25
- - ccommand ./playground # 执行子目录 playground 下的 script
23
+ <a href="https://github.com/Simon-He95/sponsor" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" style="height: 51px !important;width: 217px !important;" ></a>
26
24
 
27
- ![img](./assets/kv1.jpg)
25
+ ## License
26
+ [MIT](./LICENSE) License © 2022 [Simon He](https://github.com/Simon-He95)
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare function ccommand(): Promise<void>;
1
+ declare function ccommand(): Promise<undefined>;
2
2
 
3
3
  export { ccommand };
package/dist/index.js CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("child_process"),l=require("simon-js-tool");function h(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var f=h(g);async function p(){const t=process.argv.slice(2),[e,s]=v(t),i=l.getPkgTool(),{scripts:c}=await l.getPkg(`${e||"."}/package.json`),u=[],d=Object.keys(c).reduce((r,n)=>{const o=c[n];return u.push(n),r+=`"${n}: ${o}",`,r},""),a=f.default.spawnSync(`echo ${d} | sed "s/,/\\n/g" | gum filter | cut -d' ' -f1`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];if(!a)return console.log("\u5DF2\u53D6\u6D88"),process.exit();f.default.spawnSync($(),{shell:!0,stdio:"inherit"});function m(r){return u.find(n=>r.startsWith(n))}function $(){let r="",n="";const o=i==="npm"||i==="pnpm";return i==="npm"?(n=s?` -- ${s}`:"",r=e?` --prefix ${e} `:" "):i==="pnpm"?(n=s?` ${s}`:"",r=e?` --filter ${e} `:" "):(n=s?` ${s}`:"",r=e?` workspace ${e} `:" "),`${i}${o?" run":" "}${r}${m(a)}${n}`}}function v(t){const e=t[0];return e?e.startsWith("--")?[".",t.join(" ")]:[e,t.slice(1).join(" ")]:["",""]}p(),exports.ccommand=p;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
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};
2
+ import f from"child_process";import{getPkgTool as g,getPkg as d}from"simon-js-tool";async function a(){const s=process.argv.slice(2),[t,r]=h(s),i=g(),{scripts:c}=await d(`${t||"."}/package.json`),u=[],l=Object.keys(c).reduce((e,n)=>{const o=c[n];return u.push(n),e+=`"${n}: ${o}",`,e},""),p=f.spawnSync(`echo ${l} | sed "s/,/\\n/g" | gum filter | cut -d' ' -f1`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];if(!p)return console.log("\u5DF2\u53D6\u6D88"),process.exit();f.spawnSync($(),{shell:!0,stdio:"inherit"});function m(e){return u.find(n=>e.startsWith(n))}function $(){let e="",n="";const o=i==="npm"||i==="pnpm";return i==="npm"?(n=r?` -- ${r}`:"",e=t?` --prefix ${t} `:" "):i==="pnpm"?(n=r?` ${r}`:"",e=t?` --filter ${t} `:" "):(n=r?` ${r}`:"",e=t?` workspace ${t} `:" "),`${i}${o?" run":" "}${e}${m(p)}${n}`}}function h(s){const t=s[0];return t?t.startsWith("--")?[".",s.join(" ")]:[t,s.slice(1).join(" ")]:["",""]}a();export{a as ccommand};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccommand",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "packageManager": "pnpm@6.32.3",
5
5
  "description": "ccommand",
6
6
  "author": "Simon He",
@@ -49,12 +49,12 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@vueuse/core": "^8.1.1",
52
- "simon-js-tool": "^4.0.23",
52
+ "simon-js-tool": "^4.1.12",
53
53
  "vue": "^3.2.36"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@antfu/eslint-config": "^0.26.1",
57
- "@types/node": "^17.0.38",
57
+ "@types/node": "^17.0.45",
58
58
  "@vitejs/plugin-vue": "^3.0.1",
59
59
  "bumpp": "^7.1.1",
60
60
  "eslint": "^8.16.0",
@@ -67,4 +67,4 @@
67
67
  "eslintConfig": {
68
68
  "extends": "@antfu"
69
69
  }
70
- }
70
+ }