piral-cli 1.0.0-pre.2217 → 1.0.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.
Files changed (408) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +30 -7
  3. package/lib/api.js +23 -23
  4. package/lib/api.js.map +1 -1
  5. package/lib/apps/add-piral-instance-pilet.d.ts +26 -0
  6. package/lib/apps/add-piral-instance-pilet.js +53 -0
  7. package/lib/apps/add-piral-instance-pilet.js.map +1 -0
  8. package/lib/apps/build-pilet.d.ts +33 -2
  9. package/lib/apps/build-pilet.js +159 -32
  10. package/lib/apps/build-pilet.js.map +1 -1
  11. package/lib/apps/build-piral.d.ts +18 -1
  12. package/lib/apps/build-piral.js +68 -52
  13. package/lib/apps/build-piral.js.map +1 -1
  14. package/lib/apps/debug-pilet.d.ts +38 -2
  15. package/lib/apps/debug-pilet.js +150 -108
  16. package/lib/apps/debug-pilet.js.map +1 -1
  17. package/lib/apps/debug-piral.d.ts +23 -0
  18. package/lib/apps/debug-piral.js +63 -52
  19. package/lib/apps/debug-piral.js.map +1 -1
  20. package/lib/apps/declaration-piral.js +5 -3
  21. package/lib/apps/declaration-piral.js.map +1 -1
  22. package/lib/apps/index.d.ts +3 -0
  23. package/lib/apps/index.js +8 -1
  24. package/lib/apps/index.js.map +1 -1
  25. package/lib/apps/new-pilet.d.ts +7 -3
  26. package/lib/apps/new-pilet.js +47 -52
  27. package/lib/apps/new-pilet.js.map +1 -1
  28. package/lib/apps/new-piral.d.ts +7 -3
  29. package/lib/apps/new-piral.js +33 -23
  30. package/lib/apps/new-piral.js.map +1 -1
  31. package/lib/apps/pack-pilet.d.ts +9 -0
  32. package/lib/apps/pack-pilet.js +6 -13
  33. package/lib/apps/pack-pilet.js.map +1 -1
  34. package/lib/apps/publish-pilet.d.ts +23 -3
  35. package/lib/apps/publish-pilet.js +112 -62
  36. package/lib/apps/publish-pilet.js.map +1 -1
  37. package/lib/apps/publish-piral.d.ts +6 -2
  38. package/lib/apps/publish-piral.js +30 -26
  39. package/lib/apps/publish-piral.js.map +1 -1
  40. package/lib/apps/remove-piral-instance-pilet.d.ts +22 -0
  41. package/lib/apps/remove-piral-instance-pilet.js +52 -0
  42. package/lib/apps/remove-piral-instance-pilet.js.map +1 -0
  43. package/lib/apps/run-emulator-piral.d.ts +34 -0
  44. package/lib/apps/run-emulator-piral.js +91 -0
  45. package/lib/apps/run-emulator-piral.js.map +1 -0
  46. package/lib/apps/upgrade-pilet.d.ts +6 -2
  47. package/lib/apps/upgrade-pilet.js +41 -43
  48. package/lib/apps/upgrade-pilet.js.map +1 -1
  49. package/lib/apps/upgrade-piral.d.ts +2 -2
  50. package/lib/apps/upgrade-piral.js +21 -20
  51. package/lib/apps/upgrade-piral.js.map +1 -1
  52. package/lib/apps/validate-pilet.js +30 -36
  53. package/lib/apps/validate-pilet.js.map +1 -1
  54. package/lib/apps/validate-piral.js +13 -10
  55. package/lib/apps/validate-piral.js.map +1 -1
  56. package/lib/build/bundler-calls.d.ts +3 -0
  57. package/lib/build/bundler-calls.js +117 -0
  58. package/lib/build/bundler-calls.js.map +1 -0
  59. package/lib/build/run-build-pilet.d.ts +1 -0
  60. package/lib/build/run-build-pilet.js +65 -0
  61. package/lib/build/run-build-pilet.js.map +1 -0
  62. package/lib/build/run-build-piral.d.ts +1 -0
  63. package/lib/build/run-build-piral.js +67 -0
  64. package/lib/build/run-build-piral.js.map +1 -0
  65. package/lib/build/run-debug-mono-piral.d.ts +1 -0
  66. package/lib/build/run-debug-mono-piral.js +70 -0
  67. package/lib/build/run-debug-mono-piral.js.map +1 -0
  68. package/lib/build/run-debug-pilet.d.ts +1 -0
  69. package/lib/build/run-debug-pilet.js +89 -0
  70. package/lib/build/run-debug-pilet.js.map +1 -0
  71. package/lib/build/run-debug-piral.d.ts +1 -0
  72. package/lib/build/run-debug-piral.js +85 -0
  73. package/lib/build/run-debug-piral.js.map +1 -0
  74. package/lib/bundler.js +75 -26
  75. package/lib/bundler.js.map +1 -1
  76. package/lib/cli.js +7 -4
  77. package/lib/cli.js.map +1 -1
  78. package/lib/commands.js +266 -46
  79. package/lib/commands.js.map +1 -1
  80. package/lib/common/archive.d.ts +4 -0
  81. package/lib/common/archive.js +31 -10
  82. package/lib/common/archive.js.map +1 -1
  83. package/lib/common/browser.d.ts +2 -1
  84. package/lib/common/browser.js +17 -8
  85. package/lib/common/browser.js.map +1 -1
  86. package/lib/common/clients/index.d.ts +21 -0
  87. package/lib/common/clients/index.js +48 -0
  88. package/lib/common/clients/index.js.map +1 -0
  89. package/lib/common/clients/lerna.d.ts +7 -1
  90. package/lib/common/clients/lerna.js +93 -7
  91. package/lib/common/clients/lerna.js.map +1 -1
  92. package/lib/common/clients/npm.d.ts +6 -1
  93. package/lib/common/clients/npm.js +66 -18
  94. package/lib/common/clients/npm.js.map +1 -1
  95. package/lib/common/clients/pnp.d.ts +7 -0
  96. package/lib/common/clients/pnp.js +104 -0
  97. package/lib/common/clients/pnp.js.map +1 -0
  98. package/lib/common/clients/pnpm.d.ts +5 -0
  99. package/lib/common/clients/pnpm.js +55 -6
  100. package/lib/common/clients/pnpm.js.map +1 -1
  101. package/lib/common/clients/rush.d.ts +7 -0
  102. package/lib/common/clients/rush.js +127 -0
  103. package/lib/common/clients/rush.js.map +1 -0
  104. package/lib/common/clients/yarn.d.ts +5 -0
  105. package/lib/common/clients/yarn.js +57 -6
  106. package/lib/common/clients/yarn.js.map +1 -1
  107. package/lib/common/compatibility.js +14 -9
  108. package/lib/common/compatibility.js.map +1 -1
  109. package/lib/common/config.d.ts +52 -1
  110. package/lib/common/config.js +10 -30
  111. package/lib/common/config.js.map +1 -1
  112. package/lib/common/constants.d.ts +10 -2
  113. package/lib/common/constants.js +22 -4
  114. package/lib/common/constants.js.map +1 -1
  115. package/lib/common/declaration.d.ts +2 -1
  116. package/lib/common/declaration.js +113 -56
  117. package/lib/common/declaration.js.map +1 -1
  118. package/lib/common/emoji.d.ts +8 -0
  119. package/lib/common/emoji.js +10 -1
  120. package/lib/common/emoji.js.map +1 -1
  121. package/lib/common/emulator.d.ts +2 -2
  122. package/lib/common/emulator.js +45 -32
  123. package/lib/common/emulator.js.map +1 -1
  124. package/lib/common/enums.d.ts +0 -4
  125. package/lib/common/enums.js +1 -6
  126. package/lib/common/enums.js.map +1 -1
  127. package/lib/common/envs.js +16 -5
  128. package/lib/common/envs.js.map +1 -1
  129. package/lib/common/hash.d.ts +1 -0
  130. package/lib/common/hash.js +8 -3
  131. package/lib/common/hash.js.map +1 -1
  132. package/lib/common/http.d.ts +5 -2
  133. package/lib/common/http.js +65 -23
  134. package/lib/common/http.js.map +1 -1
  135. package/lib/common/importmap.d.ts +2 -0
  136. package/lib/common/importmap.js +202 -0
  137. package/lib/common/importmap.js.map +1 -0
  138. package/lib/common/index.d.ts +10 -0
  139. package/lib/common/index.js +15 -1
  140. package/lib/common/index.js.map +1 -1
  141. package/lib/common/info.d.ts +5 -0
  142. package/lib/common/info.js +9 -2
  143. package/lib/common/info.js.map +1 -1
  144. package/lib/common/injectors.d.ts +36 -8
  145. package/lib/common/injectors.js +46 -19
  146. package/lib/common/injectors.js.map +1 -1
  147. package/lib/common/inspect.d.ts +5 -3
  148. package/lib/common/inspect.js +15 -15
  149. package/lib/common/inspect.js.map +1 -1
  150. package/lib/common/interactive.d.ts +9 -0
  151. package/lib/common/interactive.js +60 -1
  152. package/lib/common/interactive.js.map +1 -1
  153. package/lib/common/io.d.ts +9 -3
  154. package/lib/common/io.js +219 -116
  155. package/lib/common/io.js.map +1 -1
  156. package/lib/common/language.d.ts +9 -6
  157. package/lib/common/language.js +68 -12
  158. package/lib/common/language.js.map +1 -1
  159. package/lib/common/log.d.ts +5 -3
  160. package/lib/common/log.js +34 -48
  161. package/lib/common/log.js.map +1 -1
  162. package/lib/common/npm.d.ts +17 -16
  163. package/lib/common/npm.js +262 -158
  164. package/lib/common/npm.js.map +1 -1
  165. package/lib/common/pack.js +47 -26
  166. package/lib/common/pack.js.map +1 -1
  167. package/lib/common/package.d.ts +43 -20
  168. package/lib/common/package.js +377 -213
  169. package/lib/common/package.js.map +1 -1
  170. package/lib/common/parallel.d.ts +1 -0
  171. package/lib/common/parallel.js +29 -0
  172. package/lib/common/parallel.js.map +1 -0
  173. package/lib/common/patcher.js +20 -20
  174. package/lib/common/patcher.js.map +1 -1
  175. package/lib/common/platform.d.ts +13 -0
  176. package/lib/common/platform.js +29 -0
  177. package/lib/common/platform.js.map +1 -0
  178. package/lib/common/port.d.ts +1 -0
  179. package/lib/common/port.js +14 -4
  180. package/lib/common/port.js.map +1 -1
  181. package/lib/common/rules.js +4 -4
  182. package/lib/common/rules.js.map +1 -1
  183. package/lib/common/scaffold.d.ts +18 -4
  184. package/lib/common/scaffold.js +59 -36
  185. package/lib/common/scaffold.js.map +1 -1
  186. package/lib/common/scripts.js +8 -8
  187. package/lib/common/scripts.js.map +1 -1
  188. package/lib/common/shell.d.ts +2 -0
  189. package/lib/common/shell.js +33 -0
  190. package/lib/common/shell.js.map +1 -0
  191. package/lib/common/spec.d.ts +29 -0
  192. package/lib/common/spec.js +69 -0
  193. package/lib/common/spec.js.map +1 -0
  194. package/lib/common/template.d.ts +1 -2
  195. package/lib/common/template.js +23 -22
  196. package/lib/common/template.js.map +1 -1
  197. package/lib/common/url.d.ts +1 -0
  198. package/lib/common/url.js +17 -0
  199. package/lib/common/url.js.map +1 -0
  200. package/lib/common/utils.d.ts +1 -0
  201. package/lib/common/utils.js +8 -0
  202. package/lib/common/utils.js.map +1 -0
  203. package/lib/common/version.d.ts +2 -0
  204. package/lib/common/version.js +130 -0
  205. package/lib/common/version.js.map +1 -0
  206. package/lib/common/watcher.d.ts +13 -0
  207. package/lib/common/watcher.js +78 -0
  208. package/lib/common/watcher.js.map +1 -0
  209. package/lib/external/index.js +59413 -57862
  210. package/lib/helpers.d.ts +6 -6
  211. package/lib/helpers.js +10 -25
  212. package/lib/helpers.js.map +1 -1
  213. package/lib/index.js +5 -1
  214. package/lib/index.js.map +1 -1
  215. package/lib/inject.js +2 -2
  216. package/lib/inject.js.map +1 -1
  217. package/lib/injectors/pilet-injector.d.ts +75 -0
  218. package/lib/injectors/pilet-injector.js +246 -0
  219. package/lib/injectors/pilet-injector.js.map +1 -0
  220. package/lib/injectors/{piral.d.ts → piral-injector.d.ts} +10 -2
  221. package/lib/injectors/piral-injector.js +97 -0
  222. package/lib/injectors/piral-injector.js.map +1 -0
  223. package/lib/messages.d.ts +567 -47
  224. package/lib/messages.js +638 -51
  225. package/lib/messages.js.map +1 -1
  226. package/lib/pb-cli.js +1 -1
  227. package/lib/pb-cli.js.map +1 -1
  228. package/lib/pilet-cli.js +1 -1
  229. package/lib/pilet-cli.js.map +1 -1
  230. package/lib/piral-cli.js +1 -1
  231. package/lib/piral-cli.js.map +1 -1
  232. package/lib/platforms/node.d.ts +8 -0
  233. package/lib/platforms/node.js +30 -0
  234. package/lib/platforms/node.js.map +1 -0
  235. package/lib/platforms/web.d.ts +8 -0
  236. package/lib/platforms/web.js +120 -0
  237. package/lib/platforms/web.js.map +1 -0
  238. package/lib/plugin.js +36 -11
  239. package/lib/plugin.js.map +1 -1
  240. package/lib/questionnaire.d.ts +1 -1
  241. package/lib/questionnaire.js +9 -4
  242. package/lib/questionnaire.js.map +1 -1
  243. package/lib/release.d.ts +1 -1
  244. package/lib/release.js +38 -6
  245. package/lib/release.js.map +1 -1
  246. package/lib/resolvers.js +13 -13
  247. package/lib/resolvers.js.map +1 -1
  248. package/lib/rules/index.js +8 -8
  249. package/lib/rules/index.js.map +1 -1
  250. package/lib/rules/pilet-has-externals-as-peers.d.ts +1 -1
  251. package/lib/rules/pilet-has-externals-as-peers.js +9 -7
  252. package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
  253. package/lib/rules/pilet-has-no-self-reference.d.ts +1 -1
  254. package/lib/rules/pilet-has-no-self-reference.js +2 -2
  255. package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
  256. package/lib/rules/pilet-has-no-third-party-dependency.d.ts +1 -1
  257. package/lib/rules/pilet-stays-small.d.ts +1 -1
  258. package/lib/rules/pilet-stays-small.js +4 -4
  259. package/lib/rules/pilet-stays-small.js.map +1 -1
  260. package/lib/rules/pilet-uses-latest-piral.d.ts +1 -1
  261. package/lib/rules/pilet-uses-latest-piral.js +18 -9
  262. package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
  263. package/lib/rules/piral-depends-on-piral.d.ts +1 -1
  264. package/lib/rules/piral-entry-ends-with-html.d.ts +1 -1
  265. package/lib/rules/piral-entry-ends-with-html.js +1 -1
  266. package/lib/rules/piral-entry-ends-with-html.js.map +1 -1
  267. package/lib/rules/piral-has-valid-devDependencies.d.ts +1 -1
  268. package/lib/rules/piral-has-valid-externals.d.ts +1 -1
  269. package/lib/rules/piral-has-valid-externals.js +10 -24
  270. package/lib/rules/piral-has-valid-externals.js.map +1 -1
  271. package/lib/rules/piral-has-valid-files.d.ts +1 -1
  272. package/lib/rules/piral-has-valid-files.js +5 -5
  273. package/lib/rules/piral-has-valid-files.js.map +1 -1
  274. package/lib/rules/piral-has-valid-scripts.d.ts +1 -1
  275. package/lib/runner.js +1 -1
  276. package/lib/runner.js.map +1 -1
  277. package/lib/select.js +6 -6
  278. package/lib/select.js.map +1 -1
  279. package/lib/types/common.d.ts +88 -8
  280. package/lib/types/common.js.map +1 -1
  281. package/lib/types/index.js +5 -1
  282. package/lib/types/index.js.map +1 -1
  283. package/lib/types/internal.d.ts +12 -13
  284. package/lib/types/public.d.ts +89 -23
  285. package/package.json +19 -16
  286. package/src/apps/add-piral-instance-pilet.ts +98 -0
  287. package/src/apps/build-pilet.ts +286 -38
  288. package/src/apps/build-piral.test.ts +20 -7
  289. package/src/apps/build-piral.ts +90 -39
  290. package/src/apps/debug-pilet.ts +229 -123
  291. package/src/apps/debug-piral.ts +121 -68
  292. package/src/apps/declaration-piral.ts +4 -2
  293. package/src/apps/index.ts +3 -0
  294. package/src/apps/new-pilet.test.ts +28 -11
  295. package/src/apps/new-pilet.ts +60 -48
  296. package/src/apps/new-piral.test.ts +25 -13
  297. package/src/apps/new-piral.ts +43 -19
  298. package/src/apps/pack-pilet.test.ts +2 -2
  299. package/src/apps/pack-pilet.ts +12 -10
  300. package/src/apps/publish-pilet.ts +148 -43
  301. package/src/apps/publish-piral.ts +38 -11
  302. package/src/apps/remove-piral-instance-pilet.ts +92 -0
  303. package/src/apps/run-emulator-piral.ts +154 -0
  304. package/src/apps/upgrade-pilet.ts +37 -31
  305. package/src/apps/upgrade-piral.ts +9 -7
  306. package/src/apps/validate-pilet.ts +30 -22
  307. package/src/apps/validate-piral.ts +5 -2
  308. package/src/build/bundler-calls.ts +133 -0
  309. package/src/build/run-build-pilet.ts +91 -0
  310. package/src/build/run-build-piral.ts +93 -0
  311. package/src/build/run-debug-mono-piral.ts +86 -0
  312. package/src/build/run-debug-pilet.ts +116 -0
  313. package/src/build/run-debug-piral.ts +105 -0
  314. package/src/bundler.test.ts +86 -68
  315. package/src/bundler.ts +74 -19
  316. package/src/cli.ts +6 -2
  317. package/src/commands.ts +273 -44
  318. package/src/common/archive.test.ts +51 -45
  319. package/src/common/archive.ts +28 -1
  320. package/src/common/browser.test.ts +20 -10
  321. package/src/common/browser.ts +13 -6
  322. package/src/common/clients/index.ts +41 -0
  323. package/src/common/clients/lerna.ts +85 -1
  324. package/src/common/clients/npm.ts +56 -14
  325. package/src/common/clients/pnp.ts +84 -0
  326. package/src/common/clients/pnpm.ts +45 -1
  327. package/src/common/clients/rush.ts +118 -0
  328. package/src/common/clients/yarn.ts +49 -3
  329. package/src/common/compatibility.ts +8 -1
  330. package/src/common/config.ts +57 -22
  331. package/src/common/constants.ts +21 -3
  332. package/src/common/declaration.ts +124 -50
  333. package/src/common/emoji.ts +9 -0
  334. package/src/common/emulator.ts +43 -23
  335. package/src/common/enums.ts +0 -5
  336. package/src/common/envs.ts +15 -3
  337. package/src/common/hash.ts +5 -0
  338. package/src/common/http.test.ts +76 -64
  339. package/src/common/http.ts +88 -24
  340. package/src/common/importmap.ts +242 -0
  341. package/src/common/index.ts +10 -0
  342. package/src/common/info.ts +9 -1
  343. package/src/common/injectors.ts +49 -22
  344. package/src/common/inspect.ts +13 -14
  345. package/src/common/interactive.test.ts +6 -0
  346. package/src/common/interactive.ts +69 -1
  347. package/src/common/io.ts +199 -82
  348. package/src/common/language.ts +87 -10
  349. package/src/common/log.ts +32 -46
  350. package/src/common/npm.test.ts +187 -166
  351. package/src/common/npm.ts +263 -119
  352. package/src/common/pack.test.ts +11 -13
  353. package/src/common/pack.ts +60 -21
  354. package/src/common/package.test.ts +59 -49
  355. package/src/common/package.ts +406 -167
  356. package/src/common/parallel.test.ts +28 -0
  357. package/src/common/parallel.ts +21 -0
  358. package/src/common/platform.ts +31 -0
  359. package/src/common/port.test.ts +4 -1
  360. package/src/common/port.ts +10 -0
  361. package/src/common/rules.test.ts +3 -3
  362. package/src/common/scaffold.ts +69 -41
  363. package/src/common/scripts.ts +5 -4
  364. package/src/common/shell.ts +34 -0
  365. package/src/common/spec.ts +69 -0
  366. package/src/common/template.ts +20 -18
  367. package/src/common/url.test.ts +28 -0
  368. package/src/common/url.ts +15 -0
  369. package/src/common/utils.ts +3 -0
  370. package/src/common/version.test.ts +233 -0
  371. package/src/common/version.ts +142 -0
  372. package/src/common/watcher.ts +89 -0
  373. package/src/external/index.test.ts +2 -2
  374. package/src/external/index.ts +7 -3
  375. package/src/external/resolve.ts +29 -0
  376. package/src/helpers.test.ts +2 -22
  377. package/src/helpers.ts +21 -30
  378. package/src/injectors/{pilet.test.ts → pilet-injector.test.ts} +13 -4
  379. package/src/injectors/pilet-injector.ts +346 -0
  380. package/src/injectors/{piral.test.ts → piral-injector.test.ts} +14 -5
  381. package/src/injectors/piral-injector.ts +130 -0
  382. package/src/messages.ts +649 -63
  383. package/src/platforms/node.ts +16 -0
  384. package/src/platforms/web.ts +148 -0
  385. package/src/plugin.ts +34 -5
  386. package/src/questionnaire.ts +17 -3
  387. package/src/release.ts +47 -5
  388. package/src/rules/index.ts +1 -1
  389. package/src/rules/pilet-has-externals-as-peers.test.ts +3 -2
  390. package/src/rules/pilet-has-externals-as-peers.ts +9 -7
  391. package/src/rules/pilet-has-no-self-reference.ts +1 -1
  392. package/src/rules/pilet-stays-small.ts +1 -1
  393. package/src/rules/pilet-uses-latest-piral.ts +22 -12
  394. package/src/rules/piral-has-valid-externals.ts +10 -29
  395. package/src/types/common.ts +99 -9
  396. package/src/types/internal.ts +14 -14
  397. package/src/types/public.ts +93 -27
  398. package/lib/external/child.js +0 -144
  399. package/lib/external/classes.trie +0 -0
  400. package/lib/external/xdg-open +0 -1066
  401. package/lib/injectors/pilet.d.ts +0 -47
  402. package/lib/injectors/pilet.js +0 -187
  403. package/lib/injectors/pilet.js.map +0 -1
  404. package/lib/injectors/piral.js +0 -62
  405. package/lib/injectors/piral.js.map +0 -1
  406. package/src/injectors/pilet.ts +0 -219
  407. package/src/injectors/piral.ts +0 -76
  408. package/templates/piral-index.js.ejs +0 -16
package/src/commands.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import * as apps from './apps';
2
2
  import {
3
+ piletBuildTypeKeys,
3
4
  availableBundlers,
4
5
  availableReleaseProviders,
5
6
  forceOverwriteKeys,
6
7
  keyOfForceOverwrite,
7
8
  valueOfForceOverwrite,
8
- keyOfPiletLanguage,
9
- piletLanguageKeys,
10
- valueOfPiletLanguage,
9
+ sourceLanguageKeys,
11
10
  frameworkKeys,
12
11
  clientTypeKeys,
13
12
  schemaKeys,
14
13
  fromKeys,
15
14
  bundlerKeys,
16
- buildTypeKeys,
15
+ piralBuildTypeKeys,
16
+ publishModeKeys,
17
17
  } from './helpers';
18
18
  import {
19
19
  ToolCommand,
@@ -23,6 +23,9 @@ import {
23
23
  PiralBuildType,
24
24
  PiletPublishSource,
25
25
  PiletSchemaVersion,
26
+ PiletBuildType,
27
+ PiletPublishScheme,
28
+ SourceLanguage,
26
29
  } from './types';
27
30
 
28
31
  function specializeCommand(commands: Array<ToolCommand<any>>, command: ToolCommand<any>, suffix: string) {
@@ -58,9 +61,12 @@ const allCommands: Array<ToolCommand<any>> = [
58
61
  return argv
59
62
  .positional('source', {
60
63
  type: 'string',
61
- describe: 'Sets the source root directory or index.html file for collecting all the information.',
64
+ describe: 'Sets the source Piral instance path for collecting all the information.',
62
65
  default: apps.debugPiralDefaults.entry,
63
66
  })
67
+ .string('target')
68
+ .describe('target', 'Sets the target directory or file of bundling.')
69
+ .default('target', apps.debugPiralDefaults.target)
64
70
  .number('port')
65
71
  .describe('port', 'Sets the port of the local development server.')
66
72
  .default('port', apps.debugPiralDefaults.port)
@@ -76,12 +82,17 @@ const allCommands: Array<ToolCommand<any>> = [
76
82
  .boolean('hmr')
77
83
  .describe('hmr', 'Activates Hot Module Reloading (HMR).')
78
84
  .default('hmr', apps.debugPiralDefaults.hmr)
85
+ .string('krasrc')
86
+ .describe('krasrc', 'Sets a config file for overwriting the default kras options.')
87
+ .default('krasrc', apps.debugPiralDefaults.krasrc)
79
88
  .boolean('optimize-modules')
80
89
  .describe('optimize-modules', 'Also includes the node modules for target transpilation.')
81
90
  .default('optimize-modules', apps.debugPiralDefaults.optimizeModules)
82
91
  .choices('bundler', availableBundlers)
83
92
  .describe('bundler', 'Sets the bundler to use.')
84
93
  .default('bundler', availableBundlers[0])
94
+ .string('feed')
95
+ .describe('feed', 'Sets the URL of a pilet feed for including remote pilets.')
85
96
  .string('base')
86
97
  .default('base', process.cwd())
87
98
  .describe('base', 'Sets the base directory. By default the current directory is used.');
@@ -89,13 +100,17 @@ const allCommands: Array<ToolCommand<any>> = [
89
100
  run(args) {
90
101
  return apps.debugPiral(args.base as string, {
91
102
  entry: args.source as string,
103
+ target: args.target as string,
92
104
  port: args.port as number,
93
105
  hmr: args.hmr as boolean,
106
+ krasrc: args.krasrc as string,
94
107
  optimizeModules: args['optimize-modules'] as boolean,
95
108
  publicUrl: args['public-url'] as string,
96
109
  bundlerName: args.bundler as string,
97
110
  logLevel: args['log-level'] as LogLevels,
98
111
  open: args.open as boolean,
112
+ hooks: args.hooks as object,
113
+ feed: args.feed as string,
99
114
  _: args,
100
115
  });
101
116
  },
@@ -110,14 +125,14 @@ const allCommands: Array<ToolCommand<any>> = [
110
125
  return argv
111
126
  .positional('source', {
112
127
  type: 'string',
113
- describe: 'Sets the source root directory or index.html file for collecting all the information.',
128
+ describe: 'Sets the source Piral instance path for collecting all the information.',
114
129
  default: apps.buildPiralDefaults.entry,
115
130
  })
116
131
  .string('target')
117
132
  .describe('target', 'Sets the target directory or file of bundling.')
118
133
  .default('target', apps.buildPiralDefaults.target)
119
134
  .string('public-url')
120
- .describe('public-url', 'Sets the public URL (path) of the bundle.')
135
+ .describe('public-url', 'Sets the public URL (path) of the bundle. Only for release output.')
121
136
  .default('public-url', apps.buildPiralDefaults.publicUrl)
122
137
  .number('log-level')
123
138
  .describe('log-level', 'Sets the log level to use (1-5).')
@@ -131,8 +146,14 @@ const allCommands: Array<ToolCommand<any>> = [
131
146
  .boolean('source-maps')
132
147
  .describe('source-maps', 'Create associated source maps for the bundles.')
133
148
  .default('source-maps', apps.buildPiralDefaults.sourceMaps)
149
+ .boolean('watch')
150
+ .describe('watch', 'Continuously re-builds while watching the source files.')
151
+ .default('watch', apps.buildPiralDefaults.watch)
134
152
  .boolean('subdir')
135
- .describe('subdir', `Places the build's output in an appropriate subdirectory (e.g., "emulator"). Ignored for "--all".`)
153
+ .describe(
154
+ 'subdir',
155
+ `Places the build's output in an appropriate subdirectory (e.g., "emulator"). Ignored for "--all".`,
156
+ )
136
157
  .default('subdir', apps.buildPiralDefaults.subdir)
137
158
  .boolean('content-hash')
138
159
  .describe('content-hash', 'Appends the hash to the side-bundle files.')
@@ -140,7 +161,7 @@ const allCommands: Array<ToolCommand<any>> = [
140
161
  .boolean('optimize-modules')
141
162
  .describe('optimize-modules', 'Also includes the node modules for target transpilation.')
142
163
  .default('optimize-modules', apps.buildPiralDefaults.optimizeModules)
143
- .choices('type', buildTypeKeys)
164
+ .choices('type', piralBuildTypeKeys)
144
165
  .describe('type', 'Selects the target type of the build. "all" builds all target types.')
145
166
  .default('type', apps.buildPiralDefaults.type)
146
167
  .choices('bundler', availableBundlers)
@@ -161,9 +182,11 @@ const allCommands: Array<ToolCommand<any>> = [
161
182
  subdir: args.subdir as boolean,
162
183
  contentHash: args['content-hash'] as boolean,
163
184
  sourceMaps: args['source-maps'] as boolean,
185
+ watch: args.watch as boolean,
164
186
  optimizeModules: args['optimize-modules'] as boolean,
165
187
  logLevel: args['log-level'] as LogLevels,
166
188
  type: args.type as PiralBuildType,
189
+ hooks: args.hooks as object,
167
190
  _: args,
168
191
  });
169
192
  },
@@ -183,15 +206,18 @@ const allCommands: Array<ToolCommand<any>> = [
183
206
  .number('log-level')
184
207
  .describe('log-level', 'Sets the log level to use (1-5).')
185
208
  .default('log-level', apps.publishPiralDefaults.logLevel)
186
- .choices('type', buildTypeKeys)
209
+ .choices('type', piralBuildTypeKeys)
187
210
  .describe('type', 'Selects the target type to publish. "all" publishes all target types.')
188
211
  .default('type', apps.publishPiralDefaults.type)
189
212
  .choices('provider', availableReleaseProviders)
190
213
  .describe('provider', 'Sets the provider for publishing the release assets.')
191
214
  .default('provider', apps.publishPiralDefaults.provider)
192
- .option('fields', undefined)
193
- .describe('fields', 'Sets additional fields to be included in the feed service request.')
194
- .default('fields', apps.publishPiralDefaults.fields)
215
+ .option('opts', undefined)
216
+ .describe('opts', 'Sets the options to forward to the chosen provider.')
217
+ .default('opts', apps.publishPiralDefaults.opts)
218
+ .boolean('interactive')
219
+ .describe('interactive', 'Defines if authorization tokens can be retrieved interactively.')
220
+ .default('interactive', apps.publishPiralDefaults.interactive)
195
221
  .string('base')
196
222
  .default('base', process.cwd())
197
223
  .describe('base', 'Sets the base directory. By default the current directory is used.');
@@ -202,20 +228,21 @@ const allCommands: Array<ToolCommand<any>> = [
202
228
  logLevel: args['log-level'] as LogLevels,
203
229
  type: args.type as PiralBuildType,
204
230
  provider: args.provider as string,
205
- fields: args.fields as Record<string, string>,
231
+ opts: args.opts as Record<string, string>,
232
+ interactive: args.interactive as boolean,
206
233
  });
207
234
  },
208
235
  },
209
236
  {
210
237
  name: 'declaration-piral',
211
238
  alias: ['declare-piral', 'declaration-portal', 'declare-portal'],
212
- description: 'Creates the declaration file for a Piral instance.',
239
+ description: 'Creates the TypeScript declaration file (index.d.ts) for a Piral instance.',
213
240
  arguments: ['[source]'],
214
241
  flags(argv) {
215
242
  return argv
216
243
  .positional('source', {
217
244
  type: 'string',
218
- describe: 'Sets the source root directory or index.html file for collecting all the information.',
245
+ describe: 'Sets the source Piral instance path for collecting all the information.',
219
246
  default: apps.declarationPiralDefaults.entry,
220
247
  })
221
248
  .string('target')
@@ -225,7 +252,7 @@ const allCommands: Array<ToolCommand<any>> = [
225
252
  .describe('log-level', 'Sets the log level to use (1-5).')
226
253
  .default('log-level', apps.declarationPiralDefaults.logLevel)
227
254
  .choices('force-overwrite', forceOverwriteKeys)
228
- .describe('force-overwrite', 'Determines if files should be overwritten by the declaration.')
255
+ .describe('force-overwrite', 'Determines if files should be overwritten by the command.')
229
256
  .default('force-overwrite', keyOfForceOverwrite(apps.declarationPiralDefaults.forceOverwrite))
230
257
  .string('base')
231
258
  .default('base', process.cwd())
@@ -260,28 +287,34 @@ const allCommands: Array<ToolCommand<any>> = [
260
287
  .describe('framework', 'Sets the framework/library level to use.')
261
288
  .default('framework', apps.newPiralDefaults.framework)
262
289
  .boolean('install')
263
- .describe('install', 'Already performs the installation of its NPM dependencies.')
290
+ .describe('install', 'Already performs the installation of its npm dependencies.')
264
291
  .default('install', apps.newPiralDefaults.install)
292
+ .alias('install', 'package-install')
265
293
  .string('registry')
266
294
  .describe('registry', 'Sets the package registry to use for resolving the dependencies.')
267
295
  .default('registry', apps.newPiralDefaults.registry)
296
+ .alias('registry', 'package-registry')
268
297
  .number('log-level')
269
298
  .describe('log-level', 'Sets the log level to use (1-5).')
270
299
  .default('log-level', apps.newPiralDefaults.logLevel)
271
300
  .string('tag')
272
- .describe('tag', 'Sets the tag or version of the package to install. By default, this uses the version of the CLI.')
301
+ .describe(
302
+ 'tag',
303
+ 'Sets the tag or version of the package to install. By default, this uses the version of the CLI.',
304
+ )
273
305
  .default('tag', apps.newPiralDefaults.version)
306
+ .alias('tag', 'piral-version')
274
307
  .choices('force-overwrite', forceOverwriteKeys)
275
308
  .describe('force-overwrite', 'Determines if files should be overwritten by the installation.')
276
309
  .default('force-overwrite', keyOfForceOverwrite(apps.newPiralDefaults.forceOverwrite))
277
- .choices('language', piletLanguageKeys)
310
+ .choices('language', sourceLanguageKeys)
278
311
  .describe('language', 'Determines the programming language for the new Piral instance.')
279
- .default('language', keyOfPiletLanguage(apps.newPiralDefaults.language))
312
+ .default('language', apps.newPiralDefaults.language)
280
313
  .string('template')
281
314
  .describe('template', 'Sets the boilerplate template package to be used when scaffolding.')
282
315
  .default('template', apps.newPiralDefaults.template)
283
316
  .choices('npm-client', clientTypeKeys)
284
- .describe('npm-client', 'Sets the NPM client to be used when scaffolding.')
317
+ .describe('npm-client', 'Sets the npm client to be used when scaffolding.')
285
318
  .default('npm-client', apps.newPiralDefaults.npmClient)
286
319
  .choices('bundler', bundlerKeys)
287
320
  .describe('bundler', 'Sets the default bundler to install.')
@@ -291,7 +324,10 @@ const allCommands: Array<ToolCommand<any>> = [
291
324
  .default('vars', apps.newPiralDefaults.variables)
292
325
  .string('base')
293
326
  .default('base', process.cwd())
294
- .describe('base', 'Sets the base directory. By default the current directory is used.');
327
+ .describe('base', 'Sets the base directory. By default the current directory is used.')
328
+ .string('name')
329
+ .describe('name', 'Sets the name for the new Piral app.')
330
+ .default('name', apps.newPiralDefaults.name);
295
331
  },
296
332
  run(args) {
297
333
  return apps.newPiral(args.base as string, {
@@ -301,13 +337,14 @@ const allCommands: Array<ToolCommand<any>> = [
301
337
  version: args.tag as string,
302
338
  registry: args.registry as string,
303
339
  forceOverwrite: valueOfForceOverwrite(args['force-overwrite'] as string),
304
- language: valueOfPiletLanguage(args.language as string),
340
+ language: args.language as SourceLanguage,
305
341
  install: args.install as boolean,
306
342
  template: args.template as string,
307
343
  logLevel: args['log-level'] as LogLevels,
308
344
  npmClient: args['npm-client'] as NpmClientType,
309
345
  bundlerName: args.bundler as string,
310
346
  variables: args.vars as Record<string, string>,
347
+ name: args['name'] as string,
311
348
  });
312
349
  },
313
350
  },
@@ -330,10 +367,11 @@ const allCommands: Array<ToolCommand<any>> = [
330
367
  .describe('log-level', 'Sets the log level to use (1-5).')
331
368
  .default('log-level', apps.upgradePiralDefaults.logLevel)
332
369
  .boolean('install')
333
- .describe('install', 'Already performs the update of its NPM dependencies.')
370
+ .describe('install', 'Already performs the update of its npm dependencies.')
334
371
  .default('install', apps.upgradePiralDefaults.install)
372
+ .alias('install', 'package-install')
335
373
  .choices('npm-client', clientTypeKeys)
336
- .describe('npm-client', 'Sets the NPM client to be used when upgrading.')
374
+ .describe('npm-client', 'Sets the npm client to be used when upgrading.')
337
375
  .default('npm-client', apps.upgradePiralDefaults.npmClient)
338
376
  .string('base')
339
377
  .default('base', process.cwd())
@@ -358,7 +396,7 @@ const allCommands: Array<ToolCommand<any>> = [
358
396
  return argv
359
397
  .positional('source', {
360
398
  type: 'string',
361
- describe: 'Sets the source root directory or index.html file for collecting all the information.',
399
+ describe: 'Sets the source Piral instance path for collecting all the information.',
362
400
  default: apps.validatePiralDefaults.entry,
363
401
  })
364
402
  .number('log-level')
@@ -388,18 +426,30 @@ const allCommands: Array<ToolCommand<any>> = [
388
426
  describe: 'Sets the source file containing the pilet root module.',
389
427
  default: apps.debugPiletDefaults.entry,
390
428
  })
429
+ .string('target')
430
+ .describe('target', 'Sets the target directory or file of bundling.')
431
+ .default('target', apps.debugPiletDefaults.target)
432
+ .string('public-url')
433
+ .describe('public-url', 'Sets the public URL (path) of the application.')
434
+ .default('public-url', apps.debugPiletDefaults.publicUrl)
391
435
  .number('port')
392
436
  .describe('port', 'Sets the port of the local development server.')
393
437
  .default('port', apps.debugPiletDefaults.port)
394
438
  .number('log-level')
395
439
  .describe('log-level', 'Sets the log level to use (1-5).')
396
440
  .default('log-level', apps.debugPiletDefaults.logLevel)
441
+ .number('concurrency')
442
+ .describe('concurrency', 'Sets the maximum number of concurrent build jobs.')
443
+ .default('concurrency', apps.debugPiletDefaults.concurrency)
397
444
  .boolean('open')
398
445
  .describe('open', 'Opens the pilet directly in the browser.')
399
446
  .default('open', apps.debugPiletDefaults.open)
400
447
  .boolean('hmr')
401
448
  .describe('hmr', 'Activates Hot Module Reloading (HMR).')
402
449
  .default('hmr', apps.debugPiletDefaults.hmr)
450
+ .string('krasrc')
451
+ .describe('krasrc', 'Sets a config file for overwriting the default kras options.')
452
+ .default('krasrc', apps.debugPiletDefaults.krasrc)
403
453
  .boolean('optimize-modules')
404
454
  .describe('optimize-modules', 'Also includes the node modules for target transpilation.')
405
455
  .default('optimize-modules', apps.debugPiletDefaults.optimizeModules)
@@ -411,24 +461,32 @@ const allCommands: Array<ToolCommand<any>> = [
411
461
  .default('bundler', availableBundlers[0])
412
462
  .string('app')
413
463
  .describe('app', 'Sets the name of the Piral instance.')
464
+ .string('app-dir')
465
+ .describe('app-dir', 'Sets the path to a custom Piral instance for serving.')
466
+ .string('feed')
467
+ .describe('feed', 'Sets the URL of a pilet feed for including remote pilets.')
414
468
  .string('base')
415
469
  .default('base', process.cwd())
416
- .describe('base', 'Sets the base directory. By default the current directory is used.')
417
- .string('feed')
418
- .describe('feed', 'Sets the URL of a pilet feed for including remote pilets.');
470
+ .describe('base', 'Sets the base directory. By default the current directory is used.');
419
471
  },
420
472
  run(args) {
421
473
  return apps.debugPilet(args.base as string, {
422
474
  entry: args.source as string,
475
+ target: args.target as string,
476
+ publicUrl: args['public-url'] as string,
423
477
  port: args.port as number,
424
478
  hmr: args.hmr as boolean,
425
479
  bundlerName: args.bundler as string,
480
+ krasrc: args.krasrc as string,
426
481
  optimizeModules: args['optimize-modules'] as boolean,
482
+ appInstanceDir: args['app-dir'] as string,
427
483
  app: args.app as string,
428
484
  logLevel: args['log-level'] as LogLevels,
429
485
  open: args.open as boolean,
430
486
  schemaVersion: args.schema as PiletSchemaVersion,
487
+ concurrency: args.concurrency as number,
431
488
  feed: args.feed as string,
489
+ hooks: args.hooks as object,
432
490
  _: args,
433
491
  });
434
492
  },
@@ -443,24 +501,36 @@ const allCommands: Array<ToolCommand<any>> = [
443
501
  return argv
444
502
  .positional('source', {
445
503
  type: 'string',
446
- describe: 'Sets the source index.tsx file for collecting all the information.',
504
+ describe: 'Sets the source pilet path for collecting all the information.',
447
505
  default: apps.buildPiletDefaults.entry,
448
506
  })
449
507
  .string('target')
450
508
  .describe('target', 'Sets the target file of bundling.')
451
509
  .default('target', apps.buildPiletDefaults.target)
510
+ .string('public-url')
511
+ .describe('public-url', 'Sets the public URL (path) of the application.')
512
+ .default('public-url', apps.buildPiletDefaults.publicUrl)
452
513
  .number('log-level')
453
514
  .describe('log-level', 'Sets the log level to use (1-5).')
454
515
  .default('log-level', apps.buildPiletDefaults.logLevel)
516
+ .number('concurrency')
517
+ .describe('concurrency', 'Sets the maximum number of concurrent build jobs.')
518
+ .default('concurrency', apps.buildPiletDefaults.concurrency)
455
519
  .boolean('source-maps')
456
520
  .describe('source-maps', 'Creates source maps for the bundles.')
457
521
  .default('source-maps', apps.buildPiletDefaults.sourceMaps)
522
+ .boolean('watch')
523
+ .describe('watch', 'Continuously re-builds while watching the source files.')
524
+ .default('watch', apps.buildPiletDefaults.watch)
458
525
  .boolean('fresh')
459
526
  .describe('fresh', 'Performs a fresh build by removing the target directory first.')
460
527
  .default('fresh', apps.buildPiletDefaults.fresh)
461
528
  .boolean('minify')
462
529
  .describe('minify', 'Performs minification or other post-bundle transformations.')
463
530
  .default('minify', apps.buildPiletDefaults.minify)
531
+ .boolean('declaration')
532
+ .describe('declaration', 'Creates a declaration file for the pilet.')
533
+ .default('declaration', apps.buildPiletDefaults.declaration)
464
534
  .boolean('content-hash')
465
535
  .describe('content-hash', 'Appends the hash to the side-bundle files.')
466
536
  .default('content-hash', apps.buildPiletDefaults.contentHash)
@@ -473,6 +543,9 @@ const allCommands: Array<ToolCommand<any>> = [
473
543
  .choices('bundler', availableBundlers)
474
544
  .describe('bundler', 'Sets the bundler to use.')
475
545
  .default('bundler', availableBundlers[0])
546
+ .choices('type', piletBuildTypeKeys)
547
+ .describe('type', 'Selects the target type of the build.')
548
+ .default('type', apps.buildPiletDefaults.type)
476
549
  .string('app')
477
550
  .describe('app', 'Sets the name of the Piral instance.')
478
551
  .string('base')
@@ -483,15 +556,21 @@ const allCommands: Array<ToolCommand<any>> = [
483
556
  return apps.buildPilet(args.base as string, {
484
557
  entry: args.source as string,
485
558
  target: args.target as string,
559
+ publicUrl: args['public-url'] as string,
486
560
  minify: args.minify as boolean,
487
561
  contentHash: args['content-hash'] as boolean,
488
562
  bundlerName: args.bundler as string,
563
+ declaration: args.declaration as boolean,
489
564
  sourceMaps: args['source-maps'] as boolean,
565
+ watch: args.watch as boolean,
490
566
  optimizeModules: args['optimize-modules'] as boolean,
567
+ type: args.type as PiletBuildType,
491
568
  fresh: args.fresh as boolean,
492
569
  logLevel: args['log-level'] as LogLevels,
493
570
  schemaVersion: args.schema as PiletSchemaVersion,
571
+ concurrency: args.concurrency as number,
494
572
  app: args.app as string,
573
+ hooks: args.hooks as object,
495
574
  _: args,
496
575
  });
497
576
  },
@@ -505,7 +584,7 @@ const allCommands: Array<ToolCommand<any>> = [
505
584
  return argv
506
585
  .positional('source', {
507
586
  type: 'string',
508
- describe: 'Sets the source package.json file for creating the package.',
587
+ describe: 'Sets the source pilet path for creating the package.',
509
588
  default: apps.packPiletDefaults.source,
510
589
  })
511
590
  .string('target')
@@ -536,8 +615,7 @@ const allCommands: Array<ToolCommand<any>> = [
536
615
  return argv
537
616
  .positional('source', {
538
617
  type: 'string',
539
- describe: 'Sets the source previously packed *.tgz bundle to publish.',
540
- default: apps.publishPiletDefaults.source,
618
+ describe: 'Sets the source of either the previously packed *.tgz bundle or the pilet root module to publish.',
541
619
  })
542
620
  .string('url')
543
621
  .describe('url', 'Sets the explicit URL where to publish the pilet to.')
@@ -557,16 +635,28 @@ const allCommands: Array<ToolCommand<any>> = [
557
635
  .choices('schema', schemaKeys)
558
636
  .describe('schema', 'Sets the schema to be used when making a fresh build of the pilet.')
559
637
  .default('schema', apps.publishPiletDefaults.schemaVersion)
638
+ .choices('mode', publishModeKeys)
639
+ .describe('mode', 'Sets the authorization mode to use.')
640
+ .default('mode', apps.publishPiletDefaults.mode)
641
+ .alias('mode', 'auth-mode')
642
+ .choices('bundler', availableBundlers)
643
+ .describe('bundler', 'Sets the bundler to use.')
644
+ .default('bundler', availableBundlers[0])
560
645
  .choices('from', fromKeys)
561
646
  .describe('from', 'Sets the type of the source to use for publishing.')
562
647
  .default('from', apps.publishPiletDefaults.from)
563
648
  .option('fields', undefined)
564
649
  .describe('fields', 'Sets additional fields to be included in the feed service request.')
565
650
  .default('fields', apps.publishPiletDefaults.fields)
651
+ .option('headers', undefined)
652
+ .describe('headers', 'Sets additional headers to be included in the feed service request.')
653
+ .default('headers', apps.publishPiletDefaults.headers)
654
+ .boolean('interactive')
655
+ .describe('interactive', 'Defines if authorization tokens can be retrieved interactively.')
656
+ .default('interactive', apps.publishPiletDefaults.interactive)
566
657
  .string('base')
567
658
  .default('base', process.cwd())
568
- .describe('base', 'Sets the base directory. By default the current directory is used.')
569
- .demandOption('url');
659
+ .describe('base', 'Sets the base directory. By default the current directory is used.');
570
660
  },
571
661
  run(args) {
572
662
  return apps.publishPilet(args.base as string, {
@@ -575,10 +665,15 @@ const allCommands: Array<ToolCommand<any>> = [
575
665
  url: args.url as string,
576
666
  logLevel: args['log-level'] as LogLevels,
577
667
  cert: args['ca-cert'] as string,
668
+ bundlerName: args.bundler as string,
578
669
  fresh: args.fresh as boolean,
579
670
  from: args.from as PiletPublishSource,
580
671
  schemaVersion: args.schema as PiletSchemaVersion,
581
672
  fields: args.fields as Record<string, string>,
673
+ headers: args.headers as Record<string, string>,
674
+ mode: args.mode as PiletPublishScheme,
675
+ interactive: args.interactive as boolean,
676
+ _: args,
582
677
  });
583
678
  },
584
679
  },
@@ -602,23 +697,25 @@ const allCommands: Array<ToolCommand<any>> = [
602
697
  .string('registry')
603
698
  .describe('registry', 'Sets the package registry to use for resolving the specified Piral app.')
604
699
  .default('registry', apps.newPiletDefaults.registry)
700
+ .alias('registry', 'package-registry')
605
701
  .boolean('install')
606
- .describe('install', 'Already performs the installation of its NPM dependencies.')
702
+ .describe('install', 'Already performs the installation of its npm dependencies.')
607
703
  .default('install', apps.newPiletDefaults.install)
704
+ .alias('install', 'package-install')
608
705
  .choices('force-overwrite', forceOverwriteKeys)
609
706
  .describe('force-overwrite', 'Determines if files should be overwritten by the scaffolding.')
610
707
  .default('force-overwrite', keyOfForceOverwrite(apps.newPiletDefaults.forceOverwrite))
611
708
  .number('log-level')
612
709
  .describe('log-level', 'Sets the log level to use (1-5).')
613
710
  .default('log-level', apps.newPiletDefaults.logLevel)
614
- .choices('language', piletLanguageKeys)
711
+ .choices('language', sourceLanguageKeys)
615
712
  .describe('language', 'Determines the programming language for the new pilet.')
616
- .default('language', keyOfPiletLanguage(apps.newPiletDefaults.language))
713
+ .default('language', apps.newPiletDefaults.language)
617
714
  .string('template')
618
715
  .describe('template', 'Sets the boilerplate template package to be used when scaffolding.')
619
716
  .default('template', apps.newPiletDefaults.template)
620
717
  .choices('npm-client', clientTypeKeys)
621
- .describe('npm-client', 'Sets the NPM client to be used when scaffolding.')
718
+ .describe('npm-client', 'Sets the npm client to be used when scaffolding.')
622
719
  .default('npm-client', apps.newPiletDefaults.npmClient)
623
720
  .choices('bundler', bundlerKeys)
624
721
  .describe('bundler', 'Sets the default bundler to install.')
@@ -628,7 +725,10 @@ const allCommands: Array<ToolCommand<any>> = [
628
725
  .default('vars', apps.newPiletDefaults.variables)
629
726
  .string('base')
630
727
  .default('base', process.cwd())
631
- .describe('base', 'Sets the base directory. By default the current directory is used.');
728
+ .describe('base', 'Sets the base directory. By default the current directory is used.')
729
+ .string('name')
730
+ .describe('name', 'Sets the name for the new Pilet.')
731
+ .default('name', apps.newPiletDefaults.name);
632
732
  },
633
733
  run(args) {
634
734
  return apps.newPilet(args.base as string, {
@@ -636,13 +736,14 @@ const allCommands: Array<ToolCommand<any>> = [
636
736
  source: args.source as string,
637
737
  registry: args.registry as string,
638
738
  forceOverwrite: valueOfForceOverwrite(args['force-overwrite'] as string),
639
- language: valueOfPiletLanguage(args.language as string),
739
+ language: args.language as SourceLanguage,
640
740
  logLevel: args['log-level'] as LogLevels,
641
741
  install: args.install as boolean,
642
742
  template: args.template as string,
643
743
  npmClient: args['npm-client'] as NpmClientType,
644
744
  bundlerName: args.bundler as string,
645
745
  variables: args.vars as Record<string, string>,
746
+ name: args['name'] as string,
646
747
  });
647
748
  },
648
749
  },
@@ -665,14 +766,18 @@ const allCommands: Array<ToolCommand<any>> = [
665
766
  .describe('log-level', 'Sets the log level to use (1-5).')
666
767
  .default('log-level', apps.upgradePiletDefaults.logLevel)
667
768
  .boolean('install')
668
- .describe('install', 'Already performs the update of its NPM dependencies.')
769
+ .describe('install', 'Already performs the update of its npm dependencies.')
669
770
  .default('install', apps.upgradePiletDefaults.install)
771
+ .alias('install', 'package-install')
670
772
  .choices('force-overwrite', forceOverwriteKeys)
671
773
  .describe('force-overwrite', 'Determines if files should be overwritten by the upgrading process.')
672
774
  .default('force-overwrite', keyOfForceOverwrite(apps.upgradePiletDefaults.forceOverwrite))
673
775
  .choices('npm-client', clientTypeKeys)
674
- .describe('npm-client', 'Sets the NPM client to be used when upgrading.')
776
+ .describe('npm-client', 'Sets the npm client to be used when upgrading.')
675
777
  .default('npm-client', apps.upgradePiletDefaults.npmClient)
778
+ .option('vars', undefined)
779
+ .describe('vars', 'Sets additional variables to be used when scaffolding.')
780
+ .default('vars', apps.upgradePiletDefaults.variables)
676
781
  .string('base')
677
782
  .default('base', process.cwd())
678
783
  .describe('base', 'Sets the base directory. By default the current directory is used.');
@@ -685,6 +790,7 @@ const allCommands: Array<ToolCommand<any>> = [
685
790
  forceOverwrite: valueOfForceOverwrite(args['force-overwrite'] as string),
686
791
  install: args.install as boolean,
687
792
  npmClient: args['npm-client'] as NpmClientType,
793
+ variables: args.vars as Record<string, string>,
688
794
  });
689
795
  },
690
796
  },
@@ -717,6 +823,129 @@ const allCommands: Array<ToolCommand<any>> = [
717
823
  });
718
824
  },
719
825
  },
826
+ {
827
+ name: 'add-piral-instance-pilet',
828
+ alias: ['add-shell-pilet', 'install-shell-pilet', 'add-app-pilet', 'with-app-pilet'],
829
+ description: 'Adds another Piral instance to the available apps hosting the current pilet.',
830
+ arguments: ['<app> [source]'],
831
+ flags(argv) {
832
+ return argv
833
+ .positional('app', {
834
+ type: 'string',
835
+ describe: 'Sets the name of the Piral instance to be added.',
836
+ default: apps.addPiralInstancePiletDefaults.app,
837
+ })
838
+ .positional('source', {
839
+ type: 'string',
840
+ describe: 'Sets the source pilet path where the Piral instance should be added.',
841
+ default: apps.addPiralInstancePiletDefaults.source,
842
+ })
843
+ .number('log-level')
844
+ .describe('log-level', 'Sets the log level to use (1-5).')
845
+ .default('log-level', apps.addPiralInstancePiletDefaults.logLevel)
846
+ .choices('npm-client', clientTypeKeys)
847
+ .describe('npm-client', 'Sets the npm client to be used for adding the Piral instance.')
848
+ .default('npm-client', apps.addPiralInstancePiletDefaults.npmClient)
849
+ .boolean('selected')
850
+ .describe('selected', 'Defines if the provided Piral instance should be selected initially.')
851
+ .default('selected', apps.addPiralInstancePiletDefaults.selected)
852
+ .string('base')
853
+ .default('base', process.cwd())
854
+ .describe('base', 'Sets the base directory. By default the current directory is used.');
855
+ },
856
+ run(args) {
857
+ return apps.addPiralInstancePilet(args.base as string, {
858
+ logLevel: args['log-level'] as LogLevels,
859
+ selected: args.selected as boolean,
860
+ npmClient: args['npm-client'] as NpmClientType,
861
+ app: args.app as string,
862
+ source: args.source as string,
863
+ });
864
+ },
865
+ },
866
+ {
867
+ name: 'remove-piral-instance-pilet',
868
+ alias: ['remove-shell-pilet', 'uninstall-shell-pilet', 'remove-app-pilet', 'without-app-pilet'],
869
+ description: 'Removes an existing Piral instance from the available apps hosting the current pilet.',
870
+ arguments: ['<app> [source]'],
871
+ flags(argv) {
872
+ return argv
873
+ .positional('app', {
874
+ type: 'string',
875
+ describe: 'Sets the name of the Piral instance to be removed.',
876
+ default: apps.removePiralInstancePiletDefaults.app,
877
+ })
878
+ .positional('source', {
879
+ type: 'string',
880
+ describe: 'Sets the source pilet path where the Piral instance should be removed.',
881
+ default: apps.removePiralInstancePiletDefaults.source,
882
+ })
883
+ .number('log-level')
884
+ .describe('log-level', 'Sets the log level to use (1-5).')
885
+ .default('log-level', apps.removePiralInstancePiletDefaults.logLevel)
886
+ .choices('npm-client', clientTypeKeys)
887
+ .describe('npm-client', 'Sets the npm client to be used for removing the Piral instance.')
888
+ .default('npm-client', apps.removePiralInstancePiletDefaults.npmClient)
889
+ .string('base')
890
+ .default('base', process.cwd())
891
+ .describe('base', 'Sets the base directory. By default the current directory is used.');
892
+ },
893
+ run(args) {
894
+ return apps.removePiralInstancePilet(args.base as string, {
895
+ logLevel: args['log-level'] as LogLevels,
896
+ app: args.app as string,
897
+ source: args.source as string,
898
+ npmClient: args['npm-client'] as NpmClientType,
899
+ });
900
+ },
901
+ },
902
+ {
903
+ name: 'run-emulator-piral',
904
+ alias: ['start-emulator-piral', 'dev-emulator-portal'],
905
+ description: 'Starts a Piral instance emulator.',
906
+ arguments: ['[source]'],
907
+ // "any" due to https://github.com/microsoft/TypeScript/issues/28663 [artifical N = 50]
908
+ flags(argv: any) {
909
+ return argv
910
+ .positional('source', {
911
+ type: 'string',
912
+ describe: 'Sets the source Piral instance emulator package name.',
913
+ default: apps.runEmulatorPiralDefaults.app,
914
+ })
915
+ .number('port')
916
+ .describe('port', 'Sets the port of the local development server.')
917
+ .default('port', apps.runEmulatorPiralDefaults.port)
918
+ .string('registry')
919
+ .describe('registry', 'Sets the package registry to use for resolving the emulator.')
920
+ .default('registry', apps.runEmulatorPiralDefaults.registry)
921
+ .alias('registry', 'package-registry')
922
+ .number('log-level')
923
+ .describe('log-level', 'Sets the log level to use (1-5).')
924
+ .default('log-level', apps.runEmulatorPiralDefaults.logLevel)
925
+ .choices('npm-client', clientTypeKeys)
926
+ .describe('npm-client', 'Sets the npm client to be used when installing the emulator.')
927
+ .default('npm-client', apps.runEmulatorPiralDefaults.npmClient)
928
+ .boolean('open')
929
+ .describe('open', 'Opens the Piral instance directly in the browser.')
930
+ .default('open', apps.runEmulatorPiralDefaults.open)
931
+ .string('feed')
932
+ .describe('feed', 'Sets the URL of a pilet feed for including remote pilets.')
933
+ .string('base')
934
+ .default('base', process.cwd())
935
+ .describe('base', 'Sets the base directory. By default the current directory is used.');
936
+ },
937
+ run(args) {
938
+ return apps.runEmulatorPiral(args.base as string, {
939
+ port: args.port as number,
940
+ app: args.source as string,
941
+ npmClient: args['npm-client'] as NpmClientType,
942
+ registry: args.registry as string,
943
+ logLevel: args['log-level'] as LogLevels,
944
+ open: args.open as boolean,
945
+ feed: args.feed as string,
946
+ });
947
+ },
948
+ },
720
949
  ];
721
950
 
722
951
  class Commands implements ListCommands {