@adbayb/stack 1.16.1 → 2.1.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.
- package/README.md +36 -41
- package/bin/index.js +8 -0
- package/configs/eslint/README.md +39 -0
- package/configs/eslint/constants.js +10 -0
- package/configs/eslint/helpers.js +6 -0
- package/configs/eslint/index.js +29 -0
- package/configs/eslint/presets/base.js +26 -0
- package/configs/eslint/presets/eslint.js +105 -0
- package/configs/eslint/presets/import.js +71 -0
- package/configs/eslint/presets/jsdoc.js +79 -0
- package/configs/eslint/presets/node.js +51 -0
- package/configs/eslint/presets/overridable.js +33 -0
- package/configs/eslint/presets/react.js +75 -0
- package/configs/eslint/presets/sonar.js +225 -0
- package/configs/eslint/presets/stylistic.js +69 -0
- package/configs/eslint/presets/test.js +59 -0
- package/configs/eslint/presets/typescript.js +172 -0
- package/configs/eslint/presets/uncategorized.js +34 -0
- package/configs/prettier/README.md +65 -0
- package/configs/prettier/index.js +25 -0
- package/configs/typescript/README.md +46 -0
- package/configs/typescript/index.json +35 -0
- package/dist/index.js +770 -0
- package/package.json +48 -18
- package/{template → templates/multi-projects}/.editorconfig +1 -1
- package/templates/multi-projects/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/templates/multi-projects/.github/workflows/continuous_delivery.yml +61 -0
- package/templates/multi-projects/.github/workflows/continuous_integration.yml +9 -0
- package/templates/multi-projects/.github/workflows/conventional_commit.yml +48 -0
- package/templates/multi-projects/.github/workflows/dependency_changelog.yml +117 -0
- package/templates/multi-projects/.github/workflows/workflow.yml +39 -0
- package/{template → templates/multi-projects}/.npmrc.tmpl +1 -0
- package/templates/multi-projects/applications/README.md +6 -0
- package/templates/multi-projects/eslint.config.js.tmpl +1 -0
- package/templates/multi-projects/examples/README.md +6 -0
- package/{template → templates/multi-projects}/examples/default/package.json.tmpl +2 -2
- package/templates/multi-projects/libraries/README.md +3 -0
- package/templates/multi-projects/libraries/{{projectName}}/package.json.tmpl +39 -0
- package/templates/multi-projects/libraries/{{projectName}}/tsconfig.json +5 -0
- package/{template → templates/multi-projects}/package.json.tmpl +4 -3
- package/{template → templates/multi-projects}/pnpm-workspace.yaml.tmpl +0 -1
- package/{template → templates/multi-projects}/tools/README.md +1 -1
- package/templates/multi-projects/tsconfig.json +4 -0
- package/{template → templates/multi-projects}/turbo.json +2 -1
- package/templates/single-project/.changeset/README.md +8 -0
- package/templates/single-project/.changeset/config.json.tmpl +13 -0
- package/templates/single-project/.changeset/welcome.md.tmpl +5 -0
- package/templates/single-project/.editorconfig +4 -0
- package/templates/single-project/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
- package/templates/single-project/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/templates/single-project/.github/PULL_REQUEST_TEMPLATE.md.tmpl +29 -0
- package/templates/single-project/.github/renovate.json +69 -0
- package/templates/single-project/.github/workflows/continuous_delivery.yml +61 -0
- package/templates/single-project/.github/workflows/continuous_integration.yml +9 -0
- package/templates/single-project/.github/workflows/conventional_commit.yml +48 -0
- package/templates/single-project/.github/workflows/dependency_changelog.yml +117 -0
- package/templates/single-project/.github/workflows/workflow.yml +39 -0
- package/templates/single-project/.gitignore.tmpl +134 -0
- package/templates/single-project/.npmrc.tmpl +8 -0
- package/templates/single-project/.nvmrc.tmpl +1 -0
- package/templates/single-project/.vscode/extensions.json +8 -0
- package/templates/single-project/.vscode/settings.json +27 -0
- package/templates/single-project/CONTRIBUTING.md.tmpl +21 -0
- package/templates/single-project/LICENSE.tmpl +21 -0
- package/templates/single-project/eslint.config.js.tmpl +1 -0
- package/templates/single-project/examples/README.md +6 -0
- package/templates/single-project/examples/default/package.json.tmpl +14 -0
- package/templates/single-project/examples/default/src/index.ts.tmpl +3 -0
- package/templates/single-project/examples/default/tsconfig.json +5 -0
- package/templates/single-project/package.json.tmpl +27 -0
- package/templates/single-project/pnpm-workspace.yaml.tmpl +4 -0
- package/templates/single-project/tools/README.md +6 -0
- package/templates/single-project/tsconfig.json +4 -0
- package/templates/single-project/turbo.json +25 -0
- package/templates/single-project/{{projectName}}/README.md.tmpl +42 -0
- package/{template → templates/single-project}/{{projectName}}/package.json.tmpl +3 -5
- package/templates/single-project/{{projectName}}/src/index.test.ts.tmpl +5 -0
- package/templates/single-project/{{projectName}}/src/index.ts +1 -0
- package/bin/index.cjs +0 -7
- package/dist/index.cjs +0 -15
- package/dist/index.cjs.map +0 -7
- package/template/.commitlintrc.json +0 -3
- package/template/.eslintrc.json.tmpl +0 -3
- package/template/.github/ISSUE_TEMPLATE/config.yml +0 -4
- package/template/.github/workflows/continuous_delivery.yml +0 -49
- package/template/.github/workflows/continuous_integration.yml +0 -9
- package/template/.github/workflows/conventional_commit.yml +0 -48
- package/template/.github/workflows/dependency_changelog.yml +0 -117
- package/template/.github/workflows/workflow.yml +0 -96
- package/template/applications/README.md +0 -9
- package/template/examples/README.md +0 -6
- package/template/libraries/README.md +0 -9
- package/template/tsconfig.json +0 -3
- /package/{template → templates/multi-projects}/.changeset/README.md +0 -0
- /package/{template → templates/multi-projects}/.changeset/config.json.tmpl +0 -0
- /package/{template → templates/multi-projects}/.changeset/welcome.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- /package/{template → templates/multi-projects}/.github/PULL_REQUEST_TEMPLATE.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/.github/renovate.json +0 -0
- /package/{template → templates/multi-projects}/.gitignore.tmpl +0 -0
- /package/{template → templates/multi-projects}/.nvmrc.tmpl +0 -0
- /package/{template → templates/multi-projects}/.vscode/extensions.json +0 -0
- /package/{template → templates/multi-projects}/.vscode/settings.json +0 -0
- /package/{template → templates/multi-projects}/CONTRIBUTING.md.tmpl +0 -0
- /package/{template → templates/multi-projects}/LICENSE.tmpl +0 -0
- /package/{template → templates/multi-projects}/examples/default/src/index.ts.tmpl +0 -0
- /package/{template → templates/multi-projects}/examples/default/tsconfig.json +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/README.md.tmpl +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/src/index.test.ts.tmpl +0 -0
- /package/{template → templates/multi-projects/libraries}/{{projectName}}/src/index.ts +0 -0
- /package/{template → templates/single-project}/{{projectName}}/tsconfig.json +0 -0
|
@@ -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>
|
|
@@ -10,15 +10,13 @@
|
|
|
10
10
|
],
|
|
11
11
|
"sideEffects": false,
|
|
12
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
13
|
"exports": {
|
|
18
14
|
".": {
|
|
15
|
+
"source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
19
17
|
"require": "./dist/index.cjs",
|
|
20
18
|
"import": "./dist/index.mjs",
|
|
21
|
-
"
|
|
19
|
+
"default": "./dist/index.mjs"
|
|
22
20
|
}
|
|
23
21
|
},
|
|
24
22
|
"license": "MIT",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const HELLO_WORLD = "Hello 👋, please replace me!";
|
package/bin/index.cjs
DELETED
package/dist/index.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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
|
-
\u256D\u2500\u2500\u2500\u2500\u2500\u256E
|
|
4
|
-
\u2502 \u25E0 \u25E0 ${e.title}
|
|
5
|
-
\u2502 ${t?.type==="error"?"\u25E0":"\u25E1"} \u2502 ${e.description}
|
|
6
|
-
\u2570\u2500\u2500\u2500\u2500\u2500\u256F
|
|
7
|
-
${e.body?`
|
|
8
|
-
${e.body}
|
|
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.1",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
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
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", "../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.1\",\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,EAA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uC,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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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 }}
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
|
@@ -1,117 +0,0 @@
|
|
|
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");
|
|
@@ -1,96 +0,0 @@
|
|
|
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
|
|
@@ -1,9 +0,0 @@
|
|
|
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, ...).
|
|
@@ -1,9 +0,0 @@
|
|
|
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.
|
package/template/tsconfig.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|