wbfy 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +19 -0
- package/bin/index.cjs +3 -0
- package/dist/index.min.cjs +248 -0
- package/dist/index.min.cjs.map +7 -0
- package/package.json +75 -0
package/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# wbfy
|
2
|
+
|
3
|
+
:books::rocket: A tool for applying WillBooster's conventional configurations to npm packages
|
4
|
+
|
5
|
+
[](https://circleci.com/gh/WillBooster/willboosterify)
|
6
|
+
[](https://github.com/semantic-release/semantic-release)
|
7
|
+
|
8
|
+
## Motivation
|
9
|
+
|
10
|
+
There are some resources for creating a project with conventional configurations like [Yeoman](https://yeoman.io/), GitHub's Template repository, and starter-kit repositories.
|
11
|
+
However, we sometimes faced the cases where we wanted to apply conventional configurations to an existing repository, so we've launch this tool!
|
12
|
+
|
13
|
+
## Philosophy
|
14
|
+
|
15
|
+
This tool must keep idempotency, i.e., it always yields the same result when a user applies this tool to a project even multiple times.
|
16
|
+
|
17
|
+
## How to Use
|
18
|
+
|
19
|
+
1. `yarn dlx wbfy <project directory>`
|
package/bin/index.cjs
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
var rt=Object.create;var T=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames,re=Object.getOwnPropertySymbols,lt=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var ae=(e,n,t)=>n in e?T(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,R=(e,n)=>{for(var t in n||(n={}))se.call(n,t)&&ae(e,t,n[t]);if(re)for(var t of re(n))ct.call(n,t)&&ae(e,t,n[t]);return e};var pt=e=>T(e,"__esModule",{value:!0});var mt=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of at(n))!se.call(e,r)&&(t||r!=="default")&&T(e,r,{get:()=>n[r],enumerable:!(i=st(n,r))||i.enumerable});return e},s=(e,n)=>mt(pt(T(e!=null?rt(lt(e)):{},"default",!n&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var nt=s(require("path")),it=s(require("glob")),ot=s(require("yargs"));var j=s(require("fs/promises")),B=s(require("path"));async function le(e){try{let n=B.default.resolve(e.dirPath,".tool-versions"),t=await j.default.readFile(n,"utf-8"),i=[],r=[];for(let o of t.split(`
|
2
|
+
`)){let a=o.trim();if(!a.startsWith("nodejs")){i.push(a);continue}let[,p]=a.split(/\s+/);r.push(j.default.writeFile(B.default.resolve(e.dirPath,".node-version"),p))}i.length?r.push(j.default.writeFile(n,i.join(`
|
3
|
+
`))):r.push(j.default.rm(n,{force:!0})),await Promise.all(r)}catch{}}var pe=s(require("path"));var f={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 ce=s(require("fs/promises")),m={async generateFile(e,n){await ce.default.writeFile(e,n),console.log(`Generated ${e}`)}};var gt=`root = true
|
4
|
+
|
5
|
+
[*]
|
6
|
+
charset = utf-8
|
7
|
+
end_of_line = lf
|
8
|
+
insert_final_newline = true
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
|
11
|
+
${O(f.codeWith2IndentSize)}
|
12
|
+
indent_size = 2
|
13
|
+
indent_style = space
|
14
|
+
|
15
|
+
${O(f.codeWith4IndentSize)}
|
16
|
+
indent_size = 4
|
17
|
+
indent_style = space
|
18
|
+
|
19
|
+
${O(f.codeWith8IndentSize)}
|
20
|
+
indent_size = 8
|
21
|
+
indent_style = space
|
22
|
+
|
23
|
+
${O(f.markdownLike)}
|
24
|
+
max_line_length = off
|
25
|
+
trim_trailing_whitespace = false
|
26
|
+
|
27
|
+
[{Makefile,*.mk}]
|
28
|
+
indent_style = tab
|
29
|
+
`;async function me(e){let n=pe.default.resolve(e.dirPath,".editorconfig");await m.generateFile(n,gt)}function O(e){return e.length>1?`[*.{${e.join(",")}}]`:`[*.${e[0]}]`}var U=s(require("path"));var w=s(require("fs")),g={header:"# Project-specific settings",separator:"# Generated by @willbooster/willboosterify",separatorPrefix:"# Generated by @willbooster",getExistingContent(e){return w.default.existsSync(e)?w.default.readFileSync(e).toString().replace(/# Project-specific settings[^\n]*\n/m,"").replace(/# Generated by[^\n]*\n/m,"").replace(/\r?\n\r?\n(\r?\n)+/gm,`
|
30
|
+
|
31
|
+
`):null},getUserContent(e){if(w.default.existsSync(e)){let n=w.default.readFileSync(e,"utf-8"),t=n.indexOf(this.separatorPrefix);if(t>=0)return n.substr(0,n.indexOf(`
|
32
|
+
`,t)+1)}return null},isBerryZeroInstallEnabled(e){return w.default.existsSync(e)?w.default.readFileSync(e,"utf-8").includes(`
|
33
|
+
!.yarn/cache`):!1}};var ft=`${g.header}
|
34
|
+
|
35
|
+
|
36
|
+
${g.separator}
|
37
|
+
`,dt=`
|
38
|
+
3rd-party/
|
39
|
+
@types/
|
40
|
+
__generated__/
|
41
|
+
android/
|
42
|
+
ios/
|
43
|
+
no-format/
|
44
|
+
test-fixtures/
|
45
|
+
*.config.js
|
46
|
+
*.d.ts
|
47
|
+
*.min.js
|
48
|
+
.yarn/
|
49
|
+
.pnp.js
|
50
|
+
`;async function ge(e){let n=U.default.resolve(e.dirPath,".eslintignore"),t=g.getUserContent(n)||ft,i=U.default.resolve(e.dirPath,".gitignore"),r=g.getExistingContent(i)||"";await m.generateFile(n,t+dt+r)}var ue=s(require("fs")),ye=s(require("fs/promises")),he=s(require("path")),ve=s(require("deepmerge"));var fe=s(require("deepmerge"));function J(e,n){return n}function de(e,n,t){let i=e.slice();return n.forEach((r,o)=>{typeof i[o]=="undefined"?i[o]=t.cloneUnlessOtherwiseSpecified(r,t):t.isMergeableObject(r)?i[o]=(0,fe.default)(e[o],r,t):e.indexOf(r)===-1&&i.push(r)}),i}async function Pe(e,n){let t=[];e.eslintBase&&t.push(e.eslintBase),e!==n&&t.push("../../.eslintrc.json");let i={root:!0,extends:t},r=he.default.resolve(e.dirPath,".eslintrc.json");if(ue.default.existsSync(r)){let o=await ye.default.readFile(r,"utf-8");try{let a=JSON.parse(o);a.extends&&(a.extends=a.extends.filter(l=>!l.startsWith("@willbooster/")&&l!=="../../.eslintrc.json")),t.length||(a.extends=[]);let p=i.extends;i.extends=a.extends,a.extends=p,i=ve.default.all([i,a,i],{arrayMerge:de})}catch{}}await m.generateFile(r,JSON.stringify(i))}var ke=s(require("path"));var ut=`* text=auto
|
51
|
+
|
52
|
+
*.vcproj text eol=crlf
|
53
|
+
|
54
|
+
${f.codeWith2IndentSize.concat(f.codeWith4IndentSize).concat(f.markdownLike).map(e=>`*.${e} text eol=lf`).join(`
|
55
|
+
`)}
|
56
|
+
`;async function xe(e){let n=ke.default.resolve(e.dirPath,".gitattributes");await m.generateFile(n,ut)}var L=s(require("path"));async function we(e,n){let{default:t}=await import("node-fetch");return t(e,n)}var yt=["windows","macos","linux","jetbrains","visualstudiocode","emacs","vim","yarn"],ht=`${g.header}
|
57
|
+
|
58
|
+
|
59
|
+
${g.separator}
|
60
|
+
`,vt=`
|
61
|
+
.devcontainer/
|
62
|
+
dist/
|
63
|
+
temp/
|
64
|
+
Icon[\r]
|
65
|
+
`;async function be(e,n){let t=L.default.resolve(e.dirPath,".gitignore"),i=(g.getUserContent(t)||ht)+vt,r=[...yt];e.containingGemfile&&r.push("ruby"),e.containingGoMod&&(r.push("go"),i+=`${L.default.basename(e.dirPath)}
|
66
|
+
`),e.containingPackageJson&&r.push("node"),e.containingPomXml&&(r.push("maven"),i+=`.idea/google-java-format.xml
|
67
|
+
`),e.containingPubspecYaml&&(r.push("flutter","AndroidStudio","ruby"),i+=`.flutter-plugins-dependencies
|
68
|
+
android/key.properties
|
69
|
+
ios/.bundle
|
70
|
+
.idea/runConfigurations.xml
|
71
|
+
`),e.containingTemplateYaml&&(i+=`.aws-sam/
|
72
|
+
packaged.yaml
|
73
|
+
`),e.containingPoetryLock&&r.push("python"),(n.depending.firebase||e.depending.firebase)&&r.push("firebase"),(n.depending.reactNative||e.depending.reactNative)&&(r.push("reactnative"),i+=`google-services.json
|
74
|
+
android/app/src/main/assets/
|
75
|
+
`);let o=(await Promise.all(r.map(async a=>await(await we(`https://www.toptal.com/developers/gitignore/api/${a}`)).text()))).join("");g.isBerryZeroInstallEnabled(t)||(o=o.replace("!.yarn/cache","# !.yarn/cache").replace("# .pnp.*",".pnp.*")),(e.containingPomXml||e.containingPubspecYaml)&&(o=o.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&&(o=o.replace(/^.idea\/modules.xml$/gm,"# .idea/modules.xml"))),o=o.replace(/^.idea\/?$/gm,"# .idea"),(n.depending.reactNative||e.depending.reactNative||e.containingPubspecYaml)&&(o=o.replace(/^(.idea\/.+)$/gm,`$1
|
76
|
+
android/$1`)),await m.generateFile(t,i+o)}var k=s(require("fs/promises")),b=s(require("path"));var Y=s(require("child_process"));function u(e,n,t){let[i,r]=Se(e,n,t);console.log(`$ ${i} at ${r.cwd}`),Y.default.spawnSync(i,r)}function z(e,n,t){let[i,r]=Se(e,n,t);return r.stdio="pipe",Y.default.spawnSync(i,r).stdout.toString().trim()}function Se(e,n,t){let i=R({},process.env);i.PATH&&i.BERRY_BIN_FOLDER&&(i.PATH=i.PATH.replace(`${i.BERRY_BIN_FOLDER}:`,""));let r=`${e} ${n.join(" ")}`;return i.ASDF_DIR&&(r=`bash -l -c '. ${i.ASDF_DIR}/asdf.sh && ${r}'`),[r,{cwd:t,env:i,shell:!0,stdio:"inherit"}]}var G="npm test",A={preCommit:"yarn lint-staged",prePush:"yarn typecheck",postMerge:"yarn"};async function je(e){let n=b.default.resolve(e.dirPath,"package.json"),t=await k.default.readFile(n,"utf-8"),i=JSON.parse(t);i.scripts||(i.scripts={}),delete i.scripts.postinstall,delete i.scripts.postpublish,delete i.scripts.prepare,delete i.scripts.prepublishOnly;let r=b.default.resolve(e.dirPath,".husky");await Promise.all([k.default.writeFile(n,JSON.stringify(i,void 0,2)),k.default.rm(r,{force:!0,recursive:!0})]),u("yarn",["dlx","husky-init","--yarn2"],e.dirPath);let o=b.default.resolve(r,"pre-commit"),a=await k.default.readFile(o,"utf-8"),p=[k.default.rm(b.default.resolve(e.dirPath,".huskyrc.json"),{force:!0}),k.default.writeFile(o,a.replace(G,A.preCommit))];(e.containingTypeScript||e.containingTypeScriptInPackages)&&p.push(k.default.writeFile(b.default.resolve(r,"pre-push"),a.replace(G,A.prePush),{mode:493}));let l=a.replace(G,A.postMerge).trim();e.depending.blitz?l+=" && yarn blitz codegen":e.depending.prisma&&(l+=" && yarn prisma generate"),l+=`
|
77
|
+
`,p.push(k.default.writeFile(b.default.resolve(r,"post-merge"),l,{mode:493})),await Promise.all(p)}var Fe=s(require("fs")),Ce=s(require("fs/promises")),H=s(require("path"));var Pt=`<?xml version="1.0" encoding="UTF-8"?>
|
78
|
+
<project version="4">
|
79
|
+
<component name="ProjectTasksOptions">
|
80
|
+
<TaskOptions isEnabled="true">
|
81
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
82
|
+
<option name="checkSyntaxErrors" value="false" />
|
83
|
+
<option name="description" />
|
84
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
85
|
+
<option name="fileExtension" value="ts" />
|
86
|
+
<option name="immediateSync" value="false" />
|
87
|
+
<option name="name" value="Prettier (.ts)" />
|
88
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
89
|
+
<option name="outputFilters">
|
90
|
+
<array />
|
91
|
+
</option>
|
92
|
+
<option name="outputFromStdout" value="false" />
|
93
|
+
<option name="program" value="yarn" />
|
94
|
+
<option name="runOnExternalChanges" value="false" />
|
95
|
+
<option name="scopeName" value="Project Files" />
|
96
|
+
<option name="trackOnlyRoot" value="false" />
|
97
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
98
|
+
<envs />
|
99
|
+
</TaskOptions>
|
100
|
+
<TaskOptions isEnabled="true">
|
101
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
102
|
+
<option name="checkSyntaxErrors" value="false" />
|
103
|
+
<option name="description" />
|
104
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
105
|
+
<option name="fileExtension" value="tsx" />
|
106
|
+
<option name="immediateSync" value="false" />
|
107
|
+
<option name="name" value="Prettier (.tsx)" />
|
108
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
109
|
+
<option name="outputFilters">
|
110
|
+
<array />
|
111
|
+
</option>
|
112
|
+
<option name="outputFromStdout" value="false" />
|
113
|
+
<option name="program" value="yarn" />
|
114
|
+
<option name="runOnExternalChanges" value="false" />
|
115
|
+
<option name="scopeName" value="Project Files" />
|
116
|
+
<option name="trackOnlyRoot" value="false" />
|
117
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
118
|
+
<envs />
|
119
|
+
</TaskOptions>
|
120
|
+
<TaskOptions isEnabled="true">
|
121
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
122
|
+
<option name="checkSyntaxErrors" value="false" />
|
123
|
+
<option name="description" />
|
124
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
125
|
+
<option name="fileExtension" value="js" />
|
126
|
+
<option name="immediateSync" value="false" />
|
127
|
+
<option name="name" value="Prettier (.js)" />
|
128
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
129
|
+
<option name="outputFilters">
|
130
|
+
<array />
|
131
|
+
</option>
|
132
|
+
<option name="outputFromStdout" value="false" />
|
133
|
+
<option name="program" value="yarn" />
|
134
|
+
<option name="runOnExternalChanges" value="false" />
|
135
|
+
<option name="scopeName" value="Project Files" />
|
136
|
+
<option name="trackOnlyRoot" value="false" />
|
137
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
138
|
+
<envs />
|
139
|
+
</TaskOptions>
|
140
|
+
<TaskOptions isEnabled="true">
|
141
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
142
|
+
<option name="checkSyntaxErrors" value="false" />
|
143
|
+
<option name="description" />
|
144
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
145
|
+
<option name="fileExtension" value="json" />
|
146
|
+
<option name="immediateSync" value="false" />
|
147
|
+
<option name="name" value="Prettier (.json)" />
|
148
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
149
|
+
<option name="outputFilters">
|
150
|
+
<array />
|
151
|
+
</option>
|
152
|
+
<option name="outputFromStdout" value="false" />
|
153
|
+
<option name="program" value="yarn" />
|
154
|
+
<option name="runOnExternalChanges" value="false" />
|
155
|
+
<option name="scopeName" value="Project Files" />
|
156
|
+
<option name="trackOnlyRoot" value="false" />
|
157
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
158
|
+
<envs />
|
159
|
+
</TaskOptions>
|
160
|
+
<TaskOptions isEnabled="true">
|
161
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
162
|
+
<option name="checkSyntaxErrors" value="false" />
|
163
|
+
<option name="description" />
|
164
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
165
|
+
<option name="fileExtension" value="md" />
|
166
|
+
<option name="immediateSync" value="false" />
|
167
|
+
<option name="name" value="Prettier (.md)" />
|
168
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
169
|
+
<option name="outputFilters">
|
170
|
+
<array />
|
171
|
+
</option>
|
172
|
+
<option name="outputFromStdout" value="false" />
|
173
|
+
<option name="program" value="yarn" />
|
174
|
+
<option name="runOnExternalChanges" value="false" />
|
175
|
+
<option name="scopeName" value="Project Files" />
|
176
|
+
<option name="trackOnlyRoot" value="false" />
|
177
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
178
|
+
<envs />
|
179
|
+
</TaskOptions>
|
180
|
+
<TaskOptions isEnabled="true">
|
181
|
+
<option name="arguments" value="prettier --write $FilePathRelativeToProjectRoot$" />
|
182
|
+
<option name="checkSyntaxErrors" value="false" />
|
183
|
+
<option name="description" />
|
184
|
+
<option name="exitCodeBehavior" value="ERROR" />
|
185
|
+
<option name="fileExtension" value="html" />
|
186
|
+
<option name="immediateSync" value="false" />
|
187
|
+
<option name="name" value="Prettier (.html)" />
|
188
|
+
<option name="output" value="$FilePathRelativeToProjectRoot$" />
|
189
|
+
<option name="outputFilters">
|
190
|
+
<array />
|
191
|
+
</option>
|
192
|
+
<option name="outputFromStdout" value="false" />
|
193
|
+
<option name="program" value="yarn" />
|
194
|
+
<option name="runOnExternalChanges" value="false" />
|
195
|
+
<option name="scopeName" value="Project Files" />
|
196
|
+
<option name="trackOnlyRoot" value="false" />
|
197
|
+
<option name="workingDir" value="$ProjectFileDir$" />
|
198
|
+
<envs />
|
199
|
+
</TaskOptions>
|
200
|
+
</component>
|
201
|
+
</project>
|
202
|
+
`;async function $e(e){let n=H.default.resolve(e.dirPath,".idea");if(Fe.default.existsSync(n)){let t=H.default.resolve(n,"watcherTasks.xml");e.containingJavaScript||e.containingJavaScriptInPackages||e.containingTypeScript||e.containingTypeScriptInPackages||e.containingPackageJson&&!e.containingPubspecYaml&&!e.containingGemfile&&!e.containingGoMod&&!e.containingPomXml?await m.generateFile(t,Pt):await Ce.default.rm(t,{force:!0})}}var q=s(require("fs/promises")),D=s(require("path"));var E={getLintFixSuffix(e){return e.containingJsxOrTsx?' --rule "{ react-hooks/exhaustive-deps: 0 }"':""}};var _e=`./{src,__tests__}/**/*.{${f.eslint.join(",")}}`,kt=`files = micromatch.not(files, '${_e}');`;async function K(e){let n=[];if(e.containingJavaScript||e.containingTypeScript){let o=`
|
203
|
+
'${_e}': [${JSON.stringify(`eslint --fix${E.getLintFixSuffix(e)}`)}, 'prettier --write'],`;n.push(o)}let t=e.root?" && !file.includes('/packages/')":"";n.push(`
|
204
|
+
'./**/*.{${f.prettier.join(",")}}': files => {
|
205
|
+
${e.containingJavaScript||e.containingTypeScript?kt:""}
|
206
|
+
const filteredFiles = files.filter(file => !file.includes('/test-fixtures/')${t});
|
207
|
+
if (filteredFiles.length === 0) return [];
|
208
|
+
const commands = [\`prettier --write \${filteredFiles.join(' ')}\`];
|
209
|
+
if (filteredFiles.some(file => file.endsWith('package.json'))) {
|
210
|
+
commands.push('yarn sort-package-json');
|
211
|
+
}
|
212
|
+
return commands;
|
213
|
+
},`),e.containingPubspecYaml&&n.push(`
|
214
|
+
'./{lib,test,test_driver}/**/*.dart': files => {
|
215
|
+
const filteredFiles = files.filter(file => !file.includes('generated'))
|
216
|
+
.filter(file => !file.endsWith('.freezed.dart') && !file.endsWith('.g.dart'));
|
217
|
+
if (filteredFiles.length === 0) return [];
|
218
|
+
return [\`flutter format \${filteredFiles.join(' ')}\`];
|
219
|
+
},`),e.containingPoetryLock&&n.push(`
|
220
|
+
'./**/*.py': [
|
221
|
+
'poetry run isort --profile black --filter-files',
|
222
|
+
'poetry run black',
|
223
|
+
'poetry run flake8'
|
224
|
+
],`);let i=`${e.containingJavaScript||e.containingTypeScript?"const micromatch = require('micromatch');":""}
|
225
|
+
|
226
|
+
module.exports = {${n.join("")}
|
227
|
+
};
|
228
|
+
`,r=D.default.resolve(e.dirPath,".lintstagedrc.cjs");await Promise.all([q.default.rm(D.default.resolve(e.dirPath,".lintstagedrc.js"),{force:!0}),q.default.rm(D.default.resolve(e.dirPath,".lintstagedrc.json"),{force:!0}),m.generateFile(r,i)])}var F=s(require("fs")),C=s(require("fs/promises")),S=s(require("path")),X=s(require("deepmerge"));var Te={cleanup:"yarn format && yarn lint-fix",format:"sort-package-json && yarn prettify",lint:`eslint --color "./{src,__tests__}/**/*.{${f.eslint.join(",")}}"`,"lint-fix":"yarn lint --fix",prettify:`prettier --color --write "**/{.*/,}*.{${f.prettier.join(",")}}" "!**/test-fixtures/**"`,typecheck:"tsc --noEmit --Pretty"},xt=(0,X.default)(R({},Te),{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 "**/{.*/,}*.{${f.prettier.join(",")}}" "!**/packages/**" "!**/test-fixtures/**"`,test:"yarn workspaces foreach --verbose run test",typecheck:"yarn workspaces foreach --parallel --verbose run typecheck"}),V=["eslint","eslint-config-prettier","eslint-plugin-import","eslint-plugin-sort-class-members","eslint-plugin-sort-destructure-keys"],Re=[...V,"@typescript-eslint/eslint-plugin","@typescript-eslint/parser","eslint-import-resolver-typescript"],Oe=["eslint-plugin-react","eslint-plugin-react-hooks"],Je={"@willbooster/eslint-config-js":["@willbooster/eslint-config-js",...V],"@willbooster/eslint-config-js-react":["@willbooster/eslint-config-js-react",...V,...Oe],"@willbooster/eslint-config-ts":["@willbooster/eslint-config-ts",...Re],"@willbooster/eslint-config-ts-react":["@willbooster/eslint-config-ts-react",...Re,...Oe],"../../.eslintrc.json":[]};async function Ee(e,n,t){let i=S.default.resolve(e.dirPath,"package.json"),r=await C.default.readFile(i,"utf-8"),o=JSON.parse(r);o.scripts=o.scripts||{},o.dependencies=o.dependencies||{},o.devDependencies=o.devDependencies||{},o.peerDependencies=o.peerDependencies||{},wt(o),o.name!=="@willbooster/prettier-config"&&(o.prettier="@willbooster/prettier-config");for(let l of Object.keys(o.scripts))o.scripts[l]=o.scripts[l].replace(/yarn\s*&&\s*/,"").replace(/yarn\s*install\s*&&\s*/,"");o.scripts=(0,X.default)(o.scripts,e.containingSubPackageJsons?xt:Te),o.scripts.prettify+=await bt(e.dirPath);let a=[],p=["lint-staged","prettier","sort-package-json","@willbooster/prettier-config"];if(e.root&&(p.push("husky","pinst","@willbooster/renovate-config"),e.depending.semanticRelease&&p.push("conventional-changelog-conventionalcommits"),e.containingSubPackageJsons?o.workspaces=["packages/*"]:delete o.workspaces),(e.containingJavaScript||e.containingJavaScriptInPackages||e.containingTypeScript||e.containingTypeScriptInPackages)&&(p.push("eslint","micromatch"),e.containingTypeScriptInPackages&&p.push("@typescript-eslint/parser")),(e.containingTypeScript||e.containingTypeScriptInPackages)&&p.push("typescript"),e.eslintBase&&p.push(...Je[e.eslintBase]),e.willBoosterConfigs&&(a=a.filter(l=>!l.includes("@willbooster/")),p=p.filter(l=>!l.includes("@willbooster/"))),o.name||(o.name=S.default.basename(e.dirPath)),e.containingSubPackageJsons&&(o.private=!0),o.license||(o.license="UNLICENSED"),!e.containingTypeScript&&!e.containingTypeScriptInPackages&&delete o.scripts.typecheck,!e.containingSubPackageJsons){if(!e.containingJavaScript&&!e.containingTypeScript?(delete o.scripts.lint,delete o.scripts["lint-fix"],o.scripts.cleanup=o.scripts.cleanup.replace(" && yarn lint-fix","")):o.scripts["lint-fix"]+=E.getLintFixSuffix(e),e.containingPubspecYaml){o.scripts.lint="flutter analyze",o.scripts["lint-fix"]="yarn lint";let l=["lib","test","test_driver"].filter(c=>F.default.existsSync(S.default.resolve(e.dirPath,c)));l.length>0&&(o.scripts["format-code"]=`flutter format $(find ${l.join(" ")} -name generated -prune -o -name '*.freezed.dart' -prune -o -name '*.g.dart' -prune -o -name '*.dart' -print)`,o.scripts.format+=" && yarn format-code")}if(e.containingPoetryLock){o.scripts.postinstall="poetry install";let l=F.default.readdirSync(e.dirPath).filter(c=>{let _=S.default.resolve(e.dirPath,c);return F.default.lstatSync(_).isDirectory()?F.default.readdirSync(_).some(y=>y.endsWith(".py")):!1});l.length>0&&(o.scripts["format-code"]=`poetry run isort --profile black ${l.join(" ")} && poetry run black ${l.join(" ")}`,o.scripts.lint=`poetry run flake8 ${l.join(" ")}`,o.scripts["lint-fix"]="yarn lint",o.scripts.format+=" && yarn format-code")}}Object.keys(o.dependencies).length||delete o.dependencies,Object.keys(o.devDependencies).length||delete o.devDependencies,Object.keys(o.peerDependencies).length||delete o.peerDependencies,await C.default.writeFile(i,JSON.stringify(o)),t||(a.length&&a.some(l=>{var c;return!((c=o.dependencies)==null?void 0:c[l])})&&u("yarn",["add",...new Set(a)],e.dirPath),p.length&&u("yarn",["add","-D",...new Set(p)],e.dirPath))}function wt(e){e.author==="WillBooster LLC"&&(e.author="WillBooster Inc."),delete e.scripts["sort-package-json"],delete e.scripts["sort-all-package-json"],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 n of Object.values(Je))for(let t of n)delete e.devDependencies[t];C.default.rm("lerna.json",{force:!0}).then()}async function bt(e){let n=S.default.resolve(e,".prettierignore"),t=await C.default.readFile(n,"utf-8"),i=t.indexOf(g.separatorPrefix);return i<0?"":t.substring(0,i).split(`
|
229
|
+
`).map(a=>{let p=a.trim();return p.endsWith("/")?p.slice(0,-1):p}).filter(a=>a&&!a.startsWith("#")&&!a.includes("/")).map(a=>` "!**/${a}/**"`).join("")}var Z=s(require("path"));var St=`${g.header}
|
230
|
+
|
231
|
+
|
232
|
+
${g.separator}
|
233
|
+
`,jt=`
|
234
|
+
3rd-party/
|
235
|
+
android/
|
236
|
+
ios/
|
237
|
+
no-format/
|
238
|
+
test-fixtures/
|
239
|
+
*.d.ts
|
240
|
+
*.min.js
|
241
|
+
.yarn/
|
242
|
+
.pnp.js
|
243
|
+
`;async function De(e){let n=Z.default.resolve(e.dirPath,".prettierignore"),t=g.getUserContent(n)||St,i=Z.default.resolve(e.dirPath,".gitignore"),r=g.getExistingContent(i)||"",o="";e.containingPubspecYaml&&(o=`
|
244
|
+
android/app/
|
245
|
+
ios/Runner/Assets.xcassets/
|
246
|
+
pubspec.yaml
|
247
|
+
`),await m.generateFile(n,t+jt+o+r)}var Ie=s(require("fs")),Q=s(require("fs/promises")),Ne=s(require("path"));async function Me(e){let n=Ne.default.resolve(e.dirPath,".releaserc.json");if(!Ie.default.existsSync(n))return;let t=JSON.parse(await Q.default.readFile(n,"utf8")),i=(t==null?void 0:t.plugins)||[];for(let r=0;r<i.length;r++)(i[r]==="@semantic-release/commit-analyzer"||i[r][0]==="@semantic-release/commit-analyzer")&&(i[r]=["@semantic-release/commit-analyzer",{preset:"conventionalcommits"}]);return Q.default.writeFile(n,JSON.stringify(t))}var We=s(require("fs")),I=s(require("fs/promises")),N=s(require("path")),Be=s(require("deepmerge")),Ue=s(require("lodash.clonedeep"));var Ft={extends:["@willbooster"]};async function Le(e){let n=(0,Ue.default)(Ft),t=N.default.resolve(e.dirPath,".renovaterc.json");if(We.default.existsSync(t)){let i=await I.default.readFile(t,"utf-8");try{let r=JSON.parse(i);n=Be.default.all([n,r,n],{arrayMerge:J})}catch{}}await Promise.all([I.default.rm(N.default.resolve(e.dirPath,".dependabot"),{force:!0}),I.default.rm(N.default.resolve(e.dirPath,"renovate.json"),{force:!0}),m.generateFile(t,JSON.stringify(n))])}var Ye=s(require("fs")),ze=s(require("fs/promises")),$=s(require("path")),Ge=s(require("deepmerge")),Ae=s(require("lodash.clonedeep"));var Ct={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__/**/*","packages/*/src/**/*","packages/*/__tests__/**/*","./node_modules/@types","./@types"]},$t={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__/**/*","../../node_modules/@types","../../@types","./@types"]};async function He(e,n){var o,a,p;let t=(0,Ae.default)(e.root?Ct:$t);if(!e.containingJsxOrTsx&&!e.containingJsxOrTsxInPackages&&delete t.compilerOptions.jsx,e.root&&!e.containingSubPackageJsons&&(t.include=t.include.filter(l=>!l.startsWith("packages/*/"))),!e.root&&(e.depending.jestPlaywrightPreset||n.depending.jestPlaywrightPreset)){let l=$.default.relative(e.dirPath,n.dirPath);t.include.push($.default.join(l,"node_modules/jest-playwright-preset/types"),$.default.join(l,"node_modules/expect-playwright"))}let i=$.default.resolve(e.dirPath,"tsconfig.json");if(Ye.default.existsSync(i)){let l=await ze.default.readFile(i,"utf-8");try{let c=JSON.parse(l);c.extends==="./node_modules/@willbooster/tsconfig/tsconfig.json"&&delete c.extends,(o=c.compilerOptions)==null||delete o.typeRoots,(a=t==null?void 0:t.compilerOptions)==null||delete a.target,(p=t==null?void 0:t.compilerOptions)==null||delete p.module,c.jsx&&delete t.jsx,e.depending.blitz||delete t.include,t=Ge.default.all([t,c,t],{arrayMerge:J})}catch{}}let r={};for(let l of Object.keys(t.compilerOptions).sort())r[l]=t.compilerOptions[l];t.compilerOptions=r,await m.generateFile(i,JSON.stringify(t))}var qe=s(require("fs")),ee=s(require("fs/promises")),M=s(require("path")),Ke=s(require("js-yaml")),Xe=s(require("lodash.clonedeep")),_t={name:"Test",on:{pull_request:{branches:["main","!renovate/**"]},push:{branches:["main","renovate/**"]}},jobs:{test:{uses:"WillBooster/reusable-workflows/.github/workflows/test.yml@main"}}},Tt={name:"Release",on:{push:{branches:[]}},jobs:{release:{uses:"WillBooster/reusable-workflows/.github/workflows/release.yml@main"}}};function Ve(e,n){let t=(0,Xe.default)(n==="test"?_t:Tt);n==="release"&&(t.on.push.branches=e.release.branches);let i=t.jobs.test||t.jobs.release;return e.private||(i.with||(i.with={}),i.with.non_self_hosted=!0),e.release.github&&(i.secrets||(i.secrets={}),e.private?i.secrets.GH_TOKEN="${{ secrets.GH_BOT_PAT }}":i.secrets.GH_TOKEN="${{ secrets.PUBLIC_GH_BOT_PAT }}"),e.release.npm&&(i.secrets||(i.secrets={}),i.secrets.NPM_TOKEN="${{ secrets.NPM_TOKEN }}"),Ke.default.dump(t,{noCompatMode:!0})}async function Ze(e){let n=M.default.resolve(e.dirPath,".github","workflows");qe.default.mkdirSync(n,{recursive:!0});let t=[];if(e.depending.semanticRelease){let i=Ve(e,"release");t.push(ee.default.writeFile(M.default.join(n,"release.yml"),i))}{let i=Ve(e,"test");t.push(ee.default.writeFile(M.default.join(n,"test.yml"),i))}await Promise.all(t)}var W=s(require("fs/promises")),te=s(require("path")),ne=s(require("js-yaml"));async function Qe(e){let n=z("yarn",["--version"],e.dirPath),t=z("npm",["show","@yarnpkg/cli","version"],e.dirPath);n!==t&&u("yarn",["set","version",t],e.dirPath);let i=te.default.resolve(e.dirPath,".yarnrc");W.default.rm(i,{force:!0}).then();let r=te.default.resolve(e.dirPath,".yarnrc.yml"),o=ne.default.load(await W.default.readFile(r,"utf8"));o.defaultSemverRangePrefix="",e.requiringNodeModules&&(o.nmMode="hardlinks-global"),await W.default.writeFile(r,ne.default.dump(o));let a=(o.plugins||[]).map(l=>l.spec),p=e.containingTypeScript||e.containingTypeScriptInPackages;et(e,a,p,"@yarnpkg/plugin-typescript"),p&&!e.requiringNodeModules&&u("yarn",["dlx","@yarnpkg/sdks","vscode"],e.dirPath),et(e,a,e.containingSubPackageJsons,"@yarnpkg/plugin-workspace-tools"),u("yarn",["dlx","yarn-plugin-auto-install"],e.dirPath)}function et(e,n,t,i){t!==n.includes(i)&&u("yarn",["plugin",t?"import":"remove",i],e.dirPath)}var h=s(require("fs")),ie=s(require("fs/promises")),d=s(require("path")),x=s(require("glob")),tt=s(require("js-yaml"));async function oe(e){var t;let n=d.default.resolve(e,"package.json");try{let i=h.default.existsSync(n),r={},o={},a={};if(i){let P=h.default.readFileSync(n,"utf-8");a=JSON.parse(P),r=a.dependencies??{},o=a.devDependencies??{}}let p=!0;try{let P=d.default.resolve(e,".yarnrc.yml"),v=tt.default.load(await ie.default.readFile(P,"utf8"));p=!v.nodeLinker||v.nodeLinker==="node-modules"}catch{}let l=[],c=[];try{let P=d.default.resolve(e,".releaserc.json"),v=JSON.parse(await ie.default.readFile(P,"utf8"));l=(v==null?void 0:v.branches)||[],c=((t=v==null?void 0:v.plugins)==null?void 0:t.flat())||[]}catch{}let _=a.private&&x.default.sync("packages/**/package.json",{cwd:e}).map(P=>{let v=h.default.readFileSync(d.default.join(e,P),"utf-8");return JSON.parse(v).private}),y={dirPath:e,root:d.default.basename(d.default.resolve(e,".."))!=="packages"||!h.default.existsSync(d.default.resolve(e,"..","..","package.json")),private:!!_,willBoosterConfigs:n.includes(`${d.default.sep}willbooster-configs`),containingSubPackageJsons:x.default.sync("packages/**/package.json",{cwd:e}).length>0,containingGemfile:h.default.existsSync(d.default.resolve(e,"Gemfile")),containingGoMod:h.default.existsSync(d.default.resolve(e,"go.mod")),containingPackageJson:h.default.existsSync(d.default.resolve(e,"package.json")),containingPoetryLock:h.default.existsSync(d.default.resolve(e,"poetry.lock")),containingPomXml:h.default.existsSync(d.default.resolve(e,"pom.xml")),containingPubspecYaml:h.default.existsSync(d.default.resolve(e,"pubspec.yaml")),containingTemplateYaml:h.default.existsSync(d.default.resolve(e,"template.yaml")),containingJavaScript:x.default.sync("@(app|src|__tests__)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScript:x.default.sync("@(app|src|__tests__)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsx:x.default.sync("@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,containingJavaScriptInPackages:x.default.sync("packages/**/@(app|src|__tests__)/**/*.js?(x)",{cwd:e}).length>0,containingTypeScriptInPackages:x.default.sync("packages/**/@(app|src|__tests__)/**/*.ts?(x)",{cwd:e}).length>0,containingJsxOrTsxInPackages:x.default.sync("packages/**/@(app|src|__tests__)/**/*.{t,j}sx",{cwd:e}).length>0,depending:{blitz:!!(r.blitz||o.blitz),firebase:!!o["firebase-tools"],jestPlaywrightPreset:!!o["jest-playwright-preset"],prisma:!!o.prisma,reactNative:!!r["react-native"],semanticRelease:!!o["semantic-release"]},release:{branches:l,github:c.includes("@semantic-release/github"),npm:c.includes("@semantic-release/npm")},requiringNodeModules:p};if(y.eslintBase=Rt(y),y.containingGemfile||y.containingGoMod||y.containingPackageJson||y.containingPoetryLock||y.containingPomXml||y.containingPubspecYaml||y.containingTemplateYaml)return y}catch{}return null}function Rt(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 Ot(){let e=await(0,ot.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 n of e._){if(typeof n=="number")continue;let t=await oe(n);if(t===null){console.error(`there is no valid package.json in ${n}`);continue}let i=t.containingSubPackageJsons?it.default.sync("packages/*",{cwd:n}).map(c=>nt.default.resolve(n,c)):[],r=(await Promise.all(i.map(c=>oe(c)))).filter(c=>!!c),o=[t,...r],a=[t,...r.filter(c=>c.containingPackageJson)];if(e.verbose)for(let c of o)console.log(c);let p=o.map(c=>be(c,t));await Qe(t),p.push(me(t),xe(t),je(t),$e(t),K(t),Le(t),Me(t),le(t),Ze(t)),await Promise.all(p);let l=[];for(let c of a)l.push(De(c),K(c)),(c.containingTypeScript||c.containingTypeScriptInPackages)&&l.push(He(c,t)),(c.containingJavaScript||c.containingJavaScriptInPackages||c.containingTypeScript||c.containingTypeScriptInPackages)&&(t.willBoosterConfigs||l.push(Pe(c,t)),l.push(ge(c)));await Promise.all(l);for(let c of a)await Ee(c,t,e.skipDeps);u("yarn",["cleanup"],n),u("yarn",["install"],n)}}Ot().then();
|
248
|
+
//# sourceMappingURL=index.min.cjs.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/index.ts", "../src/generators/asdf.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/utils/spawnUtil.ts", "../src/generators/idea.ts", "../src/generators/lintstagedrc.ts", "../src/utils/eslintUtil.ts", "../src/generators/packageJson.ts", "../src/generators/prettierignore.ts", "../src/generators/releaserc.ts", "../src/generators/renovaterc.ts", "../src/generators/tsconfig.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 { 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 const allNodePackageConfigs = [rootConfig, ...subPackageConfigs.filter((config) => config.containingPackageJson)];\n\n if (argv.verbose) {\n for (const config of allPackageConfigs) {\n console.log(config);\n }\n }\n\n const rootPromises = allPackageConfigs.map((config) => generateGitignore(config, rootConfig));\n // Install yarn berry at first\n await generateYarnrcYml(rootConfig);\n rootPromises.push(\n generateEditorconfig(rootConfig),\n generateGitattributes(rootConfig),\n generateHuskyrc(rootConfig),\n generateIdeaSettings(rootConfig),\n generateLintstagedrc(rootConfig),\n generateRenovateJson(rootConfig),\n generateReleaserc(rootConfig),\n generateVersionConfigs(rootConfig),\n generateWorkflow(rootConfig)\n );\n await Promise.all(rootPromises);\n\n const promises: Promise<void>[] = [];\n for (const config of allNodePackageConfigs) {\n promises.push(generatePrettierignore(config), 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\n for (const config of allNodePackageConfigs) {\n await generatePackageJson(config, rootConfig, argv.skipDeps);\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 fsp from 'fs/promises';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\n\nexport async function generateVersionConfigs(config: PackageConfig): Promise<void> {\n try {\n const toolVersionsPath = path.resolve(config.dirPath, '.tool-versions');\n const versionsText = await fsp.readFile(toolVersionsPath, 'utf-8');\n const lines = [];\n const promises = [];\n for (const versionText of versionsText.split('\\n')) {\n const line = versionText.trim();\n if (!line.startsWith('nodejs')) {\n lines.push(line);\n continue;\n }\n\n const [, version] = line.split(/\\s+/);\n promises.push(fsp.writeFile(path.resolve(config.dirPath, '.node-version'), version));\n }\n if (lines.length) {\n promises.push(fsp.writeFile(toolVersionsPath, lines.join('\\n')));\n } else {\n promises.push(fsp.rm(toolVersionsPath, { force: true }));\n }\n await Promise.all(promises);\n } catch (_) {\n // do nothing\n }\n}\n", "import path from 'path';\n\nimport { Extensions } from '../utils/extensions';\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\n\nconst content = `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 FsUtil.generateFile(filePath, content);\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';\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 = IgnoreFileUtil.getUserContent(filePath) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = IgnoreFileUtil.getExistingContent(gitignoreFilePath) || '';\n\n await FsUtil.generateFile(filePath, userContent + commonContent + gitignoreContent);\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 getExistingContent(filePath: string): string | null {\n if (fs.existsSync(filePath)) {\n return fs\n .readFileSync(filePath)\n .toString()\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 }\n return null;\n },\n getUserContent(filePath: string): string | null {\n if (fs.existsSync(filePath)) {\n const existingContent = fs.readFileSync(filePath, 'utf-8');\n const index = existingContent.indexOf(this.separatorPrefix);\n if (index >= 0) {\n return existingContent.substr(0, existingContent.indexOf('\\n', index) + 1);\n }\n }\n return null;\n },\n isBerryZeroInstallEnabled(filePath: string): boolean {\n if (fs.existsSync(filePath)) {\n const existingContent = fs.readFileSync(filePath, 'utf-8');\n return existingContent.includes('\\n!.yarn/cache');\n }\n return false;\n },\n};\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\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';\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 newJsonObj: any = { root: true, extends: bases };\n\n const filePath = path.resolve(config.dirPath, '.eslintrc.json');\n if (fs.existsSync(filePath)) {\n const existingContent = await fsp.readFile(filePath, 'utf-8');\n try {\n const existingJsonObj = JSON.parse(existingContent);\n if (existingJsonObj.extends) {\n existingJsonObj.extends = existingJsonObj.extends.filter(\n (ext: string) => !ext.startsWith('@willbooster/') && ext !== '../../.eslintrc.json'\n );\n }\n if (!bases.length) {\n existingJsonObj.extends = [];\n }\n const newExtends = newJsonObj.extends;\n newJsonObj.extends = existingJsonObj.extends;\n existingJsonObj.extends = newExtends;\n newJsonObj = merge.all([newJsonObj, existingJsonObj, newJsonObj], { arrayMerge: combineMerge });\n } catch (e) {\n // do nothing\n }\n }\n await FsUtil.generateFile(filePath, JSON.stringify(newJsonObj));\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';\n\nconst content = `* 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 FsUtil.generateFile(filePath, content);\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`;\n\nexport async function generateGitignore(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n const filePath = path.resolve(config.dirPath, '.gitignore');\n let userContent = (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\n let content = (\n await Promise.all(\n names.map(async (name) => {\n const response = await fetchOnNode(`https://www.toptal.com/developers/gitignore/api/${name}`);\n return await response.text();\n })\n )\n ).join('');\n if (!IgnoreFileUtil.isBerryZeroInstallEnabled(filePath)) {\n content = content.replace('!.yarn/cache', '# !.yarn/cache').replace('# .pnp.*', '.pnp.*');\n }\n if (config.containingPomXml || config.containingPubspecYaml) {\n content = content\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 content = content.replace(/^.idea\\/modules.xml$/gm, '# .idea/modules.xml');\n }\n }\n content = content.replace(/^.idea\\/?$/gm, '# .idea');\n if (rootConfig.depending.reactNative || config.depending.reactNative || config.containingPubspecYaml) {\n content = content.replace(/^(.idea\\/.+)$/gm, '$1\\nandroid/$1');\n }\n await FsUtil.generateFile(filePath, userContent + content);\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 fsp from 'fs/promises';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\nimport { spawnSync } from '../utils/spawnUtil';\n\nconst DEFAULT_COMMAND = 'npm test';\n\nconst settings = {\n preCommit: 'yarn lint-staged',\n prePush: 'yarn typecheck',\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 fsp.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\n const dirPath = path.resolve(config.dirPath, '.husky');\n await Promise.all([\n fsp.writeFile(packageJsonPath, JSON.stringify(packageJson, undefined, 2)),\n fsp.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 fsp.readFile(preCommitFilePath, 'utf-8');\n\n const promises = [\n fsp.rm(path.resolve(config.dirPath, '.huskyrc.json'), { force: true }),\n fsp.writeFile(preCommitFilePath, content.replace(DEFAULT_COMMAND, settings.preCommit)),\n ];\n\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\n promises.push(\n fsp.writeFile(path.resolve(dirPath, 'pre-push'), content.replace(DEFAULT_COMMAND, settings.prePush), {\n mode: 0o755,\n })\n );\n }\n\n let postMergeContent = content.replace(DEFAULT_COMMAND, settings.postMerge).trim();\n if (config.depending.blitz) {\n postMergeContent += ' && yarn blitz codegen';\n } else if (config.depending.prisma) {\n postMergeContent += ' && yarn prisma generate';\n }\n postMergeContent += '\\n';\n promises.push(\n fsp.writeFile(path.resolve(dirPath, 'post-merge'), postMergeContent, {\n mode: 0o755,\n })\n );\n\n await Promise.all(promises);\n}\n", "import child_process from 'child_process';\n\nexport function spawnSync(command: string, args: string[], cwd: string): void {\n const [commandAndArgs, options] = getSpawnSyncArgs(command, args, cwd);\n console.log(`$ ${commandAndArgs} at ${options.cwd}`);\n child_process.spawnSync(commandAndArgs, options);\n}\n\nexport function spawnSyncWithStringResult(command: string, args: string[], cwd: string): string {\n const [commandAndArgs, options] = getSpawnSyncArgs(command, args, cwd);\n options.stdio = 'pipe';\n const proc = child_process.spawnSync(commandAndArgs, options);\n return proc.stdout.toString().trim();\n}\n\nexport function getSpawnSyncArgs(command: string, args: string[], cwd: 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 let commandAndArgs = `${command} ${args.join(' ')}`;\n if (env.ASDF_DIR) {\n commandAndArgs = `bash -l -c '. ${env.ASDF_DIR}/asdf.sh && ${commandAndArgs}'`;\n }\n return [commandAndArgs, { cwd, env, shell: true, stdio: 'inherit' }];\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\nimport path from 'path';\n\nimport { FsUtil } from '../utils/fsUtil';\nimport { PackageConfig } from '../utils/packageConfig';\n\nconst content = `<?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 FsUtil.generateFile(filePath, content);\n } else {\n await fsp.rm(filePath, { force: true });\n }\n }\n}\n", "import fsp from 'fs/promises';\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';\n\nconst eslintKey = `./{src,__tests__}/**/*.{${Extensions.eslint.join(',')}}`;\nconst eslintFilterForPrettier = `files = micromatch.not(files, '${eslintKey}');`;\n\nexport async function generateLintstagedrc(config: PackageConfig): Promise<void> {\n const lines: string[] = [];\n if (config.containingJavaScript || config.containingTypeScript) {\n const eslint = `\n '${eslintKey}': [${JSON.stringify(`eslint --fix${EslintUtil.getLintFixSuffix(config)}`)}, '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 ? eslintFilterForPrettier : ''}\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 content = `${\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 Promise.all([\n fsp.rm(path.resolve(config.dirPath, '.lintstagedrc.js'), { force: true }),\n fsp.rm(path.resolve(config.dirPath, '.lintstagedrc.json'), { force: true }),\n FsUtil.generateFile(filePath, content),\n ]);\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 fs from 'fs';\nimport fsp from 'fs/promises';\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 { spawnSync } from '../utils/spawnUtil';\n\nconst scriptsWithoutWorkspace = {\n cleanup: 'yarn format && yarn lint-fix',\n format: `sort-package-json && yarn prettify`,\n lint: `eslint --color \"./{src,__tests__}/**/*.{${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\nconst scriptsWithWorkspace = merge(\n { ...scriptsWithoutWorkspace },\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\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 fsp.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 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 jsonObj.scripts[scriptKey] = jsonObj.scripts[scriptKey]\n .replace(/yarn\\s*&&\\s*/, '')\n .replace(/yarn\\s*install\\s*&&\\s*/, '');\n }\n\n jsonObj.scripts = merge(\n jsonObj.scripts,\n config.containingSubPackageJsons ? scriptsWithWorkspace : scriptsWithoutWorkspace\n );\n jsonObj.scripts.prettify += await generatePrettierSuffix(config.dirPath);\n\n let dependencies = [] as string[];\n let devDependencies = ['lint-staged', 'prettier', 'sort-package-json', '@willbooster/prettier-config'];\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 if (config.containingTypeScriptInPackages) {\n devDependencies.push('@typescript-eslint/parser');\n }\n }\n\n if (config.containingTypeScript || config.containingTypeScriptInPackages) {\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 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 jsonObj.scripts.postinstall = 'poetry install';\n const dirNames = fs.readdirSync(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 }\n }\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 fsp.writeFile(filePath, JSON.stringify(jsonObj));\n\n if (!skipAddingDeps) {\n if (dependencies.length && dependencies.some((dep) => !jsonObj.dependencies?.[dep])) {\n spawnSync('yarn', ['add', ...new Set(dependencies)], config.dirPath);\n }\n if (devDependencies.length) {\n spawnSync('yarn', ['add', '-D', ...new Set(devDependencies)], config.dirPath);\n }\n }\n}\n\nfunction removeDeprecatedStuff(jsonObj: any): 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.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 fsp.rm('lerna.json', { force: true }).then();\n}\n\nasync function generatePrettierSuffix(dirPath: string): Promise<string> {\n const filePath = path.resolve(dirPath, '.prettierignore');\n const existingContent = await fsp.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';\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 = IgnoreFileUtil.getUserContent(filePath) || defaultUserContent;\n\n const gitignoreFilePath = path.resolve(config.dirPath, '.gitignore');\n const gitignoreContent = 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 await FsUtil.generateFile(filePath, userContent + commonContent + additionalContent + gitignoreContent);\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\nimport path from 'path';\n\nimport { PackageConfig } from '../utils/packageConfig';\n\nexport async function generateReleaserc(rootConfig: PackageConfig): Promise<void> {\n const releasercJsonPath = path.resolve(rootConfig.dirPath, '.releaserc.json');\n if (!fs.existsSync(releasercJsonPath)) return;\n\n const json = JSON.parse(await fsp.readFile(releasercJsonPath, 'utf8'));\n const plugins = json?.plugins || [];\n for (let i = 0; i < plugins.length; i++) {\n if (plugins[i] === '@semantic-release/commit-analyzer' || plugins[i][0] === '@semantic-release/commit-analyzer') {\n plugins[i] = [\n '@semantic-release/commit-analyzer',\n {\n preset: 'conventionalcommits',\n },\n ];\n }\n }\n return fsp.writeFile(releasercJsonPath, JSON.stringify(json));\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\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';\n\nconst jsonObj = {\n extends: ['@willbooster'],\n};\n\nexport async function generateRenovateJson(config: PackageConfig): Promise<void> {\n let newJsonObj: any = cloneDeep(jsonObj);\n\n const filePath = path.resolve(config.dirPath, '.renovaterc.json');\n if (fs.existsSync(filePath)) {\n const existingContent = await fsp.readFile(filePath, 'utf-8');\n try {\n const existingJsonObj = JSON.parse(existingContent) as any;\n newJsonObj = merge.all([newJsonObj, existingJsonObj, newJsonObj], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n }\n await Promise.all([\n fsp.rm(path.resolve(config.dirPath, '.dependabot'), { force: true }),\n fsp.rm(path.resolve(config.dirPath, 'renovate.json'), { force: true }),\n FsUtil.generateFile(filePath, JSON.stringify(newJsonObj)),\n ]);\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\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';\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 'packages/*/src/**/*',\n 'packages/*/__tests__/**/*',\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__/**/*', '../../node_modules/@types', '../../@types', './@types'],\n};\n\nexport async function generateTsconfig(config: PackageConfig, rootConfig: PackageConfig): Promise<void> {\n let newJsonObj: any = cloneDeep(config.root ? rootJsonObj : subJsonObj);\n if (!config.containingJsxOrTsx && !config.containingJsxOrTsxInPackages) {\n delete newJsonObj.compilerOptions.jsx;\n }\n if (config.root && !config.containingSubPackageJsons) {\n newJsonObj.include = newJsonObj.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 newJsonObj.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 if (fs.existsSync(filePath)) {\n const existingContent = await fsp.readFile(filePath, 'utf-8');\n try {\n const existingJsonObj = JSON.parse(existingContent);\n if (existingJsonObj.extends === './node_modules/@willbooster/tsconfig/tsconfig.json') {\n delete existingJsonObj.extends;\n }\n delete existingJsonObj.compilerOptions?.typeRoots;\n delete newJsonObj?.compilerOptions?.target;\n delete newJsonObj?.compilerOptions?.module;\n if (existingJsonObj.jsx) {\n delete newJsonObj.jsx;\n }\n if (!config.depending.blitz) {\n delete newJsonObj.include;\n }\n newJsonObj = merge.all([newJsonObj, existingJsonObj, newJsonObj], { arrayMerge: overwriteMerge });\n } catch (e) {\n // do nothing\n }\n }\n const sortedCompilerOptions: Record<string, unknown> = {};\n for (const key of Object.keys(newJsonObj.compilerOptions).sort()) {\n sortedCompilerOptions[key] = newJsonObj.compilerOptions[key];\n }\n newJsonObj.compilerOptions = sortedCompilerOptions;\n await FsUtil.generateFile(filePath, JSON.stringify(newJsonObj));\n}\n", "import fs from 'fs';\nimport fsp from 'fs/promises';\nimport path from 'path';\n\nimport yaml from 'js-yaml';\nimport cloneDeep from 'lodash.clonedeep';\n\nimport { PackageConfig } from '../utils/packageConfig';\n\nconst testWorkflow = {\n name: 'Test',\n on: {\n pull_request: {\n branches: ['main', '!renovate/**'],\n },\n push: {\n branches: ['main', '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\nfunction getTestWorkflow(config: PackageConfig, kind: 'test' | 'release'): string {\n const workflow = cloneDeep(kind === 'test' ? testWorkflow : releaseWorkflow) as any;\n if (kind === 'release') {\n workflow.on.push.branches = config.release.branches;\n }\n const job = workflow.jobs.test || workflow.jobs.release;\n if (!config.private) {\n job.with ||= {};\n job.with['non_self_hosted'] = true;\n }\n if (config.release.github) {\n job.secrets ||= {};\n if (config.private) {\n job.secrets['GH_TOKEN'] = '${{ secrets.GH_BOT_PAT }}';\n } else {\n job.secrets['GH_TOKEN'] = '${{ secrets.PUBLIC_GH_BOT_PAT }}';\n }\n }\n if (config.release.npm) {\n job.secrets ||= {};\n job.secrets['NPM_TOKEN'] = '${{ secrets.NPM_TOKEN }}';\n }\n return yaml.dump(workflow, { noCompatMode: true });\n}\n\nexport async function generateWorkflow(rootConfig: PackageConfig): Promise<void> {\n const workflowsPath = path.resolve(rootConfig.dirPath, '.github', 'workflows');\n fs.mkdirSync(workflowsPath, { recursive: true });\n const promises: Promise<void>[] = [];\n if (rootConfig.depending.semanticRelease) {\n const releaseYml = getTestWorkflow(rootConfig, 'release');\n promises.push(fsp.writeFile(path.join(workflowsPath, 'release.yml'), releaseYml));\n }\n {\n const testYml = getTestWorkflow(rootConfig, 'test');\n promises.push(fsp.writeFile(path.join(workflowsPath, 'test.yml'), testYml));\n }\n await Promise.all(promises);\n}\n", "import fsp from 'fs/promises';\nimport path from 'path';\n\nimport yaml from 'js-yaml';\n\nimport { PackageConfig } from '../utils/packageConfig';\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);\n }\n\n const yarnrcPath = path.resolve(config.dirPath, '.yarnrc');\n fsp.rm(yarnrcPath, { force: true }).then();\n\n const yarnrcYmlPath = path.resolve(config.dirPath, '.yarnrc.yml');\n const doc = yaml.load(await fsp.readFile(yarnrcYmlPath, 'utf8')) as any;\n doc.defaultSemverRangePrefix = '';\n if (config.requiringNodeModules) {\n doc.nmMode = 'hardlinks-global';\n }\n await fsp.writeFile(yarnrcYmlPath, yaml.dump(doc));\n\n const plugins = (doc.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';\n\nexport interface PackageConfig {\n dirPath: string;\n root: boolean;\n private: boolean;\n willBoosterConfigs: boolean;\n containingSubPackageJsons: 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 };\n release: {\n branches: string[];\n github: boolean;\n npm: boolean;\n };\n eslintBase?: string;\n requiringNodeModules: boolean;\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 isPrivate =\n packageJson.private &&\n glob.sync('packages/**/package.json', { cwd: dirPath }).map((p) => {\n const packageJsonText = fs.readFileSync(path.join(dirPath, p), 'utf-8');\n return JSON.parse(packageJsonText).private;\n });\n\n const config: PackageConfig = {\n dirPath,\n root:\n path.basename(path.resolve(dirPath, '..')) !== 'packages' ||\n !fs.existsSync(path.resolve(dirPath, '..', '..', 'package.json')),\n private: !!isPrivate,\n willBoosterConfigs: packageJsonPath.includes(`${path.sep}willbooster-configs`),\n containingSubPackageJsons: glob.sync('packages/**/package.json', { cwd: dirPath }).length > 0,\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__)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScript: glob.sync('@(app|src|__tests__)/**/*.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__)/**/*.js?(x)', { cwd: dirPath }).length > 0,\n containingTypeScriptInPackages:\n glob.sync('packages/**/@(app|src|__tests__)/**/*.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 },\n release: {\n branches: releaseBranches,\n github: releasePlugins.includes('@semantic-release/github'),\n npm: releasePlugins.includes('@semantic-release/npm'),\n },\n requiringNodeModules,\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 }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AM,IAAkB,GACxB,EAAa,KACX,GAAqB,GACrB,GAAsB,GACtB,GAAgB,GAChB,GAAqB,GACrB,EAAqB,GACrB,GAAqB,GACrB,GAAkB,GAClB,GAAuB,GACvB,GAAiB,IAEnB,KAAM,SAAQ,IAAI,GAElB,GAAM,GAA4B,GAClC,OAAW,KAAU,GACnB,EAAS,KAAK,GAAuB,GAAS,EAAqB,IAC/D,GAAO,sBAAwB,EAAO,iCACxC,EAAS,KAAK,GAAiB,EAAQ,IAGvC,GAAO,sBACP,EAAO,gCACP,EAAO,sBACP,EAAO,iCAEF,GAAW,oBACd,EAAS,KAAK,GAAiB,EAAQ,IAEzC,EAAS,KAAK,GAAqB,KAGvC,KAAM,SAAQ,IAAI,GAElB,OAAW,KAAU,GACnB,KAAM,IAAoB,EAAQ,EAAY,EAAK,UAErD,EAAU,OAAQ,CAAC,WAAY,GAG/B,EAAU,OAAQ,CAAC,WAAY,IAInC,KAAO",
|
6
|
+
"names": []
|
7
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
{
|
2
|
+
"name": "wbfy",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "A tool for applying WillBooster's conventional configures to npm packages",
|
5
|
+
"license": "Apache-2.0",
|
6
|
+
"author": "WillBooster Inc.",
|
7
|
+
"bin": "./bin/index.cjs",
|
8
|
+
"files": [
|
9
|
+
"bin/",
|
10
|
+
"dist/"
|
11
|
+
],
|
12
|
+
"scripts": {
|
13
|
+
"build": "node esbuild.js",
|
14
|
+
"cleanup": "yarn format && yarn lint-fix",
|
15
|
+
"format": "sort-package-json && yarn prettify",
|
16
|
+
"_postinstall": "husky install",
|
17
|
+
"lint": "eslint --color \"./{src,__tests__}/**/*.{cjs,js,jsx,mjs,ts,tsx}\"",
|
18
|
+
"lint-fix": "yarn lint --fix",
|
19
|
+
"prepack": "rimraf dist && yarn build",
|
20
|
+
"prepublishOnly": "pinst --disable",
|
21
|
+
"prettify": "prettier --color --write \"**/{.*/,}*.{cjs,css,htm,html,js,json,json5,jsx,md,mjs,scss,ts,tsx,vue,yaml,yml}\" \"!**/test-fixtures/**\"",
|
22
|
+
"postpublish": "pinst --enable",
|
23
|
+
"setup-ci": "cd .. && pwd && rm -Rf test-fixtures-for-wbfy && git clone https://github.com/WillBooster/test-fixtures-for-wbfy.git",
|
24
|
+
"start": "node -r esbuild-register src",
|
25
|
+
"test": "yarn jest --color __tests__",
|
26
|
+
"typecheck": "tsc --noEmit --Pretty"
|
27
|
+
},
|
28
|
+
"prettier": "@willbooster/prettier-config",
|
29
|
+
"dependencies": {
|
30
|
+
"deepmerge": "4.2.2",
|
31
|
+
"glob": "7.2.0",
|
32
|
+
"js-yaml": "4.1.0",
|
33
|
+
"lodash.clonedeep": "4.5.0",
|
34
|
+
"node-fetch": "3.2.0",
|
35
|
+
"yargs": "17.3.1"
|
36
|
+
},
|
37
|
+
"devDependencies": {
|
38
|
+
"@types/eslint": "8.2.2",
|
39
|
+
"@types/glob": "7.2.0",
|
40
|
+
"@types/jest": "27.4.0",
|
41
|
+
"@types/js-yaml": "4.0.5",
|
42
|
+
"@types/lodash.clonedeep": "4.5.6",
|
43
|
+
"@types/micromatch": "4.0.2",
|
44
|
+
"@types/node": "16.11.21",
|
45
|
+
"@types/node-fetch": "3.0.3",
|
46
|
+
"@types/yargs": "17.0.8",
|
47
|
+
"@typescript-eslint/eslint-plugin": "5.10.2",
|
48
|
+
"@typescript-eslint/parser": "5.10.2",
|
49
|
+
"@willbooster/eslint-config-ts": "9.0.0",
|
50
|
+
"@willbooster/prettier-config": "9.0.0",
|
51
|
+
"@willbooster/renovate-config": "9.1.0",
|
52
|
+
"conventional-changelog-conventionalcommits": "4.6.3",
|
53
|
+
"esbuild": "0.14.12",
|
54
|
+
"esbuild-register": "3.3.2",
|
55
|
+
"eslint": "8.8.0",
|
56
|
+
"eslint-config-prettier": "8.3.0",
|
57
|
+
"eslint-import-resolver-typescript": "2.5.0",
|
58
|
+
"eslint-plugin-import": "2.25.4",
|
59
|
+
"eslint-plugin-sort-class-members": "1.14.1",
|
60
|
+
"eslint-plugin-sort-destructure-keys": "1.4.0",
|
61
|
+
"husky": "7.0.4",
|
62
|
+
"jest": "27.4.7",
|
63
|
+
"lint-staged": "12.3.3",
|
64
|
+
"micromatch": "4.0.4",
|
65
|
+
"pinst": "2.1.6",
|
66
|
+
"prettier": "2.5.1",
|
67
|
+
"semantic-release": "18.0.1",
|
68
|
+
"sort-package-json": "1.54.0",
|
69
|
+
"typescript": "4.5.5"
|
70
|
+
},
|
71
|
+
"engines": {
|
72
|
+
"node": ">=14.0.0"
|
73
|
+
},
|
74
|
+
"packageManager": "yarn@3.2.0-rc.13"
|
75
|
+
}
|