@r5n/sisyphus 0.3.8 → 0.3.9

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.
Files changed (2) hide show
  1. package/dist/cli.js +1 -1
  2. package/package.json +4 -2
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ If you want to run Sisyphus in single-mode/root package, use --single flag or se
5
5
  <details><summary>${n.length} ${t?"Commits in this release":"Commits since last stone"}:</summary>
6
6
  ${n.join("\n")}
7
7
  </details>`:""}import{note as Re}from"@clack/prompts";import{bold as Ye,cyanBright as Ve,green as Le,redBright as We,reset as qe}from"picocolors";function he({dryRun:t,github:e,githubToken:s,packages:o,rootTag:n,withTags:a}){if(t)return;if(a)for(let{name:r,version:l}of Object.values(o)){let i=`${r}@${l}`;Bun.spawnSync(["git","tag",i,"-m",`Release ${i}`,"-f"])}if(n)Bun.spawnSync(["git","tag",n,"-m","Release","-f"]);if(e){if(!1)return Re(qe(Ye(`${We("No Github token found.")}
8
- Please provide one by using ${Ve("--githubToken")} flag or by setting ${Le("GITHUB_TOKEN")} environment variable.`)));console.info("TODO: This will be implemented in the future as Github release",{withTags:a,githubToken:s})}}import{note as Je,spinner as Qe}from"@clack/prompts";import{bold as L,cyanBright as A,green as W,magenta as F,redBright as q,reset as ze,yellow as fe}from"picocolors";function pe({packages:t,dryRun:e,npmToken:s}){let o=s||"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";if(!(o||e))return Je(ze(L(`${q("No NPM token found.")}
8
+ Please provide one by using ${Ve("--githubToken")} flag or by setting ${Le("GITHUB_TOKEN")} environment variable.`)));console.info("TODO: This will be implemented in the future as Github release",{withTags:a,githubToken:s})}}import{note as Je,spinner as Qe}from"@clack/prompts";import{bold as L,cyanBright as A,green as W,magenta as F,redBright as q,reset as ze,yellow as fe}from"picocolors";function pe({packages:t,dryRun:e,npmToken:s}){let o=s||"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";if(!(o||e))return Je(ze(L(`${q("No NPM token found.")}
9
9
  Please provide one by using ${A("--npmToken")} flag or by setting one of ${W("NPM_CONFIG_TOKEN")} or ${W("NPM_TOKEN")} environment variables.`)));for(let{name:n,version:a,tag:r,file:l}of Object.values(t)){let i=Qe();i.start(`${e?fe("[dry-run]: Test "):""}Publishing ${F(n)}@${A(a)}...`);let c="";try{let{stdout:g,stderr:u}=Bun.spawnSync(Xe({tag:r,dryRun:e}),{cwd:l.replace("package.json",""),env:{NPM_CONFIG_TOKEN:o,NODE_AUTH_TOKEN:o,NPM_TOKEN:o}});if(g)c=`${W("Successfully published")} ${F(n)}@${A(a)}`;if(u)console.error(u.toString()),c=`${L(`${q("Failed to publish")} ${F(n)}@${A(a)}`)}`}catch(g){c=`${L(`${q("Failed to publish")} ${F(n)}@${A(a)}`)}`,console.error(g)}i.stop(`${e?fe("[dry-run]: Test "):""}${c}`)}}function Xe({dryRun:t,tag:e}){return["bun","publish","--access","public"].concat(e?["--tag",e]:[]).concat(t?["--dry-run"]:[])}function st(){let{values:t}=Te({allowPositionals:!0,args:Bun.argv,strict:!0,options:{changelog:{type:"boolean",short:"c"},changelogRoot:{type:"boolean",short:"r"},dryRun:{default:!1,type:"boolean",short:"d"},github:{type:"boolean",short:"g"},githubToken:{type:"string"},npm:{type:"boolean",short:"n"},npmToken:{type:"string"},rootTag:{type:"string"},withTags:{type:"boolean",short:"t"}}});return t}async function we(){let{changelog:t,changelogRoot:e,dryRun:s,github:o,githubToken:n,npm:a,npmToken:r,rootTag:l,withTags:i}=st(),c=await y(),g=Bun.spawnSync(["git","rev-parse","HEAD"]).stdout.toString().trim(),u=[];try{u=await J()}catch{}if(u.length===0)return et($e(be(`${ot("No stones found.")}
10
10
  ${$e(`Run ${tt("bunx @r5n/sisyphus")}${de(" version")} and create some first.`)}`)));if(typeof t==="boolean"?t:c.changelog?.generate)await me({dryRun:s,changelogRoot:typeof e==="boolean"?e:c.changelog?.root,commit:g,stones:u});let h=await nt({dryRun:s,stones:u});if(typeof a==="boolean"?a:c.release?.npm)pe({dryRun:s,packages:h,npmToken:r});let $=new Date().toISOString().split(".")[0]||"";if(he({dryRun:s,packages:h,withTags:typeof i==="boolean"?i:c.release?.tags,rootTag:l,githubToken:n,github:typeof o==="boolean"?o:c.release?.github}),await le({dryRun:s,stones:[],lastStone:{commit:g,date:$}}),!s)Ze(".sisyphus/stones",{recursive:!0,force:!0})}async function J({dryRun:t}={}){let e=B({dryRun:t}),{packages:s}=await N({}),o=[];for(let n of e)try{let a=await Bun.file(`.sisyphus/stones/${n}.md`).text(),[r="",l=""]=a.split(M),[i="",,c=""]=l.trim().split("|\n|"),[g="",u=""]=r.split("\n"),h=i.slice(2).split("|").map((m)=>m.trim()),f=c.trim().slice(0,-2).split("|").map((m)=>m.split(",").map((w)=>w.trim())).flatMap((m,w)=>m.map((k)=>s[k]?{...s[k],bump:h[w]}:void 0)).filter(Boolean);o.push({message:g.replace("###","").trim(),name:n,packages:f,tag:u.replaceAll("_","").trim()})}catch(a){console.error(`Error processing stone ${n}`),console.error(a)}return o}async function nt({stones:t,dryRun:e=!1}){let s=[],o={};for(let{tag:a,packages:r,message:l}of t){s.push(l);for(let i of r){o[i.name]||=i;let c=o[i.name]||i;c.tag=a,c.bump=j.indexOf(i.bump)>j.indexOf(c.bump)?i.bump:c.bump,o[i.name]=c}}let n=Object.values(o).reduce((a,r)=>{return a[r.name]||=r,a[r.name].version=S(a[r.name]||r),a},{});if(e)console.info(`${be(de("[dry-run]"))}\nConfig for next release:\nStones: ${s.join(", ")}\n${JSON.stringify(n,null,2)}`);else for(let{version:a,file:r}of Object.values(n)){let l=await Bun.file(r).json();l.version=a,await Bun.write(r,`${JSON.stringify(l,null,2)}\n`)}return n}async function ye(){await y({dryRun:!0});let{packages:t,packageNames:e}=await N(),{packages:s,packageNames:[o=""]}=await N({single:!0}),n=await J({dryRun:!0}),a=n.length>0?`${Q(it("Stones:"))}
11
11
  ${n.map((r)=>`${Q("- Name:")} ${r.name}
package/package.json CHANGED
@@ -9,7 +9,9 @@
9
9
  "devDependencies": {
10
10
  "@r5n/tools-bun": "0.0.2"
11
11
  },
12
- "files": ["dist"],
12
+ "files": [
13
+ "dist"
14
+ ],
13
15
  "homepage": "https://github.com/r5n-dev/ts-packages/tree/develop/packages/cli/sisyphus",
14
16
  "license": "MIT",
15
17
  "main": "./cli.ts",
@@ -33,5 +35,5 @@
33
35
  },
34
36
  "type": "module",
35
37
  "types": "./cli.ts",
36
- "version": "0.3.8"
38
+ "version": "0.3.9"
37
39
  }