ccommand 1.0.6 → 1.0.8
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install -g ccommand # 安装ccommand
|
|
|
18
18
|
- ccommand playground 选取当前目录下的playground文件夹下的package.json文件中的scripts中的命令
|
|
19
19
|
- ccommand playground -silent 支持额外的参数传参
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
https://user-images.githubusercontent.com/57086651/198498549-62ef8e48-291e-479e-800b-8b103d20bbdc.mov
|
|
22
22
|
|
|
23
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>
|
|
24
24
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var O=require("module"),y=require("child_process"),_=require("fs"),j=require("path"),i=require("simon-js-tool"),q=require("fast-glob");function l(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var d=l(y),g=l(_),m=l(j),S=l(q),P=require;const b=P("yamljs");async function w(){const n=process.argv.slice(2);if(n[0]==="-v"){const{version:r}=await i.getPkg();console.log(`ccommand Version: ${r}`);return}const[e,a]=x(n),t=i.getPkgTool(),o=await k();if(!o)return console.log("No scripts found");const c=[],f=Object.keys(o).reduce((r,s)=>{const u=o[s];return c.push(s),r+=`"${s}: ${u}",`,r},""),p=d.default.spawnSync(`echo ${f} | 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();d.default.spawnSync(v(),{shell:!0,stdio:"inherit"});function h(r){return c.find(s=>r.startsWith(s))}function v(){let r="",s="";const u=t!=="yarn";return t==="npm"?(s=a?` -- ${a}`:"",r=e?` --prefix ${e} `:" "):t==="pnpm"?(s=a?` ${a}`:"",r=e?` --filter ${e.slice(e.lastIndexOf("/")+1)} `:" "):t==="yarn"?(s=a?` ${a}`:"",r=e?` workspace ${e.slice(e.lastIndexOf("/")+1)} `:" "):t==="bun"&&(s=a?` ${a}`:"",r=""),`${t}${u?" run":" "}${r}${h(p)}${s}`}async function k(){if(console.log(e),!e||t==="bun"||t==="npm")return(await i.getPkg("./package.json"))?.scripts;if(t==="pnpm"){const r=await g.default.readFileSync(m.default.resolve(process.cwd(),"pnpm-workspace.yaml"),"utf-8"),s=b.parse(r)?.packages||[];return(await $(s))?.[e]||(await i.getPkg(`${e}/package.json`))?.scripts}else if(t==="yarn"){const r=await g.default.readFileSync(m.default.resolve(process.cwd(),"package.json"),"utf-8"),s=JSON.parse(r)?.workspaces||[];return(await $(s))?.[e]||(await i.getPkg(`${e}/package.json`))?.scripts}}}function x(n){const e=n[0];return e?e.startsWith("--")?[".",n.join(" ")]:[e,n.slice(1).join(" ")]:["",""]}async function $(n){if(!n.length)return;const e=await S.default(n.map(a=>`${a}/package.json`),{dot:!0,ignore:["**/node_modules/**"]});return Promise.all(e.map(async a=>{const t=await i.getPkg(a);if(!t)return;const{name:o,scripts:c}=t;return{name:o,scripts:c}})).then(a=>a.reduce((t,o)=>{const{name:c,scripts:f}=o;return t[c]=f,t},{}))}w(),exports.ccommand=w;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import{createRequire as y}from"module";import l from"child_process";import m from"fs";import d from"path";import{getPkg as p,getPkgTool as j}from"simon-js-tool";import v from"fast-glob";var S=y(import.meta.url);const x=S("yamljs");async function g(){const o=process.argv.slice(2);if(o[0]==="-v"){const{version:r}=await p();console.log(`ccommand Version: ${r}`);return}const[t,s]=b(o),e=j(),a=await h();if(!a)return console.log("No scripts found");const i=[],u=Object.keys(a).reduce((r,n)=>{const c=a[n];return i.push(n),r+=`"${n}: ${c}",`,r},""),f=l.spawnSync(`echo ${u} | sed "s/,/\\n/g" | gum filter | cut -d' ' -f1`,{shell:!0,stdio:["inherit","pipe","inherit"],encoding:"utf8"}).output[1];if(!f)return console.log("\u5DF2\u53D6\u6D88"),process.exit();l.spawnSync(k(),{shell:!0,stdio:"inherit"});function $(r){return i.find(n=>r.startsWith(n))}function k(){let r="",n="";const c=e!=="yarn";return e==="npm"?(n=s?` -- ${s}`:"",r=t?` --prefix ${t} `:" "):e==="pnpm"?(n=s?` ${s}`:"",r=t?` --filter ${t.slice(t.lastIndexOf("/")+1)} `:" "):e==="yarn"?(n=s?` ${s}`:"",r=t?` workspace ${t.slice(t.lastIndexOf("/")+1)} `:" "):e==="bun"&&(n=s?` ${s}`:"",r=""),`${e}${c?" run":" "}${r}${$(f)}${n}`}async function h(){if(console.log(t),!t||e==="bun"||e==="npm")return(await p("./package.json"))?.scripts;if(e==="pnpm"){const r=await m.readFileSync(d.resolve(process.cwd(),"pnpm-workspace.yaml"),"utf-8"),n=x.parse(r)?.packages||[];return(await w(n))?.[t]||(await p(`${t}/package.json`))?.scripts}else if(e==="yarn"){const r=await m.readFileSync(d.resolve(process.cwd(),"package.json"),"utf-8"),n=JSON.parse(r)?.workspaces||[];return(await w(n))?.[t]||(await p(`${t}/package.json`))?.scripts}}}function b(o){const t=o[0];return t?t.startsWith("--")?[".",o.join(" ")]:[t,o.slice(1).join(" ")]:["",""]}async function w(o){if(!o.length)return;const t=await v(o.map(s=>`${s}/package.json`),{dot:!0,ignore:["**/node_modules/**"]});return Promise.all(t.map(async s=>{const e=await p(s);if(!e)return;const{name:a,scripts:i}=e;return{name:a,scripts:i}})).then(s=>s.reduce((e,a)=>{const{name:i,scripts:u}=a;return e[i]=u,e},{}))}g();export{g as ccommand};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccommand",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"packageManager": "pnpm@6.32.3",
|
|
5
5
|
"description": "ccommand",
|
|
6
6
|
"author": "Simon He",
|
|
@@ -49,8 +49,10 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@vueuse/core": "^8.1.1",
|
|
52
|
+
"fast-glob": "^3.2.12",
|
|
52
53
|
"simon-js-tool": "^4.1.13",
|
|
53
|
-
"vue": "^3.2.36"
|
|
54
|
+
"vue": "^3.2.36",
|
|
55
|
+
"yamljs": "^0.3.0"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@antfu/eslint-config": "^0.26.1",
|