@cdktn/provider-project 0.7.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/.jsii +419 -0
  2. package/API.md +4154 -0
  3. package/CLAUDE.md +172 -0
  4. package/LICENSE +355 -0
  5. package/README.md +82 -0
  6. package/lib/alert-open-prs.d.ts +14 -0
  7. package/lib/alert-open-prs.js +67 -0
  8. package/lib/auto-approve.d.ts +11 -0
  9. package/lib/auto-approve.js +70 -0
  10. package/lib/auto-close-community-issues.d.ts +15 -0
  11. package/lib/auto-close-community-issues.js +104 -0
  12. package/lib/automerge.d.ts +11 -0
  13. package/lib/automerge.js +67 -0
  14. package/lib/cdktf-config.d.ts +33 -0
  15. package/lib/cdktf-config.js +134 -0
  16. package/lib/copyright-headers.d.ts +4 -0
  17. package/lib/copyright-headers.js +44 -0
  18. package/lib/customized-license.d.ts +8 -0
  19. package/lib/customized-license.js +19 -0
  20. package/lib/dependabot.d.ts +8 -0
  21. package/lib/dependabot.js +40 -0
  22. package/lib/deprecate-packages.d.ts +14 -0
  23. package/lib/deprecate-packages.js +91 -0
  24. package/lib/force-release.d.ts +12 -0
  25. package/lib/force-release.js +112 -0
  26. package/lib/github-issues.d.ts +15 -0
  27. package/lib/github-issues.js +33 -0
  28. package/lib/index.d.ts +53 -0
  29. package/lib/index.js +447 -0
  30. package/lib/lock-issues.d.ts +13 -0
  31. package/lib/lock-issues.js +54 -0
  32. package/lib/package-info.d.ts +14 -0
  33. package/lib/package-info.js +7 -0
  34. package/lib/provider-upgrade.d.ts +17 -0
  35. package/lib/provider-upgrade.js +145 -0
  36. package/lib/readme.d.ts +21 -0
  37. package/lib/readme.js +147 -0
  38. package/lib/scripts/check-for-upgrades.d.ts +15 -0
  39. package/lib/scripts/check-for-upgrades.js +186 -0
  40. package/lib/scripts/should-release.d.ts +13 -0
  41. package/lib/scripts/should-release.js +96 -0
  42. package/lib/util/random-cron.d.ts +18 -0
  43. package/lib/util/random-cron.js +33 -0
  44. package/mise.toml +2 -0
  45. package/node_modules/camel-case/LICENSE +21 -0
  46. package/node_modules/camel-case/README.md +47 -0
  47. package/node_modules/camel-case/dist/index.d.ts +5 -0
  48. package/node_modules/camel-case/dist/index.js +23 -0
  49. package/node_modules/camel-case/dist/index.js.map +1 -0
  50. package/node_modules/camel-case/dist/index.spec.d.ts +1 -0
  51. package/node_modules/camel-case/dist/index.spec.js +26 -0
  52. package/node_modules/camel-case/dist/index.spec.js.map +1 -0
  53. package/node_modules/camel-case/dist.es2015/index.d.ts +5 -0
  54. package/node_modules/camel-case/dist.es2015/index.js +17 -0
  55. package/node_modules/camel-case/dist.es2015/index.js.map +1 -0
  56. package/node_modules/camel-case/dist.es2015/index.spec.d.ts +1 -0
  57. package/node_modules/camel-case/dist.es2015/index.spec.js +24 -0
  58. package/node_modules/camel-case/dist.es2015/index.spec.js.map +1 -0
  59. package/node_modules/camel-case/package.json +89 -0
  60. package/node_modules/capital-case/LICENSE +21 -0
  61. package/node_modules/capital-case/README.md +37 -0
  62. package/node_modules/capital-case/dist/index.d.ts +4 -0
  63. package/node_modules/capital-case/dist/index.js +16 -0
  64. package/node_modules/capital-case/dist/index.js.map +1 -0
  65. package/node_modules/capital-case/dist/index.spec.d.ts +1 -0
  66. package/node_modules/capital-case/dist/index.spec.js +24 -0
  67. package/node_modules/capital-case/dist/index.spec.js.map +1 -0
  68. package/node_modules/capital-case/dist.es2015/index.d.ts +4 -0
  69. package/node_modules/capital-case/dist.es2015/index.js +11 -0
  70. package/node_modules/capital-case/dist.es2015/index.js.map +1 -0
  71. package/node_modules/capital-case/dist.es2015/index.spec.d.ts +1 -0
  72. package/node_modules/capital-case/dist.es2015/index.spec.js +22 -0
  73. package/node_modules/capital-case/dist.es2015/index.spec.js.map +1 -0
  74. package/node_modules/capital-case/package.json +90 -0
  75. package/node_modules/change-case/LICENSE +21 -0
  76. package/node_modules/change-case/README.md +44 -0
  77. package/node_modules/change-case/dist/index.d.ts +11 -0
  78. package/node_modules/change-case/dist/index.js +15 -0
  79. package/node_modules/change-case/dist/index.js.map +1 -0
  80. package/node_modules/change-case/dist/index.spec.d.ts +1 -0
  81. package/node_modules/change-case/dist/index.spec.js +9 -0
  82. package/node_modules/change-case/dist/index.spec.js.map +1 -0
  83. package/node_modules/change-case/dist.es2015/index.d.ts +11 -0
  84. package/node_modules/change-case/dist.es2015/index.js +12 -0
  85. package/node_modules/change-case/dist.es2015/index.js.map +1 -0
  86. package/node_modules/change-case/dist.es2015/index.spec.d.ts +1 -0
  87. package/node_modules/change-case/dist.es2015/index.spec.js +7 -0
  88. package/node_modules/change-case/dist.es2015/index.spec.js.map +1 -0
  89. package/node_modules/change-case/package.json +101 -0
  90. package/node_modules/constant-case/LICENSE +21 -0
  91. package/node_modules/constant-case/README.md +37 -0
  92. package/node_modules/constant-case/dist/index.d.ts +3 -0
  93. package/node_modules/constant-case/dist/index.js +12 -0
  94. package/node_modules/constant-case/dist/index.js.map +1 -0
  95. package/node_modules/constant-case/dist/index.spec.d.ts +1 -0
  96. package/node_modules/constant-case/dist/index.spec.js +26 -0
  97. package/node_modules/constant-case/dist/index.spec.js.map +1 -0
  98. package/node_modules/constant-case/dist.es2015/index.d.ts +3 -0
  99. package/node_modules/constant-case/dist.es2015/index.js +8 -0
  100. package/node_modules/constant-case/dist.es2015/index.js.map +1 -0
  101. package/node_modules/constant-case/dist.es2015/index.spec.d.ts +1 -0
  102. package/node_modules/constant-case/dist.es2015/index.spec.js +24 -0
  103. package/node_modules/constant-case/dist.es2015/index.spec.js.map +1 -0
  104. package/node_modules/constant-case/package.json +90 -0
  105. package/node_modules/dot-case/LICENSE +21 -0
  106. package/node_modules/dot-case/README.md +37 -0
  107. package/node_modules/dot-case/dist/index.d.ts +3 -0
  108. package/node_modules/dot-case/dist/index.js +11 -0
  109. package/node_modules/dot-case/dist/index.js.map +1 -0
  110. package/node_modules/dot-case/dist/index.spec.d.ts +1 -0
  111. package/node_modules/dot-case/dist/index.spec.js +26 -0
  112. package/node_modules/dot-case/dist/index.spec.js.map +1 -0
  113. package/node_modules/dot-case/dist.es2015/index.d.ts +3 -0
  114. package/node_modules/dot-case/dist.es2015/index.js +7 -0
  115. package/node_modules/dot-case/dist.es2015/index.js.map +1 -0
  116. package/node_modules/dot-case/dist.es2015/index.spec.d.ts +1 -0
  117. package/node_modules/dot-case/dist.es2015/index.spec.js +24 -0
  118. package/node_modules/dot-case/dist.es2015/index.spec.js.map +1 -0
  119. package/node_modules/dot-case/package.json +89 -0
  120. package/node_modules/fs-extra/LICENSE +15 -0
  121. package/node_modules/fs-extra/README.md +262 -0
  122. package/node_modules/fs-extra/lib/copy/copy-sync.js +169 -0
  123. package/node_modules/fs-extra/lib/copy/copy.js +235 -0
  124. package/node_modules/fs-extra/lib/copy/index.js +7 -0
  125. package/node_modules/fs-extra/lib/empty/index.js +39 -0
  126. package/node_modules/fs-extra/lib/ensure/file.js +69 -0
  127. package/node_modules/fs-extra/lib/ensure/index.js +23 -0
  128. package/node_modules/fs-extra/lib/ensure/link.js +64 -0
  129. package/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
  130. package/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
  131. package/node_modules/fs-extra/lib/ensure/symlink.js +82 -0
  132. package/node_modules/fs-extra/lib/fs/index.js +128 -0
  133. package/node_modules/fs-extra/lib/index.js +16 -0
  134. package/node_modules/fs-extra/lib/json/index.js +16 -0
  135. package/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  136. package/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  137. package/node_modules/fs-extra/lib/json/output-json.js +12 -0
  138. package/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  139. package/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  140. package/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  141. package/node_modules/fs-extra/lib/move/index.js +7 -0
  142. package/node_modules/fs-extra/lib/move/move-sync.js +54 -0
  143. package/node_modules/fs-extra/lib/move/move.js +75 -0
  144. package/node_modules/fs-extra/lib/output-file/index.js +40 -0
  145. package/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  146. package/node_modules/fs-extra/lib/remove/index.js +22 -0
  147. package/node_modules/fs-extra/lib/remove/rimraf.js +302 -0
  148. package/node_modules/fs-extra/lib/util/stat.js +154 -0
  149. package/node_modules/fs-extra/lib/util/utimes.js +26 -0
  150. package/node_modules/fs-extra/package.json +67 -0
  151. package/node_modules/graceful-fs/LICENSE +15 -0
  152. package/node_modules/graceful-fs/README.md +143 -0
  153. package/node_modules/graceful-fs/clone.js +23 -0
  154. package/node_modules/graceful-fs/graceful-fs.js +448 -0
  155. package/node_modules/graceful-fs/legacy-streams.js +118 -0
  156. package/node_modules/graceful-fs/package.json +53 -0
  157. package/node_modules/graceful-fs/polyfills.js +355 -0
  158. package/node_modules/header-case/LICENSE +21 -0
  159. package/node_modules/header-case/README.md +37 -0
  160. package/node_modules/header-case/dist/index.d.ts +3 -0
  161. package/node_modules/header-case/dist/index.js +11 -0
  162. package/node_modules/header-case/dist/index.js.map +1 -0
  163. package/node_modules/header-case/dist/index.spec.d.ts +1 -0
  164. package/node_modules/header-case/dist/index.spec.js +24 -0
  165. package/node_modules/header-case/dist/index.spec.js.map +1 -0
  166. package/node_modules/header-case/dist.es2015/index.d.ts +3 -0
  167. package/node_modules/header-case/dist.es2015/index.js +7 -0
  168. package/node_modules/header-case/dist.es2015/index.js.map +1 -0
  169. package/node_modules/header-case/dist.es2015/index.spec.d.ts +1 -0
  170. package/node_modules/header-case/dist.es2015/index.spec.js +22 -0
  171. package/node_modules/header-case/dist.es2015/index.spec.js.map +1 -0
  172. package/node_modules/header-case/package.json +89 -0
  173. package/node_modules/jsonfile/LICENSE +15 -0
  174. package/node_modules/jsonfile/README.md +230 -0
  175. package/node_modules/jsonfile/index.js +88 -0
  176. package/node_modules/jsonfile/package.json +40 -0
  177. package/node_modules/jsonfile/utils.js +14 -0
  178. package/node_modules/lower-case/LICENSE +21 -0
  179. package/node_modules/lower-case/README.md +35 -0
  180. package/node_modules/lower-case/dist/index.d.ts +8 -0
  181. package/node_modules/lower-case/dist/index.js +53 -0
  182. package/node_modules/lower-case/dist/index.js.map +1 -0
  183. package/node_modules/lower-case/dist/index.spec.d.ts +1 -0
  184. package/node_modules/lower-case/dist/index.spec.js +36 -0
  185. package/node_modules/lower-case/dist/index.spec.js.map +1 -0
  186. package/node_modules/lower-case/dist.es2015/index.d.ts +8 -0
  187. package/node_modules/lower-case/dist.es2015/index.js +48 -0
  188. package/node_modules/lower-case/dist.es2015/index.js.map +1 -0
  189. package/node_modules/lower-case/dist.es2015/index.spec.d.ts +1 -0
  190. package/node_modules/lower-case/dist.es2015/index.spec.js +34 -0
  191. package/node_modules/lower-case/dist.es2015/index.spec.js.map +1 -0
  192. package/node_modules/lower-case/package.json +87 -0
  193. package/node_modules/no-case/LICENSE +21 -0
  194. package/node_modules/no-case/README.md +37 -0
  195. package/node_modules/no-case/dist/index.d.ts +10 -0
  196. package/node_modules/no-case/dist/index.js +35 -0
  197. package/node_modules/no-case/dist/index.js.map +1 -0
  198. package/node_modules/no-case/dist/index.spec.d.ts +1 -0
  199. package/node_modules/no-case/dist/index.spec.js +59 -0
  200. package/node_modules/no-case/dist/index.spec.js.map +1 -0
  201. package/node_modules/no-case/dist.es2015/index.d.ts +10 -0
  202. package/node_modules/no-case/dist.es2015/index.js +31 -0
  203. package/node_modules/no-case/dist.es2015/index.js.map +1 -0
  204. package/node_modules/no-case/dist.es2015/index.spec.d.ts +1 -0
  205. package/node_modules/no-case/dist.es2015/index.spec.js +57 -0
  206. package/node_modules/no-case/dist.es2015/index.spec.js.map +1 -0
  207. package/node_modules/no-case/package.json +85 -0
  208. package/node_modules/param-case/LICENSE +21 -0
  209. package/node_modules/param-case/README.md +37 -0
  210. package/node_modules/param-case/dist/index.d.ts +3 -0
  211. package/node_modules/param-case/dist/index.js +11 -0
  212. package/node_modules/param-case/dist/index.js.map +1 -0
  213. package/node_modules/param-case/dist/index.spec.d.ts +1 -0
  214. package/node_modules/param-case/dist/index.spec.js +24 -0
  215. package/node_modules/param-case/dist/index.spec.js.map +1 -0
  216. package/node_modules/param-case/dist.es2015/index.d.ts +3 -0
  217. package/node_modules/param-case/dist.es2015/index.js +7 -0
  218. package/node_modules/param-case/dist.es2015/index.js.map +1 -0
  219. package/node_modules/param-case/dist.es2015/index.spec.d.ts +1 -0
  220. package/node_modules/param-case/dist.es2015/index.spec.js +22 -0
  221. package/node_modules/param-case/dist.es2015/index.spec.js.map +1 -0
  222. package/node_modules/param-case/package.json +91 -0
  223. package/node_modules/pascal-case/LICENSE +21 -0
  224. package/node_modules/pascal-case/README.md +47 -0
  225. package/node_modules/pascal-case/dist/index.d.ts +5 -0
  226. package/node_modules/pascal-case/dist/index.js +24 -0
  227. package/node_modules/pascal-case/dist/index.js.map +1 -0
  228. package/node_modules/pascal-case/dist/index.spec.d.ts +1 -0
  229. package/node_modules/pascal-case/dist/index.spec.js +25 -0
  230. package/node_modules/pascal-case/dist/index.spec.js.map +1 -0
  231. package/node_modules/pascal-case/dist.es2015/index.d.ts +5 -0
  232. package/node_modules/pascal-case/dist.es2015/index.js +18 -0
  233. package/node_modules/pascal-case/dist.es2015/index.js.map +1 -0
  234. package/node_modules/pascal-case/dist.es2015/index.spec.d.ts +1 -0
  235. package/node_modules/pascal-case/dist.es2015/index.spec.js +23 -0
  236. package/node_modules/pascal-case/dist.es2015/index.spec.js.map +1 -0
  237. package/node_modules/pascal-case/package.json +90 -0
  238. package/node_modules/path-case/LICENSE +21 -0
  239. package/node_modules/path-case/README.md +37 -0
  240. package/node_modules/path-case/dist/index.d.ts +3 -0
  241. package/node_modules/path-case/dist/index.js +11 -0
  242. package/node_modules/path-case/dist/index.js.map +1 -0
  243. package/node_modules/path-case/dist/index.spec.d.ts +1 -0
  244. package/node_modules/path-case/dist/index.spec.js +24 -0
  245. package/node_modules/path-case/dist/index.spec.js.map +1 -0
  246. package/node_modules/path-case/dist.es2015/index.d.ts +3 -0
  247. package/node_modules/path-case/dist.es2015/index.js +7 -0
  248. package/node_modules/path-case/dist.es2015/index.js.map +1 -0
  249. package/node_modules/path-case/dist.es2015/index.spec.d.ts +1 -0
  250. package/node_modules/path-case/dist.es2015/index.spec.js +22 -0
  251. package/node_modules/path-case/dist.es2015/index.spec.js.map +1 -0
  252. package/node_modules/path-case/package.json +88 -0
  253. package/node_modules/sentence-case/LICENSE +21 -0
  254. package/node_modules/sentence-case/README.md +37 -0
  255. package/node_modules/sentence-case/dist/index.d.ts +4 -0
  256. package/node_modules/sentence-case/dist/index.js +19 -0
  257. package/node_modules/sentence-case/dist/index.js.map +1 -0
  258. package/node_modules/sentence-case/dist/index.spec.d.ts +1 -0
  259. package/node_modules/sentence-case/dist/index.spec.js +24 -0
  260. package/node_modules/sentence-case/dist/index.spec.js.map +1 -0
  261. package/node_modules/sentence-case/dist.es2015/index.d.ts +4 -0
  262. package/node_modules/sentence-case/dist.es2015/index.js +14 -0
  263. package/node_modules/sentence-case/dist.es2015/index.js.map +1 -0
  264. package/node_modules/sentence-case/dist.es2015/index.spec.d.ts +1 -0
  265. package/node_modules/sentence-case/dist.es2015/index.spec.js +22 -0
  266. package/node_modules/sentence-case/dist.es2015/index.spec.js.map +1 -0
  267. package/node_modules/sentence-case/package.json +89 -0
  268. package/node_modules/snake-case/LICENSE +21 -0
  269. package/node_modules/snake-case/README.md +37 -0
  270. package/node_modules/snake-case/dist/index.d.ts +3 -0
  271. package/node_modules/snake-case/dist/index.js +11 -0
  272. package/node_modules/snake-case/dist/index.js.map +1 -0
  273. package/node_modules/snake-case/dist/index.spec.d.ts +1 -0
  274. package/node_modules/snake-case/dist/index.spec.js +25 -0
  275. package/node_modules/snake-case/dist/index.spec.js.map +1 -0
  276. package/node_modules/snake-case/dist.es2015/index.d.ts +3 -0
  277. package/node_modules/snake-case/dist.es2015/index.js +7 -0
  278. package/node_modules/snake-case/dist.es2015/index.js.map +1 -0
  279. package/node_modules/snake-case/dist.es2015/index.spec.d.ts +1 -0
  280. package/node_modules/snake-case/dist.es2015/index.spec.js +23 -0
  281. package/node_modules/snake-case/dist.es2015/index.spec.js.map +1 -0
  282. package/node_modules/snake-case/package.json +90 -0
  283. package/node_modules/tslib/CopyrightNotice.txt +15 -0
  284. package/node_modules/tslib/LICENSE.txt +12 -0
  285. package/node_modules/tslib/README.md +164 -0
  286. package/node_modules/tslib/SECURITY.md +41 -0
  287. package/node_modules/tslib/modules/index.d.ts +38 -0
  288. package/node_modules/tslib/modules/index.js +70 -0
  289. package/node_modules/tslib/modules/package.json +3 -0
  290. package/node_modules/tslib/package.json +47 -0
  291. package/node_modules/tslib/tslib.d.ts +460 -0
  292. package/node_modules/tslib/tslib.es6.html +1 -0
  293. package/node_modules/tslib/tslib.es6.js +402 -0
  294. package/node_modules/tslib/tslib.es6.mjs +401 -0
  295. package/node_modules/tslib/tslib.html +1 -0
  296. package/node_modules/tslib/tslib.js +484 -0
  297. package/node_modules/universalify/LICENSE +20 -0
  298. package/node_modules/universalify/README.md +76 -0
  299. package/node_modules/universalify/index.js +24 -0
  300. package/node_modules/universalify/package.json +34 -0
  301. package/node_modules/upper-case/README.md +34 -0
  302. package/node_modules/upper-case/dist/index.d.ts +8 -0
  303. package/node_modules/upper-case/dist/index.js +49 -0
  304. package/node_modules/upper-case/dist/index.js.map +1 -0
  305. package/node_modules/upper-case/dist/index.spec.d.ts +1 -0
  306. package/node_modules/upper-case/dist/index.spec.js +34 -0
  307. package/node_modules/upper-case/dist/index.spec.js.map +1 -0
  308. package/node_modules/upper-case/dist.es2015/index.d.ts +8 -0
  309. package/node_modules/upper-case/dist.es2015/index.js +44 -0
  310. package/node_modules/upper-case/dist.es2015/index.js.map +1 -0
  311. package/node_modules/upper-case/dist.es2015/index.spec.d.ts +1 -0
  312. package/node_modules/upper-case/dist.es2015/index.spec.js +32 -0
  313. package/node_modules/upper-case/dist.es2015/index.spec.js.map +1 -0
  314. package/node_modules/upper-case/package.json +86 -0
  315. package/node_modules/upper-case-first/LICENSE +21 -0
  316. package/node_modules/upper-case-first/README.md +32 -0
  317. package/node_modules/upper-case-first/dist/index.d.ts +4 -0
  318. package/node_modules/upper-case-first/dist/index.js +11 -0
  319. package/node_modules/upper-case-first/dist/index.js.map +1 -0
  320. package/node_modules/upper-case-first/dist/index.spec.d.ts +1 -0
  321. package/node_modules/upper-case-first/dist/index.spec.js +20 -0
  322. package/node_modules/upper-case-first/dist/index.spec.js.map +1 -0
  323. package/node_modules/upper-case-first/dist.es2015/index.d.ts +4 -0
  324. package/node_modules/upper-case-first/dist.es2015/index.js +7 -0
  325. package/node_modules/upper-case-first/dist.es2015/index.js.map +1 -0
  326. package/node_modules/upper-case-first/dist.es2015/index.spec.d.ts +1 -0
  327. package/node_modules/upper-case-first/dist.es2015/index.spec.js +18 -0
  328. package/node_modules/upper-case-first/dist.es2015/index.spec.js.map +1 -0
  329. package/node_modules/upper-case-first/package.json +87 -0
  330. package/package.json +181 -0
@@ -0,0 +1,99 @@
1
+ 'use strict'
2
+
3
+ const path = require('path')
4
+ const fs = require('graceful-fs')
5
+ const pathExists = require('../path-exists').pathExists
6
+
7
+ /**
8
+ * Function that returns two types of paths, one relative to symlink, and one
9
+ * relative to the current working directory. Checks if path is absolute or
10
+ * relative. If the path is relative, this function checks if the path is
11
+ * relative to symlink or relative to current working directory. This is an
12
+ * initiative to find a smarter `srcpath` to supply when building symlinks.
13
+ * This allows you to determine which path to use out of one of three possible
14
+ * types of source paths. The first is an absolute path. This is detected by
15
+ * `path.isAbsolute()`. When an absolute path is provided, it is checked to
16
+ * see if it exists. If it does it's used, if not an error is returned
17
+ * (callback)/ thrown (sync). The other two options for `srcpath` are a
18
+ * relative url. By default Node's `fs.symlink` works by creating a symlink
19
+ * using `dstpath` and expects the `srcpath` to be relative to the newly
20
+ * created symlink. If you provide a `srcpath` that does not exist on the file
21
+ * system it results in a broken symlink. To minimize this, the function
22
+ * checks to see if the 'relative to symlink' source file exists, and if it
23
+ * does it will use it. If it does not, it checks if there's a file that
24
+ * exists that is relative to the current working directory, if does its used.
25
+ * This preserves the expectations of the original fs.symlink spec and adds
26
+ * the ability to pass in `relative to current working direcotry` paths.
27
+ */
28
+
29
+ function symlinkPaths (srcpath, dstpath, callback) {
30
+ if (path.isAbsolute(srcpath)) {
31
+ return fs.lstat(srcpath, (err) => {
32
+ if (err) {
33
+ err.message = err.message.replace('lstat', 'ensureSymlink')
34
+ return callback(err)
35
+ }
36
+ return callback(null, {
37
+ toCwd: srcpath,
38
+ toDst: srcpath
39
+ })
40
+ })
41
+ } else {
42
+ const dstdir = path.dirname(dstpath)
43
+ const relativeToDst = path.join(dstdir, srcpath)
44
+ return pathExists(relativeToDst, (err, exists) => {
45
+ if (err) return callback(err)
46
+ if (exists) {
47
+ return callback(null, {
48
+ toCwd: relativeToDst,
49
+ toDst: srcpath
50
+ })
51
+ } else {
52
+ return fs.lstat(srcpath, (err) => {
53
+ if (err) {
54
+ err.message = err.message.replace('lstat', 'ensureSymlink')
55
+ return callback(err)
56
+ }
57
+ return callback(null, {
58
+ toCwd: srcpath,
59
+ toDst: path.relative(dstdir, srcpath)
60
+ })
61
+ })
62
+ }
63
+ })
64
+ }
65
+ }
66
+
67
+ function symlinkPathsSync (srcpath, dstpath) {
68
+ let exists
69
+ if (path.isAbsolute(srcpath)) {
70
+ exists = fs.existsSync(srcpath)
71
+ if (!exists) throw new Error('absolute srcpath does not exist')
72
+ return {
73
+ toCwd: srcpath,
74
+ toDst: srcpath
75
+ }
76
+ } else {
77
+ const dstdir = path.dirname(dstpath)
78
+ const relativeToDst = path.join(dstdir, srcpath)
79
+ exists = fs.existsSync(relativeToDst)
80
+ if (exists) {
81
+ return {
82
+ toCwd: relativeToDst,
83
+ toDst: srcpath
84
+ }
85
+ } else {
86
+ exists = fs.existsSync(srcpath)
87
+ if (!exists) throw new Error('relative srcpath does not exist')
88
+ return {
89
+ toCwd: srcpath,
90
+ toDst: path.relative(dstdir, srcpath)
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ module.exports = {
97
+ symlinkPaths,
98
+ symlinkPathsSync
99
+ }
@@ -0,0 +1,31 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+
5
+ function symlinkType (srcpath, type, callback) {
6
+ callback = (typeof type === 'function') ? type : callback
7
+ type = (typeof type === 'function') ? false : type
8
+ if (type) return callback(null, type)
9
+ fs.lstat(srcpath, (err, stats) => {
10
+ if (err) return callback(null, 'file')
11
+ type = (stats && stats.isDirectory()) ? 'dir' : 'file'
12
+ callback(null, type)
13
+ })
14
+ }
15
+
16
+ function symlinkTypeSync (srcpath, type) {
17
+ let stats
18
+
19
+ if (type) return type
20
+ try {
21
+ stats = fs.lstatSync(srcpath)
22
+ } catch {
23
+ return 'file'
24
+ }
25
+ return (stats && stats.isDirectory()) ? 'dir' : 'file'
26
+ }
27
+
28
+ module.exports = {
29
+ symlinkType,
30
+ symlinkTypeSync
31
+ }
@@ -0,0 +1,82 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromCallback
4
+ const path = require('path')
5
+ const fs = require('../fs')
6
+ const _mkdirs = require('../mkdirs')
7
+ const mkdirs = _mkdirs.mkdirs
8
+ const mkdirsSync = _mkdirs.mkdirsSync
9
+
10
+ const _symlinkPaths = require('./symlink-paths')
11
+ const symlinkPaths = _symlinkPaths.symlinkPaths
12
+ const symlinkPathsSync = _symlinkPaths.symlinkPathsSync
13
+
14
+ const _symlinkType = require('./symlink-type')
15
+ const symlinkType = _symlinkType.symlinkType
16
+ const symlinkTypeSync = _symlinkType.symlinkTypeSync
17
+
18
+ const pathExists = require('../path-exists').pathExists
19
+
20
+ const { areIdentical } = require('../util/stat')
21
+
22
+ function createSymlink (srcpath, dstpath, type, callback) {
23
+ callback = (typeof type === 'function') ? type : callback
24
+ type = (typeof type === 'function') ? false : type
25
+
26
+ fs.lstat(dstpath, (err, stats) => {
27
+ if (!err && stats.isSymbolicLink()) {
28
+ Promise.all([
29
+ fs.stat(srcpath),
30
+ fs.stat(dstpath)
31
+ ]).then(([srcStat, dstStat]) => {
32
+ if (areIdentical(srcStat, dstStat)) return callback(null)
33
+ _createSymlink(srcpath, dstpath, type, callback)
34
+ })
35
+ } else _createSymlink(srcpath, dstpath, type, callback)
36
+ })
37
+ }
38
+
39
+ function _createSymlink (srcpath, dstpath, type, callback) {
40
+ symlinkPaths(srcpath, dstpath, (err, relative) => {
41
+ if (err) return callback(err)
42
+ srcpath = relative.toDst
43
+ symlinkType(relative.toCwd, type, (err, type) => {
44
+ if (err) return callback(err)
45
+ const dir = path.dirname(dstpath)
46
+ pathExists(dir, (err, dirExists) => {
47
+ if (err) return callback(err)
48
+ if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)
49
+ mkdirs(dir, err => {
50
+ if (err) return callback(err)
51
+ fs.symlink(srcpath, dstpath, type, callback)
52
+ })
53
+ })
54
+ })
55
+ })
56
+ }
57
+
58
+ function createSymlinkSync (srcpath, dstpath, type) {
59
+ let stats
60
+ try {
61
+ stats = fs.lstatSync(dstpath)
62
+ } catch {}
63
+ if (stats && stats.isSymbolicLink()) {
64
+ const srcStat = fs.statSync(srcpath)
65
+ const dstStat = fs.statSync(dstpath)
66
+ if (areIdentical(srcStat, dstStat)) return
67
+ }
68
+
69
+ const relative = symlinkPathsSync(srcpath, dstpath)
70
+ srcpath = relative.toDst
71
+ type = symlinkTypeSync(relative.toCwd, type)
72
+ const dir = path.dirname(dstpath)
73
+ const exists = fs.existsSync(dir)
74
+ if (exists) return fs.symlinkSync(srcpath, dstpath, type)
75
+ mkdirsSync(dir)
76
+ return fs.symlinkSync(srcpath, dstpath, type)
77
+ }
78
+
79
+ module.exports = {
80
+ createSymlink: u(createSymlink),
81
+ createSymlinkSync
82
+ }
@@ -0,0 +1,128 @@
1
+ 'use strict'
2
+ // This is adapted from https://github.com/normalize/mz
3
+ // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
4
+ const u = require('universalify').fromCallback
5
+ const fs = require('graceful-fs')
6
+
7
+ const api = [
8
+ 'access',
9
+ 'appendFile',
10
+ 'chmod',
11
+ 'chown',
12
+ 'close',
13
+ 'copyFile',
14
+ 'fchmod',
15
+ 'fchown',
16
+ 'fdatasync',
17
+ 'fstat',
18
+ 'fsync',
19
+ 'ftruncate',
20
+ 'futimes',
21
+ 'lchmod',
22
+ 'lchown',
23
+ 'link',
24
+ 'lstat',
25
+ 'mkdir',
26
+ 'mkdtemp',
27
+ 'open',
28
+ 'opendir',
29
+ 'readdir',
30
+ 'readFile',
31
+ 'readlink',
32
+ 'realpath',
33
+ 'rename',
34
+ 'rm',
35
+ 'rmdir',
36
+ 'stat',
37
+ 'symlink',
38
+ 'truncate',
39
+ 'unlink',
40
+ 'utimes',
41
+ 'writeFile'
42
+ ].filter(key => {
43
+ // Some commands are not available on some systems. Ex:
44
+ // fs.opendir was added in Node.js v12.12.0
45
+ // fs.rm was added in Node.js v14.14.0
46
+ // fs.lchown is not available on at least some Linux
47
+ return typeof fs[key] === 'function'
48
+ })
49
+
50
+ // Export cloned fs:
51
+ Object.assign(exports, fs)
52
+
53
+ // Universalify async methods:
54
+ api.forEach(method => {
55
+ exports[method] = u(fs[method])
56
+ })
57
+
58
+ // We differ from mz/fs in that we still ship the old, broken, fs.exists()
59
+ // since we are a drop-in replacement for the native module
60
+ exports.exists = function (filename, callback) {
61
+ if (typeof callback === 'function') {
62
+ return fs.exists(filename, callback)
63
+ }
64
+ return new Promise(resolve => {
65
+ return fs.exists(filename, resolve)
66
+ })
67
+ }
68
+
69
+ // fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args
70
+
71
+ exports.read = function (fd, buffer, offset, length, position, callback) {
72
+ if (typeof callback === 'function') {
73
+ return fs.read(fd, buffer, offset, length, position, callback)
74
+ }
75
+ return new Promise((resolve, reject) => {
76
+ fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {
77
+ if (err) return reject(err)
78
+ resolve({ bytesRead, buffer })
79
+ })
80
+ })
81
+ }
82
+
83
+ // Function signature can be
84
+ // fs.write(fd, buffer[, offset[, length[, position]]], callback)
85
+ // OR
86
+ // fs.write(fd, string[, position[, encoding]], callback)
87
+ // We need to handle both cases, so we use ...args
88
+ exports.write = function (fd, buffer, ...args) {
89
+ if (typeof args[args.length - 1] === 'function') {
90
+ return fs.write(fd, buffer, ...args)
91
+ }
92
+
93
+ return new Promise((resolve, reject) => {
94
+ fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {
95
+ if (err) return reject(err)
96
+ resolve({ bytesWritten, buffer })
97
+ })
98
+ })
99
+ }
100
+
101
+ // fs.writev only available in Node v12.9.0+
102
+ if (typeof fs.writev === 'function') {
103
+ // Function signature is
104
+ // s.writev(fd, buffers[, position], callback)
105
+ // We need to handle the optional arg, so we use ...args
106
+ exports.writev = function (fd, buffers, ...args) {
107
+ if (typeof args[args.length - 1] === 'function') {
108
+ return fs.writev(fd, buffers, ...args)
109
+ }
110
+
111
+ return new Promise((resolve, reject) => {
112
+ fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {
113
+ if (err) return reject(err)
114
+ resolve({ bytesWritten, buffers })
115
+ })
116
+ })
117
+ }
118
+ }
119
+
120
+ // fs.realpath.native sometimes not available if fs is monkey-patched
121
+ if (typeof fs.realpath.native === 'function') {
122
+ exports.realpath.native = u(fs.realpath.native)
123
+ } else {
124
+ process.emitWarning(
125
+ 'fs.realpath.native is not a function. Is fs being monkey-patched?',
126
+ 'Warning', 'fs-extra-WARN0003'
127
+ )
128
+ }
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ // Export promiseified graceful-fs:
5
+ ...require('./fs'),
6
+ // Export extra methods:
7
+ ...require('./copy'),
8
+ ...require('./empty'),
9
+ ...require('./ensure'),
10
+ ...require('./json'),
11
+ ...require('./mkdirs'),
12
+ ...require('./move'),
13
+ ...require('./output-file'),
14
+ ...require('./path-exists'),
15
+ ...require('./remove')
16
+ }
@@ -0,0 +1,16 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromPromise
4
+ const jsonFile = require('./jsonfile')
5
+
6
+ jsonFile.outputJson = u(require('./output-json'))
7
+ jsonFile.outputJsonSync = require('./output-json-sync')
8
+ // aliases
9
+ jsonFile.outputJSON = jsonFile.outputJson
10
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync
11
+ jsonFile.writeJSON = jsonFile.writeJson
12
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync
13
+ jsonFile.readJSON = jsonFile.readJson
14
+ jsonFile.readJSONSync = jsonFile.readJsonSync
15
+
16
+ module.exports = jsonFile
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ const jsonFile = require('jsonfile')
4
+
5
+ module.exports = {
6
+ // jsonfile exports
7
+ readJson: jsonFile.readFile,
8
+ readJsonSync: jsonFile.readFileSync,
9
+ writeJson: jsonFile.writeFile,
10
+ writeJsonSync: jsonFile.writeFileSync
11
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const { stringify } = require('jsonfile/utils')
4
+ const { outputFileSync } = require('../output-file')
5
+
6
+ function outputJsonSync (file, data, options) {
7
+ const str = stringify(data, options)
8
+
9
+ outputFileSync(file, str, options)
10
+ }
11
+
12
+ module.exports = outputJsonSync
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+
3
+ const { stringify } = require('jsonfile/utils')
4
+ const { outputFile } = require('../output-file')
5
+
6
+ async function outputJson (file, data, options = {}) {
7
+ const str = stringify(data, options)
8
+
9
+ await outputFile(file, str, options)
10
+ }
11
+
12
+ module.exports = outputJson
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+ const u = require('universalify').fromPromise
3
+ const { makeDir: _makeDir, makeDirSync } = require('./make-dir')
4
+ const makeDir = u(_makeDir)
5
+
6
+ module.exports = {
7
+ mkdirs: makeDir,
8
+ mkdirsSync: makeDirSync,
9
+ // alias
10
+ mkdirp: makeDir,
11
+ mkdirpSync: makeDirSync,
12
+ ensureDir: makeDir,
13
+ ensureDirSync: makeDirSync
14
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+ const fs = require('../fs')
3
+ const { checkPath } = require('./utils')
4
+
5
+ const getMode = options => {
6
+ const defaults = { mode: 0o777 }
7
+ if (typeof options === 'number') return options
8
+ return ({ ...defaults, ...options }).mode
9
+ }
10
+
11
+ module.exports.makeDir = async (dir, options) => {
12
+ checkPath(dir)
13
+
14
+ return fs.mkdir(dir, {
15
+ mode: getMode(options),
16
+ recursive: true
17
+ })
18
+ }
19
+
20
+ module.exports.makeDirSync = (dir, options) => {
21
+ checkPath(dir)
22
+
23
+ return fs.mkdirSync(dir, {
24
+ mode: getMode(options),
25
+ recursive: true
26
+ })
27
+ }
@@ -0,0 +1,21 @@
1
+ // Adapted from https://github.com/sindresorhus/make-dir
2
+ // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
3
+ // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
+ 'use strict'
7
+ const path = require('path')
8
+
9
+ // https://github.com/nodejs/node/issues/8987
10
+ // https://github.com/libuv/libuv/pull/1088
11
+ module.exports.checkPath = function checkPath (pth) {
12
+ if (process.platform === 'win32') {
13
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
14
+
15
+ if (pathHasInvalidWinCharacters) {
16
+ const error = new Error(`Path contains invalid characters: ${pth}`)
17
+ error.code = 'EINVAL'
18
+ throw error
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromCallback
4
+ module.exports = {
5
+ move: u(require('./move')),
6
+ moveSync: require('./move-sync')
7
+ }
@@ -0,0 +1,54 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+ const path = require('path')
5
+ const copySync = require('../copy').copySync
6
+ const removeSync = require('../remove').removeSync
7
+ const mkdirpSync = require('../mkdirs').mkdirpSync
8
+ const stat = require('../util/stat')
9
+
10
+ function moveSync (src, dest, opts) {
11
+ opts = opts || {}
12
+ const overwrite = opts.overwrite || opts.clobber || false
13
+
14
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
15
+ stat.checkParentPathsSync(src, srcStat, dest, 'move')
16
+ if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
17
+ return doRename(src, dest, overwrite, isChangingCase)
18
+ }
19
+
20
+ function isParentRoot (dest) {
21
+ const parent = path.dirname(dest)
22
+ const parsedPath = path.parse(parent)
23
+ return parsedPath.root === parent
24
+ }
25
+
26
+ function doRename (src, dest, overwrite, isChangingCase) {
27
+ if (isChangingCase) return rename(src, dest, overwrite)
28
+ if (overwrite) {
29
+ removeSync(dest)
30
+ return rename(src, dest, overwrite)
31
+ }
32
+ if (fs.existsSync(dest)) throw new Error('dest already exists.')
33
+ return rename(src, dest, overwrite)
34
+ }
35
+
36
+ function rename (src, dest, overwrite) {
37
+ try {
38
+ fs.renameSync(src, dest)
39
+ } catch (err) {
40
+ if (err.code !== 'EXDEV') throw err
41
+ return moveAcrossDevice(src, dest, overwrite)
42
+ }
43
+ }
44
+
45
+ function moveAcrossDevice (src, dest, overwrite) {
46
+ const opts = {
47
+ overwrite,
48
+ errorOnExist: true
49
+ }
50
+ copySync(src, dest, opts)
51
+ return removeSync(src)
52
+ }
53
+
54
+ module.exports = moveSync
@@ -0,0 +1,75 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+ const path = require('path')
5
+ const copy = require('../copy').copy
6
+ const remove = require('../remove').remove
7
+ const mkdirp = require('../mkdirs').mkdirp
8
+ const pathExists = require('../path-exists').pathExists
9
+ const stat = require('../util/stat')
10
+
11
+ function move (src, dest, opts, cb) {
12
+ if (typeof opts === 'function') {
13
+ cb = opts
14
+ opts = {}
15
+ }
16
+
17
+ opts = opts || {}
18
+
19
+ const overwrite = opts.overwrite || opts.clobber || false
20
+
21
+ stat.checkPaths(src, dest, 'move', opts, (err, stats) => {
22
+ if (err) return cb(err)
23
+ const { srcStat, isChangingCase = false } = stats
24
+ stat.checkParentPaths(src, srcStat, dest, 'move', err => {
25
+ if (err) return cb(err)
26
+ if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb)
27
+ mkdirp(path.dirname(dest), err => {
28
+ if (err) return cb(err)
29
+ return doRename(src, dest, overwrite, isChangingCase, cb)
30
+ })
31
+ })
32
+ })
33
+ }
34
+
35
+ function isParentRoot (dest) {
36
+ const parent = path.dirname(dest)
37
+ const parsedPath = path.parse(parent)
38
+ return parsedPath.root === parent
39
+ }
40
+
41
+ function doRename (src, dest, overwrite, isChangingCase, cb) {
42
+ if (isChangingCase) return rename(src, dest, overwrite, cb)
43
+ if (overwrite) {
44
+ return remove(dest, err => {
45
+ if (err) return cb(err)
46
+ return rename(src, dest, overwrite, cb)
47
+ })
48
+ }
49
+ pathExists(dest, (err, destExists) => {
50
+ if (err) return cb(err)
51
+ if (destExists) return cb(new Error('dest already exists.'))
52
+ return rename(src, dest, overwrite, cb)
53
+ })
54
+ }
55
+
56
+ function rename (src, dest, overwrite, cb) {
57
+ fs.rename(src, dest, err => {
58
+ if (!err) return cb()
59
+ if (err.code !== 'EXDEV') return cb(err)
60
+ return moveAcrossDevice(src, dest, overwrite, cb)
61
+ })
62
+ }
63
+
64
+ function moveAcrossDevice (src, dest, overwrite, cb) {
65
+ const opts = {
66
+ overwrite,
67
+ errorOnExist: true
68
+ }
69
+ copy(src, dest, opts, err => {
70
+ if (err) return cb(err)
71
+ return remove(src, cb)
72
+ })
73
+ }
74
+
75
+ module.exports = move
@@ -0,0 +1,40 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromCallback
4
+ const fs = require('graceful-fs')
5
+ const path = require('path')
6
+ const mkdir = require('../mkdirs')
7
+ const pathExists = require('../path-exists').pathExists
8
+
9
+ function outputFile (file, data, encoding, callback) {
10
+ if (typeof encoding === 'function') {
11
+ callback = encoding
12
+ encoding = 'utf8'
13
+ }
14
+
15
+ const dir = path.dirname(file)
16
+ pathExists(dir, (err, itDoes) => {
17
+ if (err) return callback(err)
18
+ if (itDoes) return fs.writeFile(file, data, encoding, callback)
19
+
20
+ mkdir.mkdirs(dir, err => {
21
+ if (err) return callback(err)
22
+
23
+ fs.writeFile(file, data, encoding, callback)
24
+ })
25
+ })
26
+ }
27
+
28
+ function outputFileSync (file, ...args) {
29
+ const dir = path.dirname(file)
30
+ if (fs.existsSync(dir)) {
31
+ return fs.writeFileSync(file, ...args)
32
+ }
33
+ mkdir.mkdirsSync(dir)
34
+ fs.writeFileSync(file, ...args)
35
+ }
36
+
37
+ module.exports = {
38
+ outputFile: u(outputFile),
39
+ outputFileSync
40
+ }
@@ -0,0 +1,12 @@
1
+ 'use strict'
2
+ const u = require('universalify').fromPromise
3
+ const fs = require('../fs')
4
+
5
+ function pathExists (path) {
6
+ return fs.access(path).then(() => true).catch(() => false)
7
+ }
8
+
9
+ module.exports = {
10
+ pathExists: u(pathExists),
11
+ pathExistsSync: fs.existsSync
12
+ }