@justanarthur/just-github-actions-n-workflows-cli 0.0.0-beta.16 → 0.0.0-beta.17
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var d={name:"@justanarthur/just-github-actions-n-workflows-cli",version:"0.0.0-beta.
|
|
1
|
+
var d={name:"@justanarthur/just-github-actions-n-workflows-cli",version:"0.0.0-beta.17",description:"Release automation toolkit — version bumping, npm publishing, docker publishing, VPS deployment via GitHub Actions composite actions",type:"module",bin:{"just-github-actions-n-workflows":"./bin/run.js"},scripts:{build:"bun build src/commands/init.ts src/commands/update.ts src/commands/status.ts --outdir dist/commands --target node --format esm --splitting --minify --sourcemap=none --external @oclif/core --external @inquirer/prompts"},files:["bin/**/*.js","dist/**/*.js","package.json","README.md"],publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/justAnArthur/just-github-actions-n-workflows"},dependencies:{"@oclif/core":"^4","@inquirer/prompts":"^7"},oclif:{commands:"./dist/commands",default:"init"},properties:{gitCommitScopeRelatedNames:"cli"}};var j={name:"@justanarthur/just-github-actions-n-workflows",version:"0.0.0-beta.6",private:!0,type:"module",workspaces:["lib","actions/*","cli"],scripts:{build:"bun run build.ts",test:"bun test --recursive actions/ lib/ cli/"},devDependencies:{"@types/bun":"latest"},repository:{type:"git",url:"https://github.com/justAnArthur/just-github-actions-n-workflows"},properties:{gitCommitScopeRelatedNames:"toolkit,workflows"}};var o=d.repository.url.replace(/^https?:\/\/github\.com\//,"").replace(/\.git$/,""),v=`https://api.github.com/repos/${o}`,q=`https://raw.githubusercontent.com/${o}`,t=`${j.name}@`;function y(s){let b=s.split(`
|
|
2
2
|
`),p="",u=[],i=!1;for(let m of b){if(m.startsWith("# ---")){if(i)break;i=!0;continue}if(!i)continue;if(!m.startsWith("#"))break;let a=m.replace(/^#\s?/,"").trim();if(/^required secrets:/i.test(a))continue;if(/^\w+\s+[—–]/.test(a)){u.push(a);continue}if(!p&&a&&!/^copy this|^can also|^actions used|^paste this|^this one/i.test(a))p=a}return{description:p,secrets:u}}async function D(){let s=`${v}/tags?per_page=100`,b=await fetch(s,{headers:{Accept:"application/vnd.github.v3+json"}});if(!b.ok)return[];return(await b.json()).map((u)=>u.name).filter((u)=>u.startsWith(t)).map((u)=>({tag:u,version:u.slice(t.length)}))}async function $(){let s=await D();return s.length>0?s[0].tag:"main"}async function w(s){let b=`${v}/contents/workflows?ref=${s}`,p=await fetch(b,{headers:{Accept:"application/vnd.github.v3+json"}});if(!p.ok)throw Error(`failed to list workflows from ${o} @ ${s} (${p.status})`);return(await p.json()).filter((i)=>i.type==="file"&&i.name.endsWith(".yml")).map((i)=>({name:i.name.replace(/\.yml$/,""),file:i.name}))}async function C(s,b){let p=`${q}/${b}/workflows/${s}`,u=await fetch(p);if(!u.ok)throw Error(`failed to fetch workflows/${s} from ${o} @ ${b} (${u.status})`);return await u.text()}async function G(s,b){let p=[];for(let u of s)try{let i=await C(u.file,b),{description:m,secrets:a}=y(i);p.push({...u,description:m,secrets:a})}catch{p.push(u)}return p}import{existsSync as N,readFileSync as V,writeFileSync as z}from"node:fs";import{join as J}from"node:path";var M=".toolkit-lock.json";function c(){return J(process.cwd(),".github","workflows",M)}function L(){let s=c();if(!N(s))return null;try{let b=V(s,"utf-8");return JSON.parse(b)}catch{return null}}function X(s){let b=c();z(b,JSON.stringify(s,null,2)+`
|
|
3
3
|
`,"utf-8")}function A(s,b,p){let u=new Date().toISOString(),i=s??{ref:b,installedAt:u,workflows:{}};i.ref=b,i.installedAt=u;for(let m of p)i.workflows[m.file]={name:m.name,file:m.file,ref:b,installedAt:u};return i}function B(s,b){let u=`# toolkit-ref: ${b}`;if(s.includes("# toolkit-ref:"))return s.replace(/^# toolkit-ref:.*$/m,u);let i=s.split(`
|
|
4
4
|
`),m=i.findIndex((a)=>a.trim()!==""&&!a.startsWith("#"));if(m>=0)i.splice(m,0,u);else i.push(u);return i.join(`
|
package/dist/commands/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Z,b as T,d as _,e as D,f as $,g as E,h as I,i as N,j as O}from"./init-
|
|
1
|
+
import{a as Z,b as T,d as _,e as D,f as $,g as E,h as I,i as N,j as O}from"./init-b9qszdtt.js";import{Args as C,Command as R,Flags as Y,ux as z}from"@oclif/core";import{checkbox as y,select as j}from"@inquirer/prompts";import{existsSync as F,mkdirSync as L,writeFileSync as P}from"node:fs";import{join as A}from"node:path";class q extends R{static description="Scaffold workflow files into .github/workflows/ of the current repo";static examples=["<%= config.bin %> init","<%= config.bin %> init bump-version","<%= config.bin %> init --ref v1.0.0","<%= config.bin %> init --list","<%= config.bin %> init --yes --force"];static args={workflows:C.string({description:"Specific workflow names to install (space-separated)",required:!1})};static strict=!1;static flags={list:Y.boolean({char:"l",description:"Show available workflows",default:!1}),force:Y.boolean({char:"f",description:"Overwrite existing workflow files",default:!1}),yes:Y.boolean({char:"y",description:"Skip interactive prompts, install all workflows",default:!1}),ref:Y.string({description:"Git ref to fetch from (branch, tag, or sha)",default:"main"})};async run(){let{argv:K,flags:H}=await this.parse(q),B=K;if(H.list){await this.listWorkflows(H.ref);return}this.log(),this.log(z.colorize("bold"," just-github-actions-n-workflows")),this.log(z.colorize("dim",` release automation toolkit
|
|
2
2
|
`));let G=await this.resolveRef(H,B),M=await this.selectWorkflows(G,H,B);if(M.length===0){this.log(z.colorize("yellow",`
|
|
3
3
|
no workflows selected — nothing to do.
|
|
4
4
|
`));return}let{created:J,skipped:U}=await this.installWorkflows(M,G,H);this.log(`
|
|
@@ -7,7 +7,7 @@ import{a as Z,b as T,d as _,e as D,f as $,g as E,h as I,i as N,j as O}from"./ini
|
|
|
7
7
|
`));let B=await T();if(B.length===0)return"main";let G=[{name:`main ${z.colorize("dim","(latest)")}`,value:"main"},...B.slice(0,9).map((J)=>({name:`${J.version} ${z.colorize("dim",`(${J.tag})`)}`,value:J.tag}))],M=await j({message:"Pick a version",choices:G,default:"main"});return this.log(z.colorize("green",`
|
|
8
8
|
→ using ${M}
|
|
9
9
|
`)),M}async selectWorkflows(K,H,B){let G=await _(K);if(G=await $(G,K),B.length>0)return B.map((J)=>{let U=J.replace(/\.yml$/,""),Q=G.find((V)=>V.name===U);if(!Q)this.error(`Unknown workflow "${J}". Available: ${G.map((V)=>V.name).join(", ")}`);return Q});if(H.yes)return G;this.log(z.colorize("bold",` step 2 — select workflows
|
|
10
|
-
`));let M=await y({message:"Select workflows to install",choices:G.map((J)=>{let U=J.secrets?.map((V)=>V.split(/\s+[—–]\s*/)[0]).join(", "),Q=[J.description,U?`requires: ${U}`:null].filter(Boolean).join(" · ");return{name:`${J.name.padEnd(26)} ${z.colorize("dim",Q||J.file)}`,value:J.name,checked:!
|
|
10
|
+
`));let M=await y({message:"Select workflows to install",choices:G.map((J)=>{let U=J.secrets?.map((V)=>V.split(/\s+[—–]\s*/)[0]).join(", "),Q=[J.description,U?`requires: ${U}`:null].filter(Boolean).join(" · ");return{name:`${J.name.padEnd(26)} ${z.colorize("dim",Q||J.file)}`,value:J.name,checked:!1}})});return G.filter((J)=>M.includes(J.name))}async installWorkflows(K,H,B){let G=A(process.cwd(),".github","workflows");if(L(G,{recursive:!0}),!B.yes)this.log(z.colorize("bold",` step 3 — install
|
|
11
11
|
`));this.log(z.colorize("dim",` fetching from ${Z} @ ${H}
|
|
12
12
|
`));let M=0,J=0,U=[];for(let Q of K){let V=A(G,Q.file);if(!B.force&&F(V)){this.log(` ${z.colorize("yellow","skip")} ${Q.file} ${z.colorize("dim","(already exists, use --force)")}`),J++;continue}try{let X=await D(Q.file,H);X=O(X,H),P(V,X,"utf-8"),this.log(` ${z.colorize("green","create")} .github/workflows/${Q.file}`),U.push({name:Q.name,file:Q.file}),M++}catch(X){this.log(` ${z.colorize("red","error")} ${Q.file}: ${X.message}`)}}if(U.length>0){let Q=E(),V=N(Q,H,U);I(V),this.log(z.colorize("dim",`
|
|
13
13
|
lock file written → .github/workflows/.toolkit-lock.json`))}return{created:M,skipped:J}}printSecretsReminder(K){let H=new Map;for(let B of K)for(let G of B.secrets||[]){let[M,...J]=G.split(/\s+[—–]\s*/);if(M&&!H.has(M.trim()))H.set(M.trim(),J.join(" — ").trim())}if(H.size===0)return;this.log(z.colorize("bold",` required secrets:
|
package/dist/commands/status.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as n,g as c}from"./init-
|
|
1
|
+
import{c as n,g as c}from"./init-b9qszdtt.js";import{Command as h,Flags as u,ux as e}from"@oclif/core";class i extends h{static description="Show the status of installed workflows";static examples=["<%= config.bin %> status","<%= config.bin %> status --ref v2.0.0"];static flags={ref:u.string({description:"Compare against this ref instead of the latest tag"})};async run(){let{flags:d}=await this.parse(i),t=c();if(!t||Object.keys(t.workflows).length===0){this.log(e.colorize("yellow","\n no workflows installed — run `init` first.\n"));return}let s=d.ref??await n(),a=Object.values(t.workflows);this.log(),this.log(e.colorize("bold"," installed workflows")),this.log(e.colorize("dim",` latest: ${s}
|
|
2
2
|
`));let r=0;for(let o of a){let l=o.ref===s,f=l?e.colorize("green","✓"):e.colorize("yellow","⬆"),g=l?e.colorize("green",o.ref):`${e.colorize("yellow",o.ref)} → ${e.colorize("green",s)}`,w=e.colorize("dim",new Date(o.installedAt).toLocaleDateString());if(this.log(` ${f} ${e.colorize("cyan",o.name.padEnd(28))} ${g.padEnd(50)} ${w}`),!l)r++}if(this.log(),r>0)this.log(e.colorize("yellow",` ${r} workflow(s) can be updated — run \`update\` to upgrade.
|
|
3
3
|
`));else this.log(e.colorize("green",` all ${a.length} workflow(s) are up to date.
|
|
4
4
|
`))}}export{i as default};
|
package/dist/commands/update.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as m,c as u,e as w,g as k,h as $,i as y,j as z}from"./init-
|
|
1
|
+
import{a as m,c as u,e as w,g as k,h as $,i as y,j as z}from"./init-b9qszdtt.js";import{Command as j,Flags as p,ux as o}from"@oclif/core";import{confirm as E}from"@inquirer/prompts";import{writeFileSync as x}from"node:fs";import{join as h}from"node:path";class c extends j{static description="Update installed workflows to a newer version";static examples=["<%= config.bin %> update","<%= config.bin %> update --ref v2.0.0","<%= config.bin %> update --yes"];static flags={ref:p.string({description:"Target git ref to update to (branch, tag, or sha)"}),yes:p.boolean({char:"y",description:"Skip confirmation prompt",default:!1})};async run(){let{flags:a}=await this.parse(c),i=k();if(!i||Object.keys(i.workflows).length===0)this.error("No .toolkit-lock.json found. Run `init` first to install workflows.",{exit:1});let t=a.ref??await u(),l=Object.values(i.workflows);this.log(),this.log(o.colorize("bold"," workflow update check")),this.log(o.colorize("dim",` target: ${t}
|
|
2
2
|
`));let n=[],f=[];for(let e of l)if(e.ref===t)f.push(e);else n.push(e);for(let e of l){let r=e.ref===t,v=r?o.colorize("green","✓"):o.colorize("yellow","⬆"),L=r?o.colorize("green",e.ref):`${o.colorize("yellow",e.ref)} → ${o.colorize("green",t)}`;this.log(` ${v} ${o.colorize("cyan",e.name.padEnd(28))} ${L}`)}if(this.log(),n.length===0){this.log(o.colorize("green",` all ${l.length} workflow(s) are up to date at ${t}
|
|
3
3
|
`));return}if(!a.yes){if(!await E({message:`Update ${n.length} workflow(s) to ${t}?`,default:!0})){this.log(o.colorize("yellow",`
|
|
4
4
|
cancelled.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justanarthur/just-github-actions-n-workflows-cli",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.17",
|
|
4
4
|
"description": "Release automation toolkit — version bumping, npm publishing, docker publishing, VPS deployment via GitHub Actions composite actions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|