@adbayb/stack 1.15.0 → 1.16.0

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 (42) hide show
  1. package/README.md +10 -0
  2. package/dist/index.cjs +7 -7
  3. package/dist/index.cjs.map +4 -4
  4. package/package.json +7 -6
  5. package/template/.changeset/README.md +8 -0
  6. package/template/.changeset/config.json.tmpl +13 -0
  7. package/template/.changeset/welcome.md.tmpl +5 -0
  8. package/template/.commitlintrc.json +3 -0
  9. package/template/.editorconfig +4 -0
  10. package/template/.eslintrc.json.tmpl +3 -0
  11. package/template/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
  12. package/template/.github/ISSUE_TEMPLATE/config.yml +4 -0
  13. package/template/.github/PULL_REQUEST_TEMPLATE.md.tmpl +29 -0
  14. package/template/.github/renovate.json +69 -0
  15. package/template/.github/workflows/continuous_delivery.yml +49 -0
  16. package/template/.github/workflows/continuous_integration.yml +9 -0
  17. package/template/.github/workflows/conventional_commit.yml +48 -0
  18. package/template/.github/workflows/dependency_changelog.yml +117 -0
  19. package/template/.github/workflows/workflow.yml +96 -0
  20. package/template/.nvmrc.tmpl +1 -0
  21. package/template/.vscode/extensions.json +8 -0
  22. package/template/.vscode/settings.json +27 -0
  23. package/template/CONTRIBUTING.md.tmpl +21 -0
  24. package/{LICENSE → template/LICENSE.tmpl} +2 -2
  25. package/template/applications/README.md +9 -0
  26. package/template/examples/README.md +6 -0
  27. package/template/examples/default/package.json.tmpl +14 -0
  28. package/template/examples/default/src/index.ts.tmpl +3 -0
  29. package/template/examples/default/tsconfig.json +5 -0
  30. package/template/libraries/README.md +9 -0
  31. package/template/package.json.tmpl +26 -0
  32. package/template/pnpm-workspace.yaml.tmpl +6 -0
  33. package/template/tools/README.md +6 -0
  34. package/template/tsconfig.json +3 -0
  35. package/template/turbo.json +24 -0
  36. package/template/{{projectName}}/README.md.tmpl +42 -0
  37. package/template/{{projectName}}/package.json.tmpl +41 -0
  38. package/template/{{projectName}}/src/index.test.ts.tmpl +5 -0
  39. package/template/{{projectName}}/src/index.ts +1 -0
  40. package/template/{{projectName}}/tsconfig.json +5 -0
  41. package/templates/default/config.json +0 -17
  42. package/templates/default/content.tar.gz +0 -0
package/README.md CHANGED
@@ -90,6 +90,16 @@ flowchart TD
90
90
  - **Release**: Changesets
91
91
  - **Testing**: Vitest
92
92
 
93
+ ### Used conventions
94
+
95
+ - [File Structure (inspired by NX)](https://nx.dev/concepts/more-concepts/folder-structure)
96
+ - Monorepo-first structure to:
97
+ - Keep a consistent file structure pattern across templates (ease template familiarity and onboarding)
98
+ - Ease examples setup
99
+ - Not clutter the published package with development-related context, metadata, and artifacts
100
+ - [Commits](https://www.conventionalcommits.org/)
101
+ - [Scripts](https://conventionalscripts.org/)
102
+
93
103
  <br>
94
104
 
95
105
  ## 👣 Roadmap
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var ae=Object.create;var S=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var pe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!me.call(e,n)&&n!==r&&S(e,n,{get:()=>t[n],enumerable:!(o=ie(t,n))||o.enumerable});return e};var le=(e,t,r)=>(r=e!=null?ae(ce(e)):{},pe(t||!e||!e.__esModule?S(r,"default",{value:e,enumerable:!0}):r,e));var ne=require("termost");var w=require("fs"),j=require("path"),c=require("termost"),y=(e,t)=>{c.helpers.message(`
2
+ "use strict";var se=Object.create;var T=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var pe=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var de=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of me(t))!le.call(e,n)&&n!==r&&T(e,n,{get:()=>t[n],enumerable:!(o=ce(t,n))||o.enumerable});return e};var ye=(e,t,r)=>(r=e!=null?se(pe(e)):{},de(t||!e||!e.__esModule?T(r,"default",{value:e,enumerable:!0}):r,e));var ae=require("termost");var F=require("fs"),v=require("path"),m=require("termost"),u=(e,t)=>{m.helpers.message(`
3
3
  \u256D\u2500\u2500\u2500\u2500\u2500\u256E
4
4
  \u2502 \u25E0 \u25E0 ${e.title}
5
5
  \u2502 ${t?.type==="error"?"\u25E0":"\u25E1"} \u2502 ${e.description}
6
6
  \u2570\u2500\u2500\u2500\u2500\u2500\u256F
7
7
  ${e.body?`
8
8
  ${e.body}
9
- `:""}`,t)},a=e=>(0,j.resolve)(process.cwd(),e),I=e=>(0,j.resolve)(__dirname,"../",e);var O=async()=>{try{return await c.helpers.exec("pnpm -v")}catch{throw s("pnpm","The project must use `pnpm` as a node package manager tool. Follow this installation guide https://pnpm.io/installation")}},F=(e,t=!0)=>[...t?[]:["npx --no"],`stack ${e}`].join(" "),D=async()=>c.helpers.exec("corepack enable"),v={async get(e,t){let r=await fetch(e);if(!r.ok)throw s("fetch",`Failed to fetch resources from ${e} (${JSON.stringify({status:r.status,statusText:r.statusText})})`);return t==="text"?r.text():r.json()}},L=e=>async(t=[])=>{let r=[];if(t.length===0)r.push(".");else if(r=t.filter(m=>R.some(g=>m.endsWith(g))),r.length===0)return Promise.resolve();let o=[...r];o.push(`--ext ${R.join(",")}`),o.push("--cache"),o.push(`--cache-location ${a("node_modules/.cache/.eslintcache")}`),o.push("--no-error-on-unmatched-pattern");let n=a(".gitignore");(0,w.existsSync)(n)&&o.push(`--ignore-path ${n}`),e.isFixMode&&o.push("--fix");try{return await c.helpers.exec(`eslint ${o.join(" ")}`)}catch(m){throw s("eslint",m)}},A=L({isFixMode:!1}),_=L({isFixMode:!0}),M=async e=>{let t=[];if(e.length===0)t.push(`"**/!(${P.join("|")})"`);else if(t=e.filter(o=>!P.some(n=>o.endsWith(n))&&o!=="README.md"),t.length===0)return Promise.resolve();let r=[...t];(0,w.existsSync)(a(".gitignore"))&&r.push("--ignore-path .gitignore"),r.push("--write"),r.push("--ignore-unknown"),r.push("--no-error-on-unmatched-pattern");try{return await c.helpers.exec(`prettier ${r.join(" ")}`)}catch(o){throw s("prettier",o)}},V=async()=>{try{return await c.helpers.exec("pnpm --parallel exec tsc --noEmit")}catch(e){throw s("tsc",e)}},q=async()=>{try{return await c.helpers.exec('commitlint --extends "@commitlint/config-conventional" --edit')}catch(e){throw s("commitlint",e)}},s=(e,t)=>new Error(`\`${e}\` failed:
10
- ${String(t)}`),i=async(e,t={hasLiveOutput:!0})=>{try{return await c.helpers.exec(`turbo run ${e}`,t)}catch(r){throw s("turbo",r)}},h=async e=>{try{return await c.helpers.exec(e,{hasLiveOutput:!0})}catch(t){throw s("changeset",t)}},de=["ts","tsx","cts","mts"],R=["js","jsx","cjs","mjs",...de],P=["CHANGELOG.md","pnpm-lock.yaml"];var B=e=>{e.command({name:"build",description:"Build the project in production mode"}).task({async handler(){await i("build")}})};var ge=["commit","lint","type"],W=e=>{e.command({name:"check",description:"Check code health (static analysis)"}).option({key:"only",name:"only",description:`Run only one specified task (accepted value: ${ge.join(", ")})`,defaultValue:void 0}).task({label:u("Preparing the project"),async handler(){await i("build",{hasLiveOutput:!1})},skip({only:t}){return t==="commit"}}).task({label:u("Checking linters"),async handler(t,r){let o=r.operands;await A(o)},skip:U("lint")}).task({label:u("Checking types"),async handler(){await V()},skip(t,r){return U("type")(t)||!require.resolve("typescript")||r.operands.length>0}}).task({label:u("Checking commit"),async handler(){await q()},skip({only:t}){return t!=="commit"}})},u=e=>`${e} \u{1F9D0}`,U=e=>t=>t.only!==void 0&&t.only!==e;var f=require("fs"),k=require("termost");var Y=e=>{e.command({name:"clean",description:"Clean the project"}).task({key:"files",label:G("Retrieving removable assets"),async handler(){let t="node_modules/.cache",r=await ue();return he(a(t))&&r.push(t),r}}).task({label({files:t}){return t.length>0?G("Cleaning assets"):"Already clean \u2728"},async handler({files:t}){t.length!==0&&await ye(t)}}).task({handler({files:t}){k.helpers.message(`Removed assets: ${t.join(", ")}
11
- `,{type:"information"})},skip({files:t}){return t.length===0}})},G=e=>`${e} \u{1F9F9}`,ye=async e=>k.helpers.exec(`rm -rf ${e.join(" ")}`),he=e=>(0,f.existsSync)(e)&&(0,f.readdirSync)(e).length>0,ue=async()=>(await k.helpers.exec(`git clean -fdXn | grep -v '${fe.join("\\|")}' | cut -c 14-`)).split(/\n/).filter(Boolean),fe=["node_modules",".turbo"];var d=require("fs"),x=require("fs/promises"),$=require("path"),p=require("termost");var z={name:"@adbayb/stack",version:"1.15.0",description:"My opinionated toolchain",publishConfig:{access:"public"},files:["bin","dist","templates"],bin:{stack:"bin/index.cjs"},source:"src/index.ts",main:"dist/index.cjs",platform:"node",scripts:{prepublishOnly:"pnpm build",prestart:"pnpm build",start:"bin/index.js",build:"quickbundle build",watch:"quickbundle watch"},keywords:["stack","scripts","toolchain","development"],author:{name:"Ayoub Adib",email:"adbayb@gmail.com",url:"https://twitter.com/adbayb"},repository:{type:"git",url:"https://github.com/adbayb/stack.git",directory:"stack"},license:"MIT",dependencies:{"@changesets/changelog-github":"^0.5.0","@changesets/cli":"^2.27.1","@commitlint/cli":"^18.4.3","@commitlint/config-conventional":"^18.4.3",eslint:"^8.56.0",prettier:"^3.1.1",termost:"^0.12.0",turbo:"^1.11.2",typescript:"^5.3.3"}};var H={files:[".nvmrc","CONTRIBUTING.md","LICENSE","package.json","pnpm-workspace.yaml",".changeset/config.json",".changeset/welcome.md",".github/PULL_REQUEST_TEMPLATE.md","{{projectName}}/package.json","{{projectName}}/README.md","examples/default/package.json","examples/default/src/index.ts"],folders:["{{projectName}}"]};var X=e=>{e.command({name:"create",description:"Scaffold a new project"}).task({handler(){y({title:`I'm Stack v${z.version}, your bot assistant`,description:"I can guarantee you a project creation in under 1 minute \u{1F680}"},{type:"information"})}}).input({key:"inputName",label:"What's your project name?",type:"text"}).input({key:"inputDescription",label:"How would you describe it?",type:"text"}).input({key:"inputUrl",label:"Where will it be stored? (Git remote URL)",type:"text"}).task({label:l("Checking pre-requisites"),async handler(){await O()}}).task({key:"data",label:l("Evaluating contextual data"),async handler({inputDescription:t,inputName:r,inputUrl:o}){let n=(await v.get("https://resolve-node.vercel.app/lts","text")).replace("v",""),m=(await v.get("https://registry.npmjs.org/pnpm/latest","json")).version,{repoName:g,repoOwner:T}=(o.startsWith("git")?/^git@.*:(?<repoOwner>.*)\/(?<repoName>.*)\.git$/:/^https?:\/\/.*\/(?<repoOwner>.*)\/(?<repoName>.*)\.git$/).exec(o)?.groups??{};if(!T||!g)throw s("git","The owner and repository name can not be extracted. Please make sure to follow either `/^git@.*:(?<repoOwner>.*)/(?<repoName>.*).git$/` or `/^https?://.*/(?<repoOwner>.*)/(?<repoName>.*).git$/` pattern.");return{licenseYear:new Date().getFullYear().toString(),nodeVersion:n,npmVersion:m,projectDescription:t.charAt(0).toUpperCase()+t.slice(1),projectName:r.toLowerCase(),projectUrl:o,projectVersion:"0.0.0",repoId:`${T}/${g}`}}}).task({label({data:t}){return l(`Creating \`${t.projectName}\` folder`)},async handler({data:t}){let r=(0,$.resolve)(process.cwd(),t.projectName);await(0,x.mkdir)(r),process.chdir(r)}}).task({label:l("Initializing `git`"),async handler({data:t}){await p.helpers.exec("git init"),await p.helpers.exec(`git remote add origin ${t.projectUrl}`)}}).task({label:l("Applying default template"),async handler({data:t}){await Ce();let r=be(H,t);r.hydrate(),r.rename()}}).task({label:l("Installing dependencies"),async handler({data:t}){let r=["quickbundle","vitest"],o=["@adbayb/eslint-config","@adbayb/prettier-config","@adbayb/ts-config","@adbayb/stack"];try{await p.helpers.exec(`pnpm add ${o.join(" ")} --save-dev --ignore-workspace-root-check`),await p.helpers.exec(`pnpm add ${r.join(" ")} --save-dev --filter ${t.projectName}`)}catch(n){throw s("pnpm",n)}}}).task({key:"previousTaskError",label:l("Cleaning up"),async handler({data:t}){try{await(0,x.symlink)(`./${t.projectName}/README.md`,"./README.md"),await D(),await p.helpers.exec("stack install"),await p.helpers.exec("git add -A"),await p.helpers.exec('git commit -m "chore: initial commit"');return}catch(r){return r}}}).task({handler({data:t,previousTaskError:r}){if(r){y({title:"Oops, an error occurred",description:"Keep calm and carry on with some coffee \u2615\uFE0F",body:String(r)},{type:"error"});return}y({title:"The project was successfully created",description:`Run \`cd ./${t.projectName}\` and Enjoy \u{1F680}`},{type:"success"})}})},l=e=>`${e} \u{1F528}`,be=(e,t)=>{let r=o=>o.replace(/{{(.*?)}}/g,(n,m)=>t[m]||"");return{hydrate(){for(let o of e.files){let n=a(o),m=(0,d.readFileSync)(n,"utf-8");(0,d.writeFileSync)(n,r(m))}},rename(){try{for(let o of e.folders)(0,d.renameSync)(a(o),a(r(o)))}catch{}}}},Ce=async()=>{let e=(0,$.resolve)(I("./templates"),"./default/content.tar.gz"),t=a("./");return p.helpers.exec(`tar -xzf ${e} -C ${t} --strip-components=1`)};var J=e=>{e.command({name:"fix",description:"Fix auto-fixable issues"}).task({label:E("Preparing the project"),async handler(){await i("build",{hasLiveOutput:!1})}}).task({label:E("Fixing lints"),async handler(t,r){await _(r.operands)}}).task({label:E("Fixing formatting"),async handler(t,r){await M(r.operands)}})},E=e=>`${e} \u{1F691}`;var b=require("fs/promises");var Z=e=>{e.command({name:"install",description:"Setup initial requirements"}).task({label:K("Installing `git.pre-commit` hook"),async handler(){await Q("pre-commit",`${F(`fix $(git status --porcelain | awk 'BEGIN{ ORS=" " } { print $2 }')`,!1)} && git add -A`)}}).task({label:K("Installing `git.commit-msg` hook"),async handler(){await Q("commit-msg",`${F("check --only commit",!1)}`)}})},K=e=>`${e} \u{1F4F2}`,Q=async(e,t)=>{let r=a(`.git/hooks/${e}`);return await(0,b.writeFile)(r,t),(0,b.chmod)(r,"0755")};var C=require("termost");var ee=e=>{e.command({name:"release",description:"Log, version, and publish package(s)"}).option({key:"log",name:"log",description:"Add a new changelog entry"}).option({key:"tag",name:"tag",description:"Bump the package(s) version"}).option({key:"publish",name:"publish",description:"Publish package(s) to the registry"}).task({async handler(){C.helpers.message(`New changelog entry
12
- `),await h("changeset")},skip:N("log")}).task({async handler(){C.helpers.message(`Bumping the package(s) version
13
- `),await h("changeset version && pnpm install --no-frozen-lockfile")},skip:N("tag")}).task({async handler(){C.helpers.message(`Publishing package(s) to the registry
14
- `),await h("stack build && pnpm changeset publish")},skip:N("publish")})},N=e=>t=>!t[e];var te=e=>{e.command({name:"start",description:"Start the project in production mode"}).task({async handler(){await i("start")}})};var re=e=>{e.command({name:"test",description:"Test the code execution"}).task({async handler(){await i("test")}})};var oe=e=>{e.command({name:"watch",description:"Build and start the project in development mode"}).task({async handler(){await i("watch")}})};var we=(...e)=>{let t=(0,ne.termost)({name:"stack",description:"Toolbox to easily scaffold and maintain a project"});for(let r of e)r(t)};we(X,Z,Y,W,J,te,B,oe,re,ee);
9
+ `:""}`,t)},p=e=>(0,v.resolve)(process.cwd(),e),I=e=>(0,v.resolve)(__dirname,"../",e);var D=async()=>{try{return await m.helpers.exec("pnpm -v")}catch{throw s("pnpm","The project must use `pnpm` as a node package manager tool. Follow this installation guide https://pnpm.io/installation")}},$=(e,t=!0)=>[...t?[]:["npx --no"],`stack ${e}`].join(" "),A=async()=>m.helpers.exec("corepack enable"),E={async get(e,t){let r=await fetch(e);if(!r.ok)throw s("fetch",`Failed to fetch resources from ${e} (${JSON.stringify({status:r.status,statusText:r.statusText})})`);return t==="text"?r.text():r.json()}},L=e=>async(t=[])=>{let r=[];if(t.length===0)r.push(".");else if(r=t.filter(y=>P.some(a=>y.endsWith(a))),r.length===0)return Promise.resolve();let o=[...r];o.push(`--ext ${P.join(",")}`),o.push("--cache"),o.push(`--cache-location ${p("node_modules/.cache/.eslintcache")}`),o.push("--no-error-on-unmatched-pattern");let n=p(".gitignore");(0,F.existsSync)(n)&&o.push(`--ignore-path ${n}`),e.isFixMode&&o.push("--fix");try{return await m.helpers.exec(`eslint ${o.join(" ")}`)}catch(y){throw s("eslint",y)}},_=L({isFixMode:!1}),M=L({isFixMode:!0}),B=async e=>{let t=[];if(e.length===0)t.push(`"**/!(${O.join("|")})"`);else if(t=e.filter(o=>!O.some(n=>o.endsWith(n))&&o!=="README.md"),t.length===0)return Promise.resolve();let r=[...t];(0,F.existsSync)(p(".gitignore"))&&r.push("--ignore-path .gitignore"),r.push("--write"),r.push("--ignore-unknown"),r.push("--no-error-on-unmatched-pattern");try{return await m.helpers.exec(`prettier ${r.join(" ")}`)}catch(o){throw s("prettier",o)}},q=async()=>{try{return await m.helpers.exec("pnpm --parallel exec tsc --noEmit")}catch(e){throw s("tsc",e)}},V=async()=>{try{return await m.helpers.exec('commitlint --extends "@commitlint/config-conventional" --edit')}catch(e){throw s("commitlint",e)}},s=(e,t)=>new Error(`\`${e}\` failed:
10
+ ${String(t)}`),i=async(e,t={hasLiveOutput:!0})=>{try{return await m.helpers.exec(`turbo run ${e}`,t)}catch(r){throw s("turbo",r)}},f=async e=>{try{return await m.helpers.exec(e,{hasLiveOutput:!0})}catch(t){throw s("changeset",t)}},ge=["ts","tsx","cts","mts"],P=["js","jsx","cjs","mjs",...ge],O=["CHANGELOG.md","pnpm-lock.yaml"];var W=e=>{e.command({name:"build",description:"Build the project in production mode"}).task({async handler(){await i("build")}})};var he=["commit","lint","type"],U=e=>{e.command({name:"check",description:"Check code health (static analysis)"}).option({key:"only",name:"only",description:`Run only one specified task (accepted value: ${he.join(", ")})`,defaultValue:void 0}).task({label:b("Preparing the project"),async handler(){await i("build",{hasLiveOutput:!1})},skip({only:t}){return t==="commit"}}).task({label:b("Checking linters"),async handler(t,r){let o=r.operands;await _(o)},skip:G("lint")}).task({label:b("Checking types"),async handler(){await q()},skip(t,r){return G("type")(t)||!require.resolve("typescript")||r.operands.length>0}}).task({label:b("Checking commit"),async handler(){await V()},skip({only:t}){return t!=="commit"}})},b=e=>`${e} \u{1F9D0}`,G=e=>t=>t.only!==void 0&&t.only!==e;var k=require("fs"),x=require("termost");var H=e=>{e.command({name:"clean",description:"Clean the project"}).task({key:"files",label:Y("Retrieving removable assets"),async handler(){let t="node_modules/.cache",r=await be();return fe(p(t))&&r.push(t),r}}).task({label({files:t}){return t.length>0?Y("Cleaning assets"):"Already clean \u2728"},async handler({files:t}){t.length!==0&&await ue(t)}}).task({handler({files:t}){x.helpers.message(`Removed assets: ${t.join(", ")}
11
+ `,{type:"information"})},skip({files:t}){return t.length===0}})},Y=e=>`${e} \u{1F9F9}`,ue=async e=>x.helpers.exec(`rm -rf ${e.join(" ")}`),fe=e=>(0,k.existsSync)(e)&&(0,k.readdirSync)(e).length>0,be=async()=>(await x.helpers.exec(`git clean -fdXn | grep -v '${ke.join("\\|")}' | cut -c 14-`)).split(/\n/).filter(Boolean),ke=["node_modules",".turbo"];var S=require("fdir"),l=require("fs"),w=require("fs/promises"),z=require("path"),d=require("termost");var X={name:"@adbayb/stack",version:"1.16.0",description:"My opinionated toolchain",publishConfig:{access:"public"},files:["bin","dist","template"],bin:{stack:"bin/index.cjs"},source:"src/index.ts",main:"dist/index.cjs",platform:"node",scripts:{prepublishOnly:"pnpm build",prestart:"pnpm build",start:"bin/index.js",build:"quickbundle build",watch:"quickbundle watch"},keywords:["stack","scripts","toolchain","development"],author:{name:"Ayoub Adib",email:"adbayb@gmail.com",url:"https://twitter.com/adbayb"},repository:{type:"git",url:"https://github.com/adbayb/stack.git",directory:"stack"},license:"MIT",dependencies:{"@changesets/changelog-github":"^0.5.0","@changesets/cli":"^2.27.1","@commitlint/cli":"^18.6.1","@commitlint/config-conventional":"^18.6.2",eslint:"^8.56.0",fdir:"^6.1.1",prettier:"^3.2.5",termost:"^0.12.0",turbo:"^1.12.4",typescript:"^5.3.3"}};var J=e=>{e.command({name:"create",description:"Scaffold a new project"}).task({handler(){u({title:`I'm Stack v${X.version}, your bot assistant`,description:"I can guarantee you a project creation in under 1 minute \u{1F680}"},{type:"information"})}}).input({key:"inputName",label:"What's your project name?",type:"text"}).input({key:"inputDescription",label:"How would you describe it?",type:"text"}).input({key:"inputUrl",label:"Where will it be stored? (Git remote URL)",type:"text"}).task({label:g("Checking pre-requisites"),async handler(){await D()}}).task({key:"data",label:g("Evaluating contextual data"),async handler({inputDescription:t,inputName:r,inputUrl:o}){let n=(await E.get("https://resolve-node.vercel.app/lts","text")).replace("v",""),y=(await E.get("https://registry.npmjs.org/pnpm/latest","json")).version,{repoName:a,repoOwner:c}=(o.startsWith("git")?/^git@.*:(?<repoOwner>.*)\/(?<repoName>.*)\.git$/:/^https?:\/\/.*\/(?<repoOwner>.*)\/(?<repoName>.*)\.git$/).exec(o)?.groups??{};if(!c||!a)throw s("git","The owner and repository name can not be extracted. Please make sure to follow either `/^git@.*:(?<repoOwner>.*)/(?<repoName>.*).git$/` or `/^https?://.*/(?<repoOwner>.*)/(?<repoName>.*).git$/` pattern.");return{licenseYear:new Date().getFullYear().toString(),nodeVersion:n,npmVersion:y,projectDescription:t.charAt(0).toUpperCase()+t.slice(1),projectName:r.toLowerCase(),projectUrl:o,repoId:`${c}/${a}`}}}).task({label({data:t}){return g(`Creating \`${t.projectName}\` folder`)},async handler({data:t}){let r=(0,z.resolve)(process.cwd(),t.projectName);await(0,w.mkdir)(r),process.chdir(r)}}).task({label:g("Initializing `git`"),async handler({data:t}){await d.helpers.exec("git init"),await d.helpers.exec(`git remote add origin ${t.projectUrl}`)}}).task({label:g("Applying template"),handler({data:t}){we(t)}}).task({label:g("Installing dependencies"),async handler({data:t}){let r=["quickbundle","vitest"],o=["@adbayb/eslint-config","@adbayb/prettier-config","@adbayb/ts-config","@adbayb/stack"];try{await d.helpers.exec(`pnpm add ${o.join(" ")} --save-dev --ignore-workspace-root-check`),await d.helpers.exec(`pnpm add ${r.join(" ")} --save-dev --filter ${t.projectName}`)}catch(n){throw s("pnpm",n)}}}).task({key:"error",label:g("Cleaning up"),async handler({data:t}){try{await(0,w.symlink)(`./${t.projectName}/README.md`,"./README.md"),await A(),await d.helpers.exec("stack install"),await d.helpers.exec("git add -A"),await d.helpers.exec('git commit -m "chore: initial commit"');return}catch(r){return r}}}).task({handler({data:t,error:r}){if(r){u({title:"Oops, an error occurred",description:"Keep calm and carry on with some coffee \u2615\uFE0F",body:String(r)},{type:"error"});return}u({title:"The project was successfully created",description:`Run \`cd ./${t.projectName}\` and Enjoy \u{1F680}`},{type:"success"})}})},g=e=>`${e} \u{1F528}`,we=e=>{let t=".tmpl",r=I("./template"),o=p("./"),n=/{{(.*?)}}/g,y=a=>a.replace(n,(c,h)=>e[h]||"");(0,l.cpSync)(r,o,{force:!0,recursive:!0}),new S.fdir().withBasePath().glob(`**/*${t}`).crawl(o).sync().forEach(a=>{let c=a.slice(0,a.lastIndexOf(t)),h=y((0,l.readFileSync)(a,"utf-8"));(0,l.renameSync)(a,c),(0,l.writeFileSync)(c,h,"utf-8")}),new S.fdir().withBasePath().onlyDirs().filter(a=>!!n.exec(a)).crawl(o).sync().sort((a,c)=>c.length-a.length).forEach(a=>{let c=a.replace(n,(h,ie)=>e[ie]);(0,l.renameSync)(a,c)})};var K=e=>{e.command({name:"fix",description:"Fix auto-fixable issues"}).task({label:N("Preparing the project"),async handler(){await i("build",{hasLiveOutput:!1})}}).task({label:N("Fixing lints"),async handler(t,r){await M(r.operands)}}).task({label:N("Fixing formatting"),async handler(t,r){await B(r.operands)}})},N=e=>`${e} \u{1F691}`;var C=require("fs/promises");var ee=e=>{e.command({name:"install",description:"Setup initial requirements"}).task({label:Q("Installing `git.pre-commit` hook"),async handler(){await Z("pre-commit",`${$(`fix $(git status --porcelain | awk 'BEGIN{ ORS=" " } { print $2 }')`,!1)} && git add -A`)}}).task({label:Q("Installing `git.commit-msg` hook"),async handler(){await Z("commit-msg",`${$("check --only commit",!1)}`)}})},Q=e=>`${e} \u{1F4F2}`,Z=async(e,t)=>{let r=p(`.git/hooks/${e}`);return await(0,C.writeFile)(r,t),(0,C.chmod)(r,"0755")};var j=require("termost");var te=e=>{e.command({name:"release",description:"Log, version, and publish package(s)"}).option({key:"log",name:"log",description:"Add a new changelog entry"}).option({key:"tag",name:"tag",description:"Bump the package(s) version"}).option({key:"publish",name:"publish",description:"Publish package(s) to the registry"}).task({async handler(){j.helpers.message(`New changelog entry
12
+ `),await f("changeset")},skip:R("log")}).task({async handler(){j.helpers.message(`Bumping the package(s) version
13
+ `),await f("changeset version && pnpm install --no-frozen-lockfile")},skip:R("tag")}).task({async handler(){j.helpers.message(`Publishing package(s) to the registry
14
+ `),await f("stack build && pnpm changeset publish")},skip:R("publish")})},R=e=>t=>!t[e];var re=e=>{e.command({name:"start",description:"Start the project in production mode"}).task({async handler(){await i("start")}})};var oe=e=>{e.command({name:"test",description:"Test the code execution"}).task({async handler(){await i("test")}})};var ne=e=>{e.command({name:"watch",description:"Build and start the project in development mode"}).task({async handler(){await i("watch")}})};var Ce=(...e)=>{let t=(0,ae.termost)({name:"stack",description:"Toolbox to easily scaffold and maintain a project"});for(let r of e)r(t)};Ce(J,ee,H,U,K,re,W,ne,oe,te);
15
15
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/helpers.ts", "../src/commands/build.ts", "../src/commands/check.ts", "../src/commands/clean.ts", "../src/commands/create.ts", "../package.json", "../templates/default/config.json", "../src/commands/fix.ts", "../src/commands/install.ts", "../src/commands/release.ts", "../src/commands/start.ts", "../src/commands/test.ts", "../src/commands/watch.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\n\nimport { termost } from \"termost\";\n\nimport { createBuildCommand } from \"./commands/build\";\nimport { createCheckCommand } from \"./commands/check\";\nimport { createCleanCommand } from \"./commands/clean\";\nimport { createCreateCommand } from \"./commands/create\";\nimport { createFixCommand } from \"./commands/fix\";\nimport { createInstallCommand } from \"./commands/install\";\nimport { createReleaseCommand } from \"./commands/release\";\nimport { createStartCommand } from \"./commands/start\";\nimport { createTestCommand } from \"./commands/test\";\nimport { createWatchCommand } from \"./commands/watch\";\nimport type { CommandFactory } from \"./types\";\n\nconst createProgram = (...commandFactories: CommandFactory[]) => {\n\tconst program = termost({\n\t\tname: \"stack\",\n\t\tdescription: \"Toolbox to easily scaffold and maintain a project\",\n\t});\n\n\tfor (const commandBuilder of commandFactories) {\n\t\tcommandBuilder(program);\n\t}\n};\n\ncreateProgram(\n\tcreateCreateCommand,\n\tcreateInstallCommand,\n\tcreateCleanCommand,\n\tcreateCheckCommand,\n\tcreateFixCommand,\n\tcreateStartCommand,\n\tcreateBuildCommand,\n\tcreateWatchCommand,\n\tcreateTestCommand,\n\tcreateReleaseCommand,\n);\n", "import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { helpers } from \"termost\";\n\n/**\n * Helper to format log messages with a welcoming bot.\n * @param input - Message factory.\n * @param input.title - Title input.\n * @param input.description - Description input.\n * @param input.body - Body input.\n * @param options - Formatting option.\n * @example\n * botMessage(\n *\t{\n * \t\ttitle: \"Oops, an error occurred\",\n * \t\tdescription:\n * \t\t\t\"Keep calm and carry on with some coffee \u2615\uFE0F\",\n * \t\tbody: String(previousTaskError),\n * \t},\n * \t{\n * \t\ttype: \"error\",\n * \t},\n * );\n */\nexport const botMessage = (\n\tinput: { title: string; description: string; body?: string },\n\toptions: Parameters<typeof helpers.message>[1],\n) => {\n\thelpers.message(\n\t\t`\n\u256D\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 \u25E0 \u25E0 ${input.title}\n\u2502 ${options?.type === \"error\" ? \"\u25E0\" : \"\u25E1\"} \u2502 ${input.description}\n\u2570\u2500\u2500\u2500\u2500\u2500\u256F\n${\n\t!input.body\n\t\t? \"\"\n\t\t: `\n${input.body}\n`\n}`,\n\t\toptions,\n\t);\n};\n\n/**\n * Resolve a relative path to an absolute one resolved from the generated project root directory.\n * @param path - The relative path.\n * @returns The resolved absolute path.\n * @example\n * resolveFromProjectDirectory(\".gitignore\");\n */\nexport const resolveFromProjectDirectory = (path: string) => {\n\treturn resolve(process.cwd(), path);\n};\n\n/**\n * Resolve a relative path to an absolute one resolved from the `stack` node module directory.\n * @param path - The relative path.\n * @returns The resolved absolute path.\n * @example\n * resolveFromStackDirectory(\"./templates\");\n */\nexport const resolveFromStackDirectory = (path: string) => {\n\treturn resolve(__dirname, \"../\", path);\n};\n\nexport const getRepositoryUrl = async () => {\n\ttry {\n\t\t// This step is used as well to persist the repository url value:\n\t\treturn await helpers.exec(\"git config --get remote.origin.url\");\n\t} catch (error) {\n\t\tthrow createError(\n\t\t\t\"git\",\n\t\t\t`The project must be a \\`git\\` repository with an origin already setup. Have you tried to run \\`git init && git remote add origin git@github.com:OWNER/REPOSITORY.git && git add -A && git commit -m \"chore: initial commit\" && git push -u origin main\\`?\\n${String(\n\t\t\t\terror,\n\t\t\t)}`,\n\t\t);\n\t}\n};\n\nexport const getNpmVersion = async () => {\n\ttry {\n\t\treturn await helpers.exec(\"pnpm -v\");\n\t} catch (error) {\n\t\tthrow createError(\n\t\t\t\"pnpm\",\n\t\t\t\"The project must use `pnpm` as a node package manager tool. Follow this installation guide https://pnpm.io/installation\",\n\t\t);\n\t}\n};\n\nexport const getStackCommand = (command: string, isNodeRuntime = true) => {\n\t// @note: `isNodeRuntime` allows executing node bin executables in a non node environment such as in git hooks context\n\t// Npx is used to make executable resolution independent from the build tool (npx is the built-in Node tool)\n\t// `--no` flag to prevent installation prompt and throw an error if the binary is not installed\n\treturn [...(isNodeRuntime ? [] : [\"npx --no\"]), `stack ${command}`].join(\n\t\t\" \",\n\t);\n};\n\nexport const setPkgManager = async () => {\n\treturn helpers.exec(\"corepack enable\");\n};\n\nexport const request = {\n\tasync get<ResponseType extends \"json\" | \"text\">(\n\t\turl: string,\n\t\tresponseType: ResponseType,\n\t) {\n\t\tconst response = await fetch(url);\n\n\t\tif (!response.ok) {\n\t\t\tthrow createError(\n\t\t\t\t\"fetch\",\n\t\t\t\t`Failed to fetch resources from ${url} (${JSON.stringify({\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t})})`,\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\tresponseType === \"text\" ? response.text() : response.json()\n\t\t) as Promise<\n\t\t\tResponseType extends \"text\" ? string : Record<string, string>\n\t\t>;\n\t},\n};\n\nconst eslint =\n\t(options: { isFixMode: boolean }) =>\n\tasync (files: FilenameCollection = []) => {\n\t\tlet eslintFiles = [];\n\n\t\tif (files.length === 0) {\n\t\t\teslintFiles.push(\".\");\n\t\t} else {\n\t\t\teslintFiles = files.filter((file) => {\n\t\t\t\treturn ESLINT_EXTENSIONS.some((ext) => file.endsWith(ext));\n\t\t\t});\n\n\t\t\tif (eslintFiles.length === 0) return Promise.resolve();\n\t\t}\n\n\t\tconst args = [...eslintFiles];\n\n\t\targs.push(`--ext ${ESLINT_EXTENSIONS.join(\",\")}`);\n\t\targs.push(\"--cache\");\n\t\targs.push(\n\t\t\t`--cache-location ${resolveFromProjectDirectory(\n\t\t\t\t\"node_modules/.cache/.eslintcache\",\n\t\t\t)}`,\n\t\t);\n\t\t// @note: prevent errors when no matched file is found\n\t\targs.push(\"--no-error-on-unmatched-pattern\");\n\n\t\tconst gitIgnoreFile = resolveFromProjectDirectory(\".gitignore\");\n\n\t\tif (existsSync(gitIgnoreFile)) {\n\t\t\targs.push(`--ignore-path ${gitIgnoreFile}`);\n\t\t}\n\n\t\tif (options.isFixMode) {\n\t\t\targs.push(\"--fix\");\n\t\t}\n\n\t\ttry {\n\t\t\treturn await helpers.exec(`eslint ${args.join(\" \")}`);\n\t\t} catch (error) {\n\t\t\tthrow createError(\"eslint\", error);\n\t\t}\n\t};\n\nexport const checkLints = eslint({ isFixMode: false });\n\nexport const fixLints = eslint({ isFixMode: true });\n\nexport const fixFormatting = async (files: FilenameCollection) => {\n\tlet prettierFiles = [];\n\n\tif (files.length === 0) {\n\t\tprettierFiles.push(`\"**/!(${PRETTIER_IGNORE_FILES.join(\"|\")})\"`);\n\t} else {\n\t\tprettierFiles = files.filter((file) => {\n\t\t\treturn (\n\t\t\t\t!PRETTIER_IGNORE_FILES.some((filename) =>\n\t\t\t\t\tfile.endsWith(filename),\n\t\t\t\t) && // The root `README.md` file is ignored to prevent error due to its symbolic link nature when specified explicitly as a file\n\t\t\t\tfile !== \"README.md\"\n\t\t\t);\n\t\t});\n\n\t\tif (prettierFiles.length === 0) return Promise.resolve();\n\t}\n\n\tconst args = [...prettierFiles];\n\n\tif (existsSync(resolveFromProjectDirectory(\".gitignore\"))) {\n\t\targs.push(\"--ignore-path .gitignore\");\n\t}\n\n\targs.push(\"--write\");\n\targs.push(\"--ignore-unknown\");\n\targs.push(\"--no-error-on-unmatched-pattern\");\n\n\ttry {\n\t\treturn await helpers.exec(`prettier ${args.join(\" \")}`);\n\t} catch (error) {\n\t\tthrow createError(\"prettier\", error);\n\t}\n};\n\nexport const checkTypes = async () => {\n\ttry {\n\t\treturn await helpers.exec(\"pnpm --parallel exec tsc --noEmit\");\n\t} catch (error) {\n\t\tthrow createError(\"tsc\", error);\n\t}\n};\n\nexport const checkCommit = async () => {\n\ttry {\n\t\treturn await helpers.exec(\n\t\t\t'commitlint --extends \"@commitlint/config-conventional\" --edit',\n\t\t);\n\t} catch (error) {\n\t\tthrow createError(\"commitlint\", error);\n\t}\n};\n\nexport const createError = (bin: string, error: Error | string | unknown) => {\n\treturn new Error(`\\`${bin}\\` failed:\\n${String(error)}`);\n};\n\nexport const turbo = async (\n\tcommand: \"build\" | \"start\" | \"test\" | \"watch\",\n\toptions: Parameters<typeof helpers.exec>[1] = { hasLiveOutput: true },\n) => {\n\ttry {\n\t\treturn await helpers.exec(`turbo run ${command}`, options);\n\t} catch (error) {\n\t\tthrow createError(\"turbo\", error);\n\t}\n};\n\nexport const changeset = async (command: string) => {\n\ttry {\n\t\treturn await helpers.exec(command, {\n\t\t\thasLiveOutput: true,\n\t\t});\n\t} catch (error) {\n\t\tthrow createError(\"changeset\", error);\n\t}\n};\n\nconst TYPESCRIPT_EXTENSIONS = [\"ts\", \"tsx\", \"cts\", \"mts\"];\n/**\n * Extensions supported by ESLint.\n */\nconst ESLINT_EXTENSIONS = [\"js\", \"jsx\", \"cjs\", \"mjs\", ...TYPESCRIPT_EXTENSIONS];\nconst PRETTIER_IGNORE_FILES = [\"CHANGELOG.md\", \"pnpm-lock.yaml\"];\n\ntype FilenameCollection = string[];\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createBuildCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"build\",\n\t\t\tdescription: \"Build the project in production mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\");\n\t\t\t},\n\t\t});\n};\n", "import { checkCommit, checkLints, checkTypes, turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nconst onlyValues = [\"commit\", \"lint\", \"type\"] as const;\n\ntype Only = (typeof onlyValues)[number];\n\ntype CommandContext = {\n\tonly: Only | undefined;\n};\n\nexport const createCheckCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"check\",\n\t\t\tdescription: \"Check code health (static analysis)\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"only\",\n\t\t\tname: \"only\",\n\t\t\tdescription: `Run only one specified task (accepted value: ${onlyValues.join(\n\t\t\t\t\", \",\n\t\t\t)})`,\n\t\t\tdefaultValue: undefined,\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Preparing the project\"),\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\", { hasLiveOutput: false });\n\t\t\t},\n\t\t\tskip({ only }) {\n\t\t\t\treturn only === \"commit\"; // No need to build if only commitlint is run\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking linters\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tconst filenames = argv.operands;\n\n\t\t\t\tawait checkLints(filenames);\n\t\t\t},\n\t\t\tskip: ifOnlyDefinedAndNotEqualTo(\"lint\"),\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking types\"),\n\t\t\tasync handler() {\n\t\t\t\tawait checkTypes();\n\t\t\t},\n\t\t\tskip(context, argv) {\n\t\t\t\treturn (\n\t\t\t\t\tifOnlyDefinedAndNotEqualTo(\"type\")(context) ||\n\t\t\t\t\t!require.resolve(\"typescript\") ||\n\t\t\t\t\t// For now, skip type-checking if some files are passed down\n\t\t\t\t\t// @see: https://github.com/microsoft/TypeScript/issues/27379\n\t\t\t\t\targv.operands.length > 0\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking commit\"),\n\t\t\tasync handler() {\n\t\t\t\tawait checkCommit();\n\t\t\t},\n\t\t\tskip({ only }) {\n\t\t\t\treturn only !== \"commit\";\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83E\uDDD0`;\n\nconst ifOnlyDefinedAndNotEqualTo =\n\t(only: Only) => (context: CommandContext) => {\n\t\treturn context.only !== undefined && context.only !== only;\n\t};\n", "import { existsSync, readdirSync } from \"node:fs\";\nimport { helpers } from \"termost\";\n\nimport { resolveFromProjectDirectory } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tfiles: string[];\n};\n\nexport const createCleanCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"clean\",\n\t\t\tdescription: \"Clean the project\",\n\t\t})\n\t\t.task({\n\t\t\tkey: \"files\",\n\t\t\tlabel: label(\"Retrieving removable assets\"),\n\t\t\tasync handler() {\n\t\t\t\tconst cachePath = \"node_modules/.cache\";\n\t\t\t\tconst files = await retrieveIgnoredFiles();\n\n\t\t\t\tif (\n\t\t\t\t\tisDirectoryExistAndNotEmpty(\n\t\t\t\t\t\tresolveFromProjectDirectory(cachePath),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tfiles.push(cachePath);\n\t\t\t\t}\n\n\t\t\t\treturn files;\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel({ files }) {\n\t\t\t\treturn files.length > 0\n\t\t\t\t\t? label(\"Cleaning assets\")\n\t\t\t\t\t: \"Already clean \u2728\";\n\t\t\t},\n\t\t\tasync handler({ files }) {\n\t\t\t\tif (files.length === 0) return;\n\n\t\t\t\tawait cleanFiles(files);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\thandler({ files }) {\n\t\t\t\thelpers.message(`Removed assets: ${files.join(\", \")}\\n`, {\n\t\t\t\t\ttype: \"information\",\n\t\t\t\t});\n\t\t\t},\n\t\t\tskip({ files }) {\n\t\t\t\treturn files.length === 0;\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83E\uDDF9`;\n\nconst cleanFiles = async (files: string[]) => {\n\treturn helpers.exec(`rm -rf ${files.join(\" \")}`);\n};\n\nconst isDirectoryExistAndNotEmpty = (path: string) => {\n\treturn existsSync(path) && readdirSync(path).length > 0;\n};\n\nconst retrieveIgnoredFiles = async () => {\n\tconst rawFiles = await helpers.exec(\n\t\t`git clean -fdXn | grep -v '${PRESERVE_FILES.join(\n\t\t\t\"\\\\|\",\n\t\t)}' | cut -c 14-`,\n\t);\n\n\treturn rawFiles.split(/\\n/).filter(Boolean);\n};\n\nconst PRESERVE_FILES = [\"node_modules\", \".turbo\"];\n", "import { readFileSync, renameSync, writeFileSync } from \"node:fs\";\nimport { mkdir, symlink } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { helpers } from \"termost\";\n\nimport pkg from \"../../package.json\";\nimport defaultTemplateConfig from \"../../templates/default/config.json\";\nimport {\n\tbotMessage,\n\tcreateError,\n\tgetNpmVersion,\n\trequest,\n\tresolveFromProjectDirectory,\n\tresolveFromStackDirectory,\n\tsetPkgManager,\n} from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tdata: Record<\n\t\t| \"licenseYear\"\n\t\t| \"nodeVersion\"\n\t\t| \"npmVersion\"\n\t\t| \"projectDescription\"\n\t\t| \"projectName\"\n\t\t| \"projectUrl\"\n\t\t| \"repoId\",\n\t\tstring\n\t>;\n\tinputDescription: string;\n\tinputName: string;\n\tinputUrl: string;\n\tpreviousTaskError: Error | undefined;\n};\n\nexport const createCreateCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"create\",\n\t\t\tdescription: \"Scaffold a new project\",\n\t\t})\n\t\t.task({\n\t\t\thandler() {\n\t\t\t\tbotMessage(\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: `I'm Stack v${pkg.version}, your bot assistant`,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"I can guarantee you a project creation in under 1 minute \uD83D\uDE80\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"information\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputName\",\n\t\t\tlabel: \"What's your project name?\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputDescription\",\n\t\t\tlabel: \"How would you describe it?\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputUrl\",\n\t\t\tlabel: \"Where will it be stored? (Git remote URL)\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking pre-requisites\"),\n\t\t\tasync handler() {\n\t\t\t\t// Check pnpm availability by verifying its version\n\t\t\t\tawait getNpmVersion();\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tkey: \"data\",\n\t\t\tlabel: label(\"Evaluating contextual data\"),\n\t\t\tasync handler({ inputDescription, inputName, inputUrl }) {\n\t\t\t\tconst nodeVersion = (\n\t\t\t\t\tawait request.get(\n\t\t\t\t\t\t\"https://resolve-node.vercel.app/lts\",\n\t\t\t\t\t\t\"text\",\n\t\t\t\t\t)\n\t\t\t\t).replace(\"v\", \"\");\n\n\t\t\t\tconst npmVersion = (\n\t\t\t\t\tawait request.get(\n\t\t\t\t\t\t\"https://registry.npmjs.org/pnpm/latest\",\n\t\t\t\t\t\t\"json\",\n\t\t\t\t\t)\n\t\t\t\t).version as string;\n\n\t\t\t\tconst { repoName, repoOwner } =\n\t\t\t\t\t(inputUrl.startsWith(\"git\")\n\t\t\t\t\t\t? /^git@.*:(?<repoOwner>.*)\\/(?<repoName>.*)\\.git$/\n\t\t\t\t\t\t: /^https?:\\/\\/.*\\/(?<repoOwner>.*)\\/(?<repoName>.*)\\.git$/\n\t\t\t\t\t).exec(inputUrl)?.groups ?? {};\n\n\t\t\t\tif (!repoOwner || !repoName) {\n\t\t\t\t\tthrow createError(\n\t\t\t\t\t\t\"git\",\n\t\t\t\t\t\t\"The owner and repository name can not be extracted. Please make sure to follow either `/^git@.*:(?<repoOwner>.*)/(?<repoName>.*).git$/` or `/^https?://.*/(?<repoOwner>.*)/(?<repoName>.*).git$/` pattern.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tlicenseYear: new Date().getFullYear().toString(),\n\t\t\t\t\tnodeVersion,\n\t\t\t\t\tnpmVersion,\n\t\t\t\t\tprojectDescription:\n\t\t\t\t\t\tinputDescription.charAt(0).toUpperCase() +\n\t\t\t\t\t\tinputDescription.slice(1), // Enforce upper case for the first letter\n\t\t\t\t\tprojectName: inputName.toLowerCase(), // Enforce lower case for folder and package name\n\t\t\t\t\tprojectUrl: inputUrl,\n\t\t\t\t\tprojectVersion: \"0.0.0\",\n\t\t\t\t\trepoId: `${repoOwner}/${repoName}`,\n\t\t\t\t};\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel({ data }) {\n\t\t\t\treturn label(`Creating \\`${data.projectName}\\` folder`);\n\t\t\t},\n\t\t\tasync handler({ data }) {\n\t\t\t\tconst projectPath = resolve(process.cwd(), data.projectName);\n\n\t\t\t\tawait mkdir(projectPath);\n\t\t\t\tprocess.chdir(projectPath);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Initializing `git`\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\tawait helpers.exec(\"git init\");\n\t\t\t\tawait helpers.exec(`git remote add origin ${data.projectUrl}`);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Applying default template\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\tawait extractTemplate();\n\n\t\t\t\t// Hydrate template expressions with context values:\n\t\t\t\tconst engine = createTemplateEngine(\n\t\t\t\t\tdefaultTemplateConfig,\n\t\t\t\t\tdata,\n\t\t\t\t);\n\n\t\t\t\tengine.hydrate();\n\t\t\t\tengine.rename();\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing dependencies\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\tconst localDevDependencies = [\"quickbundle\", \"vitest\"];\n\n\t\t\t\tconst globalDevDependencies = [\n\t\t\t\t\t\"@adbayb/eslint-config\",\n\t\t\t\t\t\"@adbayb/prettier-config\",\n\t\t\t\t\t\"@adbayb/ts-config\",\n\t\t\t\t\t\"@adbayb/stack\",\n\t\t\t\t];\n\n\t\t\t\ttry {\n\t\t\t\t\tawait helpers.exec(\n\t\t\t\t\t\t`pnpm add ${globalDevDependencies.join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t)} --save-dev --ignore-workspace-root-check`,\n\t\t\t\t\t);\n\n\t\t\t\t\tawait helpers.exec(\n\t\t\t\t\t\t`pnpm add ${localDevDependencies.join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t)} --save-dev --filter ${data.projectName}`,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow createError(\"pnpm\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tkey: \"previousTaskError\",\n\t\t\tlabel: label(\"Cleaning up\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\ttry {\n\t\t\t\t\t// Symlink the package `README.md` file to the root project directory\n\t\t\t\t\tawait symlink(\n\t\t\t\t\t\t`./${data.projectName}/README.md`,\n\t\t\t\t\t\t\"./README.md\",\n\t\t\t\t\t);\n\t\t\t\t\t// Set the Node package manager runtime by following the `packageManager` field instruction\n\t\t\t\t\tawait setPkgManager();\n\t\t\t\t\t// Run install command to add git hooks\n\t\t\t\t\tawait helpers.exec(\"stack install\");\n\t\t\t\t\t// Commit (and run check/fix command via git hooks)\n\t\t\t\t\tawait helpers.exec(\"git add -A\");\n\t\t\t\t\tawait helpers.exec('git commit -m \"chore: initial commit\"');\n\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn error as Error;\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\thandler({ data, previousTaskError }) {\n\t\t\t\tif (previousTaskError) {\n\t\t\t\t\tbotMessage(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Oops, an error occurred\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Keep calm and carry on with some coffee \u2615\uFE0F\",\n\t\t\t\t\t\t\tbody: String(previousTaskError),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbotMessage(\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: \"The project was successfully created\",\n\t\t\t\t\t\tdescription: `Run \\`cd ./${data.projectName}\\` and Enjoy \uD83D\uDE80`,\n\t\t\t\t\t},\n\t\t\t\t\t{ type: \"success\" },\n\t\t\t\t);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDD28`;\n\n/**\n * A simple template engine to evaluate dynamic expressions and apply side effets (such as hydrating a content with values from an input object) on impacted template files.\n * @param config - Configuration object listing template files/folders that need expression evaluation.\n * @param input - Input object mapping the template expression key with its corresponding value.\n * @returns Engine functions.\n * @example\n * createTemplateEngine(\n * \t{ files: [\"./templateA.ts\"], folders: [\"./folderB\"] },\n * \t{ toReplace: \"value\" },\n * );\n */\nconst createTemplateEngine = (\n\tconfig: Record<\"files\" | \"folders\", string[]>,\n\tinput: CommandContext[\"data\"],\n) => {\n\tconst evaluate = (expression: string) => {\n\t\treturn expression.replace(\n\t\t\t/{{(.*?)}}/g,\n\t\t\t(_, key: keyof CommandContext[\"data\"]) => input[key] || \"\",\n\t\t);\n\t};\n\n\treturn {\n\t\thydrate() {\n\t\t\tfor (const filename of config.files) {\n\t\t\t\tconst filepath = resolveFromProjectDirectory(filename);\n\t\t\t\tconst content = readFileSync(filepath, \"utf-8\");\n\n\t\t\t\twriteFileSync(filepath, evaluate(content));\n\t\t\t}\n\t\t},\n\t\trename() {\n\t\t\ttry {\n\t\t\t\tfor (const pathname of config.folders) {\n\t\t\t\t\trenameSync(\n\t\t\t\t\t\tresolveFromProjectDirectory(pathname),\n\t\t\t\t\t\tresolveFromProjectDirectory(evaluate(pathname)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Silent error in case of stack re-creation\n\t\t\t}\n\t\t},\n\t};\n};\n\nconst extractTemplate = async () => {\n\tconst compressedFilePath = resolve(\n\t\tresolveFromStackDirectory(\"./templates\"),\n\t\t\"./default/content.tar.gz\",\n\t);\n\n\tconst destinationPath = resolveFromProjectDirectory(\"./\");\n\n\treturn helpers.exec(\n\t\t`tar -xzf ${compressedFilePath} -C ${destinationPath} --strip-components=1`,\n\t);\n};\n", "{\n\t\"name\": \"@adbayb/stack\",\n\t\"version\": \"1.15.0\",\n\t\"description\": \"My opinionated toolchain\",\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"files\": [\n\t\t\"bin\",\n\t\t\"dist\",\n\t\t\"templates\"\n\t],\n\t\"bin\": {\n\t\t\"stack\": \"bin/index.cjs\"\n\t},\n\t\"source\": \"src/index.ts\",\n\t\"main\": \"dist/index.cjs\",\n\t\"platform\": \"node\",\n\t\"scripts\": {\n\t\t\"prepublishOnly\": \"pnpm build\",\n\t\t\"prestart\": \"pnpm build\",\n\t\t\"start\": \"bin/index.js\",\n\t\t\"build\": \"quickbundle build\",\n\t\t\"watch\": \"quickbundle watch\"\n\t},\n\t\"keywords\": [\n\t\t\"stack\",\n\t\t\"scripts\",\n\t\t\"toolchain\",\n\t\t\"development\"\n\t],\n\t\"author\": {\n\t\t\"name\": \"Ayoub Adib\",\n\t\t\"email\": \"adbayb@gmail.com\",\n\t\t\"url\": \"https://twitter.com/adbayb\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/adbayb/stack.git\",\n\t\t\"directory\": \"stack\"\n\t},\n\t\"license\": \"MIT\",\n\t\"dependencies\": {\n\t\t\"@changesets/changelog-github\": \"^0.5.0\",\n\t\t\"@changesets/cli\": \"^2.27.1\",\n\t\t\"@commitlint/cli\": \"^18.4.3\",\n\t\t\"@commitlint/config-conventional\": \"^18.4.3\",\n\t\t\"eslint\": \"^8.56.0\",\n\t\t\"prettier\": \"^3.1.1\",\n\t\t\"termost\": \"^0.12.0\",\n\t\t\"turbo\": \"^1.11.2\",\n\t\t\"typescript\": \"^5.3.3\"\n\t}\n}\n", "{\n\t\"files\": [\n\t\t\".nvmrc\",\n\t\t\"CONTRIBUTING.md\",\n\t\t\"LICENSE\",\n\t\t\"package.json\",\n\t\t\"pnpm-workspace.yaml\",\n\t\t\".changeset/config.json\",\n\t\t\".changeset/welcome.md\",\n\t\t\".github/PULL_REQUEST_TEMPLATE.md\",\n\t\t\"{{projectName}}/package.json\",\n\t\t\"{{projectName}}/README.md\",\n\t\t\"examples/default/package.json\",\n\t\t\"examples/default/src/index.ts\"\n\t],\n\t\"folders\": [\"{{projectName}}\"]\n}\n", "import { fixFormatting, fixLints, turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createFixCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"fix\",\n\t\t\tdescription: \"Fix auto-fixable issues\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Preparing the project\"),\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\", { hasLiveOutput: false });\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Fixing lints\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tawait fixLints(argv.operands);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Fixing formatting\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tawait fixFormatting(argv.operands);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDE91`;\n", "import { chmod, writeFile } from \"node:fs/promises\";\n\nimport { getStackCommand, resolveFromProjectDirectory } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createInstallCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"install\",\n\t\t\tdescription: \"Setup initial requirements\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing `git.pre-commit` hook\"),\n\t\t\tasync handler() {\n\t\t\t\tawait installGitHook(\n\t\t\t\t\t\"pre-commit\",\n\t\t\t\t\t`${getStackCommand(\n\t\t\t\t\t\t\"fix $(git status --porcelain | awk 'BEGIN{ ORS=\\\" \\\" } { print $2 }')\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t)} && git add -A`,\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing `git.commit-msg` hook\"),\n\t\t\tasync handler() {\n\t\t\t\tawait installGitHook(\n\t\t\t\t\t\"commit-msg\",\n\t\t\t\t\t`${getStackCommand(\"check --only commit\", false)}`,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDCF2`;\n\nconst installGitHook = async (\n\thook: \"commit-msg\" | \"pre-commit\",\n\tcontent: string,\n) => {\n\tconst filename = resolveFromProjectDirectory(`.git/hooks/${hook}`);\n\n\tawait writeFile(filename, content);\n\n\treturn chmod(filename, \"0755\");\n};\n", "import { helpers } from \"termost\";\n\nimport { changeset } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tlog: boolean;\n\tpublish: boolean;\n\ttag: boolean;\n};\n\nexport const createReleaseCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"release\",\n\t\t\tdescription: \"Log, version, and publish package(s)\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"log\",\n\t\t\tname: \"log\",\n\t\t\tdescription: \"Add a new changelog entry\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"tag\",\n\t\t\tname: \"tag\",\n\t\t\tdescription: \"Bump the package(s) version\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"publish\",\n\t\t\tname: \"publish\",\n\t\t\tdescription: \"Publish package(s) to the registry\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"New changelog entry\\n\");\n\n\t\t\t\tawait changeset(\"changeset\");\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"log\"),\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"Bumping the package(s) version\\n\");\n\n\t\t\t\tawait changeset(\n\t\t\t\t\t\"changeset version && pnpm install --no-frozen-lockfile\",\n\t\t\t\t);\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"tag\"),\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"Publishing package(s) to the registry\\n\");\n\n\t\t\t\tawait changeset(\"stack build && pnpm changeset publish\");\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"publish\"),\n\t\t});\n};\n\nconst ifNotEqualTo =\n\t(validOption: keyof CommandContext) => (context: CommandContext) => {\n\t\treturn !context[validOption];\n\t};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createStartCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"start\",\n\t\t\tdescription: \"Start the project in production mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"start\");\n\t\t\t},\n\t\t});\n};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createTestCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"test\",\n\t\t\tdescription: \"Test the code execution\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"test\");\n\t\t\t},\n\t\t});\n};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createWatchCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"watch\",\n\t\t\tdescription: \"Build and start the project in development mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"watch\");\n\t\t\t},\n\t\t});\n};\n"],
5
- "mappings": ";qeAEA,IAAAA,GAAwB,mBCFxB,IAAAC,EAA2B,cAC3BC,EAAwB,gBACxBC,EAAwB,mBAsBXC,EAAa,CACzBC,EACAC,IACI,CACJ,UAAQ,QACP;AAAA;AAAA,0BAESD,EAAM;AAAA,WACXC,GAAS,OAAS,QAAU,SAAM,oBAAUD,EAAM;AAAA;AAAA,EAGtDA,EAAM,KAEJ;AAAA,EACFA,EAAM;AAAA,EAFJ,KAKFC,CACD,CACD,EASaC,EAA+BC,MACpC,WAAQ,QAAQ,IAAI,EAAGA,CAAI,EAUtBC,EAA6BD,MAClC,WAAQ,UAAW,MAAOA,CAAI,EAiB/B,IAAME,EAAgB,SAAY,CACxC,GAAI,CACH,OAAO,MAAM,UAAQ,KAAK,SAAS,CACpC,MAAE,CACD,MAAMC,EACL,OACA,yHACD,CACD,CACD,EAEaC,EAAkB,CAACC,EAAiBC,EAAgB,KAIzD,CAAC,GAAIA,EAAgB,CAAC,EAAI,CAAC,UAAU,EAAI,SAASD,GAAS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KAAM,QACN,YAAa,iDACd,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,MAAMC,EAAM,OAAO,CACpB,CACD,CAAC,CACH,EbEA,IAAMC,GAAgB,IAAIC,IAAuC,CAChE,IAAMC,KAAU,YAAQ,CACvB,KAAM,QACN,YAAa,mDACd,CAAC,EAED,QAAWC,KAAkBF,EAC5BE,EAAeD,CAAO,CAExB,EAEAF,GACCI,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,EACD",
6
- "names": ["import_termost", "import_node_fs", "import_node_path", "import_termost", "botMessage", "input", "options", "resolveFromProjectDirectory", "path", "resolveFromStackDirectory", "getNpmVersion", "createError", "getStackCommand", "command", "isNodeRuntime", "setPkgManager", "request", "url", "responseType", "response", "eslint", "options", "files", "eslintFiles", "file", "ESLINT_EXTENSIONS", "ext", "args", "resolveFromProjectDirectory", "gitIgnoreFile", "error", "checkLints", "fixLints", "fixFormatting", "prettierFiles", "PRETTIER_IGNORE_FILES", "filename", "checkTypes", "checkCommit", "bin", "turbo", "changeset", "TYPESCRIPT_EXTENSIONS", "createBuildCommand", "program", "turbo", "onlyValues", "createCheckCommand", "program", "label", "turbo", "only", "_", "argv", "filenames", "checkLints", "ifOnlyDefinedAndNotEqualTo", "checkTypes", "context", "checkCommit", "message", "import_node_fs", "import_termost", "createCleanCommand", "program", "label", "cachePath", "files", "retrieveIgnoredFiles", "isDirectoryExistAndNotEmpty", "resolveFromProjectDirectory", "cleanFiles", "message", "path", "PRESERVE_FILES", "import_node_fs", "import_promises", "import_node_path", "import_termost", "package_default", "config_default", "createCreateCommand", "program", "botMessage", "package_default", "label", "getNpmVersion", "inputDescription", "inputName", "inputUrl", "nodeVersion", "request", "npmVersion", "repoName", "repoOwner", "createError", "data", "projectPath", "extractTemplate", "engine", "createTemplateEngine", "config_default", "localDevDependencies", "globalDevDependencies", "error", "setPkgManager", "previousTaskError", "message", "config", "input", "evaluate", "expression", "_", "key", "filename", "filepath", "resolveFromProjectDirectory", "content", "pathname", "compressedFilePath", "resolveFromStackDirectory", "destinationPath", "createFixCommand", "program", "label", "turbo", "_", "argv", "fixLints", "fixFormatting", "message", "import_promises", "createInstallCommand", "program", "label", "installGitHook", "getStackCommand", "message", "hook", "content", "filename", "resolveFromProjectDirectory", "import_termost", "createReleaseCommand", "program", "changeset", "ifNotEqualTo", "validOption", "context", "createStartCommand", "program", "turbo", "createTestCommand", "program", "turbo", "createWatchCommand", "program", "turbo", "createProgram", "commandFactories", "program", "commandBuilder", "createCreateCommand", "createInstallCommand", "createCleanCommand", "createCheckCommand", "createFixCommand", "createStartCommand", "createBuildCommand", "createWatchCommand", "createTestCommand", "createReleaseCommand"]
3
+ "sources": ["../src/index.ts", "../src/helpers.ts", "../src/commands/build.ts", "../src/commands/check.ts", "../src/commands/clean.ts", "../src/commands/create.ts", "../package.json", "../src/commands/fix.ts", "../src/commands/install.ts", "../src/commands/release.ts", "../src/commands/start.ts", "../src/commands/test.ts", "../src/commands/watch.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n\nimport { termost } from \"termost\";\n\nimport { createBuildCommand } from \"./commands/build\";\nimport { createCheckCommand } from \"./commands/check\";\nimport { createCleanCommand } from \"./commands/clean\";\nimport { createCreateCommand } from \"./commands/create\";\nimport { createFixCommand } from \"./commands/fix\";\nimport { createInstallCommand } from \"./commands/install\";\nimport { createReleaseCommand } from \"./commands/release\";\nimport { createStartCommand } from \"./commands/start\";\nimport { createTestCommand } from \"./commands/test\";\nimport { createWatchCommand } from \"./commands/watch\";\nimport type { CommandFactory } from \"./types\";\n\nconst createProgram = (...commandFactories: CommandFactory[]) => {\n\tconst program = termost({\n\t\tname: \"stack\",\n\t\tdescription: \"Toolbox to easily scaffold and maintain a project\",\n\t});\n\n\tfor (const commandBuilder of commandFactories) {\n\t\tcommandBuilder(program);\n\t}\n};\n\ncreateProgram(\n\tcreateCreateCommand,\n\tcreateInstallCommand,\n\tcreateCleanCommand,\n\tcreateCheckCommand,\n\tcreateFixCommand,\n\tcreateStartCommand,\n\tcreateBuildCommand,\n\tcreateWatchCommand,\n\tcreateTestCommand,\n\tcreateReleaseCommand,\n);\n", "import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { helpers } from \"termost\";\n\n/**\n * Helper to format log messages with a welcoming bot.\n * @param input - Message factory.\n * @param input.title - Title input.\n * @param input.description - Description input.\n * @param input.body - Body input.\n * @param options - Formatting option.\n * @example\n * botMessage(\n *\t{\n * \t\ttitle: \"Oops, an error occurred\",\n * \t\tdescription:\n * \t\t\t\"Keep calm and carry on with some coffee \u2615\uFE0F\",\n * \t\tbody: String(previousTaskError),\n * \t},\n * \t{\n * \t\ttype: \"error\",\n * \t},\n * );\n */\nexport const botMessage = (\n\tinput: { title: string; description: string; body?: string },\n\toptions: Parameters<typeof helpers.message>[1],\n) => {\n\thelpers.message(\n\t\t`\n\u256D\u2500\u2500\u2500\u2500\u2500\u256E\n\u2502 \u25E0 \u25E0 ${input.title}\n\u2502 ${options?.type === \"error\" ? \"\u25E0\" : \"\u25E1\"} \u2502 ${input.description}\n\u2570\u2500\u2500\u2500\u2500\u2500\u256F\n${\n\t!input.body\n\t\t? \"\"\n\t\t: `\n${input.body}\n`\n}`,\n\t\toptions,\n\t);\n};\n\n/**\n * Resolve a relative path to an absolute one resolved from the generated project root directory.\n * @param path - The relative path.\n * @returns The resolved absolute path.\n * @example\n * resolveFromProjectDirectory(\".gitignore\");\n */\nexport const resolveFromProjectDirectory = (path: string) => {\n\treturn resolve(process.cwd(), path);\n};\n\n/**\n * Resolve a relative path to an absolute one resolved from the `stack` node module directory.\n * @param path - The relative path.\n * @returns The resolved absolute path.\n * @example\n * resolveFromStackDirectory(\"./templates\");\n */\nexport const resolveFromStackDirectory = (path: string) => {\n\treturn resolve(__dirname, \"../\", path);\n};\n\nexport const getRepositoryUrl = async () => {\n\ttry {\n\t\t// This step is used as well to persist the repository url value:\n\t\treturn await helpers.exec(\"git config --get remote.origin.url\");\n\t} catch (error) {\n\t\tthrow createError(\n\t\t\t\"git\",\n\t\t\t`The project must be a \\`git\\` repository with an origin already setup. Have you tried to run \\`git init && git remote add origin git@github.com:OWNER/REPOSITORY.git && git add -A && git commit -m \"chore: initial commit\" && git push -u origin main\\`?\\n${String(\n\t\t\t\terror,\n\t\t\t)}`,\n\t\t);\n\t}\n};\n\nexport const getNpmVersion = async () => {\n\ttry {\n\t\treturn await helpers.exec(\"pnpm -v\");\n\t} catch (error) {\n\t\tthrow createError(\n\t\t\t\"pnpm\",\n\t\t\t\"The project must use `pnpm` as a node package manager tool. Follow this installation guide https://pnpm.io/installation\",\n\t\t);\n\t}\n};\n\nexport const getStackCommand = (command: string, isNodeRuntime = true) => {\n\t// @note: `isNodeRuntime` allows executing node bin executables in a non node environment such as in git hooks context\n\t// Npx is used to make executable resolution independent from the build tool (npx is the built-in Node tool)\n\t// `--no` flag to prevent installation prompt and throw an error if the binary is not installed\n\treturn [...(isNodeRuntime ? [] : [\"npx --no\"]), `stack ${command}`].join(\n\t\t\" \",\n\t);\n};\n\nexport const setPkgManager = async () => {\n\treturn helpers.exec(\"corepack enable\");\n};\n\nexport const request = {\n\tasync get<ResponseType extends \"json\" | \"text\">(\n\t\turl: string,\n\t\tresponseType: ResponseType,\n\t) {\n\t\tconst response = await fetch(url);\n\n\t\tif (!response.ok) {\n\t\t\tthrow createError(\n\t\t\t\t\"fetch\",\n\t\t\t\t`Failed to fetch resources from ${url} (${JSON.stringify({\n\t\t\t\t\tstatus: response.status,\n\t\t\t\t\tstatusText: response.statusText,\n\t\t\t\t})})`,\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\tresponseType === \"text\" ? response.text() : response.json()\n\t\t) as Promise<\n\t\t\tResponseType extends \"text\" ? string : Record<string, string>\n\t\t>;\n\t},\n};\n\nconst eslint =\n\t(options: { isFixMode: boolean }) =>\n\tasync (files: FilenameCollection = []) => {\n\t\tlet eslintFiles = [];\n\n\t\tif (files.length === 0) {\n\t\t\teslintFiles.push(\".\");\n\t\t} else {\n\t\t\teslintFiles = files.filter((file) => {\n\t\t\t\treturn ESLINT_EXTENSIONS.some((ext) => file.endsWith(ext));\n\t\t\t});\n\n\t\t\tif (eslintFiles.length === 0) return Promise.resolve();\n\t\t}\n\n\t\tconst args = [...eslintFiles];\n\n\t\targs.push(`--ext ${ESLINT_EXTENSIONS.join(\",\")}`);\n\t\targs.push(\"--cache\");\n\t\targs.push(\n\t\t\t`--cache-location ${resolveFromProjectDirectory(\n\t\t\t\t\"node_modules/.cache/.eslintcache\",\n\t\t\t)}`,\n\t\t);\n\t\t// @note: prevent errors when no matched file is found\n\t\targs.push(\"--no-error-on-unmatched-pattern\");\n\n\t\tconst gitIgnoreFile = resolveFromProjectDirectory(\".gitignore\");\n\n\t\tif (existsSync(gitIgnoreFile)) {\n\t\t\targs.push(`--ignore-path ${gitIgnoreFile}`);\n\t\t}\n\n\t\tif (options.isFixMode) {\n\t\t\targs.push(\"--fix\");\n\t\t}\n\n\t\ttry {\n\t\t\treturn await helpers.exec(`eslint ${args.join(\" \")}`);\n\t\t} catch (error) {\n\t\t\tthrow createError(\"eslint\", error);\n\t\t}\n\t};\n\nexport const checkLints = eslint({ isFixMode: false });\n\nexport const fixLints = eslint({ isFixMode: true });\n\nexport const fixFormatting = async (files: FilenameCollection) => {\n\tlet prettierFiles = [];\n\n\tif (files.length === 0) {\n\t\tprettierFiles.push(`\"**/!(${PRETTIER_IGNORE_FILES.join(\"|\")})\"`);\n\t} else {\n\t\tprettierFiles = files.filter((file) => {\n\t\t\treturn (\n\t\t\t\t!PRETTIER_IGNORE_FILES.some((filename) =>\n\t\t\t\t\tfile.endsWith(filename),\n\t\t\t\t) && // The root `README.md` file is ignored to prevent error due to its symbolic link nature when specified explicitly as a file\n\t\t\t\tfile !== \"README.md\"\n\t\t\t);\n\t\t});\n\n\t\tif (prettierFiles.length === 0) return Promise.resolve();\n\t}\n\n\tconst args = [...prettierFiles];\n\n\tif (existsSync(resolveFromProjectDirectory(\".gitignore\"))) {\n\t\targs.push(\"--ignore-path .gitignore\");\n\t}\n\n\targs.push(\"--write\");\n\targs.push(\"--ignore-unknown\");\n\targs.push(\"--no-error-on-unmatched-pattern\");\n\n\ttry {\n\t\treturn await helpers.exec(`prettier ${args.join(\" \")}`);\n\t} catch (error) {\n\t\tthrow createError(\"prettier\", error);\n\t}\n};\n\nexport const checkTypes = async () => {\n\ttry {\n\t\treturn await helpers.exec(\"pnpm --parallel exec tsc --noEmit\");\n\t} catch (error) {\n\t\tthrow createError(\"tsc\", error);\n\t}\n};\n\nexport const checkCommit = async () => {\n\ttry {\n\t\treturn await helpers.exec(\n\t\t\t'commitlint --extends \"@commitlint/config-conventional\" --edit',\n\t\t);\n\t} catch (error) {\n\t\tthrow createError(\"commitlint\", error);\n\t}\n};\n\nexport const createError = (bin: string, error: Error | string | unknown) => {\n\treturn new Error(`\\`${bin}\\` failed:\\n${String(error)}`);\n};\n\nexport const turbo = async (\n\tcommand: \"build\" | \"start\" | \"test\" | \"watch\",\n\toptions: Parameters<typeof helpers.exec>[1] = { hasLiveOutput: true },\n) => {\n\ttry {\n\t\treturn await helpers.exec(`turbo run ${command}`, options);\n\t} catch (error) {\n\t\tthrow createError(\"turbo\", error);\n\t}\n};\n\nexport const changeset = async (command: string) => {\n\ttry {\n\t\treturn await helpers.exec(command, {\n\t\t\thasLiveOutput: true,\n\t\t});\n\t} catch (error) {\n\t\tthrow createError(\"changeset\", error);\n\t}\n};\n\nconst TYPESCRIPT_EXTENSIONS = [\"ts\", \"tsx\", \"cts\", \"mts\"];\n/**\n * Extensions supported by ESLint.\n */\nconst ESLINT_EXTENSIONS = [\"js\", \"jsx\", \"cjs\", \"mjs\", ...TYPESCRIPT_EXTENSIONS];\nconst PRETTIER_IGNORE_FILES = [\"CHANGELOG.md\", \"pnpm-lock.yaml\"];\n\ntype FilenameCollection = string[];\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createBuildCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"build\",\n\t\t\tdescription: \"Build the project in production mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\");\n\t\t\t},\n\t\t});\n};\n", "import { checkCommit, checkLints, checkTypes, turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nconst onlyValues = [\"commit\", \"lint\", \"type\"] as const;\n\ntype Only = (typeof onlyValues)[number];\n\ntype CommandContext = {\n\tonly: Only | undefined;\n};\n\nexport const createCheckCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"check\",\n\t\t\tdescription: \"Check code health (static analysis)\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"only\",\n\t\t\tname: \"only\",\n\t\t\tdescription: `Run only one specified task (accepted value: ${onlyValues.join(\n\t\t\t\t\", \",\n\t\t\t)})`,\n\t\t\tdefaultValue: undefined,\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Preparing the project\"),\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\", { hasLiveOutput: false });\n\t\t\t},\n\t\t\tskip({ only }) {\n\t\t\t\treturn only === \"commit\"; // No need to build if only commitlint is run\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking linters\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tconst filenames = argv.operands;\n\n\t\t\t\tawait checkLints(filenames);\n\t\t\t},\n\t\t\tskip: ifOnlyDefinedAndNotEqualTo(\"lint\"),\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking types\"),\n\t\t\tasync handler() {\n\t\t\t\tawait checkTypes();\n\t\t\t},\n\t\t\tskip(context, argv) {\n\t\t\t\treturn (\n\t\t\t\t\tifOnlyDefinedAndNotEqualTo(\"type\")(context) ||\n\t\t\t\t\t!require.resolve(\"typescript\") ||\n\t\t\t\t\t// For now, skip type-checking if some files are passed down\n\t\t\t\t\t// @see: https://github.com/microsoft/TypeScript/issues/27379\n\t\t\t\t\targv.operands.length > 0\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking commit\"),\n\t\t\tasync handler() {\n\t\t\t\tawait checkCommit();\n\t\t\t},\n\t\t\tskip({ only }) {\n\t\t\t\treturn only !== \"commit\";\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83E\uDDD0`;\n\nconst ifOnlyDefinedAndNotEqualTo =\n\t(only: Only) => (context: CommandContext) => {\n\t\treturn context.only !== undefined && context.only !== only;\n\t};\n", "import { existsSync, readdirSync } from \"node:fs\";\nimport { helpers } from \"termost\";\n\nimport { resolveFromProjectDirectory } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tfiles: string[];\n};\n\nexport const createCleanCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"clean\",\n\t\t\tdescription: \"Clean the project\",\n\t\t})\n\t\t.task({\n\t\t\tkey: \"files\",\n\t\t\tlabel: label(\"Retrieving removable assets\"),\n\t\t\tasync handler() {\n\t\t\t\tconst cachePath = \"node_modules/.cache\";\n\t\t\t\tconst files = await retrieveIgnoredFiles();\n\n\t\t\t\tif (\n\t\t\t\t\tisDirectoryExistAndNotEmpty(\n\t\t\t\t\t\tresolveFromProjectDirectory(cachePath),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tfiles.push(cachePath);\n\t\t\t\t}\n\n\t\t\t\treturn files;\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel({ files }) {\n\t\t\t\treturn files.length > 0\n\t\t\t\t\t? label(\"Cleaning assets\")\n\t\t\t\t\t: \"Already clean \u2728\";\n\t\t\t},\n\t\t\tasync handler({ files }) {\n\t\t\t\tif (files.length === 0) return;\n\n\t\t\t\tawait cleanFiles(files);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\thandler({ files }) {\n\t\t\t\thelpers.message(`Removed assets: ${files.join(\", \")}\\n`, {\n\t\t\t\t\ttype: \"information\",\n\t\t\t\t});\n\t\t\t},\n\t\t\tskip({ files }) {\n\t\t\t\treturn files.length === 0;\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83E\uDDF9`;\n\nconst cleanFiles = async (files: string[]) => {\n\treturn helpers.exec(`rm -rf ${files.join(\" \")}`);\n};\n\nconst isDirectoryExistAndNotEmpty = (path: string) => {\n\treturn existsSync(path) && readdirSync(path).length > 0;\n};\n\nconst retrieveIgnoredFiles = async () => {\n\tconst rawFiles = await helpers.exec(\n\t\t`git clean -fdXn | grep -v '${PRESERVE_FILES.join(\n\t\t\t\"\\\\|\",\n\t\t)}' | cut -c 14-`,\n\t);\n\n\treturn rawFiles.split(/\\n/).filter(Boolean);\n};\n\nconst PRESERVE_FILES = [\"node_modules\", \".turbo\"];\n", "import { fdir } from \"fdir\";\nimport { cpSync, readFileSync, renameSync, writeFileSync } from \"node:fs\";\nimport { mkdir, symlink } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { helpers } from \"termost\";\n\nimport pkg from \"../../package.json\";\nimport {\n\tbotMessage,\n\tcreateError,\n\tgetNpmVersion,\n\trequest,\n\tresolveFromProjectDirectory,\n\tresolveFromStackDirectory,\n\tsetPkgManager,\n} from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tdata: Record<\n\t\t| \"licenseYear\"\n\t\t| \"nodeVersion\"\n\t\t| \"npmVersion\"\n\t\t| \"projectDescription\"\n\t\t| \"projectName\"\n\t\t| \"projectUrl\"\n\t\t| \"repoId\",\n\t\tstring\n\t>;\n\terror: Error | undefined;\n\tinputDescription: string;\n\tinputName: string;\n\tinputUrl: string;\n};\n\nexport const createCreateCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"create\",\n\t\t\tdescription: \"Scaffold a new project\",\n\t\t})\n\t\t.task({\n\t\t\thandler() {\n\t\t\t\tbotMessage(\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: `I'm Stack v${pkg.version}, your bot assistant`,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\"I can guarantee you a project creation in under 1 minute \uD83D\uDE80\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"information\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputName\",\n\t\t\tlabel: \"What's your project name?\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputDescription\",\n\t\t\tlabel: \"How would you describe it?\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.input({\n\t\t\tkey: \"inputUrl\",\n\t\t\tlabel: \"Where will it be stored? (Git remote URL)\",\n\t\t\ttype: \"text\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Checking pre-requisites\"),\n\t\t\tasync handler() {\n\t\t\t\t// Check pnpm availability by verifying its version\n\t\t\t\tawait getNpmVersion();\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tkey: \"data\",\n\t\t\tlabel: label(\"Evaluating contextual data\"),\n\t\t\tasync handler({ inputDescription, inputName, inputUrl }) {\n\t\t\t\tconst nodeVersion = (\n\t\t\t\t\tawait request.get(\n\t\t\t\t\t\t\"https://resolve-node.vercel.app/lts\",\n\t\t\t\t\t\t\"text\",\n\t\t\t\t\t)\n\t\t\t\t).replace(\"v\", \"\");\n\n\t\t\t\tconst npmVersion = (\n\t\t\t\t\tawait request.get(\n\t\t\t\t\t\t\"https://registry.npmjs.org/pnpm/latest\",\n\t\t\t\t\t\t\"json\",\n\t\t\t\t\t)\n\t\t\t\t).version as string;\n\n\t\t\t\tconst { repoName, repoOwner } =\n\t\t\t\t\t(inputUrl.startsWith(\"git\")\n\t\t\t\t\t\t? /^git@.*:(?<repoOwner>.*)\\/(?<repoName>.*)\\.git$/\n\t\t\t\t\t\t: /^https?:\\/\\/.*\\/(?<repoOwner>.*)\\/(?<repoName>.*)\\.git$/\n\t\t\t\t\t).exec(inputUrl)?.groups ?? {};\n\n\t\t\t\tif (!repoOwner || !repoName) {\n\t\t\t\t\tthrow createError(\n\t\t\t\t\t\t\"git\",\n\t\t\t\t\t\t\"The owner and repository name can not be extracted. Please make sure to follow either `/^git@.*:(?<repoOwner>.*)/(?<repoName>.*).git$/` or `/^https?://.*/(?<repoOwner>.*)/(?<repoName>.*).git$/` pattern.\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tlicenseYear: new Date().getFullYear().toString(),\n\t\t\t\t\tnodeVersion,\n\t\t\t\t\tnpmVersion,\n\t\t\t\t\tprojectDescription:\n\t\t\t\t\t\tinputDescription.charAt(0).toUpperCase() +\n\t\t\t\t\t\tinputDescription.slice(1), // Enforce upper case for the first letter\n\t\t\t\t\tprojectName: inputName.toLowerCase(), // Enforce lower case for folder and package name\n\t\t\t\t\tprojectUrl: inputUrl,\n\t\t\t\t\trepoId: `${repoOwner}/${repoName}`,\n\t\t\t\t};\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel({ data }) {\n\t\t\t\treturn label(`Creating \\`${data.projectName}\\` folder`);\n\t\t\t},\n\t\t\tasync handler({ data }) {\n\t\t\t\tconst projectPath = resolve(process.cwd(), data.projectName);\n\n\t\t\t\tawait mkdir(projectPath);\n\t\t\t\tprocess.chdir(projectPath);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Initializing `git`\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\tawait helpers.exec(\"git init\");\n\t\t\t\tawait helpers.exec(`git remote add origin ${data.projectUrl}`);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Applying template\"),\n\t\t\thandler({ data }) {\n\t\t\t\tapplyTemplate(data);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing dependencies\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\tconst localDevDependencies = [\"quickbundle\", \"vitest\"];\n\n\t\t\t\tconst globalDevDependencies = [\n\t\t\t\t\t\"@adbayb/eslint-config\",\n\t\t\t\t\t\"@adbayb/prettier-config\",\n\t\t\t\t\t\"@adbayb/ts-config\",\n\t\t\t\t\t\"@adbayb/stack\",\n\t\t\t\t];\n\n\t\t\t\ttry {\n\t\t\t\t\tawait helpers.exec(\n\t\t\t\t\t\t`pnpm add ${globalDevDependencies.join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t)} --save-dev --ignore-workspace-root-check`,\n\t\t\t\t\t);\n\n\t\t\t\t\tawait helpers.exec(\n\t\t\t\t\t\t`pnpm add ${localDevDependencies.join(\n\t\t\t\t\t\t\t\" \",\n\t\t\t\t\t\t)} --save-dev --filter ${data.projectName}`,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow createError(\"pnpm\", error);\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tkey: \"error\",\n\t\t\tlabel: label(\"Cleaning up\"),\n\t\t\tasync handler({ data }) {\n\t\t\t\ttry {\n\t\t\t\t\t// Symlink the package `README.md` file to the root project directory\n\t\t\t\t\tawait symlink(\n\t\t\t\t\t\t`./${data.projectName}/README.md`,\n\t\t\t\t\t\t\"./README.md\",\n\t\t\t\t\t);\n\t\t\t\t\t// Set the Node package manager runtime by following the `packageManager` field instruction\n\t\t\t\t\tawait setPkgManager();\n\t\t\t\t\t// Run install command to add git hooks\n\t\t\t\t\tawait helpers.exec(\"stack install\");\n\t\t\t\t\t// Commit (and run check/fix command via git hooks)\n\t\t\t\t\tawait helpers.exec(\"git add -A\");\n\t\t\t\t\tawait helpers.exec('git commit -m \"chore: initial commit\"');\n\n\t\t\t\t\treturn;\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn error as Error;\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\thandler({ data, error }) {\n\t\t\t\tif (error) {\n\t\t\t\t\tbotMessage(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Oops, an error occurred\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Keep calm and carry on with some coffee \u2615\uFE0F\",\n\t\t\t\t\t\t\tbody: String(error),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tbotMessage(\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: \"The project was successfully created\",\n\t\t\t\t\t\tdescription: `Run \\`cd ./${data.projectName}\\` and Enjoy \uD83D\uDE80`,\n\t\t\t\t\t},\n\t\t\t\t\t{ type: \"success\" },\n\t\t\t\t);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDD28`;\n\n/**\n * A simple template engine to evaluate dynamic expressions and apply side effets (such as hydrating a content with values from an input object) on impacted template files.\n * @param dataModel - Data model mapping the template expression key with its corresponding value.\n * @example\n * applyTemplate(\n * \t{ toReplace: \"value\" },\n * );\n */\nconst applyTemplate = (dataModel: CommandContext[\"data\"]) => {\n\tconst templateExtension = \".tmpl\";\n\tconst templateRootPath = resolveFromStackDirectory(\"./template\");\n\tconst projectRootPath = resolveFromProjectDirectory(\"./\");\n\tconst templateExpressionRegExp = /{{(.*?)}}/g;\n\n\tconst evaluate = (content: string) => {\n\t\treturn content.replace(\n\t\t\ttemplateExpressionRegExp,\n\t\t\t(_, key: keyof CommandContext[\"data\"]) => dataModel[key] || \"\",\n\t\t);\n\t};\n\n\t/** Copy the template before mutations. */\n\tcpSync(templateRootPath, projectRootPath, {\n\t\tforce: true,\n\t\trecursive: true,\n\t});\n\n\t/** Template file mutations. */\n\tnew fdir()\n\t\t.withBasePath()\n\t\t.glob(`**/*${templateExtension}`)\n\t\t.crawl(projectRootPath)\n\t\t.sync()\n\t\t.forEach((templateFilePath) => {\n\t\t\tconst projectFilePath = templateFilePath.slice(\n\t\t\t\t0,\n\t\t\t\ttemplateFilePath.lastIndexOf(templateExtension),\n\t\t\t);\n\n\t\t\tconst content = evaluate(readFileSync(templateFilePath, \"utf-8\"));\n\n\t\t\trenameSync(templateFilePath, projectFilePath);\n\t\t\twriteFileSync(projectFilePath, content, \"utf-8\");\n\t\t});\n\n\t/** Template folder mutations. */\n\tnew fdir()\n\t\t.withBasePath()\n\t\t.onlyDirs()\n\t\t.filter((path) => {\n\t\t\treturn Boolean(templateExpressionRegExp.exec(path));\n\t\t})\n\t\t.crawl(projectRootPath)\n\t\t.sync()\n\t\t// Re-order from longest to lowest path length to apply first renaming operations on deepest file structure\n\t\t.sort((a, b) => b.length - a.length)\n\t\t.forEach((templateFolderPath) => {\n\t\t\tconst newPath = templateFolderPath.replace(\n\t\t\t\ttemplateExpressionRegExp,\n\t\t\t\t(_, dataModelKey) => {\n\t\t\t\t\treturn dataModel[dataModelKey as keyof typeof dataModel];\n\t\t\t\t},\n\t\t\t);\n\n\t\t\trenameSync(templateFolderPath, newPath);\n\t\t});\n};\n", "{\n\t\"name\": \"@adbayb/stack\",\n\t\"version\": \"1.16.0\",\n\t\"description\": \"My opinionated toolchain\",\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"files\": [\n\t\t\"bin\",\n\t\t\"dist\",\n\t\t\"template\"\n\t],\n\t\"bin\": {\n\t\t\"stack\": \"bin/index.cjs\"\n\t},\n\t\"source\": \"src/index.ts\",\n\t\"main\": \"dist/index.cjs\",\n\t\"platform\": \"node\",\n\t\"scripts\": {\n\t\t\"prepublishOnly\": \"pnpm build\",\n\t\t\"prestart\": \"pnpm build\",\n\t\t\"start\": \"bin/index.js\",\n\t\t\"build\": \"quickbundle build\",\n\t\t\"watch\": \"quickbundle watch\"\n\t},\n\t\"keywords\": [\n\t\t\"stack\",\n\t\t\"scripts\",\n\t\t\"toolchain\",\n\t\t\"development\"\n\t],\n\t\"author\": {\n\t\t\"name\": \"Ayoub Adib\",\n\t\t\"email\": \"adbayb@gmail.com\",\n\t\t\"url\": \"https://twitter.com/adbayb\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/adbayb/stack.git\",\n\t\t\"directory\": \"stack\"\n\t},\n\t\"license\": \"MIT\",\n\t\"dependencies\": {\n\t\t\"@changesets/changelog-github\": \"^0.5.0\",\n\t\t\"@changesets/cli\": \"^2.27.1\",\n\t\t\"@commitlint/cli\": \"^18.6.1\",\n\t\t\"@commitlint/config-conventional\": \"^18.6.2\",\n\t\t\"eslint\": \"^8.56.0\",\n\t\t\"fdir\": \"^6.1.1\",\n\t\t\"prettier\": \"^3.2.5\",\n\t\t\"termost\": \"^0.12.0\",\n\t\t\"turbo\": \"^1.12.4\",\n\t\t\"typescript\": \"^5.3.3\"\n\t}\n}\n", "import { fixFormatting, fixLints, turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createFixCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"fix\",\n\t\t\tdescription: \"Fix auto-fixable issues\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Preparing the project\"),\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"build\", { hasLiveOutput: false });\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Fixing lints\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tawait fixLints(argv.operands);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Fixing formatting\"),\n\t\t\tasync handler(_, argv) {\n\t\t\t\tawait fixFormatting(argv.operands);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDE91`;\n", "import { chmod, writeFile } from \"node:fs/promises\";\n\nimport { getStackCommand, resolveFromProjectDirectory } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createInstallCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"install\",\n\t\t\tdescription: \"Setup initial requirements\",\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing `git.pre-commit` hook\"),\n\t\t\tasync handler() {\n\t\t\t\tawait installGitHook(\n\t\t\t\t\t\"pre-commit\",\n\t\t\t\t\t`${getStackCommand(\n\t\t\t\t\t\t\"fix $(git status --porcelain | awk 'BEGIN{ ORS=\\\" \\\" } { print $2 }')\",\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t)} && git add -A`,\n\t\t\t\t);\n\t\t\t},\n\t\t})\n\t\t.task({\n\t\t\tlabel: label(\"Installing `git.commit-msg` hook\"),\n\t\t\tasync handler() {\n\t\t\t\tawait installGitHook(\n\t\t\t\t\t\"commit-msg\",\n\t\t\t\t\t`${getStackCommand(\"check --only commit\", false)}`,\n\t\t\t\t);\n\t\t\t},\n\t\t});\n};\n\nconst label = (message: string) => `${message} \uD83D\uDCF2`;\n\nconst installGitHook = async (\n\thook: \"commit-msg\" | \"pre-commit\",\n\tcontent: string,\n) => {\n\tconst filename = resolveFromProjectDirectory(`.git/hooks/${hook}`);\n\n\tawait writeFile(filename, content);\n\n\treturn chmod(filename, \"0755\");\n};\n", "import { helpers } from \"termost\";\n\nimport { changeset } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\ntype CommandContext = {\n\tlog: boolean;\n\tpublish: boolean;\n\ttag: boolean;\n};\n\nexport const createReleaseCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command<CommandContext>({\n\t\t\tname: \"release\",\n\t\t\tdescription: \"Log, version, and publish package(s)\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"log\",\n\t\t\tname: \"log\",\n\t\t\tdescription: \"Add a new changelog entry\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"tag\",\n\t\t\tname: \"tag\",\n\t\t\tdescription: \"Bump the package(s) version\",\n\t\t})\n\t\t.option({\n\t\t\tkey: \"publish\",\n\t\t\tname: \"publish\",\n\t\t\tdescription: \"Publish package(s) to the registry\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"New changelog entry\\n\");\n\n\t\t\t\tawait changeset(\"changeset\");\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"log\"),\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"Bumping the package(s) version\\n\");\n\n\t\t\t\tawait changeset(\n\t\t\t\t\t\"changeset version && pnpm install --no-frozen-lockfile\",\n\t\t\t\t);\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"tag\"),\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\thelpers.message(\"Publishing package(s) to the registry\\n\");\n\n\t\t\t\tawait changeset(\"stack build && pnpm changeset publish\");\n\t\t\t},\n\t\t\tskip: ifNotEqualTo(\"publish\"),\n\t\t});\n};\n\nconst ifNotEqualTo =\n\t(validOption: keyof CommandContext) => (context: CommandContext) => {\n\t\treturn !context[validOption];\n\t};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createStartCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"start\",\n\t\t\tdescription: \"Start the project in production mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"start\");\n\t\t\t},\n\t\t});\n};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createTestCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"test\",\n\t\t\tdescription: \"Test the code execution\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"test\");\n\t\t\t},\n\t\t});\n};\n", "import { turbo } from \"../helpers\";\nimport type { CommandFactory } from \"../types\";\n\nexport const createWatchCommand: CommandFactory = (program) => {\n\tprogram\n\t\t.command({\n\t\t\tname: \"watch\",\n\t\t\tdescription: \"Build and start the project in development mode\",\n\t\t})\n\t\t.task({\n\t\t\tasync handler() {\n\t\t\t\tawait turbo(\"watch\");\n\t\t\t},\n\t\t});\n};\n"],
5
+ "mappings": ";qeAEA,IAAAA,GAAwB,mBCFxB,IAAAC,EAA2B,cAC3BC,EAAwB,gBACxBC,EAAwB,mBAsBXC,EAAa,CACzBC,EACAC,IACI,CACJ,UAAQ,QACP;AAAA;AAAA,0BAESD,EAAM;AAAA,WACXC,GAAS,OAAS,QAAU,SAAM,oBAAUD,EAAM;AAAA;AAAA,EAGtDA,EAAM,KAEJ;AAAA,EACFA,EAAM;AAAA,EAFJ,KAKFC,CACD,CACD,EASaC,EAA+BC,MACpC,WAAQ,QAAQ,IAAI,EAAGA,CAAI,EAUtBC,EAA6BD,MAClC,WAAQ,UAAW,MAAOA,CAAI,EAiB/B,IAAME,EAAgB,SAAY,CACxC,GAAI,CACH,OAAO,MAAM,UAAQ,KAAK,SAAS,CACpC,MAAE,CACD,MAAMC,EACL,OACA,yHACD,CACD,CACD,EAEaC,EAAkB,CAACC,EAAiBC,EAAgB,KAIzD,CAAC,GAAIA,EAAgB,CAAC,EAAI,CAAC,UAAU,EAAI,SAASD,GAAS,EAAE,KACnE,GACD,EAGYE,EAAgB,SACrB,UAAQ,KAAK,iBAAiB,EAGzBC,EAAU,CACtB,MAAM,IACLC,EACAC,EACC,CACD,IAAMC,EAAW,MAAM,MAAMF,CAAG,EAEhC,GAAI,CAACE,EAAS,GACb,MAAMR,EACL,QACA,kCAAkCM,MAAQ,KAAK,UAAU,CACxD,OAAQE,EAAS,OACjB,WAAYA,EAAS,UACtB,CAAC,IACF,EAGD,OACCD,IAAiB,OAASC,EAAS,KAAK,EAAIA,EAAS,KAAK,CAI5D,CACD,EAEMC,EACJC,GACD,MAAOC,EAA4B,CAAC,IAAM,CACzC,IAAIC,EAAc,CAAC,EAEnB,GAAID,EAAM,SAAW,EACpBC,EAAY,KAAK,GAAG,UAEpBA,EAA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AAM,UACN,YAAa,oCACd,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,UAAQ,QAAQ;AAAA,CAAuB,EAEvC,MAAMC,EAAU,WAAW,CAC5B,EACA,KAAMC,EAAa,KAAK,CACzB,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,UAAQ,QAAQ;AAAA,CAAkC,EAElD,MAAMD,EACL,wDACD,CACD,EACA,KAAMC,EAAa,KAAK,CACzB,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,UAAQ,QAAQ;AAAA,CAAyC,EAEzD,MAAMD,EAAU,uCAAuC,CACxD,EACA,KAAMC,EAAa,SAAS,CAC7B,CAAC,CACH,EAEMA,EACJC,GAAuCC,GAChC,CAACA,EAAQD,CAAW,EC3DtB,IAAME,GAAsCC,GAAY,CAC9DA,EACE,QAAQ,CACR,KAAM,QACN,YAAa,sCACd,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,MAAMC,EAAM,OAAO,CACpB,CACD,CAAC,CACH,ECXO,IAAMC,GAAqCC,GAAY,CAC7DA,EACE,QAAQ,CACR,KAAM,OACN,YAAa,yBACd,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,MAAMC,EAAM,MAAM,CACnB,CACD,CAAC,CACH,ECXO,IAAMC,GAAsCC,GAAY,CAC9DA,EACE,QAAQ,CACR,KAAM,QACN,YAAa,iDACd,CAAC,EACA,KAAK,CACL,MAAM,SAAU,CACf,MAAMC,EAAM,OAAO,CACpB,CACD,CAAC,CACH,EZEA,IAAMC,GAAgB,IAAIC,IAAuC,CAChE,IAAMC,KAAU,YAAQ,CACvB,KAAM,QACN,YAAa,mDACd,CAAC,EAED,QAAWC,KAAkBF,EAC5BE,EAAeD,CAAO,CAExB,EAEAF,GACCI,EACAC,GACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,EACD",
6
+ "names": ["import_termost", "import_node_fs", "import_node_path", "import_termost", "botMessage", "input", "options", "resolveFromProjectDirectory", "path", "resolveFromStackDirectory", "getNpmVersion", "createError", "getStackCommand", "command", "isNodeRuntime", "setPkgManager", "request", "url", "responseType", "response", "eslint", "options", "files", "eslintFiles", "file", "ESLINT_EXTENSIONS", "ext", "args", "resolveFromProjectDirectory", "gitIgnoreFile", "error", "checkLints", "fixLints", "fixFormatting", "prettierFiles", "PRETTIER_IGNORE_FILES", "filename", "checkTypes", "checkCommit", "bin", "turbo", "changeset", "TYPESCRIPT_EXTENSIONS", "createBuildCommand", "program", "turbo", "onlyValues", "createCheckCommand", "program", "label", "turbo", "only", "_", "argv", "filenames", "checkLints", "ifOnlyDefinedAndNotEqualTo", "checkTypes", "context", "checkCommit", "message", "import_node_fs", "import_termost", "createCleanCommand", "program", "label", "cachePath", "files", "retrieveIgnoredFiles", "isDirectoryExistAndNotEmpty", "resolveFromProjectDirectory", "cleanFiles", "message", "path", "PRESERVE_FILES", "import_fdir", "import_node_fs", "import_promises", "import_node_path", "import_termost", "package_default", "createCreateCommand", "program", "botMessage", "package_default", "label", "getNpmVersion", "inputDescription", "inputName", "inputUrl", "nodeVersion", "request", "npmVersion", "repoName", "repoOwner", "createError", "data", "projectPath", "applyTemplate", "localDevDependencies", "globalDevDependencies", "error", "setPkgManager", "message", "dataModel", "templateExtension", "templateRootPath", "resolveFromStackDirectory", "projectRootPath", "resolveFromProjectDirectory", "templateExpressionRegExp", "evaluate", "content", "_", "key", "templateFilePath", "projectFilePath", "path", "b", "templateFolderPath", "newPath", "dataModelKey", "createFixCommand", "program", "label", "turbo", "_", "argv", "fixLints", "fixFormatting", "message", "import_promises", "createInstallCommand", "program", "label", "installGitHook", "getStackCommand", "message", "hook", "content", "filename", "resolveFromProjectDirectory", "import_termost", "createReleaseCommand", "program", "changeset", "ifNotEqualTo", "validOption", "context", "createStartCommand", "program", "turbo", "createTestCommand", "program", "turbo", "createWatchCommand", "program", "turbo", "createProgram", "commandFactories", "program", "commandBuilder", "createCreateCommand", "createInstallCommand", "createCleanCommand", "createCheckCommand", "createFixCommand", "createStartCommand", "createBuildCommand", "createWatchCommand", "createTestCommand", "createReleaseCommand"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adbayb/stack",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "My opinionated toolchain",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,7 +8,7 @@
8
8
  "files": [
9
9
  "bin",
10
10
  "dist",
11
- "templates"
11
+ "template"
12
12
  ],
13
13
  "bin": {
14
14
  "stack": "bin/index.cjs"
@@ -36,12 +36,13 @@
36
36
  "dependencies": {
37
37
  "@changesets/changelog-github": "^0.5.0",
38
38
  "@changesets/cli": "^2.27.1",
39
- "@commitlint/cli": "^18.4.3",
40
- "@commitlint/config-conventional": "^18.4.3",
39
+ "@commitlint/cli": "^18.6.1",
40
+ "@commitlint/config-conventional": "^18.6.2",
41
41
  "eslint": "^8.56.0",
42
- "prettier": "^3.1.1",
42
+ "fdir": "^6.1.1",
43
+ "prettier": "^3.2.5",
43
44
  "termost": "^0.12.0",
44
- "turbo": "^1.11.2",
45
+ "turbo": "^1.12.4",
45
46
  "typescript": "^5.3.3"
46
47
  },
47
48
  "scripts": {
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/changesets/changesets/main/packages/config/schema.json",
3
+ "access": "public",
4
+ "baseBranch": "main",
5
+ "changelog": ["@changesets/changelog-github", { "repo": "{{repoId}}" }],
6
+ "commit": false,
7
+ "ignore": ["@examples/*"],
8
+ "updateInternalDependencies": "patch",
9
+ "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
10
+ "onlyUpdatePeerDependentsWhenOutOfRange": true,
11
+ "updateInternalDependents": "out-of-range"
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ ---
2
+ "{{projectName}}": minor
3
+ ---
4
+
5
+ v0.1.0 release 🚀
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["@commitlint/config-conventional"]
3
+ }
@@ -0,0 +1,4 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_size = 4
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@adbayb"
3
+ }
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: "🐛 Bug Report"
3
+ about: Report a reproducible bug or regression.
4
+ title: "Bug: "
5
+ labels: ["bug", "triage"]
6
+ ---
7
+
8
+ ## Description
9
+
10
+ <!--
11
+ Please provide a clear and concise description of what the bug is with the current and expected behavior(s). Include
12
+ screenshots if needed. Please test using the latest version of the relevant package to make sure your issue has not already been fixed.
13
+ -->
14
+
15
+ ## Reproduction
16
+
17
+ <!--
18
+ Issues without reproduction steps or code examples may be immediately closed as not actionable. Your bug will get fixed much faster if we can run your code. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve.
19
+ -->
20
+
21
+ ## Environment
22
+
23
+ <!--
24
+ Please provide the environment you discovered this bug in.
25
+ It must include following informations:
26
+ - OS [eg. Android, iOS, mac OS, Windows, ...]
27
+ - Browser [eg. Chrome@110, Safari@16, ...]
28
+ -->
29
+
30
+ ## Additional context
31
+
32
+ <!--
33
+ Add any other context about the problem (eg. issue URL, related issues, documentation, etc...)
34
+ -->
@@ -0,0 +1,4 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: 🤔 Questions and Help
4
+ about: Issues are dedicated to bugs, if you have any question, please use the dedicated GitHub discussion category.
@@ -0,0 +1,29 @@
1
+ <!--
2
+ Thanks for submitting a pull request!
3
+ We appreciate you spending the time to work on these changes. Before requesting reviews, please make sure that:
4
+
5
+ 1. Your contribution follows coding conventions
6
+ 2. Some valuable tests have been added
7
+ 3. For non-internal change, a changelog entry is added
8
+
9
+ Learn more about contributing [here](https://github.com/{{repoId}}/blob/main/CONTRIBUTING.md)
10
+ -->
11
+
12
+ ## Description
13
+
14
+ Please include a concise summary of the change with the relevant context and main highlights:
15
+
16
+ - [ ] What I've done 1
17
+ - [ ] What I've done 2...
18
+
19
+ ## Screenshots
20
+
21
+ | Before | After |
22
+ | ------ | ----- |
23
+ | Image | Image |
24
+
25
+ ## Resources
26
+
27
+ - Issue (GitHub, ...)
28
+ - Specification (ADRs, RFCs, ...)
29
+ - ...
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ ":automergeAll",
5
+ ":automergePr",
6
+ ":automergeRequireAllStatusChecks",
7
+ ":enableVulnerabilityAlerts",
8
+ ":label(dependencies)",
9
+ ":maintainLockFilesMonthly",
10
+ ":prConcurrentLimit10",
11
+ ":rebaseStalePrs",
12
+ ":semanticCommits",
13
+ ":semanticCommitScopeDisabled",
14
+ ":semanticPrefixFixDepsChoreOthers",
15
+ ":timezone(Europe/Paris)",
16
+ "npm:unpublishSafe",
17
+ "replacements:all",
18
+ "schedule:monthly",
19
+ "workarounds:all"
20
+ ],
21
+ "commitBodyTable": true,
22
+ "platformAutomerge": false,
23
+ "ignoreDeps": [],
24
+ "packageRules": [
25
+ {
26
+ "matchPackagePatterns": ["*"],
27
+ "rangeStrategy": "auto"
28
+ },
29
+ {
30
+ "matchDepTypes": ["devDependencies"],
31
+ "rangeStrategy": "pin"
32
+ },
33
+ {
34
+ "matchDepTypes": ["dependencies"],
35
+ "rangeStrategy": "bump"
36
+ },
37
+ {
38
+ "description": "Synchronize CircleCI Docker image version with the Node.js one",
39
+ "matchPackageNames": ["cimg/node"],
40
+ "versioning": "node"
41
+ },
42
+ {
43
+ "groupName": "package dependencies",
44
+ "matchManagers": ["npm"],
45
+ "matchDepTypes": [
46
+ "dependencies",
47
+ "devDependencies",
48
+ "optionalDependencies",
49
+ "peerDependencies"
50
+ ]
51
+ },
52
+ {
53
+ "groupName": "infrastructure dependencies",
54
+ "matchManagers": [
55
+ "circleci",
56
+ "github-actions",
57
+ "dockerfile",
58
+ "terraform",
59
+ "terraform-version",
60
+ "docker-compose",
61
+ "kubernetes"
62
+ ]
63
+ },
64
+ {
65
+ "groupName": "engine dependencies",
66
+ "matchPackagePatterns": ["node", "pnpm"]
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,49 @@
1
+ name: Continous delivery
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ concurrency: ${{ github.workflow }}-${{ github.ref }}
9
+
10
+ jobs:
11
+ integrate:
12
+ uses: ./.github/workflows/workflow.yml
13
+ release:
14
+ timeout-minutes: 5
15
+ needs: integrate
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: write
19
+ pull-requests: write
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: pnpm/action-setup@v2
23
+ - name: Get node version
24
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
25
+ id: node
26
+ - name: Setup node ${{ steps.node.outputs.version }}
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: ${{ steps.node.outputs.version }}
30
+ cache: pnpm
31
+ - name: Setup .npmrc
32
+ run: |
33
+ cat << EOF > "$HOME/.npmrc"
34
+ //registry.npmjs.org/:_authToken=$NPM_TOKEN
35
+ EOF
36
+ env:
37
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38
+ - name: Install dependencies
39
+ run: pnpm install --frozen-lockfile
40
+ - name: Create release pull request or Publish to npm
41
+ uses: changesets/action@v1
42
+ with:
43
+ commit: "chore: release package(s)"
44
+ title: "chore: release package(s)"
45
+ version: pnpm release:version
46
+ publish: pnpm release:publish
47
+ env:
48
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,9 @@
1
+ name: Continuous integration
2
+
3
+ on:
4
+ push:
5
+ branches-ignore: main
6
+
7
+ jobs:
8
+ main:
9
+ uses: ./.github/workflows/workflow.yml
@@ -0,0 +1,48 @@
1
+ name: Conventional commit
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, edited]
6
+
7
+ jobs:
8
+ main:
9
+ timeout-minutes: 5
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: amannn/action-semantic-pull-request@v5
13
+ id: check_pr_rule
14
+ env:
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16
+ with:
17
+ types: |
18
+ build
19
+ chore
20
+ ci
21
+ docs
22
+ feat
23
+ fix
24
+ perf
25
+ refactor
26
+ revert
27
+ style
28
+ test
29
+ requireScope: false
30
+ subjectPattern: ^(?![A-Z]).+$
31
+ subjectPatternError: The subject must start with a lowercase character
32
+ # Create a sticky comment to display the detailed error
33
+ - uses: marocchino/sticky-pull-request-comment@v2
34
+ if: always() && (steps.check_pr_rule.outputs.error_message != null)
35
+ with:
36
+ header: check_pr_comment
37
+ message: |
38
+ Pull request titles must follow the [Conventional Commits specification](https://www.conventionalcommits.org/).
39
+ Please adjust your title following:
40
+ ```
41
+ ${{ steps.check_pr_rule.outputs.error_message }}
42
+ ```
43
+ # Delete a previous comment when the issue has been resolved
44
+ - if: ${{ steps.check_pr_rule.outputs.error_message == null }}
45
+ uses: marocchino/sticky-pull-request-comment@v2
46
+ with:
47
+ header: check_pr_comment
48
+ delete: true
@@ -0,0 +1,117 @@
1
+ name: Dependency changelog
2
+
3
+ on:
4
+ pull_request_target:
5
+ paths:
6
+ - "**/pnpm-lock.yaml"
7
+
8
+ jobs:
9
+ main:
10
+ timeout-minutes: 5
11
+ runs-on: ubuntu-latest
12
+ if: github.actor == 'renovate[bot]'
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4.1.1
16
+ with:
17
+ fetch-depth: 2
18
+ ref: ${{ github.head_ref }}
19
+ - name: Configure Git
20
+ run: |
21
+ git config --global user.email adbayb@gmail.com
22
+ git config --global user.name 'Ayoub Adib'
23
+ - name: Create changelog entry
24
+ uses: actions/github-script@v7.0.1
25
+ # Credits to https://github.com/backstage/backstage/blob/bcc11651add5a2589898dfb9d665ebb9d412201b/.github/workflows/sync_renovate-changesets.yml
26
+ with:
27
+ script: |
28
+ const { promises: fs } = require("fs");
29
+
30
+ async function getPackagesNames(files) {
31
+ const names = [];
32
+
33
+ for (const file of files) {
34
+ const data = JSON.parse(await fs.readFile(file, "utf8"));
35
+
36
+ if (!data.private) {
37
+ names.push(data.name);
38
+ }
39
+ }
40
+
41
+ return names;
42
+ }
43
+
44
+ async function createChangeset(fileName, packageBumps, packages) {
45
+ let message = "";
46
+
47
+ for (const [pkg, bump] of packageBumps) {
48
+ message = message + `Updated dependency \`${pkg}\` to \`${bump}\`.\n`;
49
+ }
50
+
51
+ const pkgs = packages.map((pkg) => `"${pkg}": minor`).join("\n");
52
+ const body = `---\n${pkgs}\n---\n\n${message.trim()}\n`;
53
+
54
+ await fs.writeFile(fileName, body);
55
+ }
56
+
57
+ async function getBumps(files) {
58
+ const bumps = new Map();
59
+
60
+ for (const file of files) {
61
+ const { stdout: changes } = await exec.getExecOutput("git", [
62
+ "show",
63
+ file,
64
+ ]);
65
+
66
+ for (const change of changes.split("\n")) {
67
+ if (!change.match(/^\+\s/)) {
68
+ continue;
69
+ }
70
+
71
+ const match = change.match(/"(.*?)"/g);
72
+
73
+ bumps.set(match[0].replace(/"/g, ""), match[1].replace(/"/g, ""));
74
+ }
75
+ }
76
+
77
+ return bumps;
78
+ }
79
+
80
+ const branch = await exec.getExecOutput("git branch --show-current");
81
+
82
+ if (!branch.stdout.startsWith("renovate/")) {
83
+ console.log("Not a renovate branch, skipping");
84
+
85
+ return;
86
+ }
87
+
88
+ const diffOutput = await exec.getExecOutput("git diff --name-only HEAD~1");
89
+ const diffFiles = diffOutput.stdout.split("\n");
90
+
91
+ if (diffFiles.find((f) => f.startsWith(".changeset"))) {
92
+ console.log("Changeset already exists, skipping");
93
+
94
+ return;
95
+ }
96
+
97
+ const files = diffFiles
98
+ .filter((file) => file !== "package.json") // skip root package.json
99
+ .filter((file) => file.includes("package.json"));
100
+ const packageNames = await getPackagesNames(files);
101
+
102
+ if (!packageNames.length) {
103
+ console.log("No package.json changes to published packages, skipping");
104
+
105
+ return;
106
+ }
107
+
108
+ const { stdout: shortHash } = await exec.getExecOutput(
109
+ "git rev-parse --short HEAD"
110
+ );
111
+ const fileName = `.changeset/renovate-${shortHash.trim()}.md`;
112
+ const packageBumps = await getBumps(files);
113
+
114
+ await createChangeset(fileName, packageBumps, packageNames);
115
+ await exec.exec("git", ["add", fileName]);
116
+ await exec.exec("git commit -C HEAD --amend --no-edit");
117
+ await exec.exec("git push --force");
@@ -0,0 +1,96 @@
1
+ name: Main shareable workflow
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ install:
8
+ timeout-minutes: 5
9
+ name: Install
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout the code
13
+ uses: actions/checkout@v4
14
+ - uses: pnpm/action-setup@v2
15
+ - name: Get node version
16
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
17
+ id: node
18
+ - name: Setup node ${{ steps.node.outputs.version }}
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: ${{ steps.node.outputs.version }}
22
+ cache: pnpm
23
+ - name: Setup cache
24
+ id: cache
25
+ uses: actions/cache@v3
26
+ with:
27
+ path: |
28
+ ./node_modules
29
+ ./turbo
30
+ key: ${{ runner.os }}-cache-${{ github.sha }}
31
+ restore-keys: |
32
+ ${{ runner.os }}-cache-
33
+ - name: Install dependencies
34
+ run: pnpm install --frozen-lockfile
35
+ build:
36
+ timeout-minutes: 5
37
+ needs: install
38
+ name: Build
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - name: Checkout code
42
+ uses: actions/checkout@v4
43
+ - uses: pnpm/action-setup@v2
44
+ - name: Get node version
45
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
46
+ id: node
47
+ - name: Setup node ${{ steps.node.outputs.version }}
48
+ uses: actions/setup-node@v4
49
+ with:
50
+ node-version: ${{ steps.node.outputs.version }}
51
+ cache: pnpm
52
+ - name: Setup cache
53
+ id: cache
54
+ uses: actions/cache@v3
55
+ with:
56
+ path: |
57
+ ./node_modules
58
+ ./turbo
59
+ key: ${{ runner.os }}-cache-${{ github.sha }}
60
+ restore-keys: |
61
+ ${{ runner.os }}-cache-
62
+ - name: Install dependencies
63
+ run: pnpm install --frozen-lockfile
64
+ - name: Build
65
+ run: pnpm build
66
+ check:
67
+ timeout-minutes: 5
68
+ needs: build
69
+ name: Check
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - name: Checkout the code
73
+ uses: actions/checkout@v4
74
+ - uses: pnpm/action-setup@v2
75
+ - name: Get node version
76
+ run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
77
+ id: node
78
+ - name: Setup node ${{ steps.node.outputs.version }}
79
+ uses: actions/setup-node@v4
80
+ with:
81
+ node-version: ${{ steps.node.outputs.version }}
82
+ cache: pnpm
83
+ - name: Setup cache
84
+ id: cache
85
+ uses: actions/cache@v3
86
+ with:
87
+ path: |
88
+ ./node_modules
89
+ ./turbo
90
+ key: ${{ runner.os }}-cache-${{ github.sha }}
91
+ restore-keys: |
92
+ ${{ runner.os }}-cache-
93
+ - name: Install dependencies
94
+ run: pnpm install --frozen-lockfile
95
+ - name: Check (static analysis including linters, types, and commit message)
96
+ run: pnpm check
@@ -0,0 +1 @@
1
+ {{nodeVersion}}
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "dbaeumer.vscode-eslint",
4
+ "unifiedjs.vscode-mdx",
5
+ "yoavbls.pretty-ts-errors",
6
+ "znck.grammarly"
7
+ ]
8
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "eslint.validate": [
3
+ "javascript",
4
+ "javascriptreact",
5
+ "typescript",
6
+ "typescriptreact",
7
+ "markdown",
8
+ "mdx",
9
+ "astro"
10
+ ],
11
+ "editor.codeActionsOnSave": {
12
+ "source.fixAll.eslint": "explicit"
13
+ },
14
+ "workbench.editor.labelFormat": "short",
15
+ "typescript.tsdk": "node_modules/typescript/lib",
16
+ "typescript.enablePromptUseWorkspaceTsdk": true,
17
+ "grammarly.selectors": [
18
+ {
19
+ "language": "mdx",
20
+ "scheme": "file"
21
+ },
22
+ {
23
+ "language": "md",
24
+ "scheme": "file"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,21 @@
1
+ # Contributing
2
+
3
+ Thanks for showing interest to contribute to `{{projectName}}` 🥳.
4
+ We are open to contributions, we look forward to improving it with your help!
5
+
6
+ Here you will find guidelines that will help you to know how to contribute to this repository.
7
+ It can be about reporting an issue, proposing a bug fix, adding some features, and even more...
8
+
9
+ ## 🥇 Your first contribution
10
+
11
+ TODO
12
+
13
+ ## 🗂️ Conventions
14
+
15
+ TODO
16
+
17
+ ## 👨‍🍳 Recipes
18
+
19
+ ### How to XXX?
20
+
21
+ TODO
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Ayoub Adib
3
+ Copyright (c) {{licenseYear}} Ayoub Adib
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ # Applications
2
+
3
+ > [!note]
4
+ > Optional folder that can be either:
5
+ >
6
+ > - Kept if the root package needs to be moved into it (when several package types (applications, libraries, ...) need to be created and the root package is by its nature an application)
7
+ > - Otherwise, removed if no planned use case
8
+
9
+ A collection of application-like projects. An application is a runnable program (a command-line interface, a mobile/web application, ...).
@@ -0,0 +1,6 @@
1
+ # Examples
2
+
3
+ A collection of examples to:
4
+
5
+ - Showcase the artifacts' usage (mainly for libraries)
6
+ - Source some scenarios for testing purposes (test cases)
@@ -0,0 +1,14 @@
1
+ {
2
+ "private": true,
3
+ "name": "@examples/default",
4
+ "version": "0.0.0",
5
+ "scripts": {
6
+ "start": "node -r esbuild-register ./src/index.ts"
7
+ },
8
+ "dependencies": {
9
+ "{{projectName}}": "workspace:^"
10
+ },
11
+ "devDependencies": {
12
+ "esbuild-register": "3.4.2"
13
+ }
14
+ }
@@ -0,0 +1,3 @@
1
+ import { HELLO_WORLD } from "{{projectName}}";
2
+
3
+ console.log(HELLO_WORLD);
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules", "dist"]
5
+ }
@@ -0,0 +1,9 @@
1
+ # Libraries
2
+
3
+ > [!note]
4
+ > Optional folder that can be either:
5
+ >
6
+ > - Kept if the root package needs to be moved into it (when several package types (applications, libraries, ...) need to be created and the root package is by its nature a library)
7
+ > - Otherwise, removed if no planned use case
8
+
9
+ A collection of internal and/or publishable libraries (referred to as packages in the Node ecosystem) that are leveraged during software development to implement/share a specific aspect/functionality. A library generally encapsulates highly cohesive modules together.
@@ -0,0 +1,26 @@
1
+ {
2
+ "private": true,
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "prepare": "stack install",
7
+ "clean": "stack clean",
8
+ "check": "stack check",
9
+ "fix": "stack fix",
10
+ "start": "stack start",
11
+ "build": "stack build",
12
+ "watch": "stack watch",
13
+ "test": "stack test",
14
+ "release:log": "stack release --log",
15
+ "release:version": "stack release --tag",
16
+ "release:publish": "stack release --publish"
17
+ },
18
+ "prettier": "@adbayb/prettier-config",
19
+ "packageManager": "pnpm@{{npmVersion}}",
20
+ "engines": {
21
+ "node": ">=18.0.0",
22
+ "pnpm": ">=8.0.0",
23
+ "npm": "please-use-pnpm",
24
+ "yarn": "please-use-pnpm"
25
+ }
26
+ }
@@ -0,0 +1,6 @@
1
+ packages:
2
+ - "applications/*"
3
+ - "examples/*"
4
+ - "libraries/*"
5
+ - "tools/*"
6
+ - "{{projectName}}"
@@ -0,0 +1,6 @@
1
+ # Tools
2
+
3
+ > [!note]
4
+ > Optional folder that can be removed if no internal scripts or packages for development purposes
5
+
6
+ A collection of internal packages and scripts that act locally on the repository codebase.
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@adbayb/ts-config"
3
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://turborepo.org/schema.json",
3
+ "pipeline": {
4
+ "build": {
5
+ "dependsOn": ["^build"],
6
+ "outputs": ["dist/**"]
7
+ },
8
+ "start": {
9
+ "dependsOn": ["build"],
10
+ "cache": false,
11
+ "persistent": true
12
+ },
13
+ "watch": {
14
+ "dependsOn": ["^build"],
15
+ "cache": false,
16
+ "persistent": true
17
+ },
18
+ "test": {
19
+ "dependsOn": ["build"],
20
+ "cache": false,
21
+ "persistent": true
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,42 @@
1
+ <br>
2
+ <div align="center">
3
+ <h1>📦 {{projectName}}</h1>
4
+ <strong>{{projectDescription}}</strong>
5
+ </div>
6
+ <br>
7
+ <br>
8
+
9
+ ## ✨ Features
10
+
11
+ TODO
12
+
13
+ <br>
14
+
15
+ ## 🚀 Usage
16
+
17
+ This section introduces the `{{projectName}}` essentials by walking through its main commands:
18
+
19
+ 0️⃣ ...
20
+ 1️⃣ ...
21
+ 2️⃣ ...
22
+ 3️⃣ ...
23
+
24
+ <br>
25
+
26
+ ## 🏗️ Architecture
27
+
28
+ TODO
29
+
30
+ <br>
31
+
32
+ ## ✍️ Contribution
33
+
34
+ We're open to new contributions, you can find more details [here](https://github.com/{{repoId}}/blob/main/CONTRIBUTING.md).
35
+
36
+ <br>
37
+
38
+ ## 📖 License
39
+
40
+ [MIT](https://github.com/{{repoId}}/blob/main/LICENSE "License MIT")
41
+
42
+ <br>
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "description": "{{projectDescription}}",
4
+ "version": "0.0.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "sideEffects": false,
12
+ "type": "module",
13
+ "source": "./src/index.ts",
14
+ "main": "./dist/index.cjs",
15
+ "module": "./dist/index.mjs",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "require": "./dist/index.cjs",
20
+ "import": "./dist/index.mjs",
21
+ "types": "./dist/index.d.ts"
22
+ }
23
+ },
24
+ "license": "MIT",
25
+ "author": "Ayoub Adib <adbayb@gmail.com> (https://twitter.com/adbayb)",
26
+ "bugs": "https://github.com/{{repoId}}/issues",
27
+ "homepage": "https://github.com/{{repoId}}/tree/main/{{projectName}}#readme",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "{{projectUrl}}",
31
+ "directory": "{{projectName}}"
32
+ },
33
+ "scripts": {
34
+ "prepublishOnly": "pnpm build",
35
+ "clean": "rm -rf dist",
36
+ "start": "pnpm watch",
37
+ "build": "pnpm clean && quickbundle build",
38
+ "watch": "quickbundle watch",
39
+ "test": "vitest"
40
+ }
41
+ }
@@ -0,0 +1,5 @@
1
+ import { describe, test } from "vitest";
2
+
3
+ describe.todo("xxx", () => {
4
+ test.todo("should xxx");
5
+ });
@@ -0,0 +1 @@
1
+ export const HELLO_WORLD = "Hello 👋, please replace me!";
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules", "dist"]
5
+ }
@@ -1,17 +0,0 @@
1
- {
2
- "files": [
3
- ".nvmrc",
4
- "CONTRIBUTING.md",
5
- "LICENSE",
6
- "package.json",
7
- "pnpm-workspace.yaml",
8
- ".changeset/config.json",
9
- ".changeset/welcome.md",
10
- ".github/PULL_REQUEST_TEMPLATE.md",
11
- "{{projectName}}/package.json",
12
- "{{projectName}}/README.md",
13
- "examples/default/package.json",
14
- "examples/default/src/index.ts"
15
- ],
16
- "folders": ["{{projectName}}"]
17
- }
Binary file