wbfy 1.31.0 → 1.33.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/dist/index.min.cjs +29 -26
- package/dist/index.min.cjs.map +3 -3
- package/package.json +13 -13
package/dist/index.min.cjs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
var
|
1
|
+
"use strict";var mt=Object.create;var Q=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames,ye=Object.getOwnPropertySymbols,dt=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;var he=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))Pe.call(t,n)&&he(e,n,t[n]);if(ye)for(var n of ye(t))gt.call(t,n)&&he(e,n,t[n]);return e};var yt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ut(t))!Pe.call(e,r)&&r!==n&&Q(e,r,{get:()=>t[r],enumerable:!(o=ft(t,r))||o.enumerable});return e};var l=(e,t,n)=>(n=e!=null?mt(dt(e)):{},yt(t||!e||!e.__esModule?Q(n,"default",{value:e,enumerable:!0}):n,e));var lt=l(require("path")),ct=l(require("glob")),pt=l(require("yargs"));var z=l(require("fs")),te=l(require("path"));var we=require("minimal-promise-pool"),c=new we.PromisePool;var ee=l(require("child_process"));function h(e,t,n,o=0){do{let[r,i,a]=ve(e,t,n);if(console.log(`$ ${r} ${i.join(" ")} at ${a.cwd}`),ee.default.spawnSync(r,i,a).status===0)break}while(--o>=0)}function J(e,t,n){let[o,r,i]=ve(e,t,n);i.stdio="pipe";let a=ee.default.spawnSync(o,r,i),s=a.stderr.toString().trim();return s&&console.error(`${o} [${r.map(f=>`"${f}"`)}] caused the following error:
|
2
|
+
${s}`),a.stdout.toString().trim()}function ve(e,t,n){let o=T({},process.env);return o.PATH&&o.BERRY_BIN_FOLDER&&(o.PATH=o.PATH.replace(`${o.BERRY_BIN_FOLDER}:`,"")),o.ASDF_DIR&&(t=["-l","-c",`. ${o.ASDF_DIR}/asdf.sh && ${e} ${t.join(" ")}`],e="bash"),[e,t,{cwd:n,env:o,shell:!1,stdio:"inherit"}]}async function ke(e){if(!e.versionsText)return;let t=[];for(let o of e.versionsText.trim().split(`
|
2
3
|
`)){let r=o.trim();if(r&&r.split(/\s+/)[0]!=="nodejs"){t.push(r);continue}let[,i]=r.split(/\s+/);await c.run(()=>z.default.promises.writeFile(te.default.resolve(e.dirPath,".node-version"),i))}if(e.containingPoetryLock&&(B("poetry 1.1.13",0,t),B("python 3.9.10",0,t)),e.depending.firebase&&B("java adoptopenjdk-17.0.2+8",0,t),e.containingPackageJson){let o=J("npm",["show","yarn","version"],e.dirPath);B(`yarn ${o}`,t.length,t)}let n=te.default.resolve(e.dirPath,".tool-versions");t.length?await c.run(()=>z.default.promises.writeFile(n,t.join(`
|
3
4
|
`)+`
|
4
|
-
`)):await c.run(()=>z.default.promises.rm(n,{force:!0})),await c.promiseAll(),h("asdf",["install"],e.dirPath)}function B(e,t,n){let[o]=e.split(" "),r=n.findIndex(i=>i.split(/\s+/)[0]===o);r>=0?n[r]=e:n.splice(t,0,e)}var
|
5
|
+
`)):await c.run(()=>z.default.promises.rm(n,{force:!0})),await c.promiseAll(),h("asdf",["install"],e.dirPath)}function B(e,t,n){let[o]=e.split(" "),r=n.findIndex(i=>i.split(/\s+/)[0]===o);r>=0?n[r]=e:n.splice(t,0,e)}var xe=l(require("path"));var P={codeWith2IndentSize:["cjs","mjs","js","jsx","ts","tsx","json","json5","cpp","dart","htm","html","pu","puml","rb","vue","yaml","yml"].sort(),codeWith4IndentSize:["go","gradle","py"].sort(),codeWith8IndentSize:["sh"].sort(),markdownLike:["md"].sort(),eslint:["cjs","mjs","js","ts","tsx","jsx"].sort(),prettier:["cjs","mjs","js","jsx","ts","tsx","json","json5","css","htm","html","md","scss","vue","yaml","yml"].sort()};var be=l(require("fs/promises")),d={async generateFile(e,t){await be.default.writeFile(e,t),console.log(`Generated ${e}`)}};var ht=`root = true
|
5
6
|
|
6
7
|
[*]
|
7
8
|
charset = utf-8
|
@@ -9,33 +10,33 @@ end_of_line = lf
|
|
9
10
|
insert_final_newline = true
|
10
11
|
trim_trailing_whitespace = true
|
11
12
|
|
12
|
-
${
|
13
|
+
${L(P.codeWith2IndentSize)}
|
13
14
|
indent_size = 2
|
14
15
|
indent_style = space
|
15
16
|
|
16
|
-
${
|
17
|
+
${L(P.codeWith4IndentSize)}
|
17
18
|
indent_size = 4
|
18
19
|
indent_style = space
|
19
20
|
|
20
|
-
${
|
21
|
+
${L(P.codeWith8IndentSize)}
|
21
22
|
indent_size = 8
|
22
23
|
indent_style = space
|
23
24
|
|
24
|
-
${
|
25
|
+
${L(P.markdownLike)}
|
25
26
|
max_line_length = off
|
26
27
|
trim_trailing_whitespace = false
|
27
28
|
|
28
29
|
[{Makefile,*.mk}]
|
29
30
|
indent_style = tab
|
30
|
-
`;async function
|
31
|
+
`;async function Se(e){let t=xe.default.resolve(e.dirPath,".editorconfig");await c.run(()=>d.generateFile(t,ht))}function L(e){return e.length>1?`[*.{${e.join(",")}}]`:`[*.${e[0]}]`}var ne=l(require("path"));var M=l(require("fs")),y={header:"# Project-specific settings",separator:"# Generated by @willbooster/willboosterify",separatorPrefix:"# Generated by @willbooster",async getExistingContent(e){try{return(await M.default.promises.readFile(e,"utf-8")).replace(/# Project-specific settings[^\n]*\n/m,"").replace(/# Generated by[^\n]*\n/m,"").replace(/\r?\n\r?\n(\r?\n)+/gm,`
|
31
32
|
|
32
|
-
`)}catch{return null}},async getUserContent(e){try{let t=await
|
33
|
-
`,n)+1)}catch{}return null},async isBerryZeroInstallEnabled(e){try{return(await
|
34
|
-
!.yarn/cache`)}catch{return!1}}};var
|
33
|
+
`)}catch{return null}},async getUserContent(e){try{let t=await M.default.promises.readFile(e,"utf-8"),n=t.indexOf(this.separatorPrefix);if(n>=0)return t.substring(0,t.indexOf(`
|
34
|
+
`,n)+1)}catch{}return null},async isBerryZeroInstallEnabled(e){try{return(await M.default.promises.readFile(e,"utf-8")).includes(`
|
35
|
+
!.yarn/cache`)}catch{return!1}}};var Pt=`${y.header}
|
35
36
|
|
36
37
|
|
37
38
|
${y.separator}
|
38
|
-
`,
|
39
|
+
`,wt=`
|
39
40
|
3rd-party/
|
40
41
|
@types/
|
41
42
|
__generated__/
|
@@ -48,24 +49,24 @@ test-fixtures/
|
|
48
49
|
*.min.js
|
49
50
|
.yarn/
|
50
51
|
.pnp.js
|
51
|
-
`;async function
|
52
|
+
`;async function Ce(e){let t=ne.default.resolve(e.dirPath,".eslintignore"),n=await y.getUserContent(t)||Pt,o=ne.default.resolve(e.dirPath,".gitignore"),r=await y.getExistingContent(o)||"",i=n+wt+r;await c.run(()=>d.generateFile(t,i))}var $e=l(require("fs")),_e=l(require("path")),je=l(require("deepmerge"));var Fe=l(require("deepmerge"));function U(e,t){return t}function G(e,t,n){let o=e.slice();return t.forEach((r,i)=>{typeof o[i]>"u"?o[i]=n.cloneUnlessOtherwiseSpecified(r,n):n.isMergeableObject(r)?o[i]=(0,Fe.default)(e[i],r,n):e.indexOf(r)===-1&&o.push(r)}),o}async function Re(e,t){let n=[];e.eslintBase&&n.push(e.eslintBase),e!==t&&n.push("../../.eslintrc.json");let o={root:!0,extends:n},r=_e.default.resolve(e.dirPath,".eslintrc.json");try{let a=await $e.default.promises.readFile(r,"utf-8"),s=JSON.parse(a);s.extends&&(s.extends=s.extends.filter(m=>!m.startsWith("@willbooster/")&&m!=="../../.eslintrc.json")),n.length||(s.extends=[]);let f=o.extends;o.extends=s.extends,s.extends=f,o=je.default.all([o,s,o],{arrayMerge:G}),e.depending.blitz&&(o.extends=[...o.extends.filter(m=>m!=="blitz"),"blitz"])}catch{}let i=JSON.stringify(o);await c.run(()=>d.generateFile(r,i))}var Te=l(require("path"));var vt=`* text=auto
|
52
53
|
|
53
54
|
*.vcproj text eol=crlf
|
54
55
|
|
55
56
|
${P.codeWith2IndentSize.concat(P.codeWith4IndentSize).concat(P.markdownLike).map(e=>`*.${e} text eol=lf`).join(`
|
56
57
|
`)}
|
57
|
-
`;async function
|
58
|
+
`;async function Oe(e){let t=Te.default.resolve(e.dirPath,".gitattributes");await c.run(()=>d.generateFile(t,vt))}var oe=l(require("path"));async function Y(e,t){let{default:n}=await import("node-fetch");return n(e,t)}var kt=["windows","macos","linux","jetbrains","visualstudiocode","emacs","vim","yarn"],bt=`${y.header}
|
58
59
|
|
59
60
|
|
60
61
|
${y.separator}
|
61
|
-
`,
|
62
|
+
`,xt=`
|
62
63
|
.devcontainer/
|
63
64
|
dist/
|
64
65
|
temp/
|
65
66
|
Icon[\r]
|
66
67
|
*.sqlite3
|
67
68
|
*.sqlite3-journal
|
68
|
-
`,ie=new Map;async function
|
69
|
+
`,ie=new Map;async function De(e,t){let n=oe.default.resolve(e.dirPath,".gitignore"),o=(await y.getUserContent(n)||bt)+xt,r=[...kt];e.containingGemfile&&r.push("ruby"),e.containingGoMod&&(r.push("go"),o+=`${oe.default.basename(e.dirPath)}
|
69
70
|
`),e.containingPackageJson&&r.push("node"),e.containingPomXml&&(r.push("maven"),o+=`.idea/google-java-format.xml
|
70
71
|
`),e.containingPubspecYaml&&(r.push("flutter","AndroidStudio","ruby"),o+=`.flutter-plugins-dependencies
|
71
72
|
android/key.properties
|
@@ -77,8 +78,10 @@ packaged.yaml
|
|
77
78
|
android/app/src/main/assets/
|
78
79
|
`),t.depending.storybook&&r.push("storybookjs"),t.depending.blitz&&(r.push("nextjs"),o+=`.blitz/
|
79
80
|
.blitz**
|
80
|
-
`);let i="";for(let s of r){if(!ie.has(s)){let f=`https://www.toptal.com/developers/gitignore/api/${s}`,u=await(await Y(f)).text();if(u.includes("Attention Required!")){console.error(`Failed to fetch ${f}`);return}ie.set(s,u
|
81
|
-
|
81
|
+
`);let i="";for(let s of r){if(!ie.has(s)){let f=`https://www.toptal.com/developers/gitignore/api/${s}`,u=await(await Y(f)).text();if(u.includes("Attention Required!")){console.error(`Failed to fetch ${f}`);return}ie.set(s,u.trim())}i&&(i+=`
|
82
|
+
|
83
|
+
`),i+=ie.get(s)}await y.isBerryZeroInstallEnabled(n)||(i=i.replace("!.yarn/cache","# !.yarn/cache").replace("# .pnp.*",".pnp.*")),(e.containingPomXml||e.containingPubspecYaml)&&(i=i.replace(/^# .idea\/artifacts$/gm,".idea/artifacts").replace(/^# .idea\/compiler.xml$/gm,".idea/compiler.xml").replace(/^# .idea\/jarRepositories.xml$/gm,".idea/jarRepositories.xml").replace(/^# .idea\/modules.xml$/gm,".idea/modules.xml").replace(/^# .idea\/*.iml$/gm,".idea/*.iml").replace(/^# .idea\/modules$/gm,".idea/modules").replace(/^# *.iml$/gm,"*.iml").replace(/^# *.ipr$/gm,"*.ipr"),e.containingPubspecYaml&&(i=i.replace(/^.idea\/modules.xml$/gm,"# .idea/modules.xml"))),i=i.replace(/^.idea\/?$/gm,"# .idea"),(t.depending.reactNative||e.depending.reactNative||e.containingPubspecYaml)&&(i=i.replace(/^(.idea\/.+)$/gm,`$1
|
84
|
+
android/$1`));let a=o+i;await d.generateFile(n,a)}var x=l(require("fs")),j=l(require("path"));var re="npm test",A={preCommit:"yarn lint-staged",prePush:"yarn typecheck",prePushForLab:`
|
82
85
|
if [ $(git branch --show-current) = "main" ]; then
|
83
86
|
echo "************************************************"
|
84
87
|
echo "*** Don't push main branch directly. Use PR! ***"
|
@@ -86,7 +89,7 @@ if [ $(git branch --show-current) = "main" ]; then
|
|
86
89
|
exit 1
|
87
90
|
fi
|
88
91
|
|
89
|
-
yarn typecheck`.trim(),postMerge:"yarn"};async function
|
92
|
+
yarn typecheck`.trim(),postMerge:"yarn"};async function Ee(e){var m,u;let t=j.default.resolve(e.dirPath,"package.json"),n=await x.default.promises.readFile(t,"utf-8"),o=JSON.parse(n);o.scripts||(o.scripts={}),delete o.scripts.postinstall,delete o.scripts.postpublish,delete o.scripts.prepare,delete o.scripts.prepublishOnly,delete o.scripts.prepack,delete o.scripts.postpack;let r=j.default.resolve(e.dirPath,".husky");await Promise.all([x.default.promises.writeFile(t,JSON.stringify(o,void 0,2)),x.default.promises.rm(r,{force:!0,recursive:!0})]),h("yarn",["dlx","husky-init","--yarn2"],e.dirPath);let i=j.default.resolve(r,"pre-commit"),a=await x.default.promises.readFile(i,"utf-8");if(await c.run(()=>x.default.promises.rm(j.default.resolve(e.dirPath,".huskyrc.json"),{force:!0})),await c.run(()=>x.default.promises.writeFile(i,a.replace(re,A.preCommit))),e.containingTypeScript||e.containingTypeScriptInPackages){let p=(m=e.repository)!=null&&m.startsWith("github:WillBoosterLab/")?A.prePushForLab:A.prePush;await c.run(()=>x.default.promises.writeFile(j.default.resolve(r,"pre-push"),a.replace(re,p),{mode:493}))}let s=[];(u=e.versionsText)!=null&&u.includes("python ")&&s.push("asdf install python"),e.versionsText&&s.push("asdf install"),s.push(A.postMerge),e.containingPoetryLock&&s.push("poetry install"),(e.depending.blitz||e.depending.prisma)&&s.push("yarn gen-code");let f=a.replace(re,s.join(" && "));await c.run(()=>x.default.promises.writeFile(j.default.resolve(r,"post-merge"),f,{mode:493}))}var se=l(require("fs")),ae=l(require("path"));var St=`<?xml version="1.0" encoding="UTF-8"?>
|
90
93
|
<project version="4">
|
91
94
|
<component name="ProjectTasksOptions">
|
92
95
|
<TaskOptions isEnabled="true">
|
@@ -211,10 +214,10 @@ yarn typecheck`.trim(),postMerge:"yarn"};async function Je(e){var m,u;let t=_.de
|
|
211
214
|
</TaskOptions>
|
212
215
|
</component>
|
213
216
|
</project>
|
214
|
-
`;async function
|
215
|
-
'${
|
217
|
+
`;async function Je(e){let t=ae.default.resolve(e.dirPath,".idea");if(se.default.existsSync(t)){let n=ae.default.resolve(t,"watcherTasks.xml");e.containingJavaScript||e.containingJavaScriptInPackages||e.containingTypeScript||e.containingTypeScriptInPackages||e.containingPackageJson&&!e.containingPubspecYaml&&!e.containingGemfile&&!e.containingGoMod&&!e.containingPomXml?await c.run(()=>d.generateFile(n,St)):await c.run(()=>se.default.promises.rm(n,{force:!0}))}}var le=l(require("fs")),V=l(require("path"));var K={getLintFixSuffix(e){return e.containingJsxOrTsx?' --rule "{ react-hooks/exhaustive-deps: 0 }"':""}};var N={node:["src","__tests__","scripts"],blitz:["app","db","integrations","mailers","test"]};N.blitz=[...N.node,...N.blitz];function q(e){return e.depending.blitz?N.blitz:N.node}async function ce(e){let t=[];if(e.containingJavaScript||e.containingTypeScript){let i=`
|
218
|
+
'${Ne(e)}': [${JSON.stringify(`eslint --fix${K.getLintFixSuffix(e)}`)}, 'prettier --write'],`;t.push(i)}let n=e.root?" && !file.includes('/packages/')":"";t.push(`
|
216
219
|
'./**/*.{${P.prettier.join(",")}}': files => {
|
217
|
-
${e.containingJavaScript||e.containingTypeScript?
|
220
|
+
${e.containingJavaScript||e.containingTypeScript?Ct(e):""}
|
218
221
|
const filteredFiles = files.filter(file => !file.includes('/test-fixtures/')${n});
|
219
222
|
if (filteredFiles.length === 0) return [];
|
220
223
|
const commands = [\`prettier --write \${filteredFiles.join(' ')}\`];
|
@@ -237,12 +240,12 @@ yarn typecheck`.trim(),postMerge:"yarn"};async function Je(e){var m,u;let t=_.de
|
|
237
240
|
|
238
241
|
module.exports = {${t.join("")}
|
239
242
|
};
|
240
|
-
`,r=V.default.resolve(e.dirPath,".lintstagedrc.cjs");await c.run(()=>le.default.promises.rm(V.default.resolve(e.dirPath,".lintstagedrc.js"),{force:!0})),await c.run(()=>le.default.promises.rm(V.default.resolve(e.dirPath,".lintstagedrc.json"),{force:!0})),await c.run(()=>d.generateFile(r,o))}function
|
241
|
-
`).map(a=>{let s=a.trim();return s.endsWith("/")?s.slice(0,-1):s}).filter(a=>a&&!a.startsWith("#")&&!a.includes("/")).map(a=>` "!**/${a}/**"`).join("")}var fe=l(require("path"));var
|
243
|
+
`,r=V.default.resolve(e.dirPath,".lintstagedrc.cjs");await c.run(()=>le.default.promises.rm(V.default.resolve(e.dirPath,".lintstagedrc.js"),{force:!0})),await c.run(()=>le.default.promises.rm(V.default.resolve(e.dirPath,".lintstagedrc.json"),{force:!0})),await c.run(()=>d.generateFile(r,o))}function Ne(e){return`./{${q(e).join(",")}}/**/*.{${P.eslint.join(",")}}`}function Ct(e){return`files = micromatch.not(files, '${Ne(e)}');`}var S=l(require("fs")),O=l(require("path")),me=l(require("deepmerge"));var pe=["eslint","eslint-config-prettier","eslint-plugin-import","eslint-plugin-sort-class-members","eslint-plugin-sort-destructure-keys"],We=[...pe,"@typescript-eslint/eslint-plugin","@typescript-eslint/parser","eslint-import-resolver-typescript"],Ie=["eslint-plugin-react","eslint-plugin-react-hooks"],Be={"@willbooster/eslint-config-js":["@willbooster/eslint-config-js",...pe],"@willbooster/eslint-config-js-react":["@willbooster/eslint-config-js-react",...pe,...Ie],"@willbooster/eslint-config-ts":["@willbooster/eslint-config-ts",...We],"@willbooster/eslint-config-ts-react":["@willbooster/eslint-config-ts-react",...We,...Ie],"../../.eslintrc.json":[]};async function ze(e,t,n){var m,u;let o=O.default.resolve(e.dirPath,"package.json"),r=await S.default.promises.readFile(o,"utf-8"),i=JSON.parse(r);i.scripts=i.scripts||{},i.dependencies=i.dependencies||{},i.devDependencies=i.devDependencies||{},i.peerDependencies=i.peerDependencies||{},await Ft(i),i.name!=="@willbooster/prettier-config"&&(i.prettier="@willbooster/prettier-config");for(let p of Object.keys(i.scripts))i.scripts[p].includes("git clone")||(i.scripts[p]=i.scripts[p].replace(/yarn\s*&&\s*/,"").replace(/yarn\s*install\s*&&\s*/,""));i.scripts=(0,me.default)(i.scripts,$t(e)),i.scripts.prettify+=await _t(e.dirPath);let a=[],s=["lint-staged","prettier","sort-package-json","@willbooster/prettier-config"],f=[];if(e.root&&(s.push("husky","pinst","@willbooster/renovate-config"),e.depending.semanticRelease&&s.push("conventional-changelog-conventionalcommits"),e.containingSubPackageJsons?i.workspaces=["packages/*"]:delete i.workspaces),(e.containingJavaScript||e.containingJavaScriptInPackages||e.containingTypeScript||e.containingTypeScriptInPackages)&&(s.push("eslint","micromatch"),e.containingTypeScriptInPackages&&s.push("@typescript-eslint/parser")),(e.containingTypeScript||e.containingTypeScriptInPackages)&&!e.depending.blitz&&s.push("typescript"),e.eslintBase&&s.push(...Be[e.eslintBase]),e.willBoosterConfigs&&(a=a.filter(p=>!p.includes("@willbooster/")),s=s.filter(p=>!p.includes("@willbooster/"))),i.name||(i.name=O.default.basename(e.dirPath)),e.containingSubPackageJsons&&(i.private=!0),i.license||(i.license="UNLICENSED"),!e.containingTypeScript&&!e.containingTypeScriptInPackages&&delete i.scripts.typecheck,e.depending.semanticRelease&&e.release.npm&&(i.resolutions||(i.resolutions={}),i.resolutions["npm/chalk"]="^4.1.2"),!e.containingSubPackageJsons){if(!e.containingJavaScript&&!e.containingTypeScript?(delete i.scripts.lint,delete i.scripts["lint-fix"],i.scripts.cleanup=i.scripts.cleanup.replace(" && yarn lint-fix","")):i.scripts["lint-fix"]+=K.getLintFixSuffix(e),e.containingPubspecYaml){i.scripts.lint="flutter analyze",i.scripts["lint-fix"]="yarn lint";let p=["lib","test","test_driver"].filter(k=>S.default.existsSync(O.default.resolve(e.dirPath,k)));p.length>0&&(i.scripts["format-code"]=`flutter format $(find ${p.join(" ")} -name generated -prune -o -name '*.freezed.dart' -prune -o -name '*.g.dart' -prune -o -name '*.dart' -print)`,i.scripts.format+=" && yarn format-code")}if(e.containingPoetryLock){i.scripts.postinstall==="poetry install"&&delete i.scripts.postinstall;let p=(await S.default.promises.readdir(e.dirPath)).filter(k=>{let E=O.default.resolve(e.dirPath,k);return S.default.lstatSync(E).isDirectory()?S.default.readdirSync(E).some(v=>v.endsWith(".py")):!1});p.length>0&&(i.scripts["format-code"]=`poetry run isort --profile black ${p.join(" ")} && poetry run black ${p.join(" ")}`,i.scripts.lint=`poetry run flake8 ${p.join(" ")}`,i.scripts["lint-fix"]="yarn lint",i.scripts.format+=" && yarn format-code",f.push("black","isort","flake8"))}e.repository&&(i.repository=e.repository)}e.depending.blitz?(s=s.filter(p=>!p.includes("@typescript-eslint/")),s=s.filter(p=>p!=="eslint-plugin-react"&&p!=="eslint-import-resolver-typescript"&&p!=="eslint-plugin-import"&&p!=="eslint-plugin-react-hooks"),(m=i.scripts["gen-code"])!=null&&m.startsWith("blitz codegen")||(i.scripts["gen-code"]="blitz codegen")):e.depending.prisma&&((u=i.scripts["gen-code"])!=null&&u.startsWith("prisma generate")||(i.scripts["gen-code"]="prisma generate")),Object.keys(i.dependencies).length||delete i.dependencies,Object.keys(i.devDependencies).length||delete i.devDependencies,Object.keys(i.peerDependencies).length||delete i.peerDependencies,await S.default.promises.writeFile(o,JSON.stringify(i)),n||(a=a.filter(p=>{var k;return!((k=i.devDependencies)!=null&&k[p])}),a.length&&h("yarn",["add",...new Set(a)],e.dirPath),s=s.filter(p=>{var k;return!((k=i.dependencies)!=null&&k[p])}),s.length&&h("yarn",["add","-D",...new Set(s)],e.dirPath),f.length&&h("poetry",["add",...new Set(f)],e.dirPath))}async function Ft(e){e.author==="WillBooster LLC"&&(e.author="WillBooster Inc."),delete e.scripts["sort-package-json"],delete e.scripts["sort-all-package-json"],delete e.scripts["typecheck:codegen"],delete e.dependencies.tslib,delete e.devDependencies["@willbooster/eslint-config"],delete e.devDependencies["@willbooster/eslint-config-react"],delete e.devDependencies["@willbooster/tsconfig"],delete e.devDependencies["eslint-import-resolver-node"],delete e.devDependencies["eslint-plugin-prettier"],delete e.devDependencies.lerna,delete e.devDependencies.pinst,delete e.scripts["flutter-format"],delete e.scripts["format-flutter"],delete e.scripts["python-format"],delete e.scripts["format-python"],delete e.scripts.prettier;for(let t of Object.values(Be))for(let n of t)delete e.devDependencies[n];await c.run(()=>S.default.promises.rm("lerna.json",{force:!0}))}function $t(e){let t={cleanup:"yarn format && yarn lint-fix",format:"sort-package-json && yarn prettify",lint:`eslint --color "./{${q(e)}}/**/*.{${P.eslint.join(",")}}"`,"lint-fix":"yarn lint --fix",prettify:`prettier --color --write "**/{.*/,}*.{${P.prettier.join(",")}}" "!**/test-fixtures/**"`,typecheck:"tsc --noEmit --Pretty"};return e.containingSubPackageJsons&&(t=(0,me.default)(T({},t),{format:"sort-package-json && yarn prettify && yarn workspaces foreach --parallel --verbose run format",lint:"yarn workspaces foreach --parallel --verbose run lint","lint-fix":"yarn workspaces foreach --parallel --verbose run lint-fix",prettify:`prettier --color --write "**/{.*/,}*.{${P.prettier.join(",")}}" "!**/packages/**" "!**/test-fixtures/**"`,test:"yarn workspaces foreach --verbose run test",typecheck:"yarn workspaces foreach --parallel --verbose run typecheck"})),e.depending.blitz&&(t.typecheck=`${t.typecheck} || yarn run typecheck/warn`,t["typecheck/warn"]=`echo 'Please try "yarn gen-code" if you face unknown type errors.' && exit 1`,t["typecheck:gen-code"]="yarn gen-code && tsc --noEmit --Pretty"),t}async function _t(e){let t=O.default.resolve(e,".prettierignore"),n=await S.default.promises.readFile(t,"utf-8"),o=n.indexOf(y.separatorPrefix);return o<0?"":n.substring(0,o).split(`
|
244
|
+
`).map(a=>{let s=a.trim();return s.endsWith("/")?s.slice(0,-1):s}).filter(a=>a&&!a.startsWith("#")&&!a.includes("/")).map(a=>` "!**/${a}/**"`).join("")}var fe=l(require("path"));var jt=`${y.header}
|
242
245
|
|
243
246
|
|
244
247
|
${y.separator}
|
245
|
-
`,
|
248
|
+
`,Rt=`
|
246
249
|
3rd-party/
|
247
250
|
android/
|
248
251
|
ios/
|
@@ -252,9 +255,9 @@ test-fixtures/
|
|
252
255
|
*.min.js
|
253
256
|
.yarn/
|
254
257
|
.pnp.js
|
255
|
-
`;async function Le(e){let t=fe.default.resolve(e.dirPath,".prettierignore"),n=await y.getUserContent(t)||
|
258
|
+
`;async function Le(e){let t=fe.default.resolve(e.dirPath,".prettierignore"),n=await y.getUserContent(t)||jt,o=fe.default.resolve(e.dirPath,".gitignore"),r=await y.getExistingContent(o)||"",i="";e.containingPubspecYaml&&(i=`
|
256
259
|
android/app/
|
257
260
|
ios/Runner/Assets.xcassets/
|
258
261
|
pubspec.yaml
|
259
|
-
`);let a=n+Et+i+r;await c.run(()=>d.generateFile(t,a))}var Me=l(require("fs")),Ge=l(require("path"));async function Ye(e){let t=Ge.default.resolve(e.dirPath,".releaserc.json");try{let n=JSON.parse(await Me.default.promises.readFile(t,"utf8")),o=(n==null?void 0:n.plugins)||[];for(let i=0;i<o.length;i++){let a=Array.isArray(o[i])?o[i][0]:o[i];a==="@semantic-release/commit-analyzer"?o[i]=["@semantic-release/commit-analyzer",{preset:"conventionalcommits"}]:a==="@semantic-release/github"&&!e.publicRepo&&(o[i]=["@semantic-release/github",{successComment:!1}])}let r=JSON.stringify(n);await c.run(()=>d.generateFile(t,r))}catch{}}var X=l(require("fs")),H=l(require("path")),Ae=l(require("deepmerge")),Ke=l(require("lodash.clonedeep"));var Jt={extends:["@willbooster"]};async function qe(e){let t=(0,Ke.default)(Jt),n=H.default.resolve(e.dirPath,".renovaterc.json");try{let r=await X.default.promises.readFile(n,"utf-8"),i=JSON.parse(r);t=Ae.default.all([t,i,t],{arrayMerge:M})}catch{}await c.run(()=>X.default.promises.rm(H.default.resolve(e.dirPath,".dependabot"),{force:!0})),await c.run(()=>X.default.promises.rm(H.default.resolve(e.dirPath,"renovate.json"),{force:!0}));let o=JSON.stringify(t);await c.run(()=>d.generateFile(n,o))}var Ve=l(require("fs")),ue=l(require("path")),Xe=l(require("js-yaml"));var Nt={titleOnly:!0};async function He(e){let t=ue.default.resolve(e.dirPath,".github");await Ve.default.promises.mkdir(t,{recursive:!0});let n=ue.default.join(t,"semantic.yml"),o=Xe.default.dump(Nt);await c.run(()=>d.generateFile(n,o))}var Ze=l(require("fs")),I=l(require("path")),Qe=l(require("deepmerge")),et=l(require("lodash.clonedeep"));function W(e){let t=Object.entries(e).sort(([n],[o])=>n.localeCompare(o));for(let[n,o]of t)delete e[n],e[n]=o}var Wt={compilerOptions:{target:"esnext",module:"esnext",moduleResolution:"node",jsx:"react",alwaysStrict:!0,strict:!0,skipLibCheck:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,resolveJsonModule:!0,sourceMap:!0,importHelpers:!1,outDir:"dist"},include:["src/**/*","__tests__/**/*","scripts/**/*","packages/*/src/**/*","packages/*/__tests__/**/*","packages/*/scripts/**/*","./node_modules/@types","./@types"]},It={compilerOptions:{target:"esnext",module:"esnext",moduleResolution:"node",jsx:"react",alwaysStrict:!0,strict:!0,skipLibCheck:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,resolveJsonModule:!0,sourceMap:!0,importHelpers:!1,outDir:"dist"},include:["src/**/*","__tests__/**/*","scripts/**/*","../../node_modules/@types","../../@types","./@types"]};async function tt(e,t){var i,a,s;if(t.depending.blitz)return;let n=(0,et.default)(e.root?Wt:It);if(!e.containingJsxOrTsx&&!e.containingJsxOrTsxInPackages&&delete n.compilerOptions.jsx,e.root&&!e.containingSubPackageJsons&&(n.include=n.include.filter(f=>!f.startsWith("packages/*/"))),!e.root&&(e.depending.jestPlaywrightPreset||t.depending.jestPlaywrightPreset)){let f=I.default.relative(e.dirPath,t.dirPath);n.include.push(I.default.join(f,"node_modules/jest-playwright-preset/types"),I.default.join(f,"node_modules/expect-playwright"))}let o=I.default.resolve(e.dirPath,"tsconfig.json");try{let f=await Ze.default.promises.readFile(o,"utf-8"),m=JSON.parse(f);m.extends==="./node_modules/@willbooster/tsconfig/tsconfig.json"&&delete m.extends,(i=m.compilerOptions)==null||delete i.typeRoots,(a=n==null?void 0:n.compilerOptions)==null||delete a.target,(s=n==null?void 0:n.compilerOptions)==null||delete s.module,m.jsx&&delete n.jsx,e.depending.blitz&&delete n.include,n=Qe.default.all([n,m,n],{arrayMerge:M})}catch{}W(n.compilerOptions);let r=JSON.stringify(n);await c.run(()=>d.generateFile(o,r))}var j=l(require("fs")),$=l(require("path")),ot=l(require("deepmerge")),de=l(require("js-yaml")),rt=l(require("lodash.clonedeep"));var Bt={name:"Test",on:{pull_request:null,push:{branches:["main","wbfy","renovate/**"]}},jobs:{test:{uses:"WillBooster/reusable-workflows/.github/workflows/test.yml@main"}}},zt={name:"Release",on:{push:{branches:[]}},jobs:{release:{uses:"WillBooster/reusable-workflows/.github/workflows/release.yml@main"}}},Ut={name:"Willboosterify",on:{workflow_dispatch:null},jobs:{wbfy:{uses:"WillBooster/reusable-workflows/.github/workflows/wbfy.yml@main"}}},Lt={name:"Merge wbfy",on:{workflow_dispatch:null},jobs:{"wbfy-merge":{uses:"WillBooster/reusable-workflows/.github/workflows/wbfy-merge.yml@main"}}},Mt={name:"Lint PR title",on:{pull_request_target:{types:["opened","edited","synchronize"]}},jobs:{"semantic-pr":{uses:"WillBooster/reusable-workflows/.github/workflows/semantic-pr.yml@main"}}};async function st(e){let t=$.default.resolve(e.dirPath,".github","workflows");await j.default.promises.mkdir(t,{recursive:!0});let n=(await j.default.promises.readdir(t,{withFileTypes:!0})).filter(o=>o.isFile()&&o.name.endsWith(".yml")).map(o=>o.name);e.depending.semanticRelease&&n.push("release.yml"),n.push("test.yml","wbfy.yml","wbfy-merge.yml","semantic-pr.yml");for(let o of n){let r=$.default.basename(o,".yml");await c.run(()=>Gt(e,t,r))}}async function nt(e,t){let n=de.default.dump(e,{lineWidth:-1,noCompatMode:!0,styles:{"!!null":"empty"}});await c.run(()=>j.default.promises.writeFile(t,n))}async function Gt(e,t,n){var i,a;let o={};n==="test"?o=Bt:n==="release"?o=zt:n==="wbfy"?o=Ut:n==="wbfy-merge"?o=Lt:n==="semantic-pr"&&(o=Mt),o=(0,rt.default)(o);let r=$.default.join(t,`${n}.yml`);try{let s=await j.default.promises.readFile(r,"utf-8"),f=de.default.load(s);o=ot.default.all([o,f,o],{arrayMerge:G})}catch{}for(let s of Object.values(o.jobs)){if(!((a=(i=s.uses)==null?void 0:i.includes)!=null&&a.call(i,"/reusable-workflows/")))return;Yt(e,s,n)}if(n==="release"?o.on.schedule?delete o.on.push:o.on.push.branches=e.release.branches:n==="wbfy"?it(o,20,24):n==="wbfy-merge"&&it(o,0,4),await nt(o,r),n==="release")await c.run(()=>j.default.promises.rm($.default.join(t,"semantic-release.yml"),{force:!0}));else if(n==="sync"){if(await c.run(()=>j.default.promises.rm($.default.join(t,"sync-init.yml"),{force:!0})),!o.jobs.sync)return;o.jobs["sync-force"]=o.jobs.sync;let s=o.jobs.sync.with.sync_params_without_dest;if(!s)return;o.jobs.sync.with.sync_params_without_dest=`--force ${s}`,o.name="Force to Sync",o.on={workflow_dispatch:null},delete o.jobs.sync,await nt(o,$.default.join(t,"sync-force.yml"))}}function Yt(e,t,n){var o,r,i;if(t.with||(t.with={}),t.secrets||(t.secrets={}),(e.release.github&&n==="test"||n==="release"||n==="wbfy"||n==="wbfy-merge")&&(e.publicRepo?t.secrets.GH_TOKEN="${{ secrets.PUBLIC_GH_BOT_PAT }}":t.secrets.GH_TOKEN="${{ secrets.GH_BOT_PAT }}"),e.release.npm&&(n==="release"||n==="test")&&(t.secrets.NPM_TOKEN="${{ secrets.NPM_TOKEN }}"),n==="sync"){let a=(o=t.with)==null?void 0:o.sync_params_without_dest;a&&(t.with.sync_params_without_dest=a.replace("sync ",""))}(r=e.repository)!=null&&r.startsWith("github:WillBooster/")?t.uses=t.uses.replace("WillBoosterLab/","WillBooster/"):(i=e.repository)!=null&&i.startsWith("github:WillBoosterLab/")&&(t.uses=t.uses.replace("WillBooster/","WillBoosterLab/")),delete t.with.non_self_hosted,e.containingDockerfile&&n.startsWith("deploy")&&(t.with.cpu_arch="X64"),Object.keys(t.with).length?W(t.with):delete t.with,Object.keys(t.secrets).length?W(t.secrets):delete t.secrets}function it(e,t,n){var f,m;let[o,r]=(((m=(f=e.on.schedule)==null?void 0:f[0])==null?void 0:m.cron)??"").split(" ").map(Number);if(o!==0&&Number.isInteger(r)){let u=(r+9)%24;if(t<n?t<=u&&u<n:t<=u||u<n)return}let i=1+Math.floor(Math.random()*59),a=t+Math.floor(Math.random()*(n-t)),s=`${i} ${(a-9+24)%24} * * *`;e.on.schedule=[{cron:s}]}var R=l(require("fs")),D=l(require("path")),ge=l(require("js-yaml"));async function lt(e){let t=J("yarn",["--version"],e.dirPath),n=J("npm",["show","@yarnpkg/cli","version"],e.dirPath);t!==n&&h("yarn",["set","version",n],e.dirPath,1);let o=D.default.join(e.dirPath,".yarn","releases");await R.default.promises.mkdir(o,{recursive:!0});for(let m of await R.default.promises.readdir(o))m.startsWith("yarn-")&&!m.startsWith(`yarn-${n}.`)&&(await c.run(()=>R.default.promises.rm(D.default.join(o,m))),console.log("Removed",D.default.join(o,m)));let r=D.default.resolve(e.dirPath,".yarnrc");await c.run(()=>R.default.promises.rm(r,{force:!0}));let i=D.default.resolve(e.dirPath,".yarnrc.yml"),a=ge.default.load(await R.default.promises.readFile(i,"utf8"));a.defaultSemverRangePrefix="",e.requiringNodeModules&&(a.nodeLinker="node-modules",a.nmMode="hardlinks-global"),await R.default.promises.writeFile(i,ge.default.dump(a,{lineWidth:-1}));let s=(a.plugins||[]).map(m=>m.spec),f=e.containingTypeScript||e.containingTypeScriptInPackages;at(e,s,f,"@yarnpkg/plugin-typescript"),f&&!e.requiringNodeModules&&h("yarn",["dlx","@yarnpkg/sdks","vscode"],e.dirPath),at(e,s,e.containingSubPackageJsons,"@yarnpkg/plugin-workspace-tools"),h("yarn",["dlx","yarn-plugin-auto-install"],e.dirPath)}function at(e,t,n,o){n!==t.includes(o)&&h("yarn",["plugin",n?"import":"remove",o],e.dirPath)}var w=l(require("fs")),Z=l(require("fs/promises")),g=l(require("path")),F=l(require("glob")),pt=l(require("js-yaml")),mt=l(require("simple-git"));async function ye(e){var n;let t=g.default.resolve(e,"package.json");try{let o=w.default.existsSync(t),r={},i={},a={};if(o){let C=w.default.readFileSync(t,"utf-8");a=JSON.parse(C),r=a.dependencies??{},i=a.devDependencies??{}}let s=!0;try{let C=g.default.resolve(e,".yarnrc.yml"),b=pt.default.load(await Z.default.readFile(C,"utf8"));s=!b.nodeLinker||b.nodeLinker==="node-modules"}catch{}let f=[],m=[];try{let C=g.default.resolve(e,".releaserc.json"),b=JSON.parse(await Z.default.readFile(C,"utf8"));f=(b==null?void 0:b.branches)||[],m=((n=b==null?void 0:b.plugins)==null?void 0:n.flat())||[]}catch{}let u=g.default.basename(g.default.resolve(e,".."))!=="packages"||!w.default.existsSync(g.default.resolve(e,"..","..","package.json")),p;u&&(p=await Kt(e,a));let k=g.default.resolve(e,".tool-versions"),E;try{E=await Z.default.readFile(k,"utf-8")}catch{}let v={dirPath:e,root:u,publicRepo:(p==null?void 0:p.private)===!1,repository:p!=null&&p.full_name?`github:${p==null?void 0:p.full_name}`:void 0,willBoosterConfigs:t.includes(`${g.default.sep}willbooster-configs`),containingSubPackageJsons:F.default.sync("packages/**/package.json",{cwd:e}).length>0,containingDockerfile:w.default.existsSync(g.default.resolve(e,"Dockerfile"))||w.default.existsSync(g.default.resolve(e,"docker-compose.yml")),containingGemfile:w.default.existsSync(g.default.resolve(e,"Gemfile")),containingGoMod:w.default.existsSync(g.default.resolve(e,"go.mod")),containingPackageJson:w.default.existsSync(g.default.resolve(e,"package.json")),containingPoetryLock:w.default.existsSync(g.default.resolve(e,"poetry.lock")),containingPomXml:w.default.existsSync(g.default.resolve(e,"pom.xml")),containingPubspecYaml:w.default.existsSync(g.default.resolve(e,"pubspec.yaml")),containingTemplateYaml:w.default.existsSync(g.default.resolve(e,"template.yaml")),containingJavaScript:F.default.sync("@(app|src|__tests__|scripts)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScript:F.default.sync("@(app|src|__tests__|scripts)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsx:F.default.sync("@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,containingJavaScriptInPackages:F.default.sync("packages/**/@(app|src|__tests__|scripts)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScriptInPackages:F.default.sync("packages/**/@(app|src|__tests__|scripts)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsxInPackages:F.default.sync("packages/**/@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,depending:{blitz:!!(r.blitz||i.blitz),firebase:!!i["firebase-tools"],jestPlaywrightPreset:!!i["jest-playwright-preset"],prisma:!!i.prisma,reactNative:!!r["react-native"],semanticRelease:!!i["semantic-release"],storybook:!!i["@storybook/react"]},release:{branches:f,github:m.includes("@semantic-release/github"),npm:m.includes("@semantic-release/npm")},requiringNodeModules:s,versionsText:E};if(v.eslintBase=At(v),v.containingGemfile||v.containingGoMod||v.containingPackageJson||v.containingPoetryLock||v.containingPomXml||v.containingPubspecYaml||v.containingTemplateYaml)return v}catch{}return null}function At(e){if(e.containingTypeScript)return e.containingJsxOrTsx?"@willbooster/eslint-config-ts-react":"@willbooster/eslint-config-ts";if(e.containingJsxOrTsx)return"@willbooster/eslint-config-js-react";if(e.containingJavaScript)return"@willbooster/eslint-config-js"}async function Kt(e,t){var s,f,m;let r=(await(0,mt.default)(e).getRemotes(!0)).find(u=>u.name==="origin"),i=((s=r==null?void 0:r.refs)==null?void 0:s.fetch)??((f=r==null?void 0:r.refs)==null?void 0:f.push);if(typeof i=="string"){let u=await ct(i);if(u)return u}let a=((m=t.repository)==null?void 0:m.url)??t.repository;if(typeof a=="string"){let u=await ct(a);if(u&&u.message!=="Not Found")return u}}async function ct(e){var m;let t=e.split(":").at(-1),n=t==null?void 0:t.split("/"),o=n==null?void 0:n.at(-2),r=(m=n==null?void 0:n.at(-1))==null?void 0:m.replace(/.git$/,"");if(!o||!r)return;let i=process.env.GH_TOKEN||process.env.GITHUB_TOKEN,a=i?{headers:{Authorization:`token ${i}`}}:void 0,f=await(await Y(`https://api.github.com/repos/${o}/${r}`,a)).json();return T({full_name:`${o}/${r}`},f??{})}async function qt(){let e=await(0,dt.default)(process.argv.slice(2)).command("wbfy <paths...>","Generate/update project files for WillBooster").demandCommand(1).alias("d","skipDeps").boolean("skipDeps").default("skipDeps",!1).describe("skipDeps","Skip dependency installation").alias("v","verbose").boolean("verbose").default("verbose",!1).argv;for(let t of e._){if(typeof t=="number")continue;let n=await ye(t);if(n===null){console.error(`there is no valid package.json in ${t}`);continue}let o=n.containingSubPackageJsons?ut.default.sync("packages/*",{cwd:t}).map(s=>ft.default.resolve(t,s)):[],r=(await Promise.all(o.map(s=>ye(s)))).filter(s=>!!s),i=[n,...r];if(e.verbose)for(let s of i)console.log(s);await be(n),await lt(n),await Promise.all([Ce(n),De(n),Je(n),Ne(n),ce(n),qe(n),Ye(n),He(n),st(n)]),await c.promiseAll();let a=[];for(let s of i)await Ee(s,n),!(!s.root&&!s.containingPackageJson)&&(await Le(s),await Ue(s,n,e.skipDeps),a.push(ce(s)),(s.containingTypeScript||s.containingTypeScriptInPackages)&&a.push(tt(s,n)),(s.containingJavaScript||s.containingJavaScriptInPackages||s.containingTypeScript||s.containingTypeScriptInPackages)&&(n.willBoosterConfigs||a.push(Te(s,n)),a.push(Fe(s))));await Promise.all(a),await c.promiseAll(),h("yarn",["cleanup"],t),h("yarn",["install"],t)}}qt().then();
|
262
|
+
`);let a=n+Rt+i+r;await c.run(()=>d.generateFile(t,a))}var Me=l(require("fs")),Ue=l(require("path"));async function Ge(e){let t=Ue.default.resolve(e.dirPath,".releaserc.json");try{let n=JSON.parse(await Me.default.promises.readFile(t,"utf8")),o=(n==null?void 0:n.plugins)||[];for(let i=0;i<o.length;i++){let a=Array.isArray(o[i])?o[i][0]:o[i];a==="@semantic-release/commit-analyzer"?o[i]=["@semantic-release/commit-analyzer",{preset:"conventionalcommits"}]:a==="@semantic-release/github"&&!e.publicRepo&&(o[i]=["@semantic-release/github",{successComment:!1}])}let r=JSON.stringify(n);await c.run(()=>d.generateFile(t,r))}catch{}}var X=l(require("fs")),H=l(require("path")),Ye=l(require("deepmerge")),Ae=l(require("lodash.clonedeep"));var Tt={extends:["@willbooster"]};async function Ke(e){let t=(0,Ae.default)(Tt),n=H.default.resolve(e.dirPath,".renovaterc.json");try{let r=await X.default.promises.readFile(n,"utf-8"),i=JSON.parse(r);t=Ye.default.all([t,i,t],{arrayMerge:U})}catch{}await c.run(()=>X.default.promises.rm(H.default.resolve(e.dirPath,".dependabot"),{force:!0})),await c.run(()=>X.default.promises.rm(H.default.resolve(e.dirPath,"renovate.json"),{force:!0}));let o=JSON.stringify(t);await c.run(()=>d.generateFile(n,o))}var qe=l(require("fs")),I=l(require("path")),Ve=l(require("deepmerge")),Xe=l(require("lodash.clonedeep"));function W(e){let t=Object.entries(e).sort(([n],[o])=>n.localeCompare(o));for(let[n,o]of t)delete e[n],e[n]=o}var Ot={compilerOptions:{target:"esnext",module:"esnext",moduleResolution:"node",jsx:"react",alwaysStrict:!0,strict:!0,skipLibCheck:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,resolveJsonModule:!0,sourceMap:!0,importHelpers:!1,outDir:"dist"},include:["src/**/*","__tests__/**/*","scripts/**/*","packages/*/src/**/*","packages/*/__tests__/**/*","packages/*/scripts/**/*","./node_modules/@types","./@types"]},Dt={compilerOptions:{target:"esnext",module:"esnext",moduleResolution:"node",jsx:"react",alwaysStrict:!0,strict:!0,skipLibCheck:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,resolveJsonModule:!0,sourceMap:!0,importHelpers:!1,outDir:"dist"},include:["src/**/*","__tests__/**/*","scripts/**/*","../../node_modules/@types","../../@types","./@types"]};async function He(e,t){var i,a,s;if(t.depending.blitz)return;let n=(0,Xe.default)(e.root?Ot:Dt);if(!e.containingJsxOrTsx&&!e.containingJsxOrTsxInPackages&&delete n.compilerOptions.jsx,e.root&&!e.containingSubPackageJsons&&(n.include=n.include.filter(f=>!f.startsWith("packages/*/"))),!e.root&&(e.depending.jestPlaywrightPreset||t.depending.jestPlaywrightPreset)){let f=I.default.relative(e.dirPath,t.dirPath);n.include.push(I.default.join(f,"node_modules/jest-playwright-preset/types"),I.default.join(f,"node_modules/expect-playwright"))}let o=I.default.resolve(e.dirPath,"tsconfig.json");try{let f=await qe.default.promises.readFile(o,"utf-8"),m=JSON.parse(f);m.extends==="./node_modules/@willbooster/tsconfig/tsconfig.json"&&delete m.extends,(i=m.compilerOptions)==null||delete i.typeRoots,(a=n==null?void 0:n.compilerOptions)==null||delete a.target,(s=n==null?void 0:n.compilerOptions)==null||delete s.module,m.jsx&&delete n.jsx,e.depending.blitz&&delete n.include,n=Ve.default.all([n,m,n],{arrayMerge:U})}catch{}W(n.compilerOptions);let r=JSON.stringify(n);await c.run(()=>d.generateFile(o,r))}var $=l(require("fs")),F=l(require("path")),et=l(require("deepmerge")),ue=l(require("js-yaml")),tt=l(require("lodash.clonedeep"));var Et={name:"Test",on:{pull_request:null,push:{branches:["main","wbfy","renovate/**"]}},jobs:{test:{uses:"WillBooster/reusable-workflows/.github/workflows/test.yml@main"}}},Jt={name:"Release",on:{push:{branches:[]}},jobs:{release:{uses:"WillBooster/reusable-workflows/.github/workflows/release.yml@main"}}},Nt={name:"Willboosterify",on:{workflow_dispatch:null},jobs:{wbfy:{uses:"WillBooster/reusable-workflows/.github/workflows/wbfy.yml@main"}}},Wt={name:"Merge wbfy",on:{workflow_dispatch:null},jobs:{"wbfy-merge":{uses:"WillBooster/reusable-workflows/.github/workflows/wbfy-merge.yml@main"}}},It={name:"Lint PR title",on:{pull_request_target:{types:["opened","edited","synchronize"]}},jobs:{"semantic-pr":{uses:"WillBooster/reusable-workflows/.github/workflows/semantic-pr.yml@main"}}};async function nt(e){let t=F.default.resolve(e.dirPath,".github","workflows");await $.default.promises.mkdir(t,{recursive:!0});let n=F.default.resolve(e.dirPath,".github","semantic.yml");$.default.promises.rm(n,{force:!0,recursive:!0});let o=(await $.default.promises.readdir(t,{withFileTypes:!0})).filter(r=>r.isFile()&&r.name.endsWith(".yml")).map(r=>r.name);e.depending.semanticRelease&&o.push("release.yml"),o.push("test.yml","wbfy.yml","wbfy-merge.yml","semantic-pr.yml");for(let r of o){let i=F.default.basename(r,".yml");await c.run(()=>Bt(e,t,i))}}async function Ze(e,t){let n=ue.default.dump(e,{lineWidth:-1,noCompatMode:!0,styles:{"!!null":"empty"}});await c.run(()=>$.default.promises.writeFile(t,n))}async function Bt(e,t,n){var i,a;let o={};n==="test"?o=Et:n==="release"?o=Jt:n==="wbfy"?o=Nt:n==="wbfy-merge"?o=Wt:n==="semantic-pr"&&(o=It),o=(0,tt.default)(o);let r=F.default.join(t,`${n}.yml`);try{let s=await $.default.promises.readFile(r,"utf-8"),f=ue.default.load(s);o=et.default.all([o,f,o],{arrayMerge:G})}catch{}for(let s of Object.values(o.jobs)){if(!((a=(i=s.uses)==null?void 0:i.includes)!=null&&a.call(i,"/reusable-workflows/")))return;zt(e,s,n)}if(n==="release"?o.on.schedule?delete o.on.push:o.on.push.branches=e.release.branches:n==="wbfy"?Qe(o,20,24):n==="wbfy-merge"&&Qe(o,0,4),await Ze(o,r),n==="release")await c.run(()=>$.default.promises.rm(F.default.join(t,"semantic-release.yml"),{force:!0}));else if(n==="sync"){if(await c.run(()=>$.default.promises.rm(F.default.join(t,"sync-init.yml"),{force:!0})),!o.jobs.sync)return;o.jobs["sync-force"]=o.jobs.sync;let s=o.jobs.sync.with.sync_params_without_dest;if(!s)return;o.jobs.sync.with.sync_params_without_dest=`--force ${s}`,o.name="Force to Sync",o.on={workflow_dispatch:null},delete o.jobs.sync,await Ze(o,F.default.join(t,"sync-force.yml"))}}function zt(e,t,n){var o,r,i;if(t.with||(t.with={}),t.secrets||(t.secrets={}),(e.release.github&&n==="test"||n==="release"||n==="wbfy"||n==="wbfy-merge")&&(e.publicRepo?t.secrets.GH_TOKEN="${{ secrets.PUBLIC_GH_BOT_PAT }}":t.secrets.GH_TOKEN="${{ secrets.GH_BOT_PAT }}"),e.release.npm&&(n==="release"||n==="test")&&(t.secrets.NPM_TOKEN="${{ secrets.NPM_TOKEN }}"),n==="sync"){let a=(o=t.with)==null?void 0:o.sync_params_without_dest;a&&(t.with.sync_params_without_dest=a.replace("sync ",""))}(r=e.repository)!=null&&r.startsWith("github:WillBooster/")?t.uses=t.uses.replace("WillBoosterLab/","WillBooster/"):(i=e.repository)!=null&&i.startsWith("github:WillBoosterLab/")&&(t.uses=t.uses.replace("WillBooster/","WillBoosterLab/")),delete t.with.non_self_hosted,e.containingDockerfile&&n.startsWith("deploy")&&(t.with.cpu_arch="X64"),Object.keys(t.with).length?W(t.with):delete t.with,Object.keys(t.secrets).length?W(t.secrets):delete t.secrets}function Qe(e,t,n){var f,m;let[o,r]=(((m=(f=e.on.schedule)==null?void 0:f[0])==null?void 0:m.cron)??"").split(" ").map(Number);if(o!==0&&Number.isInteger(r)){let u=(r+9)%24;if(t<n?t<=u&&u<n:t<=u||u<n)return}let i=1+Math.floor(Math.random()*59),a=t+Math.floor(Math.random()*(n-t)),s=`${i} ${(a-9+24)%24} * * *`;e.on.schedule=[{cron:s}]}var R=l(require("fs")),D=l(require("path")),de=l(require("js-yaml"));async function ot(e){let t=J("yarn",["--version"],e.dirPath),n=J("npm",["show","@yarnpkg/cli","version"],e.dirPath);t!==n&&h("yarn",["set","version",n],e.dirPath,1);let o=D.default.join(e.dirPath,".yarn","releases");await R.default.promises.mkdir(o,{recursive:!0});for(let m of await R.default.promises.readdir(o))m.startsWith("yarn-")&&!m.startsWith(`yarn-${n}.`)&&(await c.run(()=>R.default.promises.rm(D.default.join(o,m))),console.log("Removed",D.default.join(o,m)));let r=D.default.resolve(e.dirPath,".yarnrc");await c.run(()=>R.default.promises.rm(r,{force:!0}));let i=D.default.resolve(e.dirPath,".yarnrc.yml"),a=de.default.load(await R.default.promises.readFile(i,"utf8"));a.defaultSemverRangePrefix="",e.requiringNodeModules&&(a.nodeLinker="node-modules",a.nmMode="hardlinks-global"),await R.default.promises.writeFile(i,de.default.dump(a,{lineWidth:-1}));let s=(a.plugins||[]).map(m=>m.spec),f=e.containingTypeScript||e.containingTypeScriptInPackages;it(e,s,f,"@yarnpkg/plugin-typescript"),f&&!e.requiringNodeModules&&h("yarn",["dlx","@yarnpkg/sdks","vscode"],e.dirPath),it(e,s,e.containingSubPackageJsons,"@yarnpkg/plugin-workspace-tools"),h("yarn",["dlx","yarn-plugin-auto-install"],e.dirPath)}function it(e,t,n,o){n!==t.includes(o)&&h("yarn",["plugin",n?"import":"remove",o],e.dirPath)}var w=l(require("fs")),Z=l(require("fs/promises")),g=l(require("path")),_=l(require("glob")),st=l(require("js-yaml")),at=l(require("simple-git"));async function ge(e){var n;let t=g.default.resolve(e,"package.json");try{let o=w.default.existsSync(t),r={},i={},a={};if(o){let C=w.default.readFileSync(t,"utf-8");a=JSON.parse(C),r=a.dependencies??{},i=a.devDependencies??{}}let s=!0;try{let C=g.default.resolve(e,".yarnrc.yml"),b=st.default.load(await Z.default.readFile(C,"utf8"));s=!b.nodeLinker||b.nodeLinker==="node-modules"}catch{}let f=[],m=[];try{let C=g.default.resolve(e,".releaserc.json"),b=JSON.parse(await Z.default.readFile(C,"utf8"));f=(b==null?void 0:b.branches)||[],m=((n=b==null?void 0:b.plugins)==null?void 0:n.flat())||[]}catch{}let u=g.default.basename(g.default.resolve(e,".."))!=="packages"||!w.default.existsSync(g.default.resolve(e,"..","..","package.json")),p;u&&(p=await Mt(e,a));let k=g.default.resolve(e,".tool-versions"),E;try{E=await Z.default.readFile(k,"utf-8")}catch{}let v={dirPath:e,root:u,publicRepo:(p==null?void 0:p.private)===!1,repository:p!=null&&p.full_name?`github:${p==null?void 0:p.full_name}`:void 0,willBoosterConfigs:t.includes(`${g.default.sep}willbooster-configs`),containingSubPackageJsons:_.default.sync("packages/**/package.json",{cwd:e}).length>0,containingDockerfile:w.default.existsSync(g.default.resolve(e,"Dockerfile"))||w.default.existsSync(g.default.resolve(e,"docker-compose.yml")),containingGemfile:w.default.existsSync(g.default.resolve(e,"Gemfile")),containingGoMod:w.default.existsSync(g.default.resolve(e,"go.mod")),containingPackageJson:w.default.existsSync(g.default.resolve(e,"package.json")),containingPoetryLock:w.default.existsSync(g.default.resolve(e,"poetry.lock")),containingPomXml:w.default.existsSync(g.default.resolve(e,"pom.xml")),containingPubspecYaml:w.default.existsSync(g.default.resolve(e,"pubspec.yaml")),containingTemplateYaml:w.default.existsSync(g.default.resolve(e,"template.yaml")),containingJavaScript:_.default.sync("@(app|src|__tests__|scripts)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScript:_.default.sync("@(app|src|__tests__|scripts)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsx:_.default.sync("@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,containingJavaScriptInPackages:_.default.sync("packages/**/@(app|src|__tests__|scripts)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScriptInPackages:_.default.sync("packages/**/@(app|src|__tests__|scripts)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsxInPackages:_.default.sync("packages/**/@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,depending:{blitz:!!(r.blitz||i.blitz),firebase:!!i["firebase-tools"],jestPlaywrightPreset:!!i["jest-playwright-preset"],prisma:!!i.prisma,reactNative:!!r["react-native"],semanticRelease:!!i["semantic-release"],storybook:!!i["@storybook/react"]},release:{branches:f,github:m.includes("@semantic-release/github"),npm:m.includes("@semantic-release/npm")},requiringNodeModules:s,versionsText:E};if(v.eslintBase=Lt(v),v.containingGemfile||v.containingGoMod||v.containingPackageJson||v.containingPoetryLock||v.containingPomXml||v.containingPubspecYaml||v.containingTemplateYaml)return v}catch{}return null}function Lt(e){if(e.containingTypeScript)return e.containingJsxOrTsx?"@willbooster/eslint-config-ts-react":"@willbooster/eslint-config-ts";if(e.containingJsxOrTsx)return"@willbooster/eslint-config-js-react";if(e.containingJavaScript)return"@willbooster/eslint-config-js"}async function Mt(e,t){var s,f,m;let r=(await(0,at.default)(e).getRemotes(!0)).find(u=>u.name==="origin"),i=((s=r==null?void 0:r.refs)==null?void 0:s.fetch)??((f=r==null?void 0:r.refs)==null?void 0:f.push);if(typeof i=="string"){let u=await rt(i);if(u)return u}let a=((m=t.repository)==null?void 0:m.url)??t.repository;if(typeof a=="string"){let u=await rt(a);if(u&&u.message!=="Not Found")return u}}async function rt(e){var m;let t=e.split(":").at(-1),n=t==null?void 0:t.split("/"),o=n==null?void 0:n.at(-2),r=(m=n==null?void 0:n.at(-1))==null?void 0:m.replace(/.git$/,"");if(!o||!r)return;let i=process.env.GH_TOKEN||process.env.GITHUB_TOKEN,a=i?{headers:{Authorization:`token ${i}`}}:void 0,f=await(await Y(`https://api.github.com/repos/${o}/${r}`,a)).json();return T({full_name:`${o}/${r}`},f??{})}async function Ut(){let e=await(0,pt.default)(process.argv.slice(2)).command("wbfy <paths...>","Generate/update project files for WillBooster").demandCommand(1).alias("d","skipDeps").boolean("skipDeps").default("skipDeps",!1).describe("skipDeps","Skip dependency installation").alias("v","verbose").boolean("verbose").default("verbose",!1).argv;for(let t of e._){if(typeof t=="number")continue;let n=await ge(t);if(n===null){console.error(`there is no valid package.json in ${t}`);continue}let o=n.containingSubPackageJsons?ct.default.sync("packages/*",{cwd:t}).map(s=>lt.default.resolve(t,s)):[],r=(await Promise.all(o.map(s=>ge(s)))).filter(s=>!!s),i=[n,...r];if(e.verbose)for(let s of i)console.log(s);await ke(n),await ot(n),await Promise.all([Se(n),Oe(n),Ee(n),Je(n),ce(n),Ke(n),Ge(n),nt(n)]),await c.promiseAll();let a=[];for(let s of i)await De(s,n),!(!s.root&&!s.containingPackageJson)&&(await Le(s),await ze(s,n,e.skipDeps),a.push(ce(s)),(s.containingTypeScript||s.containingTypeScriptInPackages)&&a.push(He(s,n)),(s.containingJavaScript||s.containingJavaScriptInPackages||s.containingTypeScript||s.containingTypeScriptInPackages)&&(n.willBoosterConfigs||a.push(Re(s,n)),a.push(Ce(s))));await Promise.all(a),await c.promiseAll(),h("yarn",["cleanup"],t),h("yarn",["install"],t)}}Ut().then();
|
260
263
|
//# sourceMappingURL=index.min.cjs.map
|
package/dist/index.min.cjs.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
|
-
"sources": ["../src/index.ts", "../src/generators/asdf.ts", "../src/utils/promisePool.ts", "../src/utils/spawnUtil.ts", "../src/generators/editorconfig.ts", "../src/utils/extensions.ts", "../src/utils/fsUtil.ts", "../src/generators/eslintignore.ts", "../src/utils/ignoreFileUtil.ts", "../src/generators/eslintrc.ts", "../src/utils/mergeUtil.ts", "../src/generators/gitattributes.ts", "../src/generators/gitignore.ts", "../src/utils/fetchOnNode.ts", "../src/generators/huskyrc.ts", "../src/generators/idea.ts", "../src/generators/lintstagedrc.ts", "../src/utils/eslintUtil.ts", "../src/utils/srcDirectories.ts", "../src/generators/packageJson.ts", "../src/generators/prettierignore.ts", "../src/generators/releaserc.ts", "../src/generators/renovaterc.ts", "../src/generators/
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport glob from 'glob';\nimport yargs from 'yargs';\n\nimport { generateVersionConfigs } from './generators/asdf';\nimport { generateEditorconfig } from './generators/editorconfig';\nimport { generateEslintignore } from './generators/eslintignore';\nimport { generateEslintrc } from './generators/eslintrc';\nimport { generateGitattributes } from './generators/gitattributes';\nimport { generateGitignore } from './generators/gitignore';\nimport { generateHuskyrc } from './generators/huskyrc';\nimport { generateIdeaSettings } from './generators/idea';\nimport { generateLintstagedrc } from './generators/lintstagedrc';\nimport { generatePackageJson } from './generators/packageJson';\nimport { generatePrettierignore } from './generators/prettierignore';\nimport { generateReleaserc } from './generators/releaserc';\nimport { generateRenovateJson } from './generators/renovaterc';\nimport { generateSemanticYml } from './generators/semanticPullRequest';\nimport { generateTsconfig } from './generators/tsconfig';\nimport { generateWorkflow } from './generators/workflow';\nimport { generateYarnrcYml } from './generators/yarnrc';\nimport { getPackageConfig, PackageConfig } from './utils/packageConfig';\nimport { promisePool } from './utils/promisePool';\nimport { spawnSync } from './utils/spawnUtil';\n\nasync function main(): Promise<void> {\n const argv = await yargs(process.argv.slice(2))\n .command('wbfy <paths...>', 'Generate/update project files for WillBooster')\n .demandCommand(1)\n .alias('d', 'skipDeps')\n .boolean('skipDeps')\n .default('skipDeps', false)\n .describe('skipDeps', 'Skip dependency installation')\n .alias('v', 'verbose')\n .boolean('verbose')\n .default('verbose', false).argv;\n\n for (const rootDirPath of argv._) {\n if (typeof rootDirPath === 'number') continue;\n\n const rootConfig = await getPackageConfig(rootDirPath);\n if (rootConfig === null) {\n console.error(`there is no valid package.json in ${rootDirPath}`);\n continue;\n }\n\n const subDirPaths = rootConfig.containingSubPackageJsons\n ? glob.sync('packages/*', { cwd: rootDirPath }).map((subDirPath) => path.resolve(rootDirPath, subDirPath))\n : [];\n const subPackageConfigs = (await Promise.all(subDirPaths.map((subDirPath) => getPackageConfig(subDirPath)))).filter(\n (config) => !!config\n ) as PackageConfig[];\n const allPackageConfigs = [rootConfig, ...subPackageConfigs];\n\n if (argv.verbose) {\n for (const config of allPackageConfigs) {\n console.log(config);\n }\n }\n\n // Install tools via asdf at first\n await generateVersionConfigs(rootConfig);\n // Install yarn berry\n await generateYarnrcYml(rootConfig);\n await Promise.all([\n generateEditorconfig(rootConfig),\n generateGitattributes(rootConfig),\n generateHuskyrc(rootConfig),\n generateIdeaSettings(rootConfig),\n generateLintstagedrc(rootConfig),\n generateRenovateJson(rootConfig),\n generateReleaserc(rootConfig),\n generateSemanticYml(rootConfig),\n generateWorkflow(rootConfig),\n ]);\n await promisePool.promiseAll();\n\n const promises: Promise<void>[] = [];\n for (const config of allPackageConfigs) {\n await generateGitignore(config, rootConfig);\n if (!config.root && !config.containingPackageJson) {\n continue;\n }\n await generatePrettierignore(config);\n await generatePackageJson(config, rootConfig, argv.skipDeps);\n\n promises.push(generateLintstagedrc(config));\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\n promises.push(generateTsconfig(config, rootConfig));\n }\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages\n ) {\n if (!rootConfig.willBoosterConfigs) {\n promises.push(generateEslintrc(config, rootConfig));\n }\n promises.push(generateEslintignore(config));\n }\n }\n await Promise.all(promises);\n await promisePool.promiseAll();\n\n spawnSync('yarn', ['cleanup'], rootDirPath);\n // 'yarn install' should be after `yarn cleanup` because yarn berry generates yarn.lock\n // corresponding to the contents of dependant sub-package in monorepo\n spawnSync('yarn', ['install'], rootDirPath);\n }\n}\n\nmain().then();\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync, spawnSyncWithStringResult } from '../utils/spawnUtil';\n\nexport async function generateVersionConfigs(config: PackageConfig): Promise<void> {\n if (!config.versionsText) return;\n\n const lines: string[] = [];\n for (const versionText of config.versionsText.trim().split('\\n')) {\n const line = versionText.trim();\n if (line && line.split(/\\s+/)[0] !== 'nodejs') {\n lines.push(line);\n continue;\n }\n\n const [, version] = line.split(/\\s+/);\n await promisePool.run(() => fs.promises.writeFile(path.resolve(config.dirPath, '.node-version'), version));\n }\n if (config.containingPoetryLock) {\n updateLine('poetry 1.1.13', 0, lines);\n updateLine('python 3.9.10', 0, lines);\n }\n if (config.depending.firebase) {\n updateLine('java adoptopenjdk-17.0.2+8', 0, lines);\n }\n if (config.containingPackageJson) {\n const version = spawnSyncWithStringResult('npm', ['show', 'yarn', 'version'], config.dirPath);\n updateLine(`yarn ${version}`, lines.length, lines);\n }\n\n const toolVersionsPath = path.resolve(config.dirPath, '.tool-versions');\n if (lines.length) {\n await promisePool.run(() => fs.promises.writeFile(toolVersionsPath, lines.join('\\n') + '\\n'));\n } else {\n await promisePool.run(() => fs.promises.rm(toolVersionsPath, { force: true }));\n }\n await promisePool.promiseAll();\n spawnSync('asdf', ['install'], config.dirPath);\n}\n\nfunction updateLine(line: string, insertionIndex: number, lines: string[]): void {\n const [prefix] = line.split(' ');\n const index = lines.findIndex((l) => l.split(/\\s+/)[0] === prefix);\n if (index >= 0) {\n lines[index] = line;\n } else {\n lines.splice(insertionIndex, 0, line);\n }\n}\n", "import { PromisePool } from 'minimal-promise-pool';\n\nexport const promisePool = new PromisePool();\n", "import child_process from 'child_process';\n\nexport function spawnSync(command: string, args: string[], cwd: string, retry = 0): void {\n do {\n const [newCmd, newArgs, options] = getSpawnSyncArgs(command, args, cwd);\n console.log(`$ ${newCmd} ${newArgs.join(' ')} at ${options.cwd}`);\n const ret = child_process.spawnSync(newCmd, newArgs, options);\n if (ret.status === 0) break;\n } while (--retry >= 0);\n}\n\nexport function spawnSyncWithStringResult(command: string, args: string[], cwd: string): string {\n const [newCmd, newArgs, options] = getSpawnSyncArgs(command, args, cwd);\n options.stdio = 'pipe';\n const proc = child_process.spawnSync(newCmd, newArgs, options);\n return proc.stdout.toString().trim();\n}\n\nexport function getSpawnSyncArgs(command: string, args: string[], cwd: string): [string, string[], any] {\n const env = { ...process.env };\n // Remove berry from PATH\n if (env.PATH && env.BERRY_BIN_FOLDER) {\n env.PATH = env.PATH.replace(`${env.BERRY_BIN_FOLDER}:`, '');\n }\n\n if (env.ASDF_DIR) {\n args = ['-l', '-c', `. ${env.ASDF_DIR}/asdf.sh && ${command} ${args.join(' ')}`];\n command = 'bash';\n }\n return [\n command,\n args,\n {\n cwd,\n env,\n shell: false,\n stdio: 'inherit',\n },\n ];\n}\n", "import path from 'path';\n\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n${generateExtensions(extensions.codeWith2IndentSize)}\nindent_size = 2\nindent_style = space\n\n${generateExtensions(extensions.codeWith4IndentSize)}\nindent_size = 4\nindent_style = space\n\n${generateExtensions(extensions.codeWith8IndentSize)}\nindent_size = 8\nindent_style = space\n\n${generateExtensions(extensions.markdownLike)}\nmax_line_length = off\ntrim_trailing_whitespace = false\n\n[{Makefile,*.mk}]\nindent_style = tab\n`;\n\nexport async function generateEditorconfig(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.editorconfig');\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n\nfunction generateExtensions(extensions: string[]): string {\n return extensions.length > 1 ? `[*.{${extensions.join(',')}}]` : `[*.${extensions[0]}]`;\n}\n", "export const extensions = {\n codeWith2IndentSize: [\n 'cjs',\n 'mjs',\n 'js',\n 'jsx',\n 'ts',\n 'tsx',\n 'json',\n 'json5',\n 'cpp',\n 'dart',\n 'htm',\n 'html',\n 'pu',\n 'puml',\n 'rb',\n 'vue',\n 'yaml',\n 'yml',\n ].sort(),\n codeWith4IndentSize: ['go', 'gradle', 'py'].sort(),\n codeWith8IndentSize: ['sh'].sort(),\n markdownLike: ['md'].sort(),\n eslint: ['cjs', 'mjs', 'js', 'ts', 'tsx', 'jsx'].sort(),\n prettier: [\n 'cjs',\n 'mjs',\n 'js',\n 'jsx',\n 'ts',\n 'tsx',\n 'json',\n 'json5',\n 'css',\n 'htm',\n 'html',\n 'md',\n 'scss',\n 'vue',\n 'yaml',\n 'yml',\n ].sort(),\n};\n", "import fsp from 'fs/promises';\n\nexport const FsUtil = {\n async generateFile(filePath: string, content: string): Promise<void> {\n await fsp.writeFile(filePath, content);\n console.log(`Generated ${filePath}`);\n },\n};\n", "import path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n3rd-party/\n@types/\n__generated__/\nandroid/\nios/\nno-format/\ntest-fixtures/\n*.config.js\n*.d.ts\n*.min.js\n.yarn/\n.pnp.js\n`;\n\nexport async function generateEslintignore(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.eslintignore');\n const userContent = (await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = (await IgnoreFileUtil.getExistingContent(gitignoreFilePath)) || '';\n\n const newContent = userContent + commonContent + gitignoreContent;\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\n\nexport const IgnoreFileUtil = {\n header: '# Project-specific settings',\n separator: '# Generated by @willbooster/willboosterify',\n separatorPrefix: '# Generated by @willbooster',\n async getExistingContent(filePath: string): Promise<string | null> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n return content\n .replace(/# Project-specific settings[^\\n]*\\n/m, '')\n .replace(/# Generated by[^\\n]*\\n/m, '')\n .replace(/\\r?\\n\\r?\\n(\\r?\\n)+/gm, '\\n\\n');\n } catch (_) {\n return null;\n }\n },\n async getUserContent(filePath: string): Promise<string | null> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n const index = content.indexOf(this.separatorPrefix);\n if (index >= 0) {\n return content.substring(0, content.indexOf('\\n', index) + 1);\n }\n } catch (_) {\n // do nothing\n }\n return null;\n },\n async isBerryZeroInstallEnabled(filePath: string): Promise<boolean> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n return content.includes('\\n!.yarn/cache');\n } catch (_) {\n return false;\n }\n },\n};\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { combineMerge } from '../utils/mergeUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nexport async function generateEslintrc(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n const bases = [];\n if (config.eslintBase) {\n bases.push(config.eslintBase);\n }\n if (config !== rootConfig) {\n bases.push('../../.eslintrc.json');\n }\n let newSettings: any = { root: true, extends: bases };\n\n const filePath = path.resolve(config.dirPath, '.eslintrc.json');\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(oldContent);\n if (oldSettings.extends) {\n oldSettings.extends = oldSettings.extends.filter(\n (ext: string) => !ext.startsWith('@willbooster/') && ext !== '../../.eslintrc.json'\n );\n }\n if (!bases.length) {\n oldSettings.extends = [];\n }\n const newExtends = newSettings.extends;\n newSettings.extends = oldSettings.extends;\n oldSettings.extends = newExtends;\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: combineMerge });\n if (config.depending.blitz) {\n newSettings.extends = [...newSettings.extends.filter((e: string) => e !== 'blitz'), 'blitz'];\n }\n } catch (e) {\n // do nothing\n }\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import merge from 'deepmerge';\n\nexport function overwriteMerge(destinationArray: any[], sourceArray: any[]): any[] {\n return sourceArray;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function combineMerge(target: any[], source: any[], options: any): any[] {\n const destination = target.slice();\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);\n } else if (options.isMergeableObject(item)) {\n destination[index] = merge(target[index], item, options);\n } else if (target.indexOf(item) === -1) {\n destination.push(item);\n }\n });\n return destination;\n}\n", "import path from 'path';\n\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `* text=auto\n\n*.vcproj text eol=crlf\n\n${extensions.codeWith2IndentSize\n .concat(extensions.codeWith4IndentSize)\n .concat(extensions.markdownLike)\n .map((ext) => `*.${ext} text eol=lf`)\n .join('\\n')}\n`;\n\nexport async function generateGitattributes(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.gitattributes');\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import path from 'path';\n\nimport { fetchOnNode } from '../utils/fetchOnNode';\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\n\nconst defaultNames = ['windows', 'macos', 'linux', 'jetbrains', 'visualstudiocode', 'emacs', 'vim', 'yarn'];\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n.devcontainer/\ndist/\ntemp/\nIcon[\\r]\n*.sqlite3\n*.sqlite3-journal\n`;\n\nconst gitignoreCache = new Map<string, string>();\n\nexport async function generateGitignore(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.gitignore');\n let userContent = ((await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent) + commonContent;\n\n const names = [...defaultNames];\n if (config.containingGemfile) {\n names.push('ruby');\n }\n if (config.containingGoMod) {\n names.push('go');\n userContent += `${path.basename(config.dirPath)}\n`;\n }\n if (config.containingPackageJson) {\n names.push('node');\n }\n if (config.containingPomXml) {\n names.push('maven');\n userContent += `.idea/google-java-format.xml\n`;\n }\n if (config.containingPubspecYaml) {\n names.push('flutter', 'AndroidStudio', 'ruby');\n userContent += `.flutter-plugins-dependencies\nandroid/key.properties\nios/.bundle\n.idea/runConfigurations.xml\n`;\n }\n if (config.containingTemplateYaml) {\n userContent += `.aws-sam/\npackaged.yaml\n`;\n }\n // Because .venv should be ignored on root directory\n if (config.containingPoetryLock) {\n names.push('python');\n }\n if (rootConfig.depending.firebase || config.depending.firebase) {\n names.push('firebase');\n }\n if (rootConfig.depending.reactNative || config.depending.reactNative) {\n names.push('reactnative');\n userContent += `google-services.json\nandroid/app/src/main/assets/\n`;\n }\n if (rootConfig.depending.storybook) {\n names.push('storybookjs');\n }\n if (rootConfig.depending.blitz) {\n names.push('nextjs');\n userContent += `.blitz/\n.blitz**\n`;\n }\n\n let generated = '';\n for (const name of names) {\n if (!gitignoreCache.has(name)) {\n const url = `https://www.toptal.com/developers/gitignore/api/${name}`;\n const response = await fetchOnNode(url);\n const responseText = await response.text();\n if (responseText.includes('Attention Required!')) {\n console.error(`Failed to fetch ${url}`);\n return;\n }\n gitignoreCache.set(name, responseText);\n }\n generated += gitignoreCache.get(name);\n }\n if (!(await IgnoreFileUtil.isBerryZeroInstallEnabled(filePath))) {\n generated = generated.replace('!.yarn/cache', '# !.yarn/cache').replace('# .pnp.*', '.pnp.*');\n }\n if (config.containingPomXml || config.containingPubspecYaml) {\n generated = generated\n .replace(/^# .idea\\/artifacts$/gm, '.idea/artifacts')\n .replace(/^# .idea\\/compiler.xml$/gm, '.idea/compiler.xml')\n .replace(/^# .idea\\/jarRepositories.xml$/gm, '.idea/jarRepositories.xml')\n .replace(/^# .idea\\/modules.xml$/gm, '.idea/modules.xml')\n .replace(/^# .idea\\/*.iml$/gm, '.idea/*.iml')\n .replace(/^# .idea\\/modules$/gm, '.idea/modules')\n .replace(/^# *.iml$/gm, '*.iml')\n .replace(/^# *.ipr$/gm, '*.ipr');\n if (config.containingPubspecYaml) {\n generated = generated.replace(/^.idea\\/modules.xml$/gm, '# .idea/modules.xml');\n }\n }\n generated = generated.replace(/^.idea\\/?$/gm, '# .idea');\n if (rootConfig.depending.reactNative || config.depending.reactNative || config.containingPubspecYaml) {\n generated = generated.replace(/^(.idea\\/.+)$/gm, '$1\\nandroid/$1');\n }\n const newContent = userContent + generated;\n await FsUtil.generateFile(filePath, newContent);\n}\n", "import type { RequestInfo, RequestInit, Response } from 'node-fetch';\n\nexport async function fetchOnNode(url: RequestInfo, init?: RequestInit | undefined): Promise<Response> {\n const { default: nodeFetch } = await import('node-fetch');\n return nodeFetch(url, init);\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync } from '../utils/spawnUtil';\n\nconst DEFAULT_COMMAND = 'npm test';\n\nconst settings = {\n preCommit: 'yarn lint-staged',\n prePush: `yarn typecheck`,\n prePushForLab: `\nif [ $(git branch --show-current) = \"main\" ]; then\n echo \"************************************************\"\n echo \"*** Don't push main branch directly. Use PR! ***\"\n echo \"************************************************\"\n exit 1\nfi\n\nyarn typecheck`.trim(),\n postMerge: 'yarn',\n};\n\nexport async function generateHuskyrc(config: PackageConfig): Promise<void> {\n const packageJsonPath = path.resolve(config.dirPath, 'package.json');\n const jsonText = await fs.promises.readFile(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(jsonText);\n packageJson.scripts ||= {};\n delete packageJson.scripts['postinstall'];\n delete packageJson.scripts['postpublish'];\n delete packageJson.scripts['prepare'];\n delete packageJson.scripts['prepublishOnly'];\n delete packageJson.scripts['prepack'];\n delete packageJson.scripts['postpack'];\n\n const dirPath = path.resolve(config.dirPath, '.husky');\n await Promise.all([\n fs.promises.writeFile(packageJsonPath, JSON.stringify(packageJson, undefined, 2)),\n fs.promises.rm(dirPath, { force: true, recursive: true }),\n ]);\n spawnSync('yarn', ['dlx', 'husky-init', '--yarn2'], config.dirPath);\n\n const preCommitFilePath = path.resolve(dirPath, 'pre-commit');\n const content = await fs.promises.readFile(preCommitFilePath, 'utf-8');\n\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.huskyrc.json'), { force: true }));\n await promisePool.run(() =>\n fs.promises.writeFile(preCommitFilePath, content.replace(DEFAULT_COMMAND, settings.preCommit))\n );\n\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\n const prePush = config.repository?.startsWith('github:WillBoosterLab/') ? settings.prePushForLab : settings.prePush;\n await promisePool.run(() =>\n fs.promises.writeFile(path.resolve(dirPath, 'pre-push'), content.replace(DEFAULT_COMMAND, prePush), {\n mode: 0o755,\n })\n );\n }\n\n const postMergeCommands: string[] = [];\n if (config.versionsText?.includes('python ')) {\n postMergeCommands.push('asdf install python');\n }\n if (config.versionsText) {\n postMergeCommands.push('asdf install');\n }\n postMergeCommands.push(settings.postMerge);\n if (config.containingPoetryLock) {\n postMergeCommands.push('poetry install');\n }\n if (config.depending.blitz || config.depending.prisma) {\n postMergeCommands.push('yarn gen-code');\n }\n const postMergeCommand = content.replace(DEFAULT_COMMAND, postMergeCommands.join(' && '));\n await promisePool.run(() =>\n fs.promises.writeFile(path.resolve(dirPath, 'post-merge'), postMergeCommand, {\n mode: 0o755,\n })\n );\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectTasksOptions\">\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"ts\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.ts)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"tsx\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.tsx)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"js\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.js)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"json\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.json)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"md\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.md)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"html\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.html)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n </component>\n</project>\n`;\n\nexport async function generateIdeaSettings(config: PackageConfig): Promise<void> {\n const dirPath = path.resolve(config.dirPath, '.idea');\n if (fs.existsSync(dirPath)) {\n const filePath = path.resolve(dirPath, 'watcherTasks.xml');\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages ||\n (config.containingPackageJson &&\n !config.containingPubspecYaml &&\n !config.containingGemfile &&\n !config.containingGoMod &&\n !config.containingPomXml)\n ) {\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n } else {\n await promisePool.run(() => fs.promises.rm(filePath, { force: true }));\n }\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { EslintUtil } from '../utils/eslintUtil';\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { getSrcDirs } from '../utils/srcDirectories';\n\nexport async function generateLintstagedrc(config: PackageConfig): Promise<void> {\n const lines: string[] = [];\n if (config.containingJavaScript || config.containingTypeScript) {\n const eslint = `\n '${getEslintKey(config)}': [${JSON.stringify(\n `eslint --fix${EslintUtil.getLintFixSuffix(config)}`\n )}, 'prettier --write'],`;\n lines.push(eslint);\n }\n const packagesFilter = config.root ? \" && !file.includes('/packages/')\" : '';\n lines.push(`\n './**/*.{${extensions.prettier.join(',')}}': files => {\n ${config.containingJavaScript || config.containingTypeScript ? getEslintFilterForPrettier(config) : ''}\n const filteredFiles = files.filter(file => !file.includes('/test-fixtures/')${packagesFilter});\n if (filteredFiles.length === 0) return [];\n const commands = [\\`prettier --write \\${filteredFiles.join(' ')}\\`];\n if (filteredFiles.some(file => file.endsWith('package.json'))) {\n commands.push('yarn sort-package-json');\n }\n return commands;\n },`);\n if (config.containingPubspecYaml) {\n lines.push(`\n './{lib,test,test_driver}/**/*.dart': files => {\n const filteredFiles = files.filter(file => !file.includes('generated'))\n .filter(file => !file.endsWith('.freezed.dart') && !file.endsWith('.g.dart'));\n if (filteredFiles.length === 0) return [];\n return [\\`flutter format \\${filteredFiles.join(' ')}\\`];\n },`);\n }\n if (config.containingPoetryLock) {\n lines.push(`\n './**/*.py': [\n 'poetry run isort --profile black --filter-files',\n 'poetry run black',\n 'poetry run flake8'\n ],`);\n }\n\n const newContent = `${\n config.containingJavaScript || config.containingTypeScript ? \"const micromatch = require('micromatch');\" : ''\n }\n\nmodule.exports = {${lines.join('')}\n};\n`;\n\n const filePath = path.resolve(config.dirPath, '.lintstagedrc.cjs');\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.lintstagedrc.js'), { force: true }));\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.lintstagedrc.json'), { force: true }));\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n\nfunction getEslintKey(config: PackageConfig): string {\n const dirs = getSrcDirs(config);\n return `./{${dirs.join(',')}}/**/*.{${extensions.eslint.join(',')}}`;\n}\n\nfunction getEslintFilterForPrettier(config: PackageConfig): string {\n return `files = micromatch.not(files, '${getEslintKey(config)}');`;\n}\n", "import { PackageConfig } from './packageConfig';\n\nexport const EslintUtil = {\n getLintFixSuffix(config: PackageConfig): string {\n return config.containingJsxOrTsx ? ' --rule \"{ react-hooks/exhaustive-deps: 0 }\"' : '';\n },\n};\n", "import { PackageConfig } from './packageConfig';\n\nconst srcDirectories = {\n node: ['src', '__tests__', 'scripts'],\n blitz: ['app', 'db', 'integrations', 'mailers', 'test'],\n};\n\nsrcDirectories.blitz = [...srcDirectories.node, ...srcDirectories.blitz];\n\nexport function getSrcDirs(config: PackageConfig): string[] {\n return config.depending.blitz ? srcDirectories.blitz : srcDirectories.node;\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\n\nimport { EslintUtil } from '../utils/eslintUtil';\nimport { extensions } from '../utils/extensions';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync } from '../utils/spawnUtil';\nimport { getSrcDirs } from '../utils/srcDirectories';\n\nconst jsCommonDeps = [\n 'eslint',\n 'eslint-config-prettier',\n 'eslint-plugin-import',\n 'eslint-plugin-sort-class-members',\n 'eslint-plugin-sort-destructure-keys',\n];\n\nconst tsCommonDeps = [\n ...jsCommonDeps,\n '@typescript-eslint/eslint-plugin',\n '@typescript-eslint/parser',\n 'eslint-import-resolver-typescript',\n];\n\nconst reactCommonDeps = ['eslint-plugin-react', 'eslint-plugin-react-hooks'];\n\nconst devDeps: { [prop: string]: string[] } = {\n '@willbooster/eslint-config-js': ['@willbooster/eslint-config-js', ...jsCommonDeps],\n '@willbooster/eslint-config-js-react': ['@willbooster/eslint-config-js-react', ...jsCommonDeps, ...reactCommonDeps],\n '@willbooster/eslint-config-ts': ['@willbooster/eslint-config-ts', ...tsCommonDeps],\n '@willbooster/eslint-config-ts-react': ['@willbooster/eslint-config-ts-react', ...tsCommonDeps, ...reactCommonDeps],\n '../../.eslintrc.json': [],\n};\n\nexport async function generatePackageJson(\n config: PackageConfig,\n rootConfig: PackageConfig,\n skipAddingDeps: boolean\n): Promise<void> {\n const filePath = path.resolve(config.dirPath, 'package.json');\n const jsonText = await fs.promises.readFile(filePath, 'utf-8');\n const jsonObj = JSON.parse(jsonText);\n jsonObj.scripts = jsonObj.scripts || {};\n jsonObj.dependencies = jsonObj.dependencies || {};\n jsonObj.devDependencies = jsonObj.devDependencies || {};\n jsonObj.peerDependencies = jsonObj.peerDependencies || {};\n\n await removeDeprecatedStuff(jsonObj);\n\n if (jsonObj.name !== '@willbooster/prettier-config') {\n jsonObj.prettier = '@willbooster/prettier-config';\n }\n\n for (const scriptKey of Object.keys(jsonObj.scripts)) {\n // Fresh repo still requires 'yarn install'\n if (!jsonObj.scripts[scriptKey].includes('git clone')) {\n jsonObj.scripts[scriptKey] = jsonObj.scripts[scriptKey]\n .replace(/yarn\\s*&&\\s*/, '')\n .replace(/yarn\\s*install\\s*&&\\s*/, '');\n }\n }\n\n jsonObj.scripts = merge(jsonObj.scripts, generateScripts(config));\n jsonObj.scripts.prettify += await generatePrettierSuffix(config.dirPath);\n\n let dependencies: string[] = [];\n let devDependencies = ['lint-staged', 'prettier', 'sort-package-json', '@willbooster/prettier-config'];\n const poetryDependencies: string[] = [];\n\n if (config.root) {\n // To install the latest pinst\n devDependencies.push('husky', 'pinst', '@willbooster/renovate-config');\n if (config.depending.semanticRelease) {\n devDependencies.push('conventional-changelog-conventionalcommits');\n }\n if (config.containingSubPackageJsons) {\n jsonObj.workspaces = ['packages/*'];\n } else {\n delete jsonObj.workspaces;\n }\n }\n\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages\n ) {\n devDependencies.push('eslint', 'micromatch');\n // TODO: not needed anymore?\n if (config.containingTypeScriptInPackages) {\n devDependencies.push('@typescript-eslint/parser');\n }\n }\n\n if ((config.containingTypeScript || config.containingTypeScriptInPackages) && !config.depending.blitz) {\n devDependencies.push('typescript');\n }\n\n if (config.eslintBase) {\n devDependencies.push(...devDeps[config.eslintBase]);\n }\n\n if (config.willBoosterConfigs) {\n dependencies = dependencies.filter((dep) => !dep.includes('@willbooster/'));\n devDependencies = devDependencies.filter((dep) => !dep.includes('@willbooster/'));\n }\n\n if (!jsonObj.name) {\n jsonObj.name = path.basename(config.dirPath);\n }\n\n if (config.containingSubPackageJsons) {\n jsonObj.private = true;\n }\n\n if (!jsonObj.license) {\n jsonObj.license = 'UNLICENSED';\n }\n\n if (!config.containingTypeScript && !config.containingTypeScriptInPackages) {\n delete jsonObj.scripts.typecheck;\n }\n\n // https://github.com/semantic-release/semantic-release/issues/2323#issuecomment-1032341621\n if (config.depending.semanticRelease && config.release.npm) {\n jsonObj.resolutions ||= {};\n jsonObj.resolutions['npm/chalk'] = '^4.1.2';\n }\n\n if (!config.containingSubPackageJsons) {\n if (!config.containingJavaScript && !config.containingTypeScript) {\n delete jsonObj.scripts.lint;\n delete jsonObj.scripts['lint-fix'];\n jsonObj.scripts.cleanup = jsonObj.scripts.cleanup.replace(' && yarn lint-fix', '');\n } else {\n jsonObj.scripts['lint-fix'] += EslintUtil.getLintFixSuffix(config);\n }\n\n if (config.containingPubspecYaml) {\n jsonObj.scripts.lint = 'flutter analyze';\n jsonObj.scripts['lint-fix'] = 'yarn lint';\n const dirs = ['lib', 'test', 'test_driver'].filter((dir) => fs.existsSync(path.resolve(config.dirPath, dir)));\n if (dirs.length > 0) {\n jsonObj.scripts['format-code'] = `flutter format $(find ${dirs.join(\n ' '\n )} -name generated -prune -o -name '*.freezed.dart' -prune -o -name '*.g.dart' -prune -o -name '*.dart' -print)`;\n jsonObj.scripts.format += ` && yarn format-code`;\n }\n }\n\n if (config.containingPoetryLock) {\n if (jsonObj.scripts.postinstall === 'poetry install') {\n delete jsonObj.scripts.postinstall;\n }\n const dirNames = (await fs.promises.readdir(config.dirPath)).filter((dirName) => {\n const dirPath = path.resolve(config.dirPath, dirName);\n if (!fs.lstatSync(dirPath).isDirectory()) return false;\n return fs.readdirSync(dirPath).some((fileName) => fileName.endsWith('.py'));\n });\n if (dirNames.length > 0) {\n jsonObj.scripts['format-code'] = `poetry run isort --profile black ${dirNames.join(\n ' '\n )} && poetry run black ${dirNames.join(' ')}`;\n jsonObj.scripts.lint = `poetry run flake8 ${dirNames.join(' ')}`;\n jsonObj.scripts['lint-fix'] = 'yarn lint';\n jsonObj.scripts.format += ` && yarn format-code`;\n poetryDependencies.push('black', 'isort', 'flake8');\n }\n }\n\n if (config.repository) {\n jsonObj.repository = config.repository;\n }\n }\n\n if (config.depending.blitz) {\n // These cause an error of eslint-plugin-import loading\n devDependencies = devDependencies.filter((dep) => !dep.includes('@typescript-eslint/'));\n // This causes eslint errors\n devDependencies = devDependencies.filter(\n (d) =>\n d !== 'eslint-plugin-react' &&\n d !== 'eslint-import-resolver-typescript' &&\n d !== 'eslint-plugin-import' &&\n d !== 'eslint-plugin-react-hooks'\n );\n if (!jsonObj.scripts['gen-code']?.startsWith('blitz codegen')) {\n jsonObj.scripts['gen-code'] = 'blitz codegen';\n }\n } else if (config.depending.prisma) {\n if (!jsonObj.scripts['gen-code']?.startsWith('prisma generate')) {\n jsonObj.scripts['gen-code'] = 'prisma generate';\n }\n }\n if (!Object.keys(jsonObj.dependencies).length) {\n delete jsonObj.dependencies;\n }\n if (!Object.keys(jsonObj.devDependencies).length) {\n delete jsonObj.devDependencies;\n }\n if (!Object.keys(jsonObj.peerDependencies).length) {\n delete jsonObj.peerDependencies;\n }\n\n await fs.promises.writeFile(filePath, JSON.stringify(jsonObj));\n\n if (!skipAddingDeps) {\n dependencies = dependencies.filter((dep) => !jsonObj.devDependencies?.[dep]);\n if (dependencies.length) {\n spawnSync('yarn', ['add', ...new Set(dependencies)], config.dirPath);\n }\n devDependencies = devDependencies.filter((dep) => !jsonObj.dependencies?.[dep]);\n if (devDependencies.length) {\n spawnSync('yarn', ['add', '-D', ...new Set(devDependencies)], config.dirPath);\n }\n if (poetryDependencies.length) {\n spawnSync('poetry', ['add', ...new Set(poetryDependencies)], config.dirPath);\n }\n }\n}\n\nasync function removeDeprecatedStuff(jsonObj: any): Promise<void> {\n // TODO: remove the following migration code in future\n if (jsonObj.author === 'WillBooster LLC') {\n jsonObj.author = 'WillBooster Inc.';\n }\n delete jsonObj.scripts['sort-package-json'];\n delete jsonObj.scripts['sort-all-package-json'];\n delete jsonObj.scripts['typecheck:codegen'];\n delete jsonObj.dependencies['tslib'];\n delete jsonObj.devDependencies['@willbooster/eslint-config'];\n delete jsonObj.devDependencies['@willbooster/eslint-config-react'];\n delete jsonObj.devDependencies['@willbooster/tsconfig'];\n delete jsonObj.devDependencies['eslint-import-resolver-node'];\n delete jsonObj.devDependencies['eslint-plugin-prettier'];\n delete jsonObj.devDependencies['lerna'];\n // To install the latest pinst\n delete jsonObj.devDependencies['pinst'];\n delete jsonObj.scripts['flutter-format'];\n delete jsonObj.scripts['format-flutter'];\n delete jsonObj.scripts['python-format'];\n delete jsonObj.scripts['format-python'];\n delete jsonObj.scripts['prettier'];\n for (const deps of Object.values(devDeps)) {\n for (const dep of deps) {\n delete jsonObj.devDependencies[dep];\n }\n }\n await promisePool.run(() => fs.promises.rm('lerna.json', { force: true }));\n}\n\nfunction generateScripts(config: PackageConfig): Record<string, string> {\n let scripts = {\n cleanup: 'yarn format && yarn lint-fix',\n format: `sort-package-json && yarn prettify`,\n lint: `eslint --color \"./{${getSrcDirs(config)}}/**/*.{${extensions.eslint.join(',')}}\"`,\n 'lint-fix': 'yarn lint --fix',\n prettify: `prettier --color --write \"**/{.*/,}*.{${extensions.prettier.join(',')}}\" \"!**/test-fixtures/**\"`,\n typecheck: 'tsc --noEmit --Pretty',\n };\n if (config.containingSubPackageJsons) {\n scripts = merge(\n { ...scripts },\n {\n format: `sort-package-json && yarn prettify && yarn workspaces foreach --parallel --verbose run format`,\n lint: `yarn workspaces foreach --parallel --verbose run lint`,\n 'lint-fix': 'yarn workspaces foreach --parallel --verbose run lint-fix',\n prettify: `prettier --color --write \"**/{.*/,}*.{${extensions.prettier.join(\n ','\n )}}\" \"!**/packages/**\" \"!**/test-fixtures/**\"`,\n test: 'yarn workspaces foreach --verbose run test',\n typecheck: 'yarn workspaces foreach --parallel --verbose run typecheck',\n }\n );\n }\n if (config.depending.blitz) {\n scripts.typecheck = `${scripts.typecheck} || yarn run typecheck/warn`;\n (scripts as any)['typecheck/warn'] = `echo 'Please try \"yarn gen-code\" if you face unknown type errors.' && exit 1`;\n (scripts as any)['typecheck:gen-code'] = 'yarn gen-code && tsc --noEmit --Pretty';\n }\n return scripts;\n}\n\nasync function generatePrettierSuffix(dirPath: string): Promise<string> {\n const filePath = path.resolve(dirPath, '.prettierignore');\n const existingContent = await fs.promises.readFile(filePath, 'utf-8');\n const index = existingContent.indexOf(IgnoreFileUtil.separatorPrefix);\n if (index < 0) return '';\n\n const originalContent = existingContent.substring(0, index);\n const lines = originalContent\n .split('\\n')\n .map((line) => {\n const newLine = line.trim();\n return newLine.endsWith('/') ? newLine.slice(0, -1) : newLine;\n })\n .filter((l) => l && !l.startsWith('#') && !l.includes('/'));\n\n return lines.map((line) => ` \"!**/${line}/**\"`).join('');\n}\n", "import path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n3rd-party/\nandroid/\nios/\nno-format/\ntest-fixtures/\n*.d.ts\n*.min.js\n.yarn/\n.pnp.js\n`;\n\nexport async function generatePrettierignore(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.prettierignore');\n const userContent = (await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = (await IgnoreFileUtil.getExistingContent(gitignoreFilePath)) || '';\n\n let additionalContent = '';\n if (config.containingPubspecYaml) {\n additionalContent = `\nandroid/app/\nios/Runner/Assets.xcassets/\npubspec.yaml\n`;\n }\n\n const newContent = userContent + commonContent + additionalContent + gitignoreContent;\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nexport async function generateReleaserc(rootConfig: PackageConfig): Promise<void> {\n const filePath = path.resolve(rootConfig.dirPath, '.releaserc.json');\n try {\n const settings = JSON.parse(await fs.promises.readFile(filePath, 'utf8'));\n const plugins = settings?.plugins || [];\n for (let i = 0; i < plugins.length; i++) {\n const plugin = Array.isArray(plugins[i]) ? plugins[i][0] : plugins[i];\n if (plugin === '@semantic-release/commit-analyzer') {\n plugins[i] = [\n '@semantic-release/commit-analyzer',\n {\n preset: 'conventionalcommits',\n },\n ];\n } else if (plugin === '@semantic-release/github' && !rootConfig.publicRepo) {\n plugins[i] = ['@semantic-release/github', { successComment: false }];\n }\n }\n const newContent = JSON.stringify(settings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n } catch (_) {\n // do nothing\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { overwriteMerge } from '../utils/mergeUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst jsonObj = {\n extends: ['@willbooster'],\n};\n\nexport async function generateRenovateJson(config: PackageConfig): Promise<void> {\n let newSettings: any = cloneDeep(jsonObj);\n\n const filePath = path.resolve(config.dirPath, '.renovaterc.json');\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(oldContent) as any;\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.dependabot'), { force: true }));\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, 'renovate.json'), { force: true }));\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport yaml from 'js-yaml';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newSettings = {\n titleOnly: true,\n};\n\nexport async function generateSemanticYml(rootConfig: PackageConfig): Promise<void> {\n const githubPath = path.resolve(rootConfig.dirPath, '.github');\n await fs.promises.mkdir(githubPath, { recursive: true });\n const filePath = path.join(githubPath, 'semantic.yml');\n const newContent = yaml.dump(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { overwriteMerge } from '../utils/mergeUtil';\nimport { sortKeys } from '../utils/objectUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst rootJsonObj = {\n compilerOptions: {\n target: 'esnext',\n module: 'esnext',\n moduleResolution: 'node',\n jsx: 'react',\n alwaysStrict: true,\n strict: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n resolveJsonModule: true,\n sourceMap: true,\n importHelpers: false,\n outDir: 'dist',\n },\n include: [\n 'src/**/*',\n '__tests__/**/*',\n 'scripts/**/*',\n 'packages/*/src/**/*',\n 'packages/*/__tests__/**/*',\n 'packages/*/scripts/**/*',\n './node_modules/@types',\n './@types',\n ],\n};\n\nconst subJsonObj = {\n compilerOptions: {\n target: 'esnext',\n module: 'esnext',\n moduleResolution: 'node',\n jsx: 'react',\n alwaysStrict: true,\n strict: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n resolveJsonModule: true,\n sourceMap: true,\n importHelpers: false,\n outDir: 'dist',\n },\n include: ['src/**/*', '__tests__/**/*', 'scripts/**/*', '../../node_modules/@types', '../../@types', './@types'],\n};\n\nexport async function generateTsconfig(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n if (rootConfig.depending.blitz) return;\n\n let newSettings: any = cloneDeep(config.root ? rootJsonObj : subJsonObj);\n if (!config.containingJsxOrTsx && !config.containingJsxOrTsxInPackages) {\n delete newSettings.compilerOptions.jsx;\n }\n if (config.root && !config.containingSubPackageJsons) {\n newSettings.include = newSettings.include.filter((dirPath: string) => !dirPath.startsWith('packages/*/'));\n }\n if (!config.root && (config.depending.jestPlaywrightPreset || rootConfig.depending.jestPlaywrightPreset)) {\n const relativeDirPath = path.relative(config.dirPath, rootConfig.dirPath);\n newSettings.include.push(\n ...[\n path.join(relativeDirPath, 'node_modules/jest-playwright-preset/types'),\n path.join(relativeDirPath, 'node_modules/expect-playwright'),\n ]\n );\n }\n\n const filePath = path.resolve(config.dirPath, 'tsconfig.json');\n try {\n const existingContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(existingContent);\n if (oldSettings.extends === './node_modules/@willbooster/tsconfig/tsconfig.json') {\n delete oldSettings.extends;\n }\n delete oldSettings.compilerOptions?.typeRoots;\n delete newSettings?.compilerOptions?.target;\n delete newSettings?.compilerOptions?.module;\n if (oldSettings.jsx) {\n delete newSettings.jsx;\n }\n if (config.depending.blitz) {\n delete newSettings.include;\n }\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n sortKeys(newSettings.compilerOptions);\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "export function sortKeys(obj: any): void {\n const keyAndValues = Object.entries(obj).sort(([key1], [key2]) => key1.localeCompare(key2));\n for (const [key, value] of keyAndValues) {\n delete obj[key];\n obj[key] = value;\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport yaml from 'js-yaml';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { combineMerge } from '../utils/mergeUtil';\nimport { sortKeys } from '../utils/objectUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst testWorkflow = {\n name: 'Test',\n on: {\n pull_request: null,\n push: {\n branches: ['main', 'wbfy', 'renovate/**'],\n },\n },\n jobs: {\n test: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/test.yml@main',\n },\n },\n};\n\nconst releaseWorkflow = {\n name: 'Release',\n on: {\n push: {\n branches: [],\n },\n },\n jobs: {\n release: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/release.yml@main',\n },\n },\n};\n\nconst wbfyWorkflow = {\n name: 'Willboosterify',\n on: {\n workflow_dispatch: null,\n },\n jobs: {\n wbfy: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/wbfy.yml@main',\n },\n },\n};\n\nconst wbfyMergeWorkflow = {\n name: 'Merge wbfy',\n on: {\n workflow_dispatch: null,\n },\n jobs: {\n 'wbfy-merge': {\n uses: 'WillBooster/reusable-workflows/.github/workflows/wbfy-merge.yml@main',\n },\n },\n};\n\nconst semanticPullRequestWorkflow = {\n name: 'Lint PR title',\n on: {\n pull_request_target: {\n types: ['opened', 'edited', 'synchronize'],\n },\n },\n jobs: {\n 'semantic-pr': {\n uses: 'WillBooster/reusable-workflows/.github/workflows/semantic-pr.yml@main',\n },\n },\n};\n\ntype KnownKind = 'test' | 'release' | 'sync' | 'wbfy' | 'wbfy-merge' | 'semantic-pr';\n\nexport async function generateWorkflow(rootConfig: PackageConfig): Promise<void> {\n const workflowsPath = path.resolve(rootConfig.dirPath, '.github', 'workflows');\n await fs.promises.mkdir(workflowsPath, { recursive: true });\n\n const fileNames = (await fs.promises.readdir(workflowsPath, { withFileTypes: true }))\n .filter((dirent) => dirent.isFile() && dirent.name.endsWith('.yml'))\n .map((dirent) => dirent.name);\n if (rootConfig.depending.semanticRelease) {\n fileNames.push('release.yml');\n }\n fileNames.push('test.yml', 'wbfy.yml', 'wbfy-merge.yml', 'semantic-pr.yml');\n\n for (const fileName of fileNames) {\n const kind = path.basename(fileName, '.yml');\n await promisePool.run(() => writeWorkflowYaml(rootConfig, workflowsPath, kind));\n }\n}\n\nasync function writeYaml(newSettings: any, filePath: string): Promise<void> {\n const yamlText = yaml.dump(newSettings, {\n lineWidth: -1,\n noCompatMode: true,\n styles: {\n '!!null': 'empty',\n },\n });\n await promisePool.run(() => fs.promises.writeFile(filePath, yamlText));\n}\n\nasync function writeWorkflowYaml(\n config: PackageConfig,\n workflowsPath: string,\n kind: KnownKind | string\n): Promise<void> {\n let newSettings: any = {};\n if (kind === 'test') {\n newSettings = testWorkflow;\n } else if (kind === 'release') {\n newSettings = releaseWorkflow;\n } else if (kind === 'wbfy') {\n newSettings = wbfyWorkflow;\n } else if (kind === 'wbfy-merge') {\n newSettings = wbfyMergeWorkflow;\n } else if (kind === 'semantic-pr') {\n newSettings = semanticPullRequestWorkflow;\n }\n newSettings = cloneDeep(newSettings);\n\n const filePath = path.join(workflowsPath, `${kind}.yml`);\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = yaml.load(oldContent);\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: combineMerge });\n } catch (e) {\n // do nothing\n }\n\n for (const job of Object.values(newSettings.jobs) as any[]) {\n // Ignore non-reusable workflows\n if (!job.uses?.includes?.('/reusable-workflows/')) return;\n\n normalizeJob(config, job, kind);\n }\n\n if (kind === 'release') {\n if (newSettings.on.schedule) {\n delete newSettings.on.push;\n } else {\n newSettings.on.push.branches = config.release.branches;\n }\n } else if (kind === 'wbfy') {\n setSchedule(newSettings, 20, 24);\n } else if (kind === 'wbfy-merge') {\n setSchedule(newSettings, 0, 4);\n }\n await writeYaml(newSettings, filePath);\n\n if (kind === 'release') {\n await promisePool.run(() => fs.promises.rm(path.join(workflowsPath, 'semantic-release.yml'), { force: true }));\n } else if (kind === 'sync') {\n await promisePool.run(() => fs.promises.rm(path.join(workflowsPath, 'sync-init.yml'), { force: true }));\n if (!newSettings.jobs.sync) return;\n\n newSettings.jobs['sync-force'] = newSettings.jobs.sync;\n const params = newSettings.jobs.sync.with.sync_params_without_dest;\n if (!params) return;\n\n newSettings.jobs.sync.with.sync_params_without_dest = `--force ${params}`;\n newSettings.name = 'Force to Sync';\n newSettings.on = { workflow_dispatch: null };\n delete newSettings.jobs.sync;\n await writeYaml(newSettings, path.join(workflowsPath, 'sync-force.yml'));\n }\n}\n\nfunction normalizeJob(config: PackageConfig, job: any, kind: KnownKind | string): void {\n job.with ||= {};\n job.secrets ||= {};\n\n if ((config.release.github && kind === 'test') || kind === 'release' || kind === 'wbfy' || kind === 'wbfy-merge') {\n if (config.publicRepo) {\n job.secrets['GH_TOKEN'] = '${{ secrets.PUBLIC_GH_BOT_PAT }}';\n } else {\n job.secrets['GH_TOKEN'] = '${{ secrets.GH_BOT_PAT }}';\n }\n }\n if (config.release.npm && (kind === 'release' || kind === 'test')) {\n job.secrets['NPM_TOKEN'] = '${{ secrets.NPM_TOKEN }}';\n }\n\n if (kind === 'sync') {\n const params = job.with?.sync_params_without_dest;\n if (params) {\n job.with.sync_params_without_dest = params.replace('sync ', '');\n }\n }\n\n if (config.repository?.startsWith('github:WillBooster/')) {\n job.uses = job.uses.replace('WillBoosterLab/', 'WillBooster/');\n } else if (config.repository?.startsWith('github:WillBoosterLab/')) {\n job.uses = job.uses.replace('WillBooster/', 'WillBoosterLab/');\n }\n\n delete job.with['non_self_hosted'];\n if (config.containingDockerfile && kind.startsWith('deploy')) {\n job.with['cpu_arch'] = 'X64';\n }\n if (Object.keys(job.with).length) {\n sortKeys(job.with);\n } else {\n delete job.with;\n }\n\n if (Object.keys(job.secrets).length) {\n sortKeys(job.secrets);\n } else {\n delete job.secrets;\n }\n}\n\nfunction setSchedule(newSettings: any, inclusiveMinHourJst: number, exclusiveMaxHourJst: number): void {\n const [minuteUtc, hourUtc] = ((newSettings.on.schedule?.[0]?.cron as string) ?? '').split(' ').map(Number);\n if (minuteUtc !== 0 && Number.isInteger(hourUtc)) {\n const hourJst = (hourUtc + 9) % 24;\n const inRange =\n inclusiveMinHourJst < exclusiveMaxHourJst\n ? inclusiveMinHourJst <= hourJst && hourJst < exclusiveMaxHourJst\n : inclusiveMinHourJst <= hourJst || hourJst < exclusiveMaxHourJst;\n if (inRange) return;\n }\n\n const minJst = 1 + Math.floor(Math.random() * 59);\n const hourJst = inclusiveMinHourJst + Math.floor(Math.random() * (exclusiveMaxHourJst - inclusiveMinHourJst));\n const cron = `${minJst} ${(hourJst - 9 + 24) % 24} * * *`;\n newSettings.on.schedule = [{ cron }];\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport yaml from 'js-yaml';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync, spawnSyncWithStringResult } from '../utils/spawnUtil';\n\nexport async function generateYarnrcYml(config: PackageConfig): Promise<void> {\n const currentVersion = spawnSyncWithStringResult('yarn', ['--version'], config.dirPath);\n const latestVersion = spawnSyncWithStringResult('npm', ['show', '@yarnpkg/cli', 'version'], config.dirPath);\n if (currentVersion !== latestVersion) {\n spawnSync('yarn', ['set', 'version', latestVersion], config.dirPath, 1);\n }\n\n const releasesPath = path.join(config.dirPath, '.yarn', 'releases');\n await fs.promises.mkdir(releasesPath, { recursive: true });\n for (const file of await fs.promises.readdir(releasesPath)) {\n if (file.startsWith('yarn-') && !file.startsWith(`yarn-${latestVersion}.`)) {\n await promisePool.run(() => fs.promises.rm(path.join(releasesPath, file)));\n console.log('Removed', path.join(releasesPath, file));\n }\n }\n\n const yarnrcPath = path.resolve(config.dirPath, '.yarnrc');\n await promisePool.run(() => fs.promises.rm(yarnrcPath, { force: true }));\n\n const yarnrcYmlPath = path.resolve(config.dirPath, '.yarnrc.yml');\n const settings = yaml.load(await fs.promises.readFile(yarnrcYmlPath, 'utf8')) as any;\n settings.defaultSemverRangePrefix = '';\n if (config.requiringNodeModules) {\n settings.nodeLinker = 'node-modules';\n settings.nmMode = 'hardlinks-global';\n }\n await fs.promises.writeFile(yarnrcYmlPath, yaml.dump(settings, { lineWidth: -1 }));\n\n const plugins = (settings.plugins || []).map((p: any) => p.spec as string);\n const requireTypeScript = config.containingTypeScript || config.containingTypeScriptInPackages;\n importOrRemovePlugin(config, plugins, requireTypeScript, '@yarnpkg/plugin-typescript');\n if (requireTypeScript && !config.requiringNodeModules) {\n spawnSync('yarn', ['dlx', '@yarnpkg/sdks', 'vscode'], config.dirPath);\n }\n importOrRemovePlugin(config, plugins, config.containingSubPackageJsons, '@yarnpkg/plugin-workspace-tools');\n spawnSync('yarn', ['dlx', 'yarn-plugin-auto-install'], config.dirPath);\n}\n\nfunction importOrRemovePlugin(config: PackageConfig, plugins: string[], requirePlugin: boolean, plugin: string): void {\n if (requirePlugin !== plugins.includes(plugin)) {\n spawnSync('yarn', ['plugin', requirePlugin ? 'import' : 'remove', plugin], config.dirPath);\n }\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\nimport path from 'path';\n\nimport glob from 'glob';\nimport yaml from 'js-yaml';\nimport simpleGit from 'simple-git';\n\nimport { fetchOnNode } from './fetchOnNode';\n\nexport interface PackageConfig {\n dirPath: string;\n root: boolean;\n publicRepo: boolean;\n repository?: string;\n willBoosterConfigs: boolean;\n containingSubPackageJsons: boolean;\n containingDockerfile: boolean;\n containingGemfile: boolean;\n containingGoMod: boolean;\n containingPackageJson: boolean;\n containingPoetryLock: boolean;\n containingPomXml: boolean;\n containingPubspecYaml: boolean;\n containingTemplateYaml: boolean;\n\n containingJavaScript: boolean;\n containingTypeScript: boolean;\n containingJsxOrTsx: boolean;\n containingJavaScriptInPackages: boolean;\n containingTypeScriptInPackages: boolean;\n containingJsxOrTsxInPackages: boolean;\n depending: {\n blitz: boolean;\n firebase: boolean;\n jestPlaywrightPreset: boolean;\n prisma: boolean;\n reactNative: boolean;\n semanticRelease: boolean;\n storybook: boolean;\n };\n release: {\n branches: string[];\n github: boolean;\n npm: boolean;\n };\n eslintBase?: string;\n requiringNodeModules: boolean;\n versionsText?: string;\n}\n\nexport async function getPackageConfig(dirPath: string): Promise<PackageConfig | null> {\n const packageJsonPath = path.resolve(dirPath, 'package.json');\n try {\n const containingPackageJson = fs.existsSync(packageJsonPath);\n let dependencies: { [key: string]: string } = {};\n let devDependencies: { [key: string]: string } = {};\n let packageJson: any = {};\n if (containingPackageJson) {\n const packageJsonText = fs.readFileSync(packageJsonPath, 'utf-8');\n packageJson = JSON.parse(packageJsonText);\n dependencies = packageJson.dependencies ?? {};\n devDependencies = packageJson.devDependencies ?? {};\n }\n\n let requiringNodeModules = true;\n try {\n const yarnrcYmlPath = path.resolve(dirPath, '.yarnrc.yml');\n const doc = yaml.load(await fsp.readFile(yarnrcYmlPath, 'utf8')) as any;\n requiringNodeModules = !doc.nodeLinker || doc.nodeLinker === 'node-modules';\n } catch (_) {\n // do nothing\n }\n\n let releaseBranches: string[] = [];\n let releasePlugins: string[] = [];\n try {\n const releasercJsonPath = path.resolve(dirPath, '.releaserc.json');\n const json = JSON.parse(await fsp.readFile(releasercJsonPath, 'utf8'));\n releaseBranches = json?.branches || [];\n releasePlugins = json?.plugins?.flat() || [];\n } catch (_) {\n // do nothing\n }\n\n const isRoot =\n path.basename(path.resolve(dirPath, '..')) !== 'packages' ||\n !fs.existsSync(path.resolve(dirPath, '..', '..', 'package.json'));\n\n let repoInfo: Record<string, any> | undefined;\n if (isRoot) {\n repoInfo = await getRepoInfo(dirPath, packageJson);\n }\n\n const toolVersionsPath = path.resolve(dirPath, '.tool-versions');\n let versionsText: string | undefined;\n try {\n versionsText = await fsp.readFile(toolVersionsPath, 'utf-8');\n } catch (_) {\n // do nothing\n }\n\n const config: PackageConfig = {\n dirPath,\n root: isRoot,\n publicRepo: repoInfo?.private === false,\n repository: repoInfo?.full_name ? `github:${repoInfo?.full_name}` : undefined,\n willBoosterConfigs: packageJsonPath.includes(`${path.sep}willbooster-configs`),\n containingSubPackageJsons: glob.sync('packages/**/package.json', { cwd: dirPath }).length > 0,\n containingDockerfile:\n fs.existsSync(path.resolve(dirPath, 'Dockerfile')) ||\n fs.existsSync(path.resolve(dirPath, 'docker-compose.yml')),\n containingGemfile: fs.existsSync(path.resolve(dirPath, 'Gemfile')),\n containingGoMod: fs.existsSync(path.resolve(dirPath, 'go.mod')),\n containingPackageJson: fs.existsSync(path.resolve(dirPath, 'package.json')),\n containingPoetryLock: fs.existsSync(path.resolve(dirPath, 'poetry.lock')),\n containingPomXml: fs.existsSync(path.resolve(dirPath, 'pom.xml')),\n containingPubspecYaml: fs.existsSync(path.resolve(dirPath, 'pubspec.yaml')),\n containingTemplateYaml: fs.existsSync(path.resolve(dirPath, 'template.yaml')),\n containingJavaScript: glob.sync('@(app|src|__tests__|scripts)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScript: glob.sync('@(app|src|__tests__|scripts)/**/*.ts?(x)', { cwd: dirPath }).length > 0,\n containingJsxOrTsx: glob.sync('@(app|src|__tests__)/**/*.{t,j}sx', { cwd: dirPath }).length > 0,\n containingJavaScriptInPackages:\n glob.sync('packages/**/@(app|src|__tests__|scripts)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScriptInPackages:\n glob.sync('packages/**/@(app|src|__tests__|scripts)/**/*.ts?(x)', { cwd: dirPath }).length > 0,\n containingJsxOrTsxInPackages:\n glob.sync('packages/**/@(app|src|__tests__)/**/*.{t,j}sx', { cwd: dirPath }).length > 0,\n depending: {\n blitz: !!(dependencies['blitz'] || devDependencies['blitz']),\n firebase: !!devDependencies['firebase-tools'],\n jestPlaywrightPreset: !!devDependencies['jest-playwright-preset'],\n prisma: !!devDependencies['prisma'],\n reactNative: !!dependencies['react-native'],\n semanticRelease: !!devDependencies['semantic-release'],\n storybook: !!devDependencies['@storybook/react'],\n },\n release: {\n branches: releaseBranches,\n github: releasePlugins.includes('@semantic-release/github'),\n npm: releasePlugins.includes('@semantic-release/npm'),\n },\n requiringNodeModules,\n versionsText,\n };\n config.eslintBase = getEslintExtensionBase(config);\n if (\n config.containingGemfile ||\n config.containingGoMod ||\n config.containingPackageJson ||\n config.containingPoetryLock ||\n config.containingPomXml ||\n config.containingPubspecYaml ||\n config.containingTemplateYaml\n ) {\n return config;\n }\n } catch (e) {\n // do nothing\n }\n return null;\n}\n\nfunction getEslintExtensionBase(config: PackageConfig): string | undefined {\n if (config.containingTypeScript) {\n if (config.containingJsxOrTsx) {\n return '@willbooster/eslint-config-ts-react';\n } else {\n return '@willbooster/eslint-config-ts';\n }\n } else {\n if (config.containingJsxOrTsx) {\n return '@willbooster/eslint-config-js-react';\n } else if (config.containingJavaScript) {\n return '@willbooster/eslint-config-js';\n }\n }\n return undefined;\n}\n\nasync function getRepoInfo(dirPath: string, packageJson: any): Promise<Record<string, any> | undefined> {\n const git = simpleGit(dirPath);\n const remotes = await git.getRemotes(true);\n const origin = remotes.find((r) => r.name === 'origin');\n const remoteUrl = origin?.refs?.fetch ?? origin?.refs?.push;\n if (typeof remoteUrl === 'string') {\n const json = await fetchRepoInfo(remoteUrl);\n if (json) return json;\n }\n\n const url = packageJson.repository?.url ?? packageJson.repository;\n if (typeof url === 'string') {\n const json = await fetchRepoInfo(url);\n if (json && json.message !== 'Not Found') return json;\n }\n}\n\nasync function fetchRepoInfo(urlOrFullName: string): Promise<Record<string, any> | undefined> {\n const urlWithoutProtocol = urlOrFullName.split(':').at(-1);\n const names = urlWithoutProtocol?.split('/');\n const org = names?.at(-2);\n const name = names?.at(-1)?.replace(/.git$/, '');\n if (!org || !name) return;\n\n const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n const opts = token\n ? {\n headers: {\n Authorization: `token ${token}`,\n },\n }\n : undefined;\n const res = await fetchOnNode(`https://api.github.com/repos/${org}/${name}`, opts);\n const json = (await res.json()) as any;\n return { full_name: `${org}/${name}`, ...(json ?? {}) };\n}\n"],
|
5
|
-
"mappings": "+uBAAA,OAAiB,mBAEjB,GAAiB,mBACjB,GAAkB,oBCHlB,MAAe,iBACf,GAAiB,mBCDjB,OAA4B,gCAEf,EAAc,GAAI,gBCF/B,OAA0B,4BAEnB,WAAmB,EAAiB,EAAgB,EAAa,EAAQ,EAAS,CACvF,EAAG,CACD,GAAM,CAAC,EAAQ,EAAS,GAAW,GAAiB,EAAS,EAAM,CAAG,EAGtE,GAFA,QAAQ,IAAI,KAAK,KAAU,EAAQ,KAAK,GAAG,QAAQ,EAAQ,KAAK,EAE5D,AADQ,WAAc,UAAU,EAAQ,EAAS,CAAO,EACpD,SAAW,EAAG,KACxB,OAAS,EAAE,GAAS,EACtB,CAEO,WAAmC,EAAiB,EAAgB,EAAqB,CAC9F,GAAM,CAAC,EAAQ,EAAS,GAAW,GAAiB,EAAS,EAAM,CAAG,EACtE,SAAQ,MAAQ,OAET,AADM,WAAc,UAAU,EAAQ,EAAS,CAAO,EACjD,OAAO,SAAS,EAAE,KAAK,CACrC,CAEO,YAA0B,EAAiB,EAAgB,EAAsC,CACtG,GAAM,GAAM,KAAK,QAAQ,KAEzB,MAAI,GAAI,MAAQ,EAAI,kBAClB,GAAI,KAAO,EAAI,KAAK,QAAQ,GAAG,EAAI,oBAAqB,EAAE,GAGxD,EAAI,UACN,GAAO,CAAC,KAAM,KAAM,KAAK,EAAI,uB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B,CAAU,EAC1B,GAAqB,CAAU,EAC/B,GAAqB,CAAU,EAC/B,GAAqB,CAAU,EAC/B,GAAkB,CAAU,EAC5B,GAAoB,CAAU,EAC9B,GAAiB,CAAU,CAC7B,CAAC,EACD,KAAM,GAAY,WAAW,EAE7B,GAAM,GAA4B,CAAC,EACnC,OAAW,KAAU,GAEnB,AADA,KAAM,IAAkB,EAAQ,CAAU,EACtC,GAAC,EAAO,MAAQ,CAAC,EAAO,wBAG5B,MAAM,IAAuB,CAAM,EACnC,KAAM,IAAoB,EAAQ,EAAY,EAAK,QAAQ,EAE3D,EAAS,KAAK,GAAqB,CAAM,CAAC,EACtC,GAAO,sBAAwB,EAAO,iCACxC,EAAS,KAAK,GAAiB,EAAQ,CAAU,CAAC,EAGlD,GAAO,sBACP,EAAO,gCACP,EAAO,sBACP,EAAO,iCAEF,GAAW,oBACd,EAAS,KAAK,GAAiB,EAAQ,CAAU,CAAC,EAEpD,EAAS,KAAK,GAAqB,CAAM,CAAC,IAG9C,KAAM,SAAQ,IAAI,CAAQ,EAC1B,KAAM,GAAY,WAAW,EAE7B,EAAU,OAAQ,CAAC,SAAS,EAAG,CAAW,EAG1C,EAAU,OAAQ,CAAC,SAAS,EAAG,CAAW,CAC5C,CACF,CAEA,GAAK,EAAE,KAAK",
|
3
|
+
"sources": ["../src/index.ts", "../src/generators/asdf.ts", "../src/utils/promisePool.ts", "../src/utils/spawnUtil.ts", "../src/generators/editorconfig.ts", "../src/utils/extensions.ts", "../src/utils/fsUtil.ts", "../src/generators/eslintignore.ts", "../src/utils/ignoreFileUtil.ts", "../src/generators/eslintrc.ts", "../src/utils/mergeUtil.ts", "../src/generators/gitattributes.ts", "../src/generators/gitignore.ts", "../src/utils/fetchOnNode.ts", "../src/generators/huskyrc.ts", "../src/generators/idea.ts", "../src/generators/lintstagedrc.ts", "../src/utils/eslintUtil.ts", "../src/utils/srcDirectories.ts", "../src/generators/packageJson.ts", "../src/generators/prettierignore.ts", "../src/generators/releaserc.ts", "../src/generators/renovaterc.ts", "../src/generators/tsconfig.ts", "../src/utils/objectUtil.ts", "../src/generators/workflow.ts", "../src/generators/yarnrc.ts", "../src/utils/packageConfig.ts"],
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport glob from 'glob';\nimport yargs from 'yargs';\n\nimport { generateVersionConfigs } from './generators/asdf';\nimport { generateEditorconfig } from './generators/editorconfig';\nimport { generateEslintignore } from './generators/eslintignore';\nimport { generateEslintrc } from './generators/eslintrc';\nimport { generateGitattributes } from './generators/gitattributes';\nimport { generateGitignore } from './generators/gitignore';\nimport { generateHuskyrc } from './generators/huskyrc';\nimport { generateIdeaSettings } from './generators/idea';\nimport { generateLintstagedrc } from './generators/lintstagedrc';\nimport { generatePackageJson } from './generators/packageJson';\nimport { generatePrettierignore } from './generators/prettierignore';\nimport { generateReleaserc } from './generators/releaserc';\nimport { generateRenovateJson } from './generators/renovaterc';\nimport { generateTsconfig } from './generators/tsconfig';\nimport { generateWorkflow } from './generators/workflow';\nimport { generateYarnrcYml } from './generators/yarnrc';\nimport { getPackageConfig, PackageConfig } from './utils/packageConfig';\nimport { promisePool } from './utils/promisePool';\nimport { spawnSync } from './utils/spawnUtil';\n\nasync function main(): Promise<void> {\n const argv = await yargs(process.argv.slice(2))\n .command('wbfy <paths...>', 'Generate/update project files for WillBooster')\n .demandCommand(1)\n .alias('d', 'skipDeps')\n .boolean('skipDeps')\n .default('skipDeps', false)\n .describe('skipDeps', 'Skip dependency installation')\n .alias('v', 'verbose')\n .boolean('verbose')\n .default('verbose', false).argv;\n\n for (const rootDirPath of argv._) {\n if (typeof rootDirPath === 'number') continue;\n\n const rootConfig = await getPackageConfig(rootDirPath);\n if (rootConfig === null) {\n console.error(`there is no valid package.json in ${rootDirPath}`);\n continue;\n }\n\n const subDirPaths = rootConfig.containingSubPackageJsons\n ? glob.sync('packages/*', { cwd: rootDirPath }).map((subDirPath) => path.resolve(rootDirPath, subDirPath))\n : [];\n const subPackageConfigs = (await Promise.all(subDirPaths.map((subDirPath) => getPackageConfig(subDirPath)))).filter(\n (config) => !!config\n ) as PackageConfig[];\n const allPackageConfigs = [rootConfig, ...subPackageConfigs];\n\n if (argv.verbose) {\n for (const config of allPackageConfigs) {\n console.log(config);\n }\n }\n\n // Install tools via asdf at first\n await generateVersionConfigs(rootConfig);\n // Install yarn berry\n await generateYarnrcYml(rootConfig);\n await Promise.all([\n generateEditorconfig(rootConfig),\n generateGitattributes(rootConfig),\n generateHuskyrc(rootConfig),\n generateIdeaSettings(rootConfig),\n generateLintstagedrc(rootConfig),\n generateRenovateJson(rootConfig),\n generateReleaserc(rootConfig),\n generateWorkflow(rootConfig),\n ]);\n await promisePool.promiseAll();\n\n const promises: Promise<void>[] = [];\n for (const config of allPackageConfigs) {\n await generateGitignore(config, rootConfig);\n if (!config.root && !config.containingPackageJson) {\n continue;\n }\n await generatePrettierignore(config);\n await generatePackageJson(config, rootConfig, argv.skipDeps);\n\n promises.push(generateLintstagedrc(config));\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\n promises.push(generateTsconfig(config, rootConfig));\n }\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages\n ) {\n if (!rootConfig.willBoosterConfigs) {\n promises.push(generateEslintrc(config, rootConfig));\n }\n promises.push(generateEslintignore(config));\n }\n }\n await Promise.all(promises);\n await promisePool.promiseAll();\n\n spawnSync('yarn', ['cleanup'], rootDirPath);\n // 'yarn install' should be after `yarn cleanup` because yarn berry generates yarn.lock\n // corresponding to the contents of dependant sub-package in monorepo\n spawnSync('yarn', ['install'], rootDirPath);\n }\n}\n\nmain().then();\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync, spawnSyncWithStringResult } from '../utils/spawnUtil';\n\nexport async function generateVersionConfigs(config: PackageConfig): Promise<void> {\n if (!config.versionsText) return;\n\n const lines: string[] = [];\n for (const versionText of config.versionsText.trim().split('\\n')) {\n const line = versionText.trim();\n if (line && line.split(/\\s+/)[0] !== 'nodejs') {\n lines.push(line);\n continue;\n }\n\n const [, version] = line.split(/\\s+/);\n await promisePool.run(() => fs.promises.writeFile(path.resolve(config.dirPath, '.node-version'), version));\n }\n if (config.containingPoetryLock) {\n updateLine('poetry 1.1.13', 0, lines);\n updateLine('python 3.9.10', 0, lines);\n }\n if (config.depending.firebase) {\n updateLine('java adoptopenjdk-17.0.2+8', 0, lines);\n }\n if (config.containingPackageJson) {\n const version = spawnSyncWithStringResult('npm', ['show', 'yarn', 'version'], config.dirPath);\n updateLine(`yarn ${version}`, lines.length, lines);\n }\n\n const toolVersionsPath = path.resolve(config.dirPath, '.tool-versions');\n if (lines.length) {\n await promisePool.run(() => fs.promises.writeFile(toolVersionsPath, lines.join('\\n') + '\\n'));\n } else {\n await promisePool.run(() => fs.promises.rm(toolVersionsPath, { force: true }));\n }\n await promisePool.promiseAll();\n spawnSync('asdf', ['install'], config.dirPath);\n}\n\nfunction updateLine(line: string, insertionIndex: number, lines: string[]): void {\n const [prefix] = line.split(' ');\n const index = lines.findIndex((l) => l.split(/\\s+/)[0] === prefix);\n if (index >= 0) {\n lines[index] = line;\n } else {\n lines.splice(insertionIndex, 0, line);\n }\n}\n", "import { PromisePool } from 'minimal-promise-pool';\n\nexport const promisePool = new PromisePool();\n", "import child_process from 'child_process';\n\nexport function spawnSync(command: string, args: string[], cwd: string, retry = 0): void {\n do {\n const [newCmd, newArgs, options] = getSpawnSyncArgs(command, args, cwd);\n console.log(`$ ${newCmd} ${newArgs.join(' ')} at ${options.cwd}`);\n const ret = child_process.spawnSync(newCmd, newArgs, options);\n if (ret.status === 0) break;\n } while (--retry >= 0);\n}\n\nexport function spawnSyncWithStringResult(command: string, args: string[], cwd: string): string {\n const [newCmd, newArgs, options] = getSpawnSyncArgs(command, args, cwd);\n options.stdio = 'pipe';\n const proc = child_process.spawnSync(newCmd, newArgs, options);\n const error = proc.stderr.toString().trim();\n if (error) {\n console.error(`${newCmd} [${newArgs.map((s) => `\"${s}\"`)}] caused the following error:\\n ${error}`);\n }\n return proc.stdout.toString().trim();\n}\n\nexport function getSpawnSyncArgs(command: string, args: string[], cwd: string): [string, string[], any] {\n const env = { ...process.env };\n // Remove berry from PATH\n if (env.PATH && env.BERRY_BIN_FOLDER) {\n env.PATH = env.PATH.replace(`${env.BERRY_BIN_FOLDER}:`, '');\n }\n\n if (env.ASDF_DIR) {\n args = ['-l', '-c', `. ${env.ASDF_DIR}/asdf.sh && ${command} ${args.join(' ')}`];\n command = 'bash';\n }\n return [\n command,\n args,\n {\n cwd,\n env,\n shell: false,\n stdio: 'inherit',\n },\n ];\n}\n", "import path from 'path';\n\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n${generateExtensions(extensions.codeWith2IndentSize)}\nindent_size = 2\nindent_style = space\n\n${generateExtensions(extensions.codeWith4IndentSize)}\nindent_size = 4\nindent_style = space\n\n${generateExtensions(extensions.codeWith8IndentSize)}\nindent_size = 8\nindent_style = space\n\n${generateExtensions(extensions.markdownLike)}\nmax_line_length = off\ntrim_trailing_whitespace = false\n\n[{Makefile,*.mk}]\nindent_style = tab\n`;\n\nexport async function generateEditorconfig(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.editorconfig');\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n\nfunction generateExtensions(extensions: string[]): string {\n return extensions.length > 1 ? `[*.{${extensions.join(',')}}]` : `[*.${extensions[0]}]`;\n}\n", "export const extensions = {\n codeWith2IndentSize: [\n 'cjs',\n 'mjs',\n 'js',\n 'jsx',\n 'ts',\n 'tsx',\n 'json',\n 'json5',\n 'cpp',\n 'dart',\n 'htm',\n 'html',\n 'pu',\n 'puml',\n 'rb',\n 'vue',\n 'yaml',\n 'yml',\n ].sort(),\n codeWith4IndentSize: ['go', 'gradle', 'py'].sort(),\n codeWith8IndentSize: ['sh'].sort(),\n markdownLike: ['md'].sort(),\n eslint: ['cjs', 'mjs', 'js', 'ts', 'tsx', 'jsx'].sort(),\n prettier: [\n 'cjs',\n 'mjs',\n 'js',\n 'jsx',\n 'ts',\n 'tsx',\n 'json',\n 'json5',\n 'css',\n 'htm',\n 'html',\n 'md',\n 'scss',\n 'vue',\n 'yaml',\n 'yml',\n ].sort(),\n};\n", "import fsp from 'fs/promises';\n\nexport const FsUtil = {\n async generateFile(filePath: string, content: string): Promise<void> {\n await fsp.writeFile(filePath, content);\n console.log(`Generated ${filePath}`);\n },\n};\n", "import path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n3rd-party/\n@types/\n__generated__/\nandroid/\nios/\nno-format/\ntest-fixtures/\n*.config.js\n*.d.ts\n*.min.js\n.yarn/\n.pnp.js\n`;\n\nexport async function generateEslintignore(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.eslintignore');\n const userContent = (await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = (await IgnoreFileUtil.getExistingContent(gitignoreFilePath)) || '';\n\n const newContent = userContent + commonContent + gitignoreContent;\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\n\nexport const IgnoreFileUtil = {\n header: '# Project-specific settings',\n separator: '# Generated by @willbooster/willboosterify',\n separatorPrefix: '# Generated by @willbooster',\n async getExistingContent(filePath: string): Promise<string | null> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n return content\n .replace(/# Project-specific settings[^\\n]*\\n/m, '')\n .replace(/# Generated by[^\\n]*\\n/m, '')\n .replace(/\\r?\\n\\r?\\n(\\r?\\n)+/gm, '\\n\\n');\n } catch (_) {\n return null;\n }\n },\n async getUserContent(filePath: string): Promise<string | null> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n const index = content.indexOf(this.separatorPrefix);\n if (index >= 0) {\n return content.substring(0, content.indexOf('\\n', index) + 1);\n }\n } catch (_) {\n // do nothing\n }\n return null;\n },\n async isBerryZeroInstallEnabled(filePath: string): Promise<boolean> {\n try {\n const content = await fs.promises.readFile(filePath, 'utf-8');\n return content.includes('\\n!.yarn/cache');\n } catch (_) {\n return false;\n }\n },\n};\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { combineMerge } from '../utils/mergeUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nexport async function generateEslintrc(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n const bases = [];\n if (config.eslintBase) {\n bases.push(config.eslintBase);\n }\n if (config !== rootConfig) {\n bases.push('../../.eslintrc.json');\n }\n let newSettings: any = { root: true, extends: bases };\n\n const filePath = path.resolve(config.dirPath, '.eslintrc.json');\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(oldContent);\n if (oldSettings.extends) {\n oldSettings.extends = oldSettings.extends.filter(\n (ext: string) => !ext.startsWith('@willbooster/') && ext !== '../../.eslintrc.json'\n );\n }\n if (!bases.length) {\n oldSettings.extends = [];\n }\n const newExtends = newSettings.extends;\n newSettings.extends = oldSettings.extends;\n oldSettings.extends = newExtends;\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: combineMerge });\n if (config.depending.blitz) {\n newSettings.extends = [...newSettings.extends.filter((e: string) => e !== 'blitz'), 'blitz'];\n }\n } catch (e) {\n // do nothing\n }\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import merge from 'deepmerge';\n\nexport function overwriteMerge(destinationArray: any[], sourceArray: any[]): any[] {\n return sourceArray;\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function combineMerge(target: any[], source: any[], options: any): any[] {\n const destination = target.slice();\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);\n } else if (options.isMergeableObject(item)) {\n destination[index] = merge(target[index], item, options);\n } else if (target.indexOf(item) === -1) {\n destination.push(item);\n }\n });\n return destination;\n}\n", "import path from 'path';\n\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `* text=auto\n\n*.vcproj text eol=crlf\n\n${extensions.codeWith2IndentSize\n .concat(extensions.codeWith4IndentSize)\n .concat(extensions.markdownLike)\n .map((ext) => `*.${ext} text eol=lf`)\n .join('\\n')}\n`;\n\nexport async function generateGitattributes(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.gitattributes');\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import path from 'path';\n\nimport { fetchOnNode } from '../utils/fetchOnNode';\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\n\nconst defaultNames = ['windows', 'macos', 'linux', 'jetbrains', 'visualstudiocode', 'emacs', 'vim', 'yarn'];\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n.devcontainer/\ndist/\ntemp/\nIcon[\\r]\n*.sqlite3\n*.sqlite3-journal\n`;\n\nconst gitignoreCache = new Map<string, string>();\n\nexport async function generateGitignore(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.gitignore');\n let userContent = ((await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent) + commonContent;\n\n const names = [...defaultNames];\n if (config.containingGemfile) {\n names.push('ruby');\n }\n if (config.containingGoMod) {\n names.push('go');\n userContent += `${path.basename(config.dirPath)}\n`;\n }\n if (config.containingPackageJson) {\n names.push('node');\n }\n if (config.containingPomXml) {\n names.push('maven');\n userContent += `.idea/google-java-format.xml\n`;\n }\n if (config.containingPubspecYaml) {\n names.push('flutter', 'AndroidStudio', 'ruby');\n userContent += `.flutter-plugins-dependencies\nandroid/key.properties\nios/.bundle\n.idea/runConfigurations.xml\n`;\n }\n if (config.containingTemplateYaml) {\n userContent += `.aws-sam/\npackaged.yaml\n`;\n }\n // Because .venv should be ignored on root directory\n if (config.containingPoetryLock) {\n names.push('python');\n }\n if (rootConfig.depending.firebase || config.depending.firebase) {\n names.push('firebase');\n }\n if (rootConfig.depending.reactNative || config.depending.reactNative) {\n names.push('reactnative');\n userContent += `google-services.json\nandroid/app/src/main/assets/\n`;\n }\n if (rootConfig.depending.storybook) {\n names.push('storybookjs');\n }\n if (rootConfig.depending.blitz) {\n names.push('nextjs');\n userContent += `.blitz/\n.blitz**\n`;\n }\n\n let generated = '';\n for (const name of names) {\n if (!gitignoreCache.has(name)) {\n const url = `https://www.toptal.com/developers/gitignore/api/${name}`;\n const response = await fetchOnNode(url);\n const responseText = await response.text();\n if (responseText.includes('Attention Required!')) {\n console.error(`Failed to fetch ${url}`);\n return;\n }\n gitignoreCache.set(name, responseText.trim());\n }\n if (generated) generated += '\\n\\n';\n generated += gitignoreCache.get(name);\n }\n if (!(await IgnoreFileUtil.isBerryZeroInstallEnabled(filePath))) {\n generated = generated.replace('!.yarn/cache', '# !.yarn/cache').replace('# .pnp.*', '.pnp.*');\n }\n if (config.containingPomXml || config.containingPubspecYaml) {\n generated = generated\n .replace(/^# .idea\\/artifacts$/gm, '.idea/artifacts')\n .replace(/^# .idea\\/compiler.xml$/gm, '.idea/compiler.xml')\n .replace(/^# .idea\\/jarRepositories.xml$/gm, '.idea/jarRepositories.xml')\n .replace(/^# .idea\\/modules.xml$/gm, '.idea/modules.xml')\n .replace(/^# .idea\\/*.iml$/gm, '.idea/*.iml')\n .replace(/^# .idea\\/modules$/gm, '.idea/modules')\n .replace(/^# *.iml$/gm, '*.iml')\n .replace(/^# *.ipr$/gm, '*.ipr');\n if (config.containingPubspecYaml) {\n generated = generated.replace(/^.idea\\/modules.xml$/gm, '# .idea/modules.xml');\n }\n }\n generated = generated.replace(/^.idea\\/?$/gm, '# .idea');\n if (rootConfig.depending.reactNative || config.depending.reactNative || config.containingPubspecYaml) {\n generated = generated.replace(/^(.idea\\/.+)$/gm, '$1\\nandroid/$1');\n }\n const newContent = userContent + generated;\n await FsUtil.generateFile(filePath, newContent);\n}\n", "import type { RequestInfo, RequestInit, Response } from 'node-fetch';\n\nexport async function fetchOnNode(url: RequestInfo, init?: RequestInit | undefined): Promise<Response> {\n const { default: nodeFetch } = await import('node-fetch');\n return nodeFetch(url, init);\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync } from '../utils/spawnUtil';\n\nconst DEFAULT_COMMAND = 'npm test';\n\nconst settings = {\n preCommit: 'yarn lint-staged',\n prePush: `yarn typecheck`,\n prePushForLab: `\nif [ $(git branch --show-current) = \"main\" ]; then\n echo \"************************************************\"\n echo \"*** Don't push main branch directly. Use PR! ***\"\n echo \"************************************************\"\n exit 1\nfi\n\nyarn typecheck`.trim(),\n postMerge: 'yarn',\n};\n\nexport async function generateHuskyrc(config: PackageConfig): Promise<void> {\n const packageJsonPath = path.resolve(config.dirPath, 'package.json');\n const jsonText = await fs.promises.readFile(packageJsonPath, 'utf-8');\n const packageJson = JSON.parse(jsonText);\n packageJson.scripts ||= {};\n delete packageJson.scripts['postinstall'];\n delete packageJson.scripts['postpublish'];\n delete packageJson.scripts['prepare'];\n delete packageJson.scripts['prepublishOnly'];\n delete packageJson.scripts['prepack'];\n delete packageJson.scripts['postpack'];\n\n const dirPath = path.resolve(config.dirPath, '.husky');\n await Promise.all([\n fs.promises.writeFile(packageJsonPath, JSON.stringify(packageJson, undefined, 2)),\n fs.promises.rm(dirPath, { force: true, recursive: true }),\n ]);\n spawnSync('yarn', ['dlx', 'husky-init', '--yarn2'], config.dirPath);\n\n const preCommitFilePath = path.resolve(dirPath, 'pre-commit');\n const content = await fs.promises.readFile(preCommitFilePath, 'utf-8');\n\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.huskyrc.json'), { force: true }));\n await promisePool.run(() =>\n fs.promises.writeFile(preCommitFilePath, content.replace(DEFAULT_COMMAND, settings.preCommit))\n );\n\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\n const prePush = config.repository?.startsWith('github:WillBoosterLab/') ? settings.prePushForLab : settings.prePush;\n await promisePool.run(() =>\n fs.promises.writeFile(path.resolve(dirPath, 'pre-push'), content.replace(DEFAULT_COMMAND, prePush), {\n mode: 0o755,\n })\n );\n }\n\n const postMergeCommands: string[] = [];\n if (config.versionsText?.includes('python ')) {\n postMergeCommands.push('asdf install python');\n }\n if (config.versionsText) {\n postMergeCommands.push('asdf install');\n }\n postMergeCommands.push(settings.postMerge);\n if (config.containingPoetryLock) {\n postMergeCommands.push('poetry install');\n }\n if (config.depending.blitz || config.depending.prisma) {\n postMergeCommands.push('yarn gen-code');\n }\n const postMergeCommand = content.replace(DEFAULT_COMMAND, postMergeCommands.join(' && '));\n await promisePool.run(() =>\n fs.promises.writeFile(path.resolve(dirPath, 'post-merge'), postMergeCommand, {\n mode: 0o755,\n })\n );\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst newContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectTasksOptions\">\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"ts\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.ts)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"tsx\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.tsx)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"js\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.js)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"json\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.json)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"md\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.md)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n <TaskOptions isEnabled=\"true\">\n <option name=\"arguments\" value=\"prettier --write $FilePathRelativeToProjectRoot$\" />\n <option name=\"checkSyntaxErrors\" value=\"false\" />\n <option name=\"description\" />\n <option name=\"exitCodeBehavior\" value=\"ERROR\" />\n <option name=\"fileExtension\" value=\"html\" />\n <option name=\"immediateSync\" value=\"false\" />\n <option name=\"name\" value=\"Prettier (.html)\" />\n <option name=\"output\" value=\"$FilePathRelativeToProjectRoot$\" />\n <option name=\"outputFilters\">\n <array />\n </option>\n <option name=\"outputFromStdout\" value=\"false\" />\n <option name=\"program\" value=\"yarn\" />\n <option name=\"runOnExternalChanges\" value=\"false\" />\n <option name=\"scopeName\" value=\"Project Files\" />\n <option name=\"trackOnlyRoot\" value=\"false\" />\n <option name=\"workingDir\" value=\"$ProjectFileDir$\" />\n <envs />\n </TaskOptions>\n </component>\n</project>\n`;\n\nexport async function generateIdeaSettings(config: PackageConfig): Promise<void> {\n const dirPath = path.resolve(config.dirPath, '.idea');\n if (fs.existsSync(dirPath)) {\n const filePath = path.resolve(dirPath, 'watcherTasks.xml');\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages ||\n (config.containingPackageJson &&\n !config.containingPubspecYaml &&\n !config.containingGemfile &&\n !config.containingGoMod &&\n !config.containingPomXml)\n ) {\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n } else {\n await promisePool.run(() => fs.promises.rm(filePath, { force: true }));\n }\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { EslintUtil } from '../utils/eslintUtil';\nimport { extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { getSrcDirs } from '../utils/srcDirectories';\n\nexport async function generateLintstagedrc(config: PackageConfig): Promise<void> {\n const lines: string[] = [];\n if (config.containingJavaScript || config.containingTypeScript) {\n const eslint = `\n '${getEslintKey(config)}': [${JSON.stringify(\n `eslint --fix${EslintUtil.getLintFixSuffix(config)}`\n )}, 'prettier --write'],`;\n lines.push(eslint);\n }\n const packagesFilter = config.root ? \" && !file.includes('/packages/')\" : '';\n lines.push(`\n './**/*.{${extensions.prettier.join(',')}}': files => {\n ${config.containingJavaScript || config.containingTypeScript ? getEslintFilterForPrettier(config) : ''}\n const filteredFiles = files.filter(file => !file.includes('/test-fixtures/')${packagesFilter});\n if (filteredFiles.length === 0) return [];\n const commands = [\\`prettier --write \\${filteredFiles.join(' ')}\\`];\n if (filteredFiles.some(file => file.endsWith('package.json'))) {\n commands.push('yarn sort-package-json');\n }\n return commands;\n },`);\n if (config.containingPubspecYaml) {\n lines.push(`\n './{lib,test,test_driver}/**/*.dart': files => {\n const filteredFiles = files.filter(file => !file.includes('generated'))\n .filter(file => !file.endsWith('.freezed.dart') && !file.endsWith('.g.dart'));\n if (filteredFiles.length === 0) return [];\n return [\\`flutter format \\${filteredFiles.join(' ')}\\`];\n },`);\n }\n if (config.containingPoetryLock) {\n lines.push(`\n './**/*.py': [\n 'poetry run isort --profile black --filter-files',\n 'poetry run black',\n 'poetry run flake8'\n ],`);\n }\n\n const newContent = `${\n config.containingJavaScript || config.containingTypeScript ? \"const micromatch = require('micromatch');\" : ''\n }\n\nmodule.exports = {${lines.join('')}\n};\n`;\n\n const filePath = path.resolve(config.dirPath, '.lintstagedrc.cjs');\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.lintstagedrc.js'), { force: true }));\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.lintstagedrc.json'), { force: true }));\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n\nfunction getEslintKey(config: PackageConfig): string {\n const dirs = getSrcDirs(config);\n return `./{${dirs.join(',')}}/**/*.{${extensions.eslint.join(',')}}`;\n}\n\nfunction getEslintFilterForPrettier(config: PackageConfig): string {\n return `files = micromatch.not(files, '${getEslintKey(config)}');`;\n}\n", "import { PackageConfig } from './packageConfig';\n\nexport const EslintUtil = {\n getLintFixSuffix(config: PackageConfig): string {\n return config.containingJsxOrTsx ? ' --rule \"{ react-hooks/exhaustive-deps: 0 }\"' : '';\n },\n};\n", "import { PackageConfig } from './packageConfig';\n\nconst srcDirectories = {\n node: ['src', '__tests__', 'scripts'],\n blitz: ['app', 'db', 'integrations', 'mailers', 'test'],\n};\n\nsrcDirectories.blitz = [...srcDirectories.node, ...srcDirectories.blitz];\n\nexport function getSrcDirs(config: PackageConfig): string[] {\n return config.depending.blitz ? srcDirectories.blitz : srcDirectories.node;\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\n\nimport { EslintUtil } from '../utils/eslintUtil';\nimport { extensions } from '../utils/extensions';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync } from '../utils/spawnUtil';\nimport { getSrcDirs } from '../utils/srcDirectories';\n\nconst jsCommonDeps = [\n 'eslint',\n 'eslint-config-prettier',\n 'eslint-plugin-import',\n 'eslint-plugin-sort-class-members',\n 'eslint-plugin-sort-destructure-keys',\n];\n\nconst tsCommonDeps = [\n ...jsCommonDeps,\n '@typescript-eslint/eslint-plugin',\n '@typescript-eslint/parser',\n 'eslint-import-resolver-typescript',\n];\n\nconst reactCommonDeps = ['eslint-plugin-react', 'eslint-plugin-react-hooks'];\n\nconst devDeps: { [prop: string]: string[] } = {\n '@willbooster/eslint-config-js': ['@willbooster/eslint-config-js', ...jsCommonDeps],\n '@willbooster/eslint-config-js-react': ['@willbooster/eslint-config-js-react', ...jsCommonDeps, ...reactCommonDeps],\n '@willbooster/eslint-config-ts': ['@willbooster/eslint-config-ts', ...tsCommonDeps],\n '@willbooster/eslint-config-ts-react': ['@willbooster/eslint-config-ts-react', ...tsCommonDeps, ...reactCommonDeps],\n '../../.eslintrc.json': [],\n};\n\nexport async function generatePackageJson(\n config: PackageConfig,\n rootConfig: PackageConfig,\n skipAddingDeps: boolean\n): Promise<void> {\n const filePath = path.resolve(config.dirPath, 'package.json');\n const jsonText = await fs.promises.readFile(filePath, 'utf-8');\n const jsonObj = JSON.parse(jsonText);\n jsonObj.scripts = jsonObj.scripts || {};\n jsonObj.dependencies = jsonObj.dependencies || {};\n jsonObj.devDependencies = jsonObj.devDependencies || {};\n jsonObj.peerDependencies = jsonObj.peerDependencies || {};\n\n await removeDeprecatedStuff(jsonObj);\n\n if (jsonObj.name !== '@willbooster/prettier-config') {\n jsonObj.prettier = '@willbooster/prettier-config';\n }\n\n for (const scriptKey of Object.keys(jsonObj.scripts)) {\n // Fresh repo still requires 'yarn install'\n if (!jsonObj.scripts[scriptKey].includes('git clone')) {\n jsonObj.scripts[scriptKey] = jsonObj.scripts[scriptKey]\n .replace(/yarn\\s*&&\\s*/, '')\n .replace(/yarn\\s*install\\s*&&\\s*/, '');\n }\n }\n\n jsonObj.scripts = merge(jsonObj.scripts, generateScripts(config));\n jsonObj.scripts.prettify += await generatePrettierSuffix(config.dirPath);\n\n let dependencies: string[] = [];\n let devDependencies = ['lint-staged', 'prettier', 'sort-package-json', '@willbooster/prettier-config'];\n const poetryDependencies: string[] = [];\n\n if (config.root) {\n // To install the latest pinst\n devDependencies.push('husky', 'pinst', '@willbooster/renovate-config');\n if (config.depending.semanticRelease) {\n devDependencies.push('conventional-changelog-conventionalcommits');\n }\n if (config.containingSubPackageJsons) {\n jsonObj.workspaces = ['packages/*'];\n } else {\n delete jsonObj.workspaces;\n }\n }\n\n if (\n config.containingJavaScript ||\n config.containingJavaScriptInPackages ||\n config.containingTypeScript ||\n config.containingTypeScriptInPackages\n ) {\n devDependencies.push('eslint', 'micromatch');\n // TODO: not needed anymore?\n if (config.containingTypeScriptInPackages) {\n devDependencies.push('@typescript-eslint/parser');\n }\n }\n\n if ((config.containingTypeScript || config.containingTypeScriptInPackages) && !config.depending.blitz) {\n devDependencies.push('typescript');\n }\n\n if (config.eslintBase) {\n devDependencies.push(...devDeps[config.eslintBase]);\n }\n\n if (config.willBoosterConfigs) {\n dependencies = dependencies.filter((dep) => !dep.includes('@willbooster/'));\n devDependencies = devDependencies.filter((dep) => !dep.includes('@willbooster/'));\n }\n\n if (!jsonObj.name) {\n jsonObj.name = path.basename(config.dirPath);\n }\n\n if (config.containingSubPackageJsons) {\n jsonObj.private = true;\n }\n\n if (!jsonObj.license) {\n jsonObj.license = 'UNLICENSED';\n }\n\n if (!config.containingTypeScript && !config.containingTypeScriptInPackages) {\n delete jsonObj.scripts.typecheck;\n }\n\n // https://github.com/semantic-release/semantic-release/issues/2323#issuecomment-1032341621\n if (config.depending.semanticRelease && config.release.npm) {\n jsonObj.resolutions ||= {};\n jsonObj.resolutions['npm/chalk'] = '^4.1.2';\n }\n\n if (!config.containingSubPackageJsons) {\n if (!config.containingJavaScript && !config.containingTypeScript) {\n delete jsonObj.scripts.lint;\n delete jsonObj.scripts['lint-fix'];\n jsonObj.scripts.cleanup = jsonObj.scripts.cleanup.replace(' && yarn lint-fix', '');\n } else {\n jsonObj.scripts['lint-fix'] += EslintUtil.getLintFixSuffix(config);\n }\n\n if (config.containingPubspecYaml) {\n jsonObj.scripts.lint = 'flutter analyze';\n jsonObj.scripts['lint-fix'] = 'yarn lint';\n const dirs = ['lib', 'test', 'test_driver'].filter((dir) => fs.existsSync(path.resolve(config.dirPath, dir)));\n if (dirs.length > 0) {\n jsonObj.scripts['format-code'] = `flutter format $(find ${dirs.join(\n ' '\n )} -name generated -prune -o -name '*.freezed.dart' -prune -o -name '*.g.dart' -prune -o -name '*.dart' -print)`;\n jsonObj.scripts.format += ` && yarn format-code`;\n }\n }\n\n if (config.containingPoetryLock) {\n if (jsonObj.scripts.postinstall === 'poetry install') {\n delete jsonObj.scripts.postinstall;\n }\n const dirNames = (await fs.promises.readdir(config.dirPath)).filter((dirName) => {\n const dirPath = path.resolve(config.dirPath, dirName);\n if (!fs.lstatSync(dirPath).isDirectory()) return false;\n return fs.readdirSync(dirPath).some((fileName) => fileName.endsWith('.py'));\n });\n if (dirNames.length > 0) {\n jsonObj.scripts['format-code'] = `poetry run isort --profile black ${dirNames.join(\n ' '\n )} && poetry run black ${dirNames.join(' ')}`;\n jsonObj.scripts.lint = `poetry run flake8 ${dirNames.join(' ')}`;\n jsonObj.scripts['lint-fix'] = 'yarn lint';\n jsonObj.scripts.format += ` && yarn format-code`;\n poetryDependencies.push('black', 'isort', 'flake8');\n }\n }\n\n if (config.repository) {\n jsonObj.repository = config.repository;\n }\n }\n\n if (config.depending.blitz) {\n // These cause an error of eslint-plugin-import loading\n devDependencies = devDependencies.filter((dep) => !dep.includes('@typescript-eslint/'));\n // This causes eslint errors\n devDependencies = devDependencies.filter(\n (d) =>\n d !== 'eslint-plugin-react' &&\n d !== 'eslint-import-resolver-typescript' &&\n d !== 'eslint-plugin-import' &&\n d !== 'eslint-plugin-react-hooks'\n );\n if (!jsonObj.scripts['gen-code']?.startsWith('blitz codegen')) {\n jsonObj.scripts['gen-code'] = 'blitz codegen';\n }\n } else if (config.depending.prisma) {\n if (!jsonObj.scripts['gen-code']?.startsWith('prisma generate')) {\n jsonObj.scripts['gen-code'] = 'prisma generate';\n }\n }\n if (!Object.keys(jsonObj.dependencies).length) {\n delete jsonObj.dependencies;\n }\n if (!Object.keys(jsonObj.devDependencies).length) {\n delete jsonObj.devDependencies;\n }\n if (!Object.keys(jsonObj.peerDependencies).length) {\n delete jsonObj.peerDependencies;\n }\n\n await fs.promises.writeFile(filePath, JSON.stringify(jsonObj));\n\n if (!skipAddingDeps) {\n dependencies = dependencies.filter((dep) => !jsonObj.devDependencies?.[dep]);\n if (dependencies.length) {\n spawnSync('yarn', ['add', ...new Set(dependencies)], config.dirPath);\n }\n devDependencies = devDependencies.filter((dep) => !jsonObj.dependencies?.[dep]);\n if (devDependencies.length) {\n spawnSync('yarn', ['add', '-D', ...new Set(devDependencies)], config.dirPath);\n }\n if (poetryDependencies.length) {\n spawnSync('poetry', ['add', ...new Set(poetryDependencies)], config.dirPath);\n }\n }\n}\n\nasync function removeDeprecatedStuff(jsonObj: any): Promise<void> {\n // TODO: remove the following migration code in future\n if (jsonObj.author === 'WillBooster LLC') {\n jsonObj.author = 'WillBooster Inc.';\n }\n delete jsonObj.scripts['sort-package-json'];\n delete jsonObj.scripts['sort-all-package-json'];\n delete jsonObj.scripts['typecheck:codegen'];\n delete jsonObj.dependencies['tslib'];\n delete jsonObj.devDependencies['@willbooster/eslint-config'];\n delete jsonObj.devDependencies['@willbooster/eslint-config-react'];\n delete jsonObj.devDependencies['@willbooster/tsconfig'];\n delete jsonObj.devDependencies['eslint-import-resolver-node'];\n delete jsonObj.devDependencies['eslint-plugin-prettier'];\n delete jsonObj.devDependencies['lerna'];\n // To install the latest pinst\n delete jsonObj.devDependencies['pinst'];\n delete jsonObj.scripts['flutter-format'];\n delete jsonObj.scripts['format-flutter'];\n delete jsonObj.scripts['python-format'];\n delete jsonObj.scripts['format-python'];\n delete jsonObj.scripts['prettier'];\n for (const deps of Object.values(devDeps)) {\n for (const dep of deps) {\n delete jsonObj.devDependencies[dep];\n }\n }\n await promisePool.run(() => fs.promises.rm('lerna.json', { force: true }));\n}\n\nfunction generateScripts(config: PackageConfig): Record<string, string> {\n let scripts = {\n cleanup: 'yarn format && yarn lint-fix',\n format: `sort-package-json && yarn prettify`,\n lint: `eslint --color \"./{${getSrcDirs(config)}}/**/*.{${extensions.eslint.join(',')}}\"`,\n 'lint-fix': 'yarn lint --fix',\n prettify: `prettier --color --write \"**/{.*/,}*.{${extensions.prettier.join(',')}}\" \"!**/test-fixtures/**\"`,\n typecheck: 'tsc --noEmit --Pretty',\n };\n if (config.containingSubPackageJsons) {\n scripts = merge(\n { ...scripts },\n {\n format: `sort-package-json && yarn prettify && yarn workspaces foreach --parallel --verbose run format`,\n lint: `yarn workspaces foreach --parallel --verbose run lint`,\n 'lint-fix': 'yarn workspaces foreach --parallel --verbose run lint-fix',\n prettify: `prettier --color --write \"**/{.*/,}*.{${extensions.prettier.join(\n ','\n )}}\" \"!**/packages/**\" \"!**/test-fixtures/**\"`,\n test: 'yarn workspaces foreach --verbose run test',\n typecheck: 'yarn workspaces foreach --parallel --verbose run typecheck',\n }\n );\n }\n if (config.depending.blitz) {\n scripts.typecheck = `${scripts.typecheck} || yarn run typecheck/warn`;\n (scripts as any)['typecheck/warn'] = `echo 'Please try \"yarn gen-code\" if you face unknown type errors.' && exit 1`;\n (scripts as any)['typecheck:gen-code'] = 'yarn gen-code && tsc --noEmit --Pretty';\n }\n return scripts;\n}\n\nasync function generatePrettierSuffix(dirPath: string): Promise<string> {\n const filePath = path.resolve(dirPath, '.prettierignore');\n const existingContent = await fs.promises.readFile(filePath, 'utf-8');\n const index = existingContent.indexOf(IgnoreFileUtil.separatorPrefix);\n if (index < 0) return '';\n\n const originalContent = existingContent.substring(0, index);\n const lines = originalContent\n .split('\\n')\n .map((line) => {\n const newLine = line.trim();\n return newLine.endsWith('/') ? newLine.slice(0, -1) : newLine;\n })\n .filter((l) => l && !l.startsWith('#') && !l.includes('/'));\n\n return lines.map((line) => ` \"!**/${line}/**\"`).join('');\n}\n", "import path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { IgnoreFileUtil } from '../utils/ignoreFileUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst defaultUserContent = `${IgnoreFileUtil.header}\n\n\n${IgnoreFileUtil.separator}\n`;\n\nconst commonContent = `\n3rd-party/\nandroid/\nios/\nno-format/\ntest-fixtures/\n*.d.ts\n*.min.js\n.yarn/\n.pnp.js\n`;\n\nexport async function generatePrettierignore(config: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.prettierignore');\n const userContent = (await IgnoreFileUtil.getUserContent(filePath)) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = (await IgnoreFileUtil.getExistingContent(gitignoreFilePath)) || '';\n\n let additionalContent = '';\n if (config.containingPubspecYaml) {\n additionalContent = `\nandroid/app/\nios/Runner/Assets.xcassets/\npubspec.yaml\n`;\n }\n\n const newContent = userContent + commonContent + additionalContent + gitignoreContent;\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nexport async function generateReleaserc(rootConfig: PackageConfig): Promise<void> {\n const filePath = path.resolve(rootConfig.dirPath, '.releaserc.json');\n try {\n const settings = JSON.parse(await fs.promises.readFile(filePath, 'utf8'));\n const plugins = settings?.plugins || [];\n for (let i = 0; i < plugins.length; i++) {\n const plugin = Array.isArray(plugins[i]) ? plugins[i][0] : plugins[i];\n if (plugin === '@semantic-release/commit-analyzer') {\n plugins[i] = [\n '@semantic-release/commit-analyzer',\n {\n preset: 'conventionalcommits',\n },\n ];\n } else if (plugin === '@semantic-release/github' && !rootConfig.publicRepo) {\n plugins[i] = ['@semantic-release/github', { successComment: false }];\n }\n }\n const newContent = JSON.stringify(settings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n } catch (_) {\n // do nothing\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { overwriteMerge } from '../utils/mergeUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst jsonObj = {\n extends: ['@willbooster'],\n};\n\nexport async function generateRenovateJson(config: PackageConfig): Promise<void> {\n let newSettings: any = cloneDeep(jsonObj);\n\n const filePath = path.resolve(config.dirPath, '.renovaterc.json');\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(oldContent) as any;\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, '.dependabot'), { force: true }));\n await promisePool.run(() => fs.promises.rm(path.resolve(config.dirPath, 'renovate.json'), { force: true }));\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { overwriteMerge } from '../utils/mergeUtil';\nimport { sortKeys } from '../utils/objectUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst rootJsonObj = {\n compilerOptions: {\n target: 'esnext',\n module: 'esnext',\n moduleResolution: 'node',\n jsx: 'react',\n alwaysStrict: true,\n strict: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n resolveJsonModule: true,\n sourceMap: true,\n importHelpers: false,\n outDir: 'dist',\n },\n include: [\n 'src/**/*',\n '__tests__/**/*',\n 'scripts/**/*',\n 'packages/*/src/**/*',\n 'packages/*/__tests__/**/*',\n 'packages/*/scripts/**/*',\n './node_modules/@types',\n './@types',\n ],\n};\n\nconst subJsonObj = {\n compilerOptions: {\n target: 'esnext',\n module: 'esnext',\n moduleResolution: 'node',\n jsx: 'react',\n alwaysStrict: true,\n strict: true,\n skipLibCheck: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n resolveJsonModule: true,\n sourceMap: true,\n importHelpers: false,\n outDir: 'dist',\n },\n include: ['src/**/*', '__tests__/**/*', 'scripts/**/*', '../../node_modules/@types', '../../@types', './@types'],\n};\n\nexport async function generateTsconfig(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n if (rootConfig.depending.blitz) return;\n\n let newSettings: any = cloneDeep(config.root ? rootJsonObj : subJsonObj);\n if (!config.containingJsxOrTsx && !config.containingJsxOrTsxInPackages) {\n delete newSettings.compilerOptions.jsx;\n }\n if (config.root && !config.containingSubPackageJsons) {\n newSettings.include = newSettings.include.filter((dirPath: string) => !dirPath.startsWith('packages/*/'));\n }\n if (!config.root && (config.depending.jestPlaywrightPreset || rootConfig.depending.jestPlaywrightPreset)) {\n const relativeDirPath = path.relative(config.dirPath, rootConfig.dirPath);\n newSettings.include.push(\n ...[\n path.join(relativeDirPath, 'node_modules/jest-playwright-preset/types'),\n path.join(relativeDirPath, 'node_modules/expect-playwright'),\n ]\n );\n }\n\n const filePath = path.resolve(config.dirPath, 'tsconfig.json');\n try {\n const existingContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = JSON.parse(existingContent);\n if (oldSettings.extends === './node_modules/@willbooster/tsconfig/tsconfig.json') {\n delete oldSettings.extends;\n }\n delete oldSettings.compilerOptions?.typeRoots;\n delete newSettings?.compilerOptions?.target;\n delete newSettings?.compilerOptions?.module;\n if (oldSettings.jsx) {\n delete newSettings.jsx;\n }\n if (config.depending.blitz) {\n delete newSettings.include;\n }\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n sortKeys(newSettings.compilerOptions);\n const newContent = JSON.stringify(newSettings);\n await promisePool.run(() => FsUtil.generateFile(filePath, newContent));\n}\n", "export function sortKeys(obj: any): void {\n const keyAndValues = Object.entries(obj).sort(([key1], [key2]) => key1.localeCompare(key2));\n for (const [key, value] of keyAndValues) {\n delete obj[key];\n obj[key] = value;\n }\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport merge from 'deepmerge';\nimport yaml from 'js-yaml';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { combineMerge } from '../utils/mergeUtil';\nimport { sortKeys } from '../utils/objectUtil';\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\n\nconst testWorkflow = {\n name: 'Test',\n on: {\n pull_request: null,\n push: {\n branches: ['main', 'wbfy', 'renovate/**'],\n },\n },\n jobs: {\n test: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/test.yml@main',\n },\n },\n};\n\nconst releaseWorkflow = {\n name: 'Release',\n on: {\n push: {\n branches: [],\n },\n },\n jobs: {\n release: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/release.yml@main',\n },\n },\n};\n\nconst wbfyWorkflow = {\n name: 'Willboosterify',\n on: {\n workflow_dispatch: null,\n },\n jobs: {\n wbfy: {\n uses: 'WillBooster/reusable-workflows/.github/workflows/wbfy.yml@main',\n },\n },\n};\n\nconst wbfyMergeWorkflow = {\n name: 'Merge wbfy',\n on: {\n workflow_dispatch: null,\n },\n jobs: {\n 'wbfy-merge': {\n uses: 'WillBooster/reusable-workflows/.github/workflows/wbfy-merge.yml@main',\n },\n },\n};\n\nconst semanticPullRequestWorkflow = {\n name: 'Lint PR title',\n on: {\n pull_request_target: {\n types: ['opened', 'edited', 'synchronize'],\n },\n },\n jobs: {\n 'semantic-pr': {\n uses: 'WillBooster/reusable-workflows/.github/workflows/semantic-pr.yml@main',\n },\n },\n};\n\ntype KnownKind = 'test' | 'release' | 'sync' | 'wbfy' | 'wbfy-merge' | 'semantic-pr';\n\nexport async function generateWorkflow(rootConfig: PackageConfig): Promise<void> {\n const workflowsPath = path.resolve(rootConfig.dirPath, '.github', 'workflows');\n await fs.promises.mkdir(workflowsPath, { recursive: true });\n\n // Remove config of semantic pull request\n const semanticYmlPath = path.resolve(rootConfig.dirPath, '.github', 'semantic.yml');\n void fs.promises.rm(semanticYmlPath, { force: true, recursive: true });\n\n const fileNames = (await fs.promises.readdir(workflowsPath, { withFileTypes: true }))\n .filter((dirent) => dirent.isFile() && dirent.name.endsWith('.yml'))\n .map((dirent) => dirent.name);\n if (rootConfig.depending.semanticRelease) {\n fileNames.push('release.yml');\n }\n fileNames.push('test.yml', 'wbfy.yml', 'wbfy-merge.yml', 'semantic-pr.yml');\n\n for (const fileName of fileNames) {\n const kind = path.basename(fileName, '.yml');\n await promisePool.run(() => writeWorkflowYaml(rootConfig, workflowsPath, kind));\n }\n}\n\nasync function writeYaml(newSettings: any, filePath: string): Promise<void> {\n const yamlText = yaml.dump(newSettings, {\n lineWidth: -1,\n noCompatMode: true,\n styles: {\n '!!null': 'empty',\n },\n });\n await promisePool.run(() => fs.promises.writeFile(filePath, yamlText));\n}\n\nasync function writeWorkflowYaml(\n config: PackageConfig,\n workflowsPath: string,\n kind: KnownKind | string\n): Promise<void> {\n let newSettings: any = {};\n if (kind === 'test') {\n newSettings = testWorkflow;\n } else if (kind === 'release') {\n newSettings = releaseWorkflow;\n } else if (kind === 'wbfy') {\n newSettings = wbfyWorkflow;\n } else if (kind === 'wbfy-merge') {\n newSettings = wbfyMergeWorkflow;\n } else if (kind === 'semantic-pr') {\n newSettings = semanticPullRequestWorkflow;\n }\n newSettings = cloneDeep(newSettings);\n\n const filePath = path.join(workflowsPath, `${kind}.yml`);\n try {\n const oldContent = await fs.promises.readFile(filePath, 'utf-8');\n const oldSettings = yaml.load(oldContent);\n newSettings = merge.all([newSettings, oldSettings, newSettings], { arrayMerge: combineMerge });\n } catch (e) {\n // do nothing\n }\n\n for (const job of Object.values(newSettings.jobs) as any[]) {\n // Ignore non-reusable workflows\n if (!job.uses?.includes?.('/reusable-workflows/')) return;\n\n normalizeJob(config, job, kind);\n }\n\n if (kind === 'release') {\n if (newSettings.on.schedule) {\n delete newSettings.on.push;\n } else {\n newSettings.on.push.branches = config.release.branches;\n }\n } else if (kind === 'wbfy') {\n setSchedule(newSettings, 20, 24);\n } else if (kind === 'wbfy-merge') {\n setSchedule(newSettings, 0, 4);\n }\n await writeYaml(newSettings, filePath);\n\n if (kind === 'release') {\n await promisePool.run(() => fs.promises.rm(path.join(workflowsPath, 'semantic-release.yml'), { force: true }));\n } else if (kind === 'sync') {\n await promisePool.run(() => fs.promises.rm(path.join(workflowsPath, 'sync-init.yml'), { force: true }));\n if (!newSettings.jobs.sync) return;\n\n newSettings.jobs['sync-force'] = newSettings.jobs.sync;\n const params = newSettings.jobs.sync.with.sync_params_without_dest;\n if (!params) return;\n\n newSettings.jobs.sync.with.sync_params_without_dest = `--force ${params}`;\n newSettings.name = 'Force to Sync';\n newSettings.on = { workflow_dispatch: null };\n delete newSettings.jobs.sync;\n await writeYaml(newSettings, path.join(workflowsPath, 'sync-force.yml'));\n }\n}\n\nfunction normalizeJob(config: PackageConfig, job: any, kind: KnownKind | string): void {\n job.with ||= {};\n job.secrets ||= {};\n\n if ((config.release.github && kind === 'test') || kind === 'release' || kind === 'wbfy' || kind === 'wbfy-merge') {\n if (config.publicRepo) {\n job.secrets['GH_TOKEN'] = '${{ secrets.PUBLIC_GH_BOT_PAT }}';\n } else {\n job.secrets['GH_TOKEN'] = '${{ secrets.GH_BOT_PAT }}';\n }\n }\n if (config.release.npm && (kind === 'release' || kind === 'test')) {\n job.secrets['NPM_TOKEN'] = '${{ secrets.NPM_TOKEN }}';\n }\n\n if (kind === 'sync') {\n const params = job.with?.sync_params_without_dest;\n if (params) {\n job.with.sync_params_without_dest = params.replace('sync ', '');\n }\n }\n\n if (config.repository?.startsWith('github:WillBooster/')) {\n job.uses = job.uses.replace('WillBoosterLab/', 'WillBooster/');\n } else if (config.repository?.startsWith('github:WillBoosterLab/')) {\n job.uses = job.uses.replace('WillBooster/', 'WillBoosterLab/');\n }\n\n delete job.with['non_self_hosted'];\n if (config.containingDockerfile && kind.startsWith('deploy')) {\n job.with['cpu_arch'] = 'X64';\n }\n if (Object.keys(job.with).length) {\n sortKeys(job.with);\n } else {\n delete job.with;\n }\n\n if (Object.keys(job.secrets).length) {\n sortKeys(job.secrets);\n } else {\n delete job.secrets;\n }\n}\n\nfunction setSchedule(newSettings: any, inclusiveMinHourJst: number, exclusiveMaxHourJst: number): void {\n const [minuteUtc, hourUtc] = ((newSettings.on.schedule?.[0]?.cron as string) ?? '').split(' ').map(Number);\n if (minuteUtc !== 0 && Number.isInteger(hourUtc)) {\n const hourJst = (hourUtc + 9) % 24;\n const inRange =\n inclusiveMinHourJst < exclusiveMaxHourJst\n ? inclusiveMinHourJst <= hourJst && hourJst < exclusiveMaxHourJst\n : inclusiveMinHourJst <= hourJst || hourJst < exclusiveMaxHourJst;\n if (inRange) return;\n }\n\n const minJst = 1 + Math.floor(Math.random() * 59);\n const hourJst = inclusiveMinHourJst + Math.floor(Math.random() * (exclusiveMaxHourJst - inclusiveMinHourJst));\n const cron = `${minJst} ${(hourJst - 9 + 24) % 24} * * *`;\n newSettings.on.schedule = [{ cron }];\n}\n", "import fs from 'fs';\nimport path from 'path';\n\nimport yaml from 'js-yaml';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { promisePool } from '../utils/promisePool';\nimport { spawnSync, spawnSyncWithStringResult } from '../utils/spawnUtil';\n\nexport async function generateYarnrcYml(config: PackageConfig): Promise<void> {\n const currentVersion = spawnSyncWithStringResult('yarn', ['--version'], config.dirPath);\n const latestVersion = spawnSyncWithStringResult('npm', ['show', '@yarnpkg/cli', 'version'], config.dirPath);\n if (currentVersion !== latestVersion) {\n spawnSync('yarn', ['set', 'version', latestVersion], config.dirPath, 1);\n }\n\n const releasesPath = path.join(config.dirPath, '.yarn', 'releases');\n await fs.promises.mkdir(releasesPath, { recursive: true });\n for (const file of await fs.promises.readdir(releasesPath)) {\n if (file.startsWith('yarn-') && !file.startsWith(`yarn-${latestVersion}.`)) {\n await promisePool.run(() => fs.promises.rm(path.join(releasesPath, file)));\n console.log('Removed', path.join(releasesPath, file));\n }\n }\n\n const yarnrcPath = path.resolve(config.dirPath, '.yarnrc');\n await promisePool.run(() => fs.promises.rm(yarnrcPath, { force: true }));\n\n const yarnrcYmlPath = path.resolve(config.dirPath, '.yarnrc.yml');\n const settings = yaml.load(await fs.promises.readFile(yarnrcYmlPath, 'utf8')) as any;\n settings.defaultSemverRangePrefix = '';\n if (config.requiringNodeModules) {\n settings.nodeLinker = 'node-modules';\n settings.nmMode = 'hardlinks-global';\n }\n await fs.promises.writeFile(yarnrcYmlPath, yaml.dump(settings, { lineWidth: -1 }));\n\n const plugins = (settings.plugins || []).map((p: any) => p.spec as string);\n const requireTypeScript = config.containingTypeScript || config.containingTypeScriptInPackages;\n importOrRemovePlugin(config, plugins, requireTypeScript, '@yarnpkg/plugin-typescript');\n if (requireTypeScript && !config.requiringNodeModules) {\n spawnSync('yarn', ['dlx', '@yarnpkg/sdks', 'vscode'], config.dirPath);\n }\n importOrRemovePlugin(config, plugins, config.containingSubPackageJsons, '@yarnpkg/plugin-workspace-tools');\n spawnSync('yarn', ['dlx', 'yarn-plugin-auto-install'], config.dirPath);\n}\n\nfunction importOrRemovePlugin(config: PackageConfig, plugins: string[], requirePlugin: boolean, plugin: string): void {\n if (requirePlugin !== plugins.includes(plugin)) {\n spawnSync('yarn', ['plugin', requirePlugin ? 'import' : 'remove', plugin], config.dirPath);\n }\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\nimport path from 'path';\n\nimport glob from 'glob';\nimport yaml from 'js-yaml';\nimport simpleGit from 'simple-git';\n\nimport { fetchOnNode } from './fetchOnNode';\n\nexport interface PackageConfig {\n dirPath: string;\n root: boolean;\n publicRepo: boolean;\n repository?: string;\n willBoosterConfigs: boolean;\n containingSubPackageJsons: boolean;\n containingDockerfile: boolean;\n containingGemfile: boolean;\n containingGoMod: boolean;\n containingPackageJson: boolean;\n containingPoetryLock: boolean;\n containingPomXml: boolean;\n containingPubspecYaml: boolean;\n containingTemplateYaml: boolean;\n\n containingJavaScript: boolean;\n containingTypeScript: boolean;\n containingJsxOrTsx: boolean;\n containingJavaScriptInPackages: boolean;\n containingTypeScriptInPackages: boolean;\n containingJsxOrTsxInPackages: boolean;\n depending: {\n blitz: boolean;\n firebase: boolean;\n jestPlaywrightPreset: boolean;\n prisma: boolean;\n reactNative: boolean;\n semanticRelease: boolean;\n storybook: boolean;\n };\n release: {\n branches: string[];\n github: boolean;\n npm: boolean;\n };\n eslintBase?: string;\n requiringNodeModules: boolean;\n versionsText?: string;\n}\n\nexport async function getPackageConfig(dirPath: string): Promise<PackageConfig | null> {\n const packageJsonPath = path.resolve(dirPath, 'package.json');\n try {\n const containingPackageJson = fs.existsSync(packageJsonPath);\n let dependencies: { [key: string]: string } = {};\n let devDependencies: { [key: string]: string } = {};\n let packageJson: any = {};\n if (containingPackageJson) {\n const packageJsonText = fs.readFileSync(packageJsonPath, 'utf-8');\n packageJson = JSON.parse(packageJsonText);\n dependencies = packageJson.dependencies ?? {};\n devDependencies = packageJson.devDependencies ?? {};\n }\n\n let requiringNodeModules = true;\n try {\n const yarnrcYmlPath = path.resolve(dirPath, '.yarnrc.yml');\n const doc = yaml.load(await fsp.readFile(yarnrcYmlPath, 'utf8')) as any;\n requiringNodeModules = !doc.nodeLinker || doc.nodeLinker === 'node-modules';\n } catch (_) {\n // do nothing\n }\n\n let releaseBranches: string[] = [];\n let releasePlugins: string[] = [];\n try {\n const releasercJsonPath = path.resolve(dirPath, '.releaserc.json');\n const json = JSON.parse(await fsp.readFile(releasercJsonPath, 'utf8'));\n releaseBranches = json?.branches || [];\n releasePlugins = json?.plugins?.flat() || [];\n } catch (_) {\n // do nothing\n }\n\n const isRoot =\n path.basename(path.resolve(dirPath, '..')) !== 'packages' ||\n !fs.existsSync(path.resolve(dirPath, '..', '..', 'package.json'));\n\n let repoInfo: Record<string, any> | undefined;\n if (isRoot) {\n repoInfo = await getRepoInfo(dirPath, packageJson);\n }\n\n const toolVersionsPath = path.resolve(dirPath, '.tool-versions');\n let versionsText: string | undefined;\n try {\n versionsText = await fsp.readFile(toolVersionsPath, 'utf-8');\n } catch (_) {\n // do nothing\n }\n\n const config: PackageConfig = {\n dirPath,\n root: isRoot,\n publicRepo: repoInfo?.private === false,\n repository: repoInfo?.full_name ? `github:${repoInfo?.full_name}` : undefined,\n willBoosterConfigs: packageJsonPath.includes(`${path.sep}willbooster-configs`),\n containingSubPackageJsons: glob.sync('packages/**/package.json', { cwd: dirPath }).length > 0,\n containingDockerfile:\n fs.existsSync(path.resolve(dirPath, 'Dockerfile')) ||\n fs.existsSync(path.resolve(dirPath, 'docker-compose.yml')),\n containingGemfile: fs.existsSync(path.resolve(dirPath, 'Gemfile')),\n containingGoMod: fs.existsSync(path.resolve(dirPath, 'go.mod')),\n containingPackageJson: fs.existsSync(path.resolve(dirPath, 'package.json')),\n containingPoetryLock: fs.existsSync(path.resolve(dirPath, 'poetry.lock')),\n containingPomXml: fs.existsSync(path.resolve(dirPath, 'pom.xml')),\n containingPubspecYaml: fs.existsSync(path.resolve(dirPath, 'pubspec.yaml')),\n containingTemplateYaml: fs.existsSync(path.resolve(dirPath, 'template.yaml')),\n containingJavaScript: glob.sync('@(app|src|__tests__|scripts)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScript: glob.sync('@(app|src|__tests__|scripts)/**/*.ts?(x)', { cwd: dirPath }).length > 0,\n containingJsxOrTsx: glob.sync('@(app|src|__tests__)/**/*.{t,j}sx', { cwd: dirPath }).length > 0,\n containingJavaScriptInPackages:\n glob.sync('packages/**/@(app|src|__tests__|scripts)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScriptInPackages:\n glob.sync('packages/**/@(app|src|__tests__|scripts)/**/*.ts?(x)', { cwd: dirPath }).length > 0,\n containingJsxOrTsxInPackages:\n glob.sync('packages/**/@(app|src|__tests__)/**/*.{t,j}sx', { cwd: dirPath }).length > 0,\n depending: {\n blitz: !!(dependencies['blitz'] || devDependencies['blitz']),\n firebase: !!devDependencies['firebase-tools'],\n jestPlaywrightPreset: !!devDependencies['jest-playwright-preset'],\n prisma: !!devDependencies['prisma'],\n reactNative: !!dependencies['react-native'],\n semanticRelease: !!devDependencies['semantic-release'],\n storybook: !!devDependencies['@storybook/react'],\n },\n release: {\n branches: releaseBranches,\n github: releasePlugins.includes('@semantic-release/github'),\n npm: releasePlugins.includes('@semantic-release/npm'),\n },\n requiringNodeModules,\n versionsText,\n };\n config.eslintBase = getEslintExtensionBase(config);\n if (\n config.containingGemfile ||\n config.containingGoMod ||\n config.containingPackageJson ||\n config.containingPoetryLock ||\n config.containingPomXml ||\n config.containingPubspecYaml ||\n config.containingTemplateYaml\n ) {\n return config;\n }\n } catch (e) {\n // do nothing\n }\n return null;\n}\n\nfunction getEslintExtensionBase(config: PackageConfig): string | undefined {\n if (config.containingTypeScript) {\n if (config.containingJsxOrTsx) {\n return '@willbooster/eslint-config-ts-react';\n } else {\n return '@willbooster/eslint-config-ts';\n }\n } else {\n if (config.containingJsxOrTsx) {\n return '@willbooster/eslint-config-js-react';\n } else if (config.containingJavaScript) {\n return '@willbooster/eslint-config-js';\n }\n }\n return undefined;\n}\n\nasync function getRepoInfo(dirPath: string, packageJson: any): Promise<Record<string, any> | undefined> {\n const git = simpleGit(dirPath);\n const remotes = await git.getRemotes(true);\n const origin = remotes.find((r) => r.name === 'origin');\n const remoteUrl = origin?.refs?.fetch ?? origin?.refs?.push;\n if (typeof remoteUrl === 'string') {\n const json = await fetchRepoInfo(remoteUrl);\n if (json) return json;\n }\n\n const url = packageJson.repository?.url ?? packageJson.repository;\n if (typeof url === 'string') {\n const json = await fetchRepoInfo(url);\n if (json && json.message !== 'Not Found') return json;\n }\n}\n\nasync function fetchRepoInfo(urlOrFullName: string): Promise<Record<string, any> | undefined> {\n const urlWithoutProtocol = urlOrFullName.split(':').at(-1);\n const names = urlWithoutProtocol?.split('/');\n const org = names?.at(-2);\n const name = names?.at(-1)?.replace(/.git$/, '');\n if (!org || !name) return;\n\n const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;\n const opts = token\n ? {\n headers: {\n Authorization: `token ${token}`,\n },\n }\n : undefined;\n const res = await fetchOnNode(`https://api.github.com/repos/${org}/${name}`, opts);\n const json = (await res.json()) as any;\n return { full_name: `${org}/${name}`, ...(json ?? {}) };\n}\n"],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AwB,EAAO,iCACxC,EAAS,KAAK,GAAiB,EAAQ,CAAU,CAAC,EAGlD,GAAO,sBACP,EAAO,gCACP,EAAO,sBACP,EAAO,iCAEF,GAAW,oBACd,EAAS,KAAK,GAAiB,EAAQ,CAAU,CAAC,EAEpD,EAAS,KAAK,GAAqB,CAAM,CAAC,IAG9C,KAAM,SAAQ,IAAI,CAAQ,EAC1B,KAAM,GAAY,WAAW,EAE7B,EAAU,OAAQ,CAAC,SAAS,EAAG,CAAW,EAG1C,EAAU,OAAQ,CAAC,SAAS,EAAG,CAAW,CAC5C,CACF,CAEA,GAAK,EAAE,KAAK",
|
6
6
|
"names": []
|
7
7
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wbfy",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.33.0",
|
4
4
|
"description": "A tool for applying WillBooster's conventional configures to npm packages",
|
5
5
|
"repository": "github:WillBooster/wbfy",
|
6
6
|
"license": "Apache-2.0",
|
@@ -36,29 +36,29 @@
|
|
36
36
|
"js-yaml": "4.1.0",
|
37
37
|
"lodash.clonedeep": "4.5.0",
|
38
38
|
"minimal-promise-pool": "1.1.4",
|
39
|
-
"node-fetch": "3.2.
|
39
|
+
"node-fetch": "3.2.6",
|
40
40
|
"simple-git": "3.7.1",
|
41
41
|
"yargs": "17.5.1"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
44
|
"@types/eslint": "8.4.3",
|
45
45
|
"@types/glob": "7.2.0",
|
46
|
-
"@types/jest": "28.1.
|
46
|
+
"@types/jest": "28.1.2",
|
47
47
|
"@types/js-yaml": "4.0.5",
|
48
48
|
"@types/lodash.clonedeep": "4.5.7",
|
49
49
|
"@types/micromatch": "4.0.2",
|
50
|
-
"@types/node": "16.11.
|
50
|
+
"@types/node": "16.11.41",
|
51
51
|
"@types/node-fetch": "3.0.3",
|
52
52
|
"@types/yargs": "17.0.10",
|
53
|
-
"@typescript-eslint/eslint-plugin": "5.
|
54
|
-
"@typescript-eslint/parser": "5.
|
53
|
+
"@typescript-eslint/eslint-plugin": "5.29.0",
|
54
|
+
"@typescript-eslint/parser": "5.29.0",
|
55
55
|
"@willbooster/eslint-config-ts": "9.0.0",
|
56
56
|
"@willbooster/prettier-config": "9.0.0",
|
57
57
|
"@willbooster/renovate-config": "9.3.0",
|
58
58
|
"conventional-changelog-conventionalcommits": "5.0.0",
|
59
|
-
"esbuild": "0.14.
|
59
|
+
"esbuild": "0.14.45",
|
60
60
|
"esbuild-register": "3.3.3",
|
61
|
-
"eslint": "8.
|
61
|
+
"eslint": "8.18.0",
|
62
62
|
"eslint-config-prettier": "8.5.0",
|
63
63
|
"eslint-import-resolver-typescript": "2.7.1",
|
64
64
|
"eslint-plugin-import": "2.26.0",
|
@@ -66,15 +66,15 @@
|
|
66
66
|
"eslint-plugin-sort-destructure-keys": "1.4.0",
|
67
67
|
"husky": "8.0.1",
|
68
68
|
"jest": "28.1.1",
|
69
|
-
"lint-staged": "13.0.
|
69
|
+
"lint-staged": "13.0.2",
|
70
70
|
"micromatch": "4.0.5",
|
71
71
|
"pinst": "3.0.0",
|
72
|
-
"prettier": "2.
|
73
|
-
"semantic-release": "19.0.
|
72
|
+
"prettier": "2.7.1",
|
73
|
+
"semantic-release": "19.0.3",
|
74
74
|
"sort-package-json": "1.57.0",
|
75
|
-
"typescript": "4.7.
|
75
|
+
"typescript": "4.7.4"
|
76
76
|
},
|
77
|
-
"packageManager": "yarn@4.0.0-rc.
|
77
|
+
"packageManager": "yarn@4.0.0-rc.9",
|
78
78
|
"engines": {
|
79
79
|
"node": ">=16.6.0"
|
80
80
|
}
|