@r5n/sisyphus 0.3.35 → 0.3.39
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/dist/cli.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -88,7 +88,7 @@ ${i instanceof Error?i.message:i}`),k(a.reset(a.bold(a.redBright("Failed to crea
|
|
|
88
88
|
${e}`,name:`Release ${o}`,tag:o,token:r}),k(a.green(`\u2713 Created GitHub root release ${o}`))}var{$:Ct}=globalThis.Bun;async function eo({packages:r,dryRun:o,npmToken:t}){let e=t||process.env.NPM_CONFIG_TOKEN||process.env.NPM_TOKEN;if(!(e||o))return k(a.reset(a.bold(`${a.redBright("No NPM token found.")}
|
|
89
89
|
Please provide one by using ${a.cyanBright("--npmToken")} flag or by setting one of ${a.green("NPM_CONFIG_TOKEN")} or ${a.green("NPM_TOKEN")} environment variables.`)));await Gt({dryRun:o,packages:r,token:e})}async function Gt({packages:r,dryRun:o,token:t}){let e=await Pt();for(let{name:s,version:i,tag:n,file:c}of Object.values(r)){let l=Mr();l.start(`${o?a.yellow("[dry-run]: Test "):""}Publishing ${a.magenta(s)}@${a.cyanBright(i)}...`),await Mt({cwd:c.replace("package.json","")});let p=await(async()=>{try{let h=jt({dryRun:o,otp:e,tag:n});return await Kr(async()=>{let{stdout:f,exitCode:g}=Bun.spawnSync(h,{cwd:c.replace("package.json",""),env:{...process.env,NPM_CONFIG_TOKEN:t,NPM_TOKEN:t},stderr:"inherit"});if(g!==0)throw new Error(`npm publish failed with exit code ${g}`);return f},{onRetry:(f,g)=>{l.stop(),l.start(`${o?a.yellow("[dry-run]: Test "):""}Retrying publish ${a.magenta(s)}@${a.cyanBright(i)} (attempt ${f})...`)}}),`${a.green("Successfully published")} ${a.magenta(s)}@${a.cyanBright(i)}`}catch(h){return _.error(h instanceof Error?h.message:String(h)),`${a.bold(`${a.redBright("Failed")} ${a.magenta(s)}@${a.cyanBright(i)}`)}`}})();l.stop(`${o?a.yellow("[dry-run]: Test "):""}${p}`)}}async function Pt(){if(!Vr())return"";let r=await z({message:"Provide your NPM one-time password"});return H(r)?"":r}async function Mt({cwd:r}){try{let o=await Ct`cd ${r} && bun run build`.quiet();if(o.exitCode!==0)throw new Error(`Build failed with exit code ${o.exitCode}`)}catch(o){try{if(!(await Bun.file(`${r}/package.json`).json()).scripts?.build)return}catch{}_.warn(`${o instanceof Error?o.message:String(o)}:
|
|
90
90
|
Error during build step. If you don't have a build step, you can ignore this message.`)}}function jt({dryRun:r,tag:o,otp:t}){return["npm","publish","--access","public"].concat(o?["--tag",o]:[]).concat(r?["--dry-run"]:[]).concat(t?["--otp",t]:[])}var W=I({prefix:"sisyphus"}).child("roll");function Ut(){let{values:r}=Bt({allowPositionals:!0,args:Bun.argv,options:{changelog:{short:"c",type:"boolean"},changelogRoot:{short:"r",type:"boolean"},dryRun:{default:!1,short:"d",type:"boolean"},github:{short:"g",type:"boolean"},githubToken:{type:"string"},npm:{short:"n",type:"boolean"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{short:"t",type:"boolean"}},strict:!0});return r}async function so(){let r=Ut(),{dryRun:o,changelog:t,changelogRoot:e,github:s,githubToken:i,npm:n,npmToken:c,rootTag:l,withTags:p}=r,h=await G(),f=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),g=await(async()=>{try{return await or()}catch{return[]}})();if(g.length===0)return k(a.reset(a.bold(`${a.redBright("No stones found.")}
|
|
91
|
-
${a.reset(`Run ${a.green("bunx @r5n/sisyphus")}${a.yellow(" version")} and create some first.`)}`)));if(typeof t==="boolean"?t:h.changelog?.generate)await ro({changelogRoot:typeof e==="boolean"?e:h.changelog?.root,commit:f,dryRun:o,stones:g});let d=await Tt({dryRun:o,stones:g});if(typeof n==="boolean"?n:h.release?.npm)await eo({dryRun:o,npmToken:c,packages:d});let b=new Date().toISOString().split(".")[0]||"";if(await to({dryRun:o,github:typeof s==="boolean"?s:h.release?.github,githubToken:i,packages:d,rootTag:l,withTags:typeof p==="boolean"?p:h.release?.tags}),await Dr({dryRun:o,lastStone:{commit:f,date:b},stones:[]}),!o)await B`rm -rf .sisyphus/stones`.quiet();if(h.release?.commitAndPush){let y=Object.values(d).map((N)=>`${N.name}@${N.version}`).join(", "),u=h.commit?.message?h.commit.message.replace("{message}",y):`release(\uD83C\uDF89): ${y}`,{stdout:S}=await B`git config user.name`.quiet(),{stdout:$}=await B`git config user.email`.quiet();console.log(`git config user.name "${S.toString()}"`,`git config user.email "${$.toString()}"`),await B`bun lint`.quiet(),await B`git config user.name "Sisyphus"`,await B`git config user.email "contact@r5n.dev"`,await B`git commit --all -m "${u}"`,await B`git push`,await B`git config user.name "${S.toString()}"`,await B`git config user.email "${$.toString()}"`}}async function or({dryRun:r,silent:o,configPath:t,testModeEnabled:e}={}){let s=e,i=await En({configPath:t,dryRun:r,silent:o}),{packages:n}=await X({single:s}),c=t||".sisyphus";if(s&&i.length===0&&t)try{let p=`${t}/stones`,f=(await B`ls ${p} 2>/dev/null || true`.quiet()).stdout.toString().trim(),g=f?f.split(`
|
|
91
|
+
${a.reset(`Run ${a.green("bunx @r5n/sisyphus")}${a.yellow(" version")} and create some first.`)}`)));if(typeof t==="boolean"?t:h.changelog?.generate)await ro({changelogRoot:typeof e==="boolean"?e:h.changelog?.root,commit:f,dryRun:o,stones:g});let d=await Tt({dryRun:o,stones:g});if(typeof n==="boolean"?n:h.release?.npm)await eo({dryRun:o,npmToken:c,packages:d});let b=new Date().toISOString().split(".")[0]||"";if(await to({dryRun:o,github:typeof s==="boolean"?s:h.release?.github,githubToken:i,packages:d,rootTag:l,withTags:typeof p==="boolean"?p:h.release?.tags}),await Dr({dryRun:o,lastStone:{commit:f,date:b},stones:[]}),!o)await B`rm -rf .sisyphus/stones`.quiet();if(h.release?.commitAndPush){let y=Object.values(d).map((N)=>`${N.name}@${N.version}`).join(", "),u=h.commit?.message?h.commit.message.replace("{message}",y):`release(\uD83C\uDF89): ${y}`,{stdout:S}=await B`git config user.name`.quiet(),{stdout:$}=await B`git config user.email`.quiet();console.log(`git config user.name "${S.toString().trim()}"`,`git config user.email "${$.toString().trim()}"`),await B`bun lint`.quiet(),await B`git config user.name "Sisyphus"`,await B`git config user.email "contact@r5n.dev"`,await B`git commit --all -m "${u}"`,await B`git push`,await B`git config user.name "${S.toString().trim()}"`,await B`git config user.email "${$.toString().trim()}"`}}async function or({dryRun:r,silent:o,configPath:t,testModeEnabled:e}={}){let s=e,i=await En({configPath:t,dryRun:r,silent:o}),{packages:n}=await X({single:s}),c=t||".sisyphus";if(s&&i.length===0&&t)try{let p=`${t}/stones`,f=(await B`ls ${p} 2>/dev/null || true`.quiet()).stdout.toString().trim(),g=f?f.split(`
|
|
92
92
|
`).filter(Boolean).map((d)=>d.replace(".md","")):[];if(g.length>0)return W.info(`Found ${g.length} stones in test environment`),[{message:"Test stone config",name:g[0],packages:[{bump:"major",file:`${t}/workspace/packages/test-pkg/package.json`,name:"@test/pkg",version:"1.0.0"}],tag:"latest"}]}catch(p){W.error(`Test directory read error: ${p}`)}let l=[];for(let p of i)try{let f=(await Bun.file(`${c}/stones/${p}.md`).text()).split(`
|
|
93
93
|
`),[g]=f,d=g?.replace(/^#+\s*/,"")||"",b=f.findIndex((w)=>w.includes("|")&&w.includes(":---:"));if(b===-1){W.error(`Failed to parse stone ${p} - could not find table format`);continue}let y=f[b-1],u=f[b+1];if(!y||!u){W.error(`Failed to parse stone ${p} - invalid table structure`);continue}let S=y.split("|").map((w)=>w.trim()).filter(Boolean),$=u.split("|").map((w)=>w.trim()).filter(Boolean),N=[];for(let w=0;w<S.length;w++){let P=S[w],U=$[w];if(U){let Z=U.split(",").map((an)=>an.trim());for(let an of Z)if(n[an])N.push({...n[an],bump:P})}}let x=f.find((w)=>w.trim().startsWith("_")&&w.trim().endsWith("_")),E=x?x.replace(/_/g,"").trim():"";l.push({message:d.trim(),name:p,packages:N,tag:E})}catch(h){W.error(`Error processing stone ${p}
|
|
94
94
|
${h instanceof Error?h.message:String(h)}`)}return l}async function Tt({stones:r,dryRun:o=!1}){let t=[],e={};for(let{tag:i,packages:n,message:c}of r){t.push(c);for(let l of n){e[l.name]||=l;let p=e[l.name]||l;if(i)p.tag=i;p.bump=nr.indexOf(l.bump)>nr.indexOf(p.bump)?l.bump:p.bump,e[l.name]=p}}let s=Object.values(e).reduce((i,n)=>{return i[n.name]={...n,version:n.tag?T({tag:n.tag,version:T({bump:n.bump,version:n.version})}):T({bump:n.bump,version:n.version})},i},{});if(o)W.info(`${a.bold(a.yellow("[dry-run]"))}
|
|
@@ -106,7 +106,7 @@ ${a.bold(a.green("Packages:"))}
|
|
|
106
106
|
${n.map((g)=>{let d=i[g]?.version?`@${i[g]?.version}`:"";return` ${a.yellow("\u2022")} ${a.cyan(g)}${a.dim(d)}`}).join(`
|
|
107
107
|
`)}
|
|
108
108
|
|
|
109
|
-
${h}`),k(a.reset(a.green("Sisyphus check complete.")))}var On="0.3.
|
|
109
|
+
${h}`),k(a.reset(a.green("Sisyphus check complete.")))}var On="0.3.39";var co={check:`
|
|
110
110
|
sisyphus check - Check current state and pending changes
|
|
111
111
|
|
|
112
112
|
USAGE
|
package/package.json
CHANGED