@gluhar/cli 3.0.1 → 3.0.2

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 (427) hide show
  1. package/CHANGELOG.md +628 -0
  2. package/README.md +11 -0
  3. package/package.json +46 -46
  4. package/src/GlobalOptions.ts +8 -0
  5. package/src/commands/blank/BlankOptions.ts +3 -0
  6. package/src/commands/blank/blank.ts +6 -0
  7. package/src/commands/blank/index.ts +8 -0
  8. package/src/commands/blank/log.ts +3 -0
  9. package/src/commands/build/BuildOptions.ts +3 -0
  10. package/src/commands/build/build.ts +24 -0
  11. package/src/commands/build/index.ts +8 -0
  12. package/src/commands/build/log.ts +3 -0
  13. package/src/commands/deinstall/DeinstallOptions.ts +3 -0
  14. package/src/commands/deinstall/deinstall.ts +19 -0
  15. package/src/commands/deinstall/index.ts +11 -0
  16. package/src/commands/deinstall/log.ts +3 -0
  17. package/src/commands/deploy/DeployOptions.ts +6 -0
  18. package/src/commands/deploy/deploy.ts +39 -0
  19. package/src/commands/deploy/deployIos.ts +48 -0
  20. package/src/commands/deploy/index.ts +20 -0
  21. package/src/commands/deploy/log.ts +3 -0
  22. package/src/commands/deploy/setSsr.ts +25 -0
  23. package/src/commands/dev/DevOptions.ts +4 -0
  24. package/src/commands/dev/dev.ts +15 -0
  25. package/src/commands/dev/devIos.ts +23 -0
  26. package/src/commands/dev/index.ts +12 -0
  27. package/src/commands/dev/log.ts +3 -0
  28. package/src/commands/generate/GenerateOptions.ts +9 -0
  29. package/src/commands/generate/generate.ts +29 -0
  30. package/src/commands/generate/generateCommand.ts +46 -0
  31. package/src/commands/generate/generateProject.ts +115 -0
  32. package/src/commands/generate/index.ts +19 -0
  33. package/src/commands/generate/log.ts +3 -0
  34. package/src/commands/index.ts +21 -0
  35. package/src/commands/reinstall/ReinstallOptions.ts +3 -0
  36. package/src/commands/reinstall/index.ts +11 -0
  37. package/src/commands/reinstall/log.ts +3 -0
  38. package/src/commands/reinstall/reinstall.ts +13 -0
  39. package/src/commands/release/ReleaseOptions.ts +8 -0
  40. package/src/commands/release/index.ts +40 -0
  41. package/src/commands/release/log.ts +3 -0
  42. package/src/commands/release/publish.ts +18 -0
  43. package/src/commands/release/release.ts +24 -0
  44. package/src/commands/release/tag.ts +119 -0
  45. package/src/commands/upgrade/UpgradeOptions.ts +3 -0
  46. package/src/commands/upgrade/index.ts +10 -0
  47. package/src/commands/upgrade/log.ts +3 -0
  48. package/src/commands/upgrade/upgrade.ts +10 -0
  49. package/src/commands/version/VersionOptions.ts +7 -0
  50. package/src/commands/version/getPreid.ts +7 -0
  51. package/src/commands/version/index.ts +18 -0
  52. package/src/commands/version/log.ts +3 -0
  53. package/src/commands/version/pimpChangelogs.ts +43 -0
  54. package/src/commands/version/version.ts +33 -0
  55. package/src/constants.ts +5 -0
  56. package/src/index.ts +24 -0
  57. package/src/preAction.ts +93 -0
  58. package/src/scripts/cmd/cd.ts +9 -0
  59. package/src/scripts/cmd/{executeBash.d.ts → executeBash.ts} +20 -10
  60. package/src/scripts/cmd/executeCmd.ts +23 -0
  61. package/src/scripts/cmd/{getBashOutput.d.ts → getBashOutput.ts} +23 -10
  62. package/src/scripts/cmd/getCmdOutput.ts +26 -0
  63. package/src/scripts/cmd/{index.d.ts → index.ts} +10 -8
  64. package/src/scripts/cmd/log.ts +3 -0
  65. package/src/scripts/cmd/parseArgs.ts +44 -0
  66. package/src/scripts/cmd/parseBashArgs.ts +21 -0
  67. package/src/scripts/cmd/types.ts +13 -0
  68. package/src/scripts/filesystem/copyDir.ts +29 -0
  69. package/src/scripts/filesystem/copyFiles.ts +75 -0
  70. package/src/scripts/filesystem/findFile.ts +29 -0
  71. package/src/scripts/filesystem/index.ts +15 -0
  72. package/src/scripts/filesystem/loadJsonFile.ts +17 -0
  73. package/src/scripts/filesystem/log.ts +3 -0
  74. package/src/scripts/filesystem/readDirRecursive.ts +21 -0
  75. package/src/scripts/git/branch/branchDelete.ts +32 -0
  76. package/src/scripts/git/branch/branchExists.ts +14 -0
  77. package/src/scripts/git/branch/checkout.ts +19 -0
  78. package/src/scripts/git/branch/getCurrentBranch.ts +37 -0
  79. package/src/scripts/git/clone.ts +20 -0
  80. package/src/scripts/git/commit.sh +0 -0
  81. package/src/scripts/git/getRepo.ts +11 -0
  82. package/src/scripts/git/index.ts +44 -0
  83. package/src/scripts/git/log.ts +3 -0
  84. package/src/scripts/git/openPr.ts +21 -0
  85. package/src/scripts/git/remoteStatus.ts +28 -0
  86. package/src/scripts/git/tag/createTag.ts +28 -0
  87. package/src/scripts/git/tag/deleteTag.ts +11 -0
  88. package/src/scripts/git/tag/getTags.ts +6 -0
  89. package/src/scripts/git/tag/pushAllTags.ts +6 -0
  90. package/src/scripts/git/tag/renameTag.ts +12 -0
  91. package/src/scripts/lerna/changed.ts +11 -0
  92. package/src/scripts/lerna/constants.ts +6 -0
  93. package/src/scripts/lerna/filterByDependency.ts +21 -0
  94. package/src/scripts/lerna/getConfig.ts +12 -0
  95. package/src/scripts/lerna/getDependencies.ts +25 -0
  96. package/src/scripts/lerna/getDetails.ts +44 -0
  97. package/src/scripts/lerna/index.ts +18 -0
  98. package/src/scripts/lerna/log.ts +3 -0
  99. package/src/scripts/lerna/publish.sh +0 -0
  100. package/src/scripts/lerna/types.ts +64 -0
  101. package/src/scripts/lerna/version.sh +1 -1
  102. package/src/utils/chalk.ts +4 -0
  103. package/src/utils/common.ts +16 -0
  104. package/src/utils/{index.d.ts → index.ts} +3 -4
  105. package/src/utils/inquirer.ts +20 -0
  106. package/src/utils/logger.ts +51 -0
  107. package/tsconfig.json +28 -0
  108. package/src/GlobalOptions.d.ts +0 -8
  109. package/src/GlobalOptions.d.ts.map +0 -1
  110. package/src/GlobalOptions.js +0 -2
  111. package/src/commands/blank/BlankOptions.d.ts +0 -4
  112. package/src/commands/blank/BlankOptions.d.ts.map +0 -1
  113. package/src/commands/blank/BlankOptions.js +0 -2
  114. package/src/commands/blank/blank.d.ts +0 -3
  115. package/src/commands/blank/blank.d.ts.map +0 -1
  116. package/src/commands/blank/blank.js +0 -8
  117. package/src/commands/blank/index.d.ts +0 -4
  118. package/src/commands/blank/index.d.ts.map +0 -1
  119. package/src/commands/blank/index.js +0 -9
  120. package/src/commands/blank/log.d.ts +0 -2
  121. package/src/commands/blank/log.d.ts.map +0 -1
  122. package/src/commands/blank/log.js +0 -5
  123. package/src/commands/build/BuildOptions.d.ts +0 -4
  124. package/src/commands/build/BuildOptions.d.ts.map +0 -1
  125. package/src/commands/build/BuildOptions.js +0 -2
  126. package/src/commands/build/build.d.ts +0 -3
  127. package/src/commands/build/build.d.ts.map +0 -1
  128. package/src/commands/build/build.js +0 -22
  129. package/src/commands/build/index.d.ts +0 -4
  130. package/src/commands/build/index.d.ts.map +0 -1
  131. package/src/commands/build/index.js +0 -9
  132. package/src/commands/build/log.d.ts +0 -2
  133. package/src/commands/build/log.d.ts.map +0 -1
  134. package/src/commands/build/log.js +0 -5
  135. package/src/commands/danka/DankaOptions.d.ts +0 -4
  136. package/src/commands/danka/DankaOptions.d.ts.map +0 -1
  137. package/src/commands/danka/DankaOptions.js +0 -2
  138. package/src/commands/danka/danka.d.ts +0 -3
  139. package/src/commands/danka/danka.d.ts.map +0 -1
  140. package/src/commands/danka/danka.js +0 -8
  141. package/src/commands/danka/index.d.ts +0 -4
  142. package/src/commands/danka/index.d.ts.map +0 -1
  143. package/src/commands/danka/index.js +0 -9
  144. package/src/commands/danka/log.d.ts +0 -2
  145. package/src/commands/danka/log.d.ts.map +0 -1
  146. package/src/commands/danka/log.js +0 -5
  147. package/src/commands/deinstall/DeinstallOptions.d.ts +0 -4
  148. package/src/commands/deinstall/DeinstallOptions.d.ts.map +0 -1
  149. package/src/commands/deinstall/DeinstallOptions.js +0 -2
  150. package/src/commands/deinstall/deinstall.d.ts +0 -3
  151. package/src/commands/deinstall/deinstall.d.ts.map +0 -1
  152. package/src/commands/deinstall/deinstall.js +0 -21
  153. package/src/commands/deinstall/index.d.ts +0 -4
  154. package/src/commands/deinstall/index.d.ts.map +0 -1
  155. package/src/commands/deinstall/index.js +0 -9
  156. package/src/commands/deinstall/log.d.ts +0 -2
  157. package/src/commands/deinstall/log.d.ts.map +0 -1
  158. package/src/commands/deinstall/log.js +0 -5
  159. package/src/commands/deploy/DeployOptions.d.ts +0 -7
  160. package/src/commands/deploy/DeployOptions.d.ts.map +0 -1
  161. package/src/commands/deploy/DeployOptions.js +0 -2
  162. package/src/commands/deploy/deploy.d.ts +0 -3
  163. package/src/commands/deploy/deploy.d.ts.map +0 -1
  164. package/src/commands/deploy/deploy.js +0 -33
  165. package/src/commands/deploy/deployIos.d.ts +0 -2
  166. package/src/commands/deploy/deployIos.d.ts.map +0 -1
  167. package/src/commands/deploy/deployIos.js +0 -44
  168. package/src/commands/deploy/index.d.ts +0 -4
  169. package/src/commands/deploy/index.d.ts.map +0 -1
  170. package/src/commands/deploy/index.js +0 -12
  171. package/src/commands/deploy/log.d.ts +0 -2
  172. package/src/commands/deploy/log.d.ts.map +0 -1
  173. package/src/commands/deploy/log.js +0 -5
  174. package/src/commands/deploy/setSsr.d.ts +0 -2
  175. package/src/commands/deploy/setSsr.d.ts.map +0 -1
  176. package/src/commands/deploy/setSsr.js +0 -25
  177. package/src/commands/dev/DevOptions.d.ts +0 -5
  178. package/src/commands/dev/DevOptions.d.ts.map +0 -1
  179. package/src/commands/dev/DevOptions.js +0 -2
  180. package/src/commands/dev/dev.d.ts +0 -3
  181. package/src/commands/dev/dev.d.ts.map +0 -1
  182. package/src/commands/dev/dev.js +0 -16
  183. package/src/commands/dev/devIos.d.ts +0 -3
  184. package/src/commands/dev/devIos.d.ts.map +0 -1
  185. package/src/commands/dev/devIos.js +0 -26
  186. package/src/commands/dev/index.d.ts +0 -4
  187. package/src/commands/dev/index.d.ts.map +0 -1
  188. package/src/commands/dev/index.js +0 -10
  189. package/src/commands/dev/log.d.ts +0 -2
  190. package/src/commands/dev/log.d.ts.map +0 -1
  191. package/src/commands/dev/log.js +0 -5
  192. package/src/commands/generate/GenerateOptions.d.ts +0 -9
  193. package/src/commands/generate/GenerateOptions.d.ts.map +0 -1
  194. package/src/commands/generate/GenerateOptions.js +0 -4
  195. package/src/commands/generate/generate.d.ts +0 -3
  196. package/src/commands/generate/generate.d.ts.map +0 -1
  197. package/src/commands/generate/generate.js +0 -22
  198. package/src/commands/generate/generateCommand.d.ts +0 -2
  199. package/src/commands/generate/generateCommand.d.ts.map +0 -1
  200. package/src/commands/generate/generateCommand.js +0 -36
  201. package/src/commands/generate/generateProject.d.ts +0 -3
  202. package/src/commands/generate/generateProject.d.ts.map +0 -1
  203. package/src/commands/generate/generateProject.js +0 -85
  204. package/src/commands/generate/index.d.ts +0 -4
  205. package/src/commands/generate/index.d.ts.map +0 -1
  206. package/src/commands/generate/index.js +0 -14
  207. package/src/commands/generate/log.d.ts +0 -2
  208. package/src/commands/generate/log.d.ts.map +0 -1
  209. package/src/commands/generate/log.js +0 -5
  210. package/src/commands/index.d.ts +0 -3
  211. package/src/commands/index.d.ts.map +0 -1
  212. package/src/commands/index.js +0 -25
  213. package/src/commands/kiss/KissOptions.d.ts +0 -4
  214. package/src/commands/kiss/KissOptions.d.ts.map +0 -1
  215. package/src/commands/kiss/KissOptions.js +0 -2
  216. package/src/commands/kiss/index.d.ts +0 -4
  217. package/src/commands/kiss/index.d.ts.map +0 -1
  218. package/src/commands/kiss/index.js +0 -9
  219. package/src/commands/kiss/kiss.d.ts +0 -3
  220. package/src/commands/kiss/kiss.d.ts.map +0 -1
  221. package/src/commands/kiss/kiss.js +0 -8
  222. package/src/commands/kiss/log.d.ts +0 -2
  223. package/src/commands/kiss/log.d.ts.map +0 -1
  224. package/src/commands/kiss/log.js +0 -5
  225. package/src/commands/reinstall/ReinstallOptions.d.ts +0 -4
  226. package/src/commands/reinstall/ReinstallOptions.d.ts.map +0 -1
  227. package/src/commands/reinstall/ReinstallOptions.js +0 -2
  228. package/src/commands/reinstall/index.d.ts +0 -4
  229. package/src/commands/reinstall/index.d.ts.map +0 -1
  230. package/src/commands/reinstall/index.js +0 -9
  231. package/src/commands/reinstall/log.d.ts +0 -2
  232. package/src/commands/reinstall/log.d.ts.map +0 -1
  233. package/src/commands/reinstall/log.js +0 -5
  234. package/src/commands/reinstall/reinstall.d.ts +0 -3
  235. package/src/commands/reinstall/reinstall.d.ts.map +0 -1
  236. package/src/commands/reinstall/reinstall.js +0 -14
  237. package/src/commands/release/ReleaseOptions.d.ts +0 -9
  238. package/src/commands/release/ReleaseOptions.d.ts.map +0 -1
  239. package/src/commands/release/ReleaseOptions.js +0 -2
  240. package/src/commands/release/index.d.ts +0 -4
  241. package/src/commands/release/index.d.ts.map +0 -1
  242. package/src/commands/release/index.js +0 -22
  243. package/src/commands/release/log.d.ts +0 -2
  244. package/src/commands/release/log.d.ts.map +0 -1
  245. package/src/commands/release/log.js +0 -5
  246. package/src/commands/release/publish.d.ts +0 -3
  247. package/src/commands/release/publish.d.ts.map +0 -1
  248. package/src/commands/release/publish.js +0 -18
  249. package/src/commands/release/release.d.ts +0 -3
  250. package/src/commands/release/release.d.ts.map +0 -1
  251. package/src/commands/release/release.js +0 -24
  252. package/src/commands/release/tag.d.ts +0 -23
  253. package/src/commands/release/tag.d.ts.map +0 -1
  254. package/src/commands/release/tag.js +0 -90
  255. package/src/commands/upgrade/UpgradeOptions.d.ts +0 -4
  256. package/src/commands/upgrade/UpgradeOptions.d.ts.map +0 -1
  257. package/src/commands/upgrade/UpgradeOptions.js +0 -2
  258. package/src/commands/upgrade/index.d.ts +0 -4
  259. package/src/commands/upgrade/index.d.ts.map +0 -1
  260. package/src/commands/upgrade/index.js +0 -9
  261. package/src/commands/upgrade/log.d.ts +0 -2
  262. package/src/commands/upgrade/log.d.ts.map +0 -1
  263. package/src/commands/upgrade/log.js +0 -5
  264. package/src/commands/upgrade/upgrade.d.ts +0 -3
  265. package/src/commands/upgrade/upgrade.d.ts.map +0 -1
  266. package/src/commands/upgrade/upgrade.js +0 -11
  267. package/src/commands/version/VersionOptions.d.ts +0 -8
  268. package/src/commands/version/VersionOptions.d.ts.map +0 -1
  269. package/src/commands/version/VersionOptions.js +0 -2
  270. package/src/commands/version/getPreid.d.ts +0 -2
  271. package/src/commands/version/getPreid.d.ts.map +0 -1
  272. package/src/commands/version/getPreid.js +0 -10
  273. package/src/commands/version/index.d.ts +0 -4
  274. package/src/commands/version/index.d.ts.map +0 -1
  275. package/src/commands/version/index.js +0 -12
  276. package/src/commands/version/log.d.ts +0 -2
  277. package/src/commands/version/log.d.ts.map +0 -1
  278. package/src/commands/version/log.js +0 -5
  279. package/src/commands/version/pimpChangelogs.d.ts +0 -2
  280. package/src/commands/version/pimpChangelogs.d.ts.map +0 -1
  281. package/src/commands/version/pimpChangelogs.js +0 -37
  282. package/src/commands/version/version.d.ts +0 -3
  283. package/src/commands/version/version.d.ts.map +0 -1
  284. package/src/commands/version/version.js +0 -33
  285. package/src/constants.d.ts +0 -4
  286. package/src/constants.d.ts.map +0 -1
  287. package/src/constants.js +0 -7
  288. package/src/index.d.ts +0 -3
  289. package/src/index.d.ts.map +0 -1
  290. package/src/index.js +0 -24
  291. package/src/preAction.d.ts +0 -3
  292. package/src/preAction.d.ts.map +0 -1
  293. package/src/preAction.js +0 -76
  294. package/src/scripts/cmd/cd.d.ts +0 -2
  295. package/src/scripts/cmd/cd.d.ts.map +0 -1
  296. package/src/scripts/cmd/cd.js +0 -15
  297. package/src/scripts/cmd/executeBash.d.ts.map +0 -1
  298. package/src/scripts/cmd/executeBash.js +0 -21
  299. package/src/scripts/cmd/executeCmd.d.ts +0 -9
  300. package/src/scripts/cmd/executeCmd.d.ts.map +0 -1
  301. package/src/scripts/cmd/executeCmd.js +0 -23
  302. package/src/scripts/cmd/getBashOutput.d.ts.map +0 -1
  303. package/src/scripts/cmd/getBashOutput.js +0 -19
  304. package/src/scripts/cmd/getCmdOutput.d.ts +0 -10
  305. package/src/scripts/cmd/getCmdOutput.d.ts.map +0 -1
  306. package/src/scripts/cmd/getCmdOutput.js +0 -26
  307. package/src/scripts/cmd/index.d.ts.map +0 -1
  308. package/src/scripts/cmd/index.js +0 -25
  309. package/src/scripts/cmd/log.d.ts +0 -2
  310. package/src/scripts/cmd/log.d.ts.map +0 -1
  311. package/src/scripts/cmd/log.js +0 -5
  312. package/src/scripts/cmd/parseArgs.d.ts +0 -3
  313. package/src/scripts/cmd/parseArgs.d.ts.map +0 -1
  314. package/src/scripts/cmd/parseArgs.js +0 -41
  315. package/src/scripts/cmd/parseBashArgs.d.ts +0 -3
  316. package/src/scripts/cmd/parseBashArgs.d.ts.map +0 -1
  317. package/src/scripts/cmd/parseBashArgs.js +0 -16
  318. package/src/scripts/cmd/types.d.ts +0 -12
  319. package/src/scripts/cmd/types.d.ts.map +0 -1
  320. package/src/scripts/cmd/types.js +0 -2
  321. package/src/scripts/filesystem/copyDir.d.ts +0 -9
  322. package/src/scripts/filesystem/copyDir.d.ts.map +0 -1
  323. package/src/scripts/filesystem/copyDir.js +0 -26
  324. package/src/scripts/filesystem/copyFiles.d.ts +0 -11
  325. package/src/scripts/filesystem/copyFiles.d.ts.map +0 -1
  326. package/src/scripts/filesystem/copyFiles.js +0 -59
  327. package/src/scripts/filesystem/findFile.d.ts +0 -2
  328. package/src/scripts/filesystem/findFile.d.ts.map +0 -1
  329. package/src/scripts/filesystem/findFile.js +0 -24
  330. package/src/scripts/filesystem/index.d.ts +0 -10
  331. package/src/scripts/filesystem/index.d.ts.map +0 -1
  332. package/src/scripts/filesystem/index.js +0 -17
  333. package/src/scripts/filesystem/loadJsonFile.d.ts +0 -2
  334. package/src/scripts/filesystem/loadJsonFile.d.ts.map +0 -1
  335. package/src/scripts/filesystem/loadJsonFile.js +0 -18
  336. package/src/scripts/filesystem/log.d.ts +0 -2
  337. package/src/scripts/filesystem/log.d.ts.map +0 -1
  338. package/src/scripts/filesystem/log.js +0 -5
  339. package/src/scripts/filesystem/readDirRecursive.d.ts +0 -2
  340. package/src/scripts/filesystem/readDirRecursive.d.ts.map +0 -1
  341. package/src/scripts/filesystem/readDirRecursive.js +0 -16
  342. package/src/scripts/git/branch/branchDelete.d.ts +0 -6
  343. package/src/scripts/git/branch/branchDelete.d.ts.map +0 -1
  344. package/src/scripts/git/branch/branchDelete.js +0 -24
  345. package/src/scripts/git/branch/branchExists.d.ts +0 -5
  346. package/src/scripts/git/branch/branchExists.d.ts.map +0 -1
  347. package/src/scripts/git/branch/branchExists.js +0 -15
  348. package/src/scripts/git/branch/checkout.d.ts +0 -5
  349. package/src/scripts/git/branch/checkout.d.ts.map +0 -1
  350. package/src/scripts/git/branch/checkout.js +0 -15
  351. package/src/scripts/git/branch/getCurrentBranch.d.ts +0 -11
  352. package/src/scripts/git/branch/getCurrentBranch.d.ts.map +0 -1
  353. package/src/scripts/git/branch/getCurrentBranch.js +0 -28
  354. package/src/scripts/git/clone.d.ts +0 -10
  355. package/src/scripts/git/clone.d.ts.map +0 -1
  356. package/src/scripts/git/clone.js +0 -14
  357. package/src/scripts/git/getRepo.d.ts +0 -2
  358. package/src/scripts/git/getRepo.d.ts.map +0 -1
  359. package/src/scripts/git/getRepo.js +0 -13
  360. package/src/scripts/git/index.d.ts +0 -29
  361. package/src/scripts/git/index.d.ts.map +0 -1
  362. package/src/scripts/git/index.js +0 -40
  363. package/src/scripts/git/log.d.ts +0 -2
  364. package/src/scripts/git/log.d.ts.map +0 -1
  365. package/src/scripts/git/log.js +0 -5
  366. package/src/scripts/git/openPr.d.ts +0 -2
  367. package/src/scripts/git/openPr.d.ts.map +0 -1
  368. package/src/scripts/git/openPr.js +0 -20
  369. package/src/scripts/git/remoteStatus.d.ts +0 -3
  370. package/src/scripts/git/remoteStatus.d.ts.map +0 -1
  371. package/src/scripts/git/remoteStatus.js +0 -22
  372. package/src/scripts/git/tag/createTag.d.ts +0 -18
  373. package/src/scripts/git/tag/createTag.d.ts.map +0 -1
  374. package/src/scripts/git/tag/createTag.js +0 -18
  375. package/src/scripts/git/tag/deleteTag.d.ts +0 -2
  376. package/src/scripts/git/tag/deleteTag.d.ts.map +0 -1
  377. package/src/scripts/git/tag/deleteTag.js +0 -13
  378. package/src/scripts/git/tag/getTags.d.ts +0 -2
  379. package/src/scripts/git/tag/getTags.d.ts.map +0 -1
  380. package/src/scripts/git/tag/getTags.js +0 -8
  381. package/src/scripts/git/tag/pushAllTags.d.ts +0 -2
  382. package/src/scripts/git/tag/pushAllTags.d.ts.map +0 -1
  383. package/src/scripts/git/tag/pushAllTags.js +0 -8
  384. package/src/scripts/git/tag/renameTag.d.ts +0 -2
  385. package/src/scripts/git/tag/renameTag.d.ts.map +0 -1
  386. package/src/scripts/git/tag/renameTag.js +0 -14
  387. package/src/scripts/lerna/changed.d.ts +0 -3
  388. package/src/scripts/lerna/changed.d.ts.map +0 -1
  389. package/src/scripts/lerna/changed.js +0 -13
  390. package/src/scripts/lerna/constants.d.ts +0 -5
  391. package/src/scripts/lerna/constants.d.ts.map +0 -1
  392. package/src/scripts/lerna/constants.js +0 -7
  393. package/src/scripts/lerna/filterByDependency.d.ts +0 -7
  394. package/src/scripts/lerna/filterByDependency.d.ts.map +0 -1
  395. package/src/scripts/lerna/filterByDependency.js +0 -18
  396. package/src/scripts/lerna/getConfig.d.ts +0 -3
  397. package/src/scripts/lerna/getConfig.d.ts.map +0 -1
  398. package/src/scripts/lerna/getConfig.js +0 -13
  399. package/src/scripts/lerna/getDependencies.d.ts +0 -9
  400. package/src/scripts/lerna/getDependencies.d.ts.map +0 -1
  401. package/src/scripts/lerna/getDependencies.js +0 -23
  402. package/src/scripts/lerna/getDetails.d.ts +0 -3
  403. package/src/scripts/lerna/getDetails.d.ts.map +0 -1
  404. package/src/scripts/lerna/getDetails.js +0 -38
  405. package/src/scripts/lerna/index.d.ts +0 -14
  406. package/src/scripts/lerna/index.d.ts.map +0 -1
  407. package/src/scripts/lerna/index.js +0 -19
  408. package/src/scripts/lerna/log.d.ts +0 -2
  409. package/src/scripts/lerna/log.d.ts.map +0 -1
  410. package/src/scripts/lerna/log.js +0 -5
  411. package/src/scripts/lerna/types.d.ts +0 -62
  412. package/src/scripts/lerna/types.d.ts.map +0 -1
  413. package/src/scripts/lerna/types.js +0 -2
  414. package/src/utils/chalk.d.ts +0 -4
  415. package/src/utils/chalk.d.ts.map +0 -1
  416. package/src/utils/chalk.js +0 -9
  417. package/src/utils/common.d.ts +0 -8
  418. package/src/utils/common.d.ts.map +0 -1
  419. package/src/utils/common.js +0 -21
  420. package/src/utils/index.d.ts.map +0 -1
  421. package/src/utils/index.js +0 -19
  422. package/src/utils/inquirer.d.ts +0 -5
  423. package/src/utils/inquirer.d.ts.map +0 -1
  424. package/src/utils/inquirer.js +0 -21
  425. package/src/utils/logger.d.ts +0 -9
  426. package/src/utils/logger.d.ts.map +0 -1
  427. package/src/utils/logger.js +0 -36
@@ -0,0 +1,21 @@
1
+ import build from "./build";
2
+ import deinstall from "./deinstall";
3
+ import deploy from "./deploy";
4
+ import generate from "./generate";
5
+ import reinstall from "./reinstall";
6
+ import release from "./release";
7
+ import version from "./version";
8
+ import upgrade from "./upgrade";
9
+ import dev from "./dev";
10
+
11
+ export default [
12
+ deploy,
13
+ version,
14
+ release,
15
+ build,
16
+ deinstall,
17
+ reinstall,
18
+ generate,
19
+ upgrade,
20
+ dev,
21
+ ];
@@ -0,0 +1,3 @@
1
+ export interface ReinstallOptions {
2
+ packages?: boolean;
3
+ }
@@ -0,0 +1,11 @@
1
+ import { Command } from "commander";
2
+ import { reinstall } from "./reinstall";
3
+
4
+ export default new Command()
5
+ .name("reinstall")
6
+ .description("Reinstall npm dependencies with a fresh package-lock.json.")
7
+ .option(
8
+ "-p, --packages",
9
+ "Reinstall dependencies in when using multiple packages (monorepo)."
10
+ )
11
+ .action(reinstall);
@@ -0,0 +1,3 @@
1
+ import { logger } from "src/utils";
2
+
3
+ export const log = logger("reinstall");
@@ -0,0 +1,13 @@
1
+ import { executeCmd } from "src/scripts/cmd";
2
+ import { ReinstallOptions } from "./ReinstallOptions";
3
+ import { log } from "./log";
4
+ import { deinstall } from "../deinstall/deinstall";
5
+
6
+ export const reinstall = (options: ReinstallOptions) => {
7
+ // Run deinstall first
8
+ deinstall(options);
9
+
10
+ // Install dependencies
11
+ log.info("Reinstalling packages.");
12
+ executeCmd("npm install");
13
+ };
@@ -0,0 +1,8 @@
1
+ export interface ReleaseOptions {
2
+ pre: boolean | string;
3
+ dev: boolean;
4
+ directory: string;
5
+ yes: boolean;
6
+ version: boolean;
7
+ gitTag: boolean | string;
8
+ }
@@ -0,0 +1,40 @@
1
+ import { Command } from "commander";
2
+ import { release } from "./release";
3
+ import { pattern } from "./tag";
4
+
5
+ export default new Command()
6
+ .name("release")
7
+ .description("Release and publish packages to the npm registry.")
8
+ .option(
9
+ "-y, --yes",
10
+ "When run with this flag, we will skip all confirmation prompts. NOTE does not currently work.",
11
+ false
12
+ )
13
+ .option(
14
+ "--pre [id]",
15
+ "Prerelease identifier. Use this when releasing a prerelease version.",
16
+ false
17
+ )
18
+ .option(
19
+ "-d, --dev",
20
+ "Release a dev version. This is a shorthand for a prerelease with a 'dev' identifier.",
21
+ false
22
+ )
23
+ .option(
24
+ "--dir, --directory <path>",
25
+ "Subdirectory to publish. Must apply to ALL packages, and MUST contain a package.json file.",
26
+ "dist"
27
+ )
28
+ .option("--no-version", "Disable versioning and changelog gen.")
29
+ .option(
30
+ "--git-tag [tag]",
31
+ [
32
+ "Create and push git tag(s). Optionally provide a template.",
33
+ "Template placeholders:",
34
+ `"${pattern.fullPackageName}" (full package name, e.g. "@gluhar/cli"),`,
35
+ `"${pattern.shortPackageName}" (short package name, e.g. "cli"),`,
36
+ `"${pattern.version}" (released package version, e.g. "1.2.3").`,
37
+ `When set to "true" defaults to: "${pattern.default.independent}" for independent versioning and "${pattern.default.fixed}" for fixed.`,
38
+ ].join("\n")
39
+ )
40
+ .action(release);
@@ -0,0 +1,3 @@
1
+ import { logger } from 'src/utils';
2
+
3
+ export const log = logger('release');
@@ -0,0 +1,18 @@
1
+ import { lerna } from "src/scripts/lerna";
2
+ import type { ReleaseOptions } from "./ReleaseOptions";
3
+ import { log } from "./log";
4
+ import { getPreid } from "../version/getPreid";
5
+
6
+ export const publish = (options: ReleaseOptions) => {
7
+ const { yes, pre, dev, directory } = options;
8
+
9
+ const distTag = dev ? "dev" : getPreid(pre) ?? "latest";
10
+ log.info("Dist tag:", distTag);
11
+ log.info("Directory:", directory);
12
+
13
+ lerna.publish({
14
+ distTag,
15
+ contents: directory,
16
+ yes,
17
+ });
18
+ };
@@ -0,0 +1,24 @@
1
+ import { version } from "../version/version";
2
+ import type { ReleaseOptions } from "./ReleaseOptions";
3
+ import { log } from "./log";
4
+ import { publish } from "./publish";
5
+ import { tag } from "./tag";
6
+
7
+ export const release = async (options: ReleaseOptions) => {
8
+ log.info("Initiating release...");
9
+ const { pre, dev, yes } = options;
10
+ if (yes) log.info("and saying yes to all prompts.");
11
+
12
+ if (options.version)
13
+ await version({
14
+ pre,
15
+ dev,
16
+ yes,
17
+ changelog: !dev,
18
+ commit: "chore: Releasing gluhar packages.",
19
+ });
20
+
21
+ publish(options);
22
+
23
+ await tag(options);
24
+ };
@@ -0,0 +1,119 @@
1
+ import { lerna } from "src/scripts/lerna";
2
+ import { INDEPENDENT_VERSION } from "src/scripts/lerna/constants";
3
+ import { git } from "src/scripts/git";
4
+ import { confirmQuestion } from "src/utils";
5
+ import type { ReleaseOptions } from "./ReleaseOptions";
6
+ import { log } from "./log";
7
+
8
+ export const pattern = {
9
+ /** e.g. `@gluhar/cli` */
10
+ fullPackageName: "%f",
11
+ /** e.g. `cli` */
12
+ shortPackageName: "%s",
13
+ /** e.g. `1.2.3` */
14
+ version: "%v",
15
+ default: {
16
+ /** e.g. `cli/v1.2.3` */
17
+ independent: "%f@%v",
18
+ /** e.g. `v1.2.3` */
19
+ fixed: "v%v",
20
+ },
21
+ };
22
+
23
+ const getGitTagPattern = (
24
+ gitTag: ReleaseOptions["gitTag"],
25
+ isIndependent: boolean
26
+ ) => {
27
+ if (typeof gitTag === "string") {
28
+ return gitTag;
29
+ }
30
+
31
+ if (!gitTag) {
32
+ return null;
33
+ }
34
+
35
+ return isIndependent ? pattern.default.independent : pattern.default.fixed;
36
+ };
37
+
38
+ export interface PackageInfo {
39
+ /** Required for independent versioning. */
40
+ name?: string;
41
+ version: string;
42
+ }
43
+
44
+ export const parsePattern = (tagPattern: string, pkg: PackageInfo): string => {
45
+ const { name: fullName, version } = pkg;
46
+ const placeholders: { pattern: string; value: string }[] = [
47
+ {
48
+ pattern: pattern.version,
49
+ value: version,
50
+ },
51
+ ];
52
+
53
+ if (fullName) {
54
+ const shortName = fullName.substring(fullName.indexOf("/") + 1);
55
+ placeholders.push({
56
+ pattern: pattern.fullPackageName,
57
+ value: fullName,
58
+ });
59
+ placeholders.push({
60
+ pattern: pattern.shortPackageName,
61
+ value: shortName,
62
+ });
63
+ }
64
+
65
+ return placeholders.reduce(
66
+ (t, ph) => t.replaceAll(ph.pattern, ph.value),
67
+ tagPattern
68
+ );
69
+ };
70
+
71
+ export const tag = async (options: ReleaseOptions) => {
72
+ const { gitTag, yes } = options;
73
+ if (!gitTag) {
74
+ return;
75
+ }
76
+
77
+ const lernaConfig = lerna.getConfig();
78
+ const isIndependent =
79
+ !!lernaConfig && lernaConfig.version === INDEPENDENT_VERSION;
80
+
81
+ const tagPattern = getGitTagPattern(gitTag, isIndependent);
82
+ if (!tagPattern) {
83
+ return;
84
+ }
85
+
86
+ const tags = new Set<string>();
87
+
88
+ if (
89
+ !lernaConfig ||
90
+ isIndependent ||
91
+ tagPattern.includes(pattern.fullPackageName) ||
92
+ tagPattern.includes(pattern.shortPackageName)
93
+ ) {
94
+ lerna
95
+ .changed()
96
+ .filter((pkg) => !pkg.private)
97
+ .map((pkg) => parsePattern(tagPattern, pkg))
98
+ .forEach((t) => tags.add(t));
99
+ } else {
100
+ const t = parsePattern(tagPattern, { version: lernaConfig.version });
101
+ tags.add(t);
102
+ }
103
+
104
+ const tagList = [...tags].map((t) => `\n - ${t}`).join("");
105
+ log.verbose("Tags to create:", tagList);
106
+
107
+ const confirm = await confirmQuestion(
108
+ `Create and push tag(s): ${tagList}. Confirm?`,
109
+ yes
110
+ );
111
+
112
+ if (confirm) {
113
+ tags.forEach((t) => {
114
+ git.tag.create(t);
115
+ });
116
+
117
+ git.tag.pushAll();
118
+ }
119
+ };
@@ -0,0 +1,3 @@
1
+ export interface UpgradeOptions {
2
+ upgrade: boolean;
3
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from "commander";
2
+ import { upgrade } from "./upgrade";
3
+
4
+ export default new Command()
5
+ .name("upgrade")
6
+ .description(
7
+ "Upgrade all gluhar dependencies in a project to their latest versions."
8
+ )
9
+ .option("-b, --upgrade", "A boolean option.")
10
+ .action(upgrade);
@@ -0,0 +1,3 @@
1
+ import { logger } from "src/utils";
2
+
3
+ export const log = logger("upgrade");
@@ -0,0 +1,10 @@
1
+ import { executeCmd } from "src/scripts/cmd";
2
+ import { UpgradeOptions } from "./UpgradeOptions";
3
+ import { log } from "./log";
4
+
5
+ export const upgrade = (options: UpgradeOptions) => {
6
+ log.info("Upgrading gluhar dependencies.");
7
+
8
+ // Upgrade all gluhar dependencies in a project to their latest versions.
9
+ executeCmd("npm update @gluhar/cli @gluhar/app");
10
+ };
@@ -0,0 +1,7 @@
1
+ export interface VersionOptions {
2
+ pre: boolean | string;
3
+ dev: boolean;
4
+ changelog: boolean;
5
+ commit: boolean | string;
6
+ yes?: boolean;
7
+ }
@@ -0,0 +1,7 @@
1
+ export const getPreid = (pre: boolean | string) => {
2
+ if (typeof pre === 'string') {
3
+ return pre;
4
+ }
5
+
6
+ return pre ? 'beta' : undefined;
7
+ };
@@ -0,0 +1,18 @@
1
+ import { Command } from "commander";
2
+ import { version } from "./version";
3
+
4
+ export default new Command()
5
+ .name("version")
6
+ .description("Update package versions and generate change logs.")
7
+ .option(
8
+ "--pre [id]",
9
+ "Prerelease identifier. Use this when creating a prerelease versioning.",
10
+ false
11
+ )
12
+ .option(
13
+ "-d, --dev",
14
+ "Release a dev version. This is a shorthand for a prerelease with a 'dev' identifier."
15
+ )
16
+ .option("--no-changelog", "Disable generating changelogs.")
17
+ .option("-c, --commit [msg]", "Commit changes in git.", false)
18
+ .action(version);
@@ -0,0 +1,3 @@
1
+ import { logger } from 'src/utils';
2
+
3
+ export const log = logger('version');
@@ -0,0 +1,43 @@
1
+ import { log } from "./log";
2
+ import { glob } from "glob";
3
+ import { join } from "path";
4
+ import { readFileSync, writeFileSync } from "fs";
5
+ import { capitalize } from "src/utils/common";
6
+
7
+ export const pimpChangelogs = async () => {
8
+ log.info("Pimping changelogs");
9
+
10
+ const g = join("packages", "**", "CHANGELOG.md");
11
+ const filePaths = await glob(g);
12
+
13
+ const changelogs = filePaths.map((fp) => {
14
+ const changelog = readFileSync(fp).toString();
15
+
16
+ const lines = changelog.split("\n").map((line) => {
17
+ if (line.substring(0, 2) === "* ") {
18
+ if (line.substring(0, 4) === "* **")
19
+ return `- ${line.substring(2).split("** ").map(capitalize).join("** ")}`;
20
+
21
+ return `- ${capitalize(line.substring(2))}`;
22
+ }
23
+
24
+ if (line.includes("**Note:**"))
25
+ return line.replace("**Note:**", "**📝 Note:**");
26
+
27
+ if (line.substring(0, 4) === "### ")
28
+ return line
29
+ .replace("### Features", "### 🚀 Enhancements")
30
+ .replace("### Bug Fixes", "### 🩹 Fixes")
31
+ .replace("### Chore", "### 🏡 Chore")
32
+ .replace("### Performance Improvements", "### 🔥 Performance");
33
+
34
+ return line;
35
+ });
36
+
37
+ return lines.join("\n");
38
+ });
39
+
40
+ await filePaths.forEach((file, idx) => {
41
+ writeFileSync(file, changelogs[idx]);
42
+ });
43
+ };
@@ -0,0 +1,33 @@
1
+ import { lerna } from "src/scripts/lerna";
2
+ import { git } from "src/scripts/git";
3
+ import type { VersionOptions } from "./VersionOptions";
4
+ import { log } from "./log";
5
+ import { getPreid } from "./getPreid";
6
+ import { pimpChangelogs } from "./pimpChangelogs";
7
+
8
+ export const version = async (options: VersionOptions) => {
9
+ const { pre, dev, changelog, commit, yes } = options;
10
+
11
+ lerna.version({
12
+ conventionalCommits: true,
13
+ conventionalGraduate: (!dev && !pre) || undefined,
14
+ conventionalPrerelease: !!dev || !!pre || undefined,
15
+ preid: dev ? "dev" : getPreid(pre),
16
+ includeMergedTags: true,
17
+ gitTagVersion: false,
18
+ private: false,
19
+ push: false,
20
+ changelog,
21
+ yes,
22
+ });
23
+
24
+ if (changelog) await pimpChangelogs();
25
+
26
+ if (commit) {
27
+ log.info("Commit changes.");
28
+ const msg = commit === true ? "chore: Prepare Release" : commit;
29
+ git.commit({
30
+ m: msg,
31
+ });
32
+ }
33
+ };
@@ -0,0 +1,5 @@
1
+ import { bin, version } from "../package.json";
2
+
3
+ export const PROGRAM_NAME = Object.keys(bin)[0];
4
+ export const VERSION = version;
5
+ export const CONFIG_FILE = `${PROGRAM_NAME}.json`;
package/src/index.ts ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { program } from "commander";
3
+ import { PROGRAM_NAME, VERSION } from "./constants";
4
+ import commands from "./commands";
5
+ import { preAction } from "./preAction";
6
+
7
+ program
8
+ .name(PROGRAM_NAME)
9
+ .description(
10
+ "A collection of commands and scripts for helping running, building, deploying and assisting in developing with Gluhar, Vue, Nuxt, Tailwind & Sanity."
11
+ )
12
+ .version(VERSION, "-v, --version", "Output the version number.")
13
+ .helpOption("-h, --help", "Display help for a command.")
14
+ .option("-l, --log-level <level>", "Set log level.", "info")
15
+ .option("-lp, --log-prefix <prefixes...>", "Set log prefixes.")
16
+ .option("--ci", "Enable CI mode. Full logging and no prompts.", false)
17
+ .option("--cwd <path>", "The current working directory for the scripts.")
18
+ .usage("<command> [options]")
19
+ .hook("preAction", preAction)
20
+ .action(() => program.outputHelp());
21
+
22
+ commands.forEach((cmd) => program.addCommand(cmd));
23
+
24
+ program.parse(process.argv);
@@ -0,0 +1,93 @@
1
+ import { existsSync } from "fs";
2
+ import type { Command } from "commander";
3
+ import { confirmQuestion, init, logger } from "./utils";
4
+ import type { GlobalOptions } from "./GlobalOptions";
5
+ import { cmd, executeCmd, getCmdOutput } from "./scripts/cmd";
6
+ import { PROGRAM_NAME, VERSION } from "./constants";
7
+ import { git } from "./scripts/git";
8
+ // import { getConfigOpt, setConfigOpt } from './config';
9
+
10
+ const getOptions = <T>(command: Command) => command.opts() as T;
11
+ const log = logger("cli");
12
+
13
+ // const loadConfig = (rootCmd: Command, actionCmd: Command) => {
14
+ // const config = getConfigOpt(actionCmd.name());
15
+ // setConfigOpt(config, rootCmd, actionCmd);
16
+ // };
17
+
18
+ const setupCi = (rootCmd: Command, actionCmd: Command) => {
19
+ const { ci } = getOptions<GlobalOptions>(rootCmd);
20
+ const ciSource = rootCmd.getOptionValueSource("ci") ?? "implied";
21
+
22
+ if (ci) {
23
+ rootCmd.setOptionValueWithSource("yes", true, ciSource);
24
+ actionCmd.setOptionValueWithSource("yes", true, ciSource);
25
+ rootCmd.setOptionValueWithSource("logLevel", "verbose", ciSource);
26
+ rootCmd.setOptionValueWithSource("logPrefix", undefined, ciSource);
27
+ }
28
+ };
29
+
30
+ const setupLogging = (rootCmd: Command) => {
31
+ const { logLevel, logPrefix } = getOptions<GlobalOptions>(rootCmd);
32
+ init(PROGRAM_NAME, logLevel, logPrefix);
33
+ };
34
+
35
+ const setup = (rootCmd: Command, actionCmd: Command) => {
36
+ setupCi(rootCmd, actionCmd);
37
+ setupLogging(rootCmd);
38
+ };
39
+
40
+ const logCli = (actionCmd: Command) => {
41
+ log.notice(`v${VERSION}`);
42
+
43
+ log.verbose("Calling command:", actionCmd.name());
44
+ log.verbose("arguments:", actionCmd.args);
45
+ log.verbose("options:", getOptions(actionCmd));
46
+ log.verbose("cwd:", process.cwd());
47
+ };
48
+
49
+ const checkCliVersion = async () => {
50
+ const hasGit = existsSync(".git");
51
+ if (hasGit && git.getRepo() === "gluhar") return;
52
+
53
+ const latestVersion = getCmdOutput("npm show @gluhar/cli version");
54
+
55
+ // Version is up to date
56
+ if (latestVersion === VERSION) return;
57
+
58
+ // Version is old, ask to install latest
59
+ const installLatest = await confirmQuestion(
60
+ `There is a newer version of the gluhar/cli available (v${latestVersion}). \nDo you want to install it now? (npm i -g @gluhar/cli)`
61
+ );
62
+ if (installLatest) {
63
+ executeCmd("npm i -g @gluhar/cli@latest");
64
+
65
+ // If we are in a project, also update the local version
66
+ const isLocal = !getCmdOutput("npm list @gluhar/cli --depth=0").includes(
67
+ "empty"
68
+ );
69
+ if (isLocal) executeCmd("npm update @gluhar/cli");
70
+ }
71
+ };
72
+
73
+ export const preAction = async (rootCmd: Command, actionCmd: Command) => {
74
+ // setup logging before loadConfig, so we can get logging from loadConfig
75
+ setup(rootCmd, actionCmd);
76
+
77
+ const { cwd: initCwd } = getOptions<GlobalOptions>(rootCmd);
78
+ if (initCwd) cmd.cd(initCwd);
79
+
80
+ // Check for newer cli version
81
+ await checkCliVersion();
82
+
83
+ // loadConfig(rootCmd, actionCmd);
84
+
85
+ const { cwd: newCwd } = getOptions<GlobalOptions>(rootCmd);
86
+ if (newCwd && newCwd !== initCwd) cmd.cd(newCwd);
87
+
88
+ // setup logging after loadConfig so we apply options from config
89
+ setup(rootCmd, actionCmd);
90
+
91
+ logCli(actionCmd);
92
+ if (initCwd) log.notice("from", initCwd);
93
+ };
@@ -0,0 +1,9 @@
1
+ import shell from 'shelljs';
2
+ import { log } from './log';
3
+
4
+ export const cd = (path: string) => {
5
+ const oldDir = process.cwd();
6
+ shell.cd(path);
7
+ const newDir = process.cwd();
8
+ log.verbose(`cd ${path}: ${oldDir} -> ${newDir}`);
9
+ };
@@ -1,10 +1,20 @@
1
- import type { Args } from './types';
2
- /**
3
- * Function that executes a bash script file in the same console from a given relative path. Can pass arguments/flags to the script.
4
- * @param path A path to a bash script file, relative to one directory up: 'lerna/bootstrap'.
5
- * @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
6
- * @param absolute Flag if you are providing an absolute path.
7
- * @returns Executes the bash script file in the same stdio.
8
- */
9
- export declare const executeBash: (path: string, args?: Args, absolute?: boolean) => import("child_process").SpawnSyncReturns<Buffer>;
10
- //# sourceMappingURL=executeBash.d.ts.map
1
+ import { spawnSync } from 'child_process';
2
+ import { parseBashArgs } from './parseBashArgs';
3
+ import type { Args } from './types';
4
+
5
+ /**
6
+ * Function that executes a bash script file in the same console from a given relative path. Can pass arguments/flags to the script.
7
+ * @param path A path to a bash script file, relative to one directory up: 'lerna/bootstrap'.
8
+ * @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
9
+ * @param absolute Flag if you are providing an absolute path.
10
+ * @returns Executes the bash script file in the same stdio.
11
+ */
12
+ export const executeBash = (path: string, args?: Args, absolute?: boolean) => {
13
+ const bashArgs = parseBashArgs(path, args, absolute);
14
+
15
+ // TODO make stdio configurable
16
+ // TODO make an async option
17
+ return spawnSync('bash', bashArgs, {
18
+ stdio: 'inherit',
19
+ });
20
+ };
@@ -0,0 +1,23 @@
1
+ import { spawnSync } from 'child_process';
2
+ import { log } from './log';
3
+ import type { Args } from './types';
4
+ import { parseArgs } from './parseArgs';
5
+
6
+ /**
7
+ * Function that executes a bash script from string.
8
+ * @param cmd A one-line string of a bash command: 'npm install'.
9
+ * @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
10
+ * @returns Executes the bash script in the same stdio.
11
+ */
12
+ export const executeCmd = (cmd: string, args?: Args) => {
13
+ const cmdArgs = [cmd];
14
+ if (args) {
15
+ cmdArgs.push(...parseArgs(args));
16
+ }
17
+
18
+ const fullCmd = cmdArgs.join(' ');
19
+ log.verbose('executeCmd:', fullCmd);
20
+ return spawnSync(fullCmd, { stdio: 'inherit', shell: true });
21
+ };
22
+
23
+ // TODO make an async option
@@ -1,10 +1,23 @@
1
- import type { Args } from './types';
2
- /**
3
- * Function that executes a bash script file from a given relative path and returns the output. Can pass arguments/flags to the script.
4
- * @param cmd A path to a bash script file, relative to one directory up: 'lerna/bootstrap'.
5
- * @param options Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
6
- * @param absolute Flag if you are providing an absolute path.
7
- * @returns The output of the bash file script as a string.
8
- */
9
- export declare const getBashOutput: (path: string, args?: Args, absolute?: boolean) => string;
10
- //# sourceMappingURL=getBashOutput.d.ts.map
1
+ import { log } from './log';
2
+ import { parseBashArgs } from './parseBashArgs';
3
+ import { getCmdOutput } from './getCmdOutput';
4
+ import type { Args } from './types';
5
+
6
+ /**
7
+ * Function that executes a bash script file from a given relative path and returns the output. Can pass arguments/flags to the script.
8
+ * @param cmd A path to a bash script file, relative to one directory up: 'lerna/bootstrap'.
9
+ * @param options Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
10
+ * @param absolute Flag if you are providing an absolute path.
11
+ * @returns The output of the bash file script as a string.
12
+ */
13
+ export const getBashOutput = (
14
+ path: string,
15
+ args?: Args,
16
+ absolute?: boolean,
17
+ ) => {
18
+ log.verbose('getBashOutput:', args);
19
+
20
+ const bashArgs = parseBashArgs(path, args, absolute).join(' ');
21
+
22
+ return getCmdOutput(`bash ${bashArgs}`);
23
+ };