piral-cli 1.0.0-pre.2296 → 1.0.1-beta.5640

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
@@ -11,60 +11,70 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.newPiral = exports.newPiralDefaults = void 0;
13
13
  const path_1 = require("path");
14
+ const helpers_1 = require("../helpers");
14
15
  const types_1 = require("../types");
15
16
  const common_1 = require("../common");
16
17
  exports.newPiralDefaults = {
17
18
  app: './src/index.html',
18
- registry: common_1.defaultRegistry,
19
+ registry: common_1.config.registry,
19
20
  framework: 'piral',
20
21
  target: '.',
21
22
  version: common_1.cliVersion,
22
23
  forceOverwrite: common_1.ForceOverwrite.no,
23
- language: common_1.SourceLanguage.ts,
24
+ language: common_1.config.language,
24
25
  install: true,
25
26
  template: 'default',
26
27
  logLevel: types_1.LogLevels.info,
27
28
  npmClient: undefined,
28
29
  bundlerName: 'none',
29
30
  variables: {},
31
+ name: undefined,
30
32
  };
31
33
  function newPiral(baseDir = process.cwd(), options = {}) {
32
34
  return __awaiter(this, void 0, void 0, function* () {
33
- const { app = exports.newPiralDefaults.app, registry = exports.newPiralDefaults.registry, framework = exports.newPiralDefaults.framework, target = exports.newPiralDefaults.target, version = exports.newPiralDefaults.version, forceOverwrite = exports.newPiralDefaults.forceOverwrite, language = exports.newPiralDefaults.language, install = exports.newPiralDefaults.install, template = exports.newPiralDefaults.template, logLevel = exports.newPiralDefaults.logLevel, bundlerName = exports.newPiralDefaults.bundlerName, variables = exports.newPiralDefaults.variables, } = options;
34
- common_1.setLogLevel(logLevel);
35
- common_1.progress('Preparing source and target ...');
36
- const root = path_1.resolve(baseDir, target);
37
- const success = yield common_1.createDirectory(root);
35
+ const { app = exports.newPiralDefaults.app, registry = exports.newPiralDefaults.registry, framework = exports.newPiralDefaults.framework, target = exports.newPiralDefaults.target, version = exports.newPiralDefaults.version, forceOverwrite = exports.newPiralDefaults.forceOverwrite, language = exports.newPiralDefaults.language, install = exports.newPiralDefaults.install, template = exports.newPiralDefaults.template, logLevel = exports.newPiralDefaults.logLevel, bundlerName = exports.newPiralDefaults.bundlerName, variables = exports.newPiralDefaults.variables, name = exports.newPiralDefaults.name, npmClient: defaultNpmClient = exports.newPiralDefaults.npmClient, } = options;
36
+ const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
37
+ const root = (0, path_1.resolve)(fullBase, target);
38
+ if (!helpers_1.frameworkKeys.includes(framework)) {
39
+ (0, common_1.fail)('generalError_0002', `The "framework" value must be one of: ${helpers_1.frameworkKeys.join(', ')}`);
40
+ }
41
+ (0, common_1.setLogLevel)(logLevel);
42
+ (0, common_1.progress)('Preparing source and target ...');
43
+ const success = yield (0, common_1.createDirectory)(root);
38
44
  if (success) {
39
- const npmClient = yield common_1.determineNpmClient(root, options.npmClient);
40
- const packageRef = common_1.combinePackageRef(framework, version, 'registry');
41
- common_1.progress(`Creating a new Piral instance in %s ...`, root);
42
- yield common_1.createFileIfNotExists(root, 'package.json', JSON.stringify({
43
- name: path_1.basename(root),
45
+ const npmClient = yield (0, common_1.determineNpmClient)(root, defaultNpmClient);
46
+ const packageRef = (0, common_1.combinePackageRef)(framework, version, 'registry');
47
+ const projectName = name || (0, path_1.basename)(root);
48
+ (0, common_1.progress)(`Creating a new Piral instance in %s ...`, root);
49
+ yield (0, common_1.createFileIfNotExists)(root, 'package.json', JSON.stringify({
50
+ name: projectName,
44
51
  version: '1.0.0',
45
52
  description: '',
46
53
  keywords: ['piral'],
47
54
  dependencies: {},
48
55
  scripts: {},
49
56
  }, undefined, 2));
57
+ yield (0, common_1.initNpmProject)(npmClient, projectName, root);
50
58
  if (registry !== exports.newPiralDefaults.registry) {
51
- common_1.progress(`Setting up NPM registry (%s) ...`, registry);
52
- yield common_1.createFileIfNotExists(root, '.npmrc', `registry=${registry}
59
+ (0, common_1.progress)(`Setting up npm registry (%s) ...`, registry);
60
+ yield (0, common_1.createFileIfNotExists)(root, '.npmrc', `registry=${registry}
53
61
  always-auth=true`, forceOverwrite);
54
62
  }
55
- yield common_1.updateExistingJson(root, 'package.json', common_1.getPiralPackage(app, language, version, framework, bundlerName));
56
- common_1.progress(`Installing NPM package ${packageRef} ...`);
57
- yield common_1.installPackage(npmClient, packageRef, root);
58
- common_1.progress(`Taking care of templating ...`);
59
- yield common_1.scaffoldPiralSourceFiles(template, registry, language, root, app, framework, forceOverwrite, variables);
63
+ yield (0, common_1.createFileIfNotExists)(root, common_1.piralJson, JSON.stringify({}, undefined, 2));
64
+ (0, common_1.progress)(`Installing npm package ${packageRef} ...`);
65
+ yield (0, common_1.installNpmPackage)(npmClient, packageRef, root, '--save-exact');
66
+ (0, common_1.progress)(`Taking care of templating ...`);
67
+ const data = (0, common_1.getPiralScaffoldData)(language, root, app, framework, variables);
68
+ yield (0, common_1.patchPiralPackage)(root, app, data, version, bundlerName);
69
+ yield (0, common_1.scaffoldPiralSourceFiles)(template, registry, data, forceOverwrite);
60
70
  if (install) {
61
- common_1.progress(`Installing dependencies ...`);
62
- yield common_1.installDependencies(npmClient, root);
71
+ (0, common_1.progress)(`Installing dependencies ...`);
72
+ yield (0, common_1.installNpmDependencies)(npmClient, root);
63
73
  }
64
- common_1.logDone(`Piral instance scaffolded successfully!`);
74
+ (0, common_1.logDone)(`Piral instance scaffolded successfully!`);
65
75
  }
66
76
  else {
67
- common_1.fail('cannotCreateDirectory_0044');
77
+ (0, common_1.fail)('cannotCreateDirectory_0044');
68
78
  }
69
79
  });
70
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"new-piral.js","sourceRoot":"","sources":["../../src/apps/new-piral.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAyC;AACzC,oCAA+D;AAC/D,sCAkBmB;AAqEN,QAAA,gBAAgB,GAAoB;IAC/C,GAAG,EAAE,kBAAkB;IACvB,QAAQ,EAAE,wBAAe;IACzB,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,mBAAU;IACnB,cAAc,EAAE,uBAAc,CAAC,EAAE;IACjC,QAAQ,EAAE,uBAAc,CAAC,EAAE;IAC3B,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,iBAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,SAAsB,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAA2B,EAAE;;QACnF,MAAM,EACJ,GAAG,GAAG,wBAAgB,CAAC,GAAG,EAC1B,QAAQ,GAAG,wBAAgB,CAAC,QAAQ,EACpC,SAAS,GAAG,wBAAgB,CAAC,SAAS,EACtC,MAAM,GAAG,wBAAgB,CAAC,MAAM,EAChC,OAAO,GAAG,wBAAgB,CAAC,OAAO,EAClC,cAAc,GAAG,wBAAgB,CAAC,cAAc,EAChD,QAAQ,GAAG,wBAAgB,CAAC,QAAQ,EACpC,OAAO,GAAG,wBAAgB,CAAC,OAAO,EAClC,QAAQ,GAAG,wBAAgB,CAAC,QAAQ,EAC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iB,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YAE/D,MAAM,IAAA,iCAAwB,EAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;YAEzE,IAAI,OAAO,EAAE;gBACX,IAAA,iBAAQ,EAAC,6BAA6B,CAAC,CAAC;gBACxC,MAAM,IAAA,+BAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aAC/C;YAED,IAAA,gBAAO,EAAC,yCAAyC,CAAC,CAAC;SACpD;aAAM;YACL,IAAA,aAAI,EAAC,4BAA4B,CAAC,CAAC;SACpC;IACH,CAAC;CAAA;AA1FD,4BA0FC"}
@@ -1,7 +1,16 @@
1
1
  import { LogLevels } from '../types';
2
2
  export interface PackPiletOptions {
3
+ /**
4
+ * Sets the source directory for creating the npm package.
5
+ */
3
6
  source?: string;
7
+ /**
8
+ * Sets the target directory for storing the tarball.
9
+ */
4
10
  target?: string;
11
+ /**
12
+ * Sets the log level to use (1-5).
13
+ */
5
14
  logLevel?: LogLevels;
6
15
  }
7
16
  export declare const packPiletDefaults: PackPiletOptions;
@@ -10,29 +10,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.packPilet = exports.packPiletDefaults = void 0;
13
+ const path_1 = require("path");
13
14
  const common_1 = require("../common");
14
15
  const types_1 = require("../types");
15
16
  exports.packPiletDefaults = {
16
- /**
17
- * Sets the source directory for creating the NPM package.
18
- */
19
17
  source: '.',
20
- /**
21
- * Sets the target directory for storing the tarball.
22
- */
23
18
  target: '.',
24
- /**
25
- * Sets the log level to use (1-5).
26
- */
27
19
  logLevel: types_1.LogLevels.info,
28
20
  };
29
21
  function packPilet(baseDir = process.cwd(), options = {}) {
30
22
  return __awaiter(this, void 0, void 0, function* () {
31
23
  const { source = exports.packPiletDefaults.source, target = exports.packPiletDefaults.target, logLevel = exports.packPiletDefaults.logLevel, } = options;
32
- common_1.setLogLevel(logLevel);
33
- common_1.progress('Reading configuration ...');
34
- yield common_1.createPiletPackage(baseDir, source, target);
35
- common_1.logDone(`Pilet packed successfully!`);
24
+ const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
25
+ (0, common_1.setLogLevel)(logLevel);
26
+ (0, common_1.progress)('Reading configuration ...');
27
+ yield (0, common_1.createPiletPackage)(fullBase, source, target);
28
+ (0, common_1.logDone)(`Pilet packed successfully!`);
36
29
  });
37
30
  }
38
31
  exports.packPilet = packPilet;
@@ -1 +1 @@
1
- {"version":3,"file":"pack-pilet.js","sourceRoot":"","sources":["../../src/apps/pack-pilet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAA+E;AAC/E,oCAAqC;AAQxB,QAAA,iBAAiB,GAAqB;IACjD;;OAEG;IACH,MAAM,EAAE,GAAG;IAEX;;OAEG;IACH,MAAM,EAAE,GAAG;IAEX;;OAEG;IACH,QAAQ,EAAE,iBAAS,CAAC,IAAI;CACzB,CAAC;AAEF,SAAsB,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAA4B,EAAE;;QACrF,MAAM,EACJ,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,QAAQ,GAAG,yBAAiB,CAAC,QAAQ,GACtC,GAAG,OAAO,CAAC;QACZ,oBAAW,CAAC,QAAQ,CAAC,CAAC;QACtB,iBAAQ,CAAC,2BAA2B,CAAC,CAAC;QACtC,MAAM,2BAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,gBAAO,CAAC,4BAA4B,CAAC,CAAC;IACxC,CAAC;CAAA;AAVD,8BAUC"}
1
+ {"version":3,"file":"pack-pilet.js","sourceRoot":"","sources":["../../src/apps/pack-pilet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,sCAA+E;AAC/E,oCAAqC;AAmBxB,QAAA,iBAAiB,GAAqB;IACjD,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,iBAAS,CAAC,IAAI;CACzB,CAAC;AAEF,SAAsB,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAA4B,EAAE;;QACrF,MAAM,EACJ,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,QAAQ,GAAG,yBAAiB,CAAC,QAAQ,GACtC,GAAG,OAAO,CAAC;QACZ,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACjD,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;QACtB,IAAA,iBAAQ,EAAC,2BAA2B,CAAC,CAAC;QACtC,MAAM,IAAA,2BAAkB,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACnD,IAAA,gBAAO,EAAC,4BAA4B,CAAC,CAAC;IACxC,CAAC;CAAA;AAXD,8BAWC"}
@@ -1,11 +1,11 @@
1
- import { LogLevels, PiletSchemaVersion, PiletPublishSource } from '../types';
1
+ import { LogLevels, PiletSchemaVersion, PiletPublishSource, PiletPublishScheme } from '../types';
2
2
  export interface PublishPiletOptions {
3
3
  /**
4
4
  * Sets the root module's path to use as source starting point when
5
5
  * used with `--fresh`, otherwise expects source to be a path leading
6
6
  * to a `*.tgz` file.
7
7
  */
8
- source?: string;
8
+ source?: string | Array<string>;
9
9
  /**
10
10
  * Sets the URL of the feed service to deploy to.
11
11
  */
@@ -34,13 +34,33 @@ export interface PublishPiletOptions {
34
34
  /**
35
35
  * Changing the publish source makes it possible to publish pilets that have
36
36
  * been stored on non-local paths, e.g., when a pilet was already published to
37
- * an NPM feed.
37
+ * an npm feed.
38
38
  */
39
39
  from?: PiletPublishSource;
40
40
  /**
41
41
  * Places additional fields that should be posted to the feed service.
42
42
  */
43
43
  fields?: Record<string, string>;
44
+ /**
45
+ * Places additional headers that should be posted to the feed service.
46
+ */
47
+ headers?: Record<string, string>;
48
+ /**
49
+ * Defines if authorization tokens can be retrieved interactively.
50
+ */
51
+ interactive?: boolean;
52
+ /**
53
+ * Sets the bundler to use for building, if any specific.
54
+ */
55
+ bundlerName?: string;
56
+ /**
57
+ * Sets the authorization scheme to use.
58
+ */
59
+ mode?: PiletPublishScheme;
60
+ /**
61
+ * Additional arguments for a specific bundler.
62
+ */
63
+ _?: Record<string, any>;
44
64
  }
45
65
  export declare const publishPiletDefaults: PublishPiletOptions;
46
66
  export declare function publishPilet(baseDir?: string, options?: PublishPiletOptions): Promise<void>;
@@ -11,117 +11,167 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.publishPilet = exports.publishPiletDefaults = void 0;
13
13
  const path_1 = require("path");
14
- const build_pilet_1 = require("./build-pilet");
14
+ const bundler_1 = require("../bundler");
15
15
  const types_1 = require("../types");
16
16
  const common_1 = require("../common");
17
17
  exports.publishPiletDefaults = {
18
- source: '*.tgz',
19
- url: '',
20
- apiKey: '',
18
+ url: undefined,
19
+ apiKey: undefined,
21
20
  fresh: false,
22
21
  cert: undefined,
23
22
  logLevel: types_1.LogLevels.info,
24
- schemaVersion: 'v1',
23
+ schemaVersion: undefined,
24
+ mode: 'basic',
25
25
  from: 'local',
26
26
  fields: {},
27
+ headers: {},
28
+ interactive: false,
27
29
  };
28
- function getFiles(baseDir, source, from, fresh, schemaVersion, ca) {
30
+ function isSubDir(parent, dir) {
31
+ const rel = (0, path_1.relative)(parent, dir);
32
+ return rel && !rel.startsWith('..') && !(0, path_1.isAbsolute)(rel);
33
+ }
34
+ function getFiles(baseDir, sources, from, fresh, originalSchemaVersion, logLevel, bundlerName, _, ca) {
29
35
  return __awaiter(this, void 0, void 0, function* () {
30
36
  if (fresh) {
31
- common_1.log('generalDebug_0003', 'Detected "--fresh". Trying to resolve the package.json.');
32
- const details = require(path_1.join(baseDir, 'package.json'));
33
- common_1.progress('Triggering pilet build ...');
34
- yield build_pilet_1.buildPilet(baseDir, {
35
- target: details.main,
36
- fresh,
37
- schemaVersion,
38
- });
39
- common_1.log('generalDebug_0003', 'Successfully built.');
40
- common_1.progress('Triggering pilet pack ...');
41
- const file = yield common_1.createPiletPackage(baseDir, '.', '.');
42
- common_1.log('generalDebug_0003', 'Successfully packed.');
43
- return [file];
37
+ (0, common_1.log)('generalDebug_0003', 'Detected "--fresh". Trying to resolve the package.json.');
38
+ const allEntries = yield (0, common_1.matchAnyPilet)(baseDir, sources);
39
+ if (allEntries.length === 0) {
40
+ (0, common_1.fail)('entryFileMissing_0077');
41
+ }
42
+ return yield Promise.all(allEntries.map((entryModule) => __awaiter(this, void 0, void 0, function* () {
43
+ const targetDir = (0, path_1.dirname)(entryModule);
44
+ (0, common_1.progress)('Triggering pilet build ...');
45
+ const { root, piletPackage, importmap, peerDependencies, peerModules, apps, schema } = yield (0, common_1.retrievePiletData)(targetDir);
46
+ const schemaVersion = originalSchemaVersion || schema || common_1.config.schemaVersion || common_1.defaultSchemaVersion;
47
+ const piralInstances = apps.map((m) => m.appPackage.name);
48
+ const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
49
+ const propDest = (0, path_1.resolve)(root, main);
50
+ (0, common_1.log)('generalDebug_0003', `Pilet "${name}" is supposed to generate artifact in "${propDest}".`);
51
+ const usePropDest = (0, path_1.dirname)(propDest) !== root && isSubDir(root, propDest);
52
+ const dest = usePropDest ? propDest : (0, path_1.resolve)(root, 'dist');
53
+ (0, common_1.log)('generalDebug_0003', `Pilet "${name}" is generating artifact in "${dest}".`);
54
+ const outDir = (0, path_1.dirname)(dest);
55
+ const outFile = (0, path_1.basename)(dest);
56
+ const externals = (0, common_1.combinePiletExternals)(piralInstances, peerDependencies, peerModules, importmap);
57
+ (0, common_1.log)('generalDebug_0003', `Pilet "${name}" uses externals: ${externals.join(', ')}.`);
58
+ (0, common_1.progress)('Removing output directory ...');
59
+ yield (0, common_1.removeDirectory)(outDir);
60
+ (0, common_1.logInfo)('Bundle pilet ...');
61
+ yield (0, bundler_1.callPiletBuild)({
62
+ root,
63
+ piralInstances,
64
+ optimizeModules: false,
65
+ sourceMaps: true,
66
+ watch: false,
67
+ contentHash: true,
68
+ minify: true,
69
+ externals,
70
+ targetDir,
71
+ importmap,
72
+ outFile,
73
+ outDir,
74
+ entryModule: `./${(0, path_1.relative)(root, entryModule)}`,
75
+ logLevel,
76
+ version: schemaVersion,
77
+ ignored: [],
78
+ _,
79
+ }, bundlerName);
80
+ (0, common_1.log)('generalDebug_0003', `Pilet "${name}" built successfully!`);
81
+ (0, common_1.progress)('Triggering pilet pack ...');
82
+ const file = yield (0, common_1.createPiletPackage)(root, '.', '.');
83
+ (0, common_1.log)('generalDebug_0003', `Pilet "${name}" packed successfully!`);
84
+ return file;
85
+ })));
44
86
  }
45
87
  else {
46
- common_1.log('generalDebug_0003', `Did not find fresh flag. Trying to match from "${from}".`);
88
+ (0, common_1.log)('generalDebug_0003', `Did not find fresh flag. Trying to match from "${from}".`);
47
89
  switch (from) {
48
- case 'local':
49
- common_1.log('generalDebug_0003', `Matching files using "${source}".`);
50
- return yield common_1.matchFiles(baseDir, source);
51
- case 'remote':
52
- common_1.log('generalDebug_0003', `Download file from "${source}".`);
53
- return yield common_1.downloadFile(source, ca);
54
- case 'npm':
55
- common_1.log('generalDebug_0003', `View NPM package "${source}".`);
56
- const url = yield common_1.findTarball(source);
57
- common_1.log('generalDebug_0003', `Download file from "${url}".`);
58
- return yield common_1.downloadFile(url, ca);
90
+ case 'local': {
91
+ (0, common_1.log)('generalDebug_0003', `Matching files using "${sources.join('", "')}".`);
92
+ const allFiles = yield Promise.all(sources.map((s) => (0, common_1.matchFiles)(baseDir, s)));
93
+ return allFiles.reduce((result, files) => [...result, ...files], []);
94
+ }
95
+ case 'remote': {
96
+ (0, common_1.log)('generalDebug_0003', `Download file from "${sources.join('", "')}".`);
97
+ const allFiles = yield Promise.all(sources.map((s) => (0, common_1.downloadFile)(s, ca)));
98
+ return allFiles.reduce((result, files) => [...result, ...files], []);
99
+ }
100
+ case 'npm': {
101
+ (0, common_1.log)('generalDebug_0003', `View npm package "${sources.join('", "')}".`);
102
+ const allUrls = yield Promise.all(sources.map((s) => (0, common_1.findNpmTarball)(s)));
103
+ (0, common_1.log)('generalDebug_0003', `Download file from "${allUrls.join('", "')}".`);
104
+ const allFiles = yield Promise.all(allUrls.map((url) => (0, common_1.downloadFile)(url, ca)));
105
+ return allFiles.reduce((result, files) => [...result, ...files], []);
106
+ }
59
107
  }
60
108
  }
61
109
  });
62
110
  }
63
111
  function publishPilet(baseDir = process.cwd(), options = {}) {
64
- var _a, _b, _c;
112
+ var _a, _b, _c, _d, _e;
65
113
  return __awaiter(this, void 0, void 0, function* () {
66
- const { source = exports.publishPiletDefaults.source, url = (_a = common_1.config.url) !== null && _a !== void 0 ? _a : exports.publishPiletDefaults.url, apiKey = (_b = common_1.config.apiKey) !== null && _b !== void 0 ? _b : exports.publishPiletDefaults.apiKey, fresh = exports.publishPiletDefaults.fresh, logLevel = exports.publishPiletDefaults.logLevel, from = exports.publishPiletDefaults.from, schemaVersion = exports.publishPiletDefaults.schemaVersion, cert = (_c = common_1.config.cert) !== null && _c !== void 0 ? _c : exports.publishPiletDefaults.cert, fields = exports.publishPiletDefaults.fields, } = options;
67
- common_1.setLogLevel(logLevel);
68
- common_1.progress('Reading configuration ...');
114
+ const { fresh = exports.publishPiletDefaults.fresh, source = fresh ? './src/index' : '*.tgz', url = (_a = common_1.config.url) !== null && _a !== void 0 ? _a : exports.publishPiletDefaults.url, apiKey = (_d = (_c = (_b = common_1.config.apiKeys) === null || _b === void 0 ? void 0 : _b[url]) !== null && _c !== void 0 ? _c : common_1.config.apiKey) !== null && _d !== void 0 ? _d : exports.publishPiletDefaults.apiKey, logLevel = exports.publishPiletDefaults.logLevel, from = exports.publishPiletDefaults.from, schemaVersion = exports.publishPiletDefaults.schemaVersion, cert = (_e = common_1.config.cert) !== null && _e !== void 0 ? _e : exports.publishPiletDefaults.cert, fields = exports.publishPiletDefaults.fields, headers = exports.publishPiletDefaults.headers, mode = exports.publishPiletDefaults.mode, interactive = exports.publishPiletDefaults.interactive, _ = {}, bundlerName, } = options;
115
+ const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
116
+ (0, common_1.setLogLevel)(logLevel);
117
+ (0, common_1.progress)('Reading configuration ...');
69
118
  if (!url) {
70
- common_1.fail('missingPiletFeedUrl_0060');
119
+ (0, common_1.fail)('missingPiletFeedUrl_0060');
71
120
  }
72
- common_1.log('generalDebug_0003', 'Checking if certificate exists.');
121
+ (0, common_1.log)('generalDebug_0003', 'Checking if certificate exists.');
73
122
  let ca = undefined;
74
- if (yield common_1.checkExists(cert)) {
75
- const dir = path_1.dirname(cert);
76
- const file = path_1.basename(cert);
77
- common_1.log('generalDebug_0003', `Reading certificate file "${file}" from "${dir}".`);
78
- ca = yield common_1.readBinary(dir, file);
123
+ if (yield (0, common_1.checkExists)(cert)) {
124
+ const dir = (0, path_1.dirname)(cert);
125
+ const file = (0, path_1.basename)(cert);
126
+ (0, common_1.log)('generalDebug_0003', `Reading certificate file "${file}" from "${dir}".`);
127
+ ca = yield (0, common_1.readBinary)(dir, file);
79
128
  }
80
- common_1.log('generalDebug_0003', 'Getting the tgz files ...');
81
- const files = yield getFiles(baseDir, source, from, fresh, schemaVersion, ca);
129
+ (0, common_1.log)('generalDebug_0003', 'Getting the tgz files ...');
130
+ const sources = Array.isArray(source) ? source : [source];
131
+ const files = yield getFiles(fullBase, sources, from, fresh, schemaVersion, logLevel, bundlerName, _, ca);
82
132
  const successfulUploads = [];
83
- common_1.log('generalDebug_0003', 'Received available tgz files.');
133
+ (0, common_1.log)('generalDebug_0003', 'Received available tgz files.');
84
134
  if (files.length === 0) {
85
- common_1.fail('missingPiletTarball_0061', source);
135
+ (0, common_1.fail)('missingPiletTarball_0061', sources);
86
136
  }
87
- common_1.log('generalInfo_0000', `Using feed service "${url}".`);
137
+ (0, common_1.log)('generalInfo_0000', `Using feed service "${url}".`);
88
138
  for (const file of files) {
89
- common_1.log('generalDebug_0003', 'Reading the file for upload ...');
90
- const fileName = path_1.relative(baseDir, file);
91
- const content = yield common_1.readBinary(baseDir, fileName);
139
+ (0, common_1.log)('generalDebug_0003', 'Reading the file for upload ...');
140
+ const fileName = (0, path_1.relative)(fullBase, file);
141
+ const content = yield (0, common_1.readBinary)(fullBase, fileName);
92
142
  if (content) {
93
- common_1.progress(`Publishing "%s" ...`, file, url);
94
- const result = yield common_1.postFile(url, apiKey, content, fields, ca);
143
+ (0, common_1.progress)(`Publishing "%s" ...`, file, url);
144
+ const result = yield (0, common_1.postFile)(url, mode, apiKey, content, fields, headers, ca, interactive);
95
145
  if (result.success) {
96
146
  successfulUploads.push(file);
97
147
  if (result.response) {
98
- common_1.log('httpPostResponse_0067', result);
148
+ (0, common_1.log)('httpPostResponse_0067', result);
99
149
  }
100
- common_1.progress(`Published successfully!`);
150
+ (0, common_1.progress)(`Published successfully!`);
101
151
  }
102
152
  else if (result.status === 402) {
103
- common_1.log('failedToUploadPayment_0161', result.response);
153
+ (0, common_1.log)('failedToUploadPayment_0161', result.response);
104
154
  }
105
155
  else if (result.status === 409) {
106
- common_1.log('failedToUploadVersion_0162', result.response);
156
+ (0, common_1.log)('failedToUploadVersion_0162', result.response);
107
157
  }
108
158
  else if (result.status === 413) {
109
- common_1.log('failedToUploadSize_0163', result.response);
159
+ (0, common_1.log)('failedToUploadSize_0163', result.response);
110
160
  }
111
161
  else {
112
- common_1.log('failedToUpload_0062', fileName);
162
+ (0, common_1.log)('failedToUpload_0062', fileName);
113
163
  }
114
164
  }
115
165
  else {
116
- common_1.log('failedToRead_0063', fileName);
166
+ (0, common_1.log)('failedToRead_0063', fileName);
117
167
  }
118
- common_1.log('generalDebug_0003', 'Finished uploading the file.');
168
+ (0, common_1.log)('generalDebug_0003', 'Finished uploading the file.');
119
169
  }
120
170
  if (files.length === successfulUploads.length) {
121
- common_1.logDone(`Pilet(s) published successfully!`);
171
+ (0, common_1.logDone)(`Pilet(s) published successfully!`);
122
172
  }
123
173
  else {
124
- common_1.fail('failedUploading_0064');
174
+ (0, common_1.fail)('failedUploading_0064');
125
175
  }
126
176
  });
127
177
  }
@@ -1 +1 @@
1
- {"version":3,"file":"publish-pilet.js","sourceRoot":"","sources":["../../src/apps/publish-pilet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAyD;AACzD,+CAA2C;AAC3C,oCAA6E;AAC7E,sCAcmB;AAsDN,QAAA,oBAAoB,GAAwB;IACvD,MAAM,EAAE,OAAO;IACf,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,iBAAS,CAAC,IAAI;IACxB,aAAa,EAAE,IAAI;IACnB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,SAAe,QAAQ,CACrB,OAAe,EACf,MAAc,EACd,IAAwB,EACxB,KAAc,EACd,aAAiC,EACjC,EAAW;;QAEX,IAAI,KAAK,EAAE;YACT,YAAG,CAAC,mBAAmB,EAAE,yDAAyD,CAAC,CAAC;YACpF,MAAM,OAAO,GAAG,OAAO,CAAC,WAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;YACvD,iBAAQ,CAAC,4BAA4B,CAAC,CAAC;YACvC,MAAM,wBAAU,CAAC,OAAO,EAAE;gBACxB,MAAM,EAAE,OAAO,CAAC,IAAI;gBACpB,KAAK;gBACL,aAAa;aACd,CAAC,CAAC;YACH,YAAG,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;YAChD,iBAAQ,CAAC,2BAA2B,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,MAAM,2BAAkB,CAAC,OAAO,EAAE,GAA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MAAM,CAAC,QAAQ,CAAC,CAAC;iBACjD;qBAAM;oBACL,IAAA,YAAG,EAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;iBACtC;aACF;iBAAM;gBACL,IAAA,YAAG,EAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;aACpC;YAED,IAAA,YAAG,EAAC,mBAAmB,EAAE,8BAA8B,CAAC,CAAC;SAC1D;QAED,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM,EAAE;YAC7C,IAAA,gBAAO,EAAC,kCAAkC,CAAC,CAAC;SAC7C;aAAM;YACL,IAAA,aAAI,EAAC,sBAAsB,CAAC,CAAC;SAC9B;;CACF;AArFD,oCAqFC"}
@@ -9,9 +9,13 @@ export interface PublishPiralOptions {
9
9
  */
10
10
  logLevel?: LogLevels;
11
11
  /**
12
- * The additional fields to supply for the provider.
12
+ * The options to supply for the provider.
13
13
  */
14
- fields?: Record<string, string>;
14
+ opts?: Record<string, string>;
15
+ /**
16
+ * Defines if authorization tokens can be retrieved interactively.
17
+ */
18
+ interactive?: boolean;
15
19
  /**
16
20
  * The provider to use for publishing the release artifacts.
17
21
  */
@@ -19,59 +19,63 @@ exports.publishPiralDefaults = {
19
19
  logLevel: types_1.LogLevels.info,
20
20
  type: 'all',
21
21
  provider: 'none',
22
- fields: {},
22
+ opts: {},
23
+ interactive: false,
23
24
  };
24
- function publishEmulator(baseDir, source, args = {}) {
25
+ function publishEmulator(baseDir, source, args = {}, interactive = false) {
25
26
  return __awaiter(this, void 0, void 0, function* () {
26
27
  const type = 'emulator';
27
- const directory = path_1.resolve(baseDir, source, type);
28
- const exists = yield common_1.checkExists(directory);
28
+ const directory = (0, path_1.resolve)(baseDir, source, type);
29
+ const exists = yield (0, common_1.checkExists)(directory);
29
30
  if (!exists) {
30
- common_1.fail('publishDirectoryMissing_0110', directory);
31
+ (0, common_1.fail)('publishDirectoryMissing_0110', directory);
31
32
  }
32
- const files = yield common_1.matchFiles(directory, '*.tgz');
33
+ const files = yield (0, common_1.matchFiles)(directory, '*.tgz');
34
+ (0, common_1.log)('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
33
35
  if (files.length !== 1) {
34
- common_1.fail('publishEmulatorFilesUnexpected_0111', directory);
36
+ (0, common_1.fail)('publishEmulatorFilesUnexpected_0111', directory);
35
37
  }
36
38
  const [file] = files;
37
39
  const flags = Object.keys(args).reduce((p, c) => {
38
40
  p.push(`--${c}`, args[c]);
39
41
  return p;
40
42
  }, []);
41
- yield common_1.publishPackage(directory, file, flags);
43
+ yield (0, common_1.publishNpmPackage)(directory, file, flags, interactive);
42
44
  });
43
45
  }
44
- function publishRelease(baseDir, source, providerName, args = {}) {
46
+ function publishRelease(baseDir, source, providerName, args = {}, interactive = false) {
45
47
  return __awaiter(this, void 0, void 0, function* () {
46
48
  const type = 'release';
47
- const directory = path_1.resolve(baseDir, source, type);
48
- const exists = yield common_1.checkExists(directory);
49
+ const directory = (0, path_1.resolve)(baseDir, source, type);
50
+ const exists = yield (0, common_1.checkExists)(directory);
49
51
  if (!exists) {
50
- common_1.fail('publishDirectoryMissing_0110', directory);
52
+ (0, common_1.fail)('publishDirectoryMissing_0110', directory);
51
53
  }
52
- const files = yield common_1.matchFiles(directory, '**/*');
53
- yield release_1.publishArtifacts(providerName, files, args);
54
+ const files = yield (0, common_1.matchFiles)(directory, '**/*');
55
+ (0, common_1.log)('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
56
+ yield (0, release_1.publishArtifacts)(providerName, directory, files, args, interactive);
54
57
  });
55
58
  }
56
59
  function publishPiral(baseDir = process.cwd(), options = {}) {
57
60
  return __awaiter(this, void 0, void 0, function* () {
58
- const { source = exports.publishPiralDefaults.source, type = exports.publishPiralDefaults.type, logLevel = exports.publishPiralDefaults.logLevel, fields = exports.publishPiralDefaults.fields, provider = exports.publishPiralDefaults.provider, } = options;
59
- common_1.setLogLevel(logLevel);
61
+ const { source = exports.publishPiralDefaults.source, type = exports.publishPiralDefaults.type, logLevel = exports.publishPiralDefaults.logLevel, opts = exports.publishPiralDefaults.opts, provider = exports.publishPiralDefaults.provider, interactive = exports.publishPiralDefaults.interactive, } = options;
62
+ const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
63
+ (0, common_1.setLogLevel)(logLevel);
60
64
  if (type === 'emulator-sources') {
61
- common_1.fail('publishEmulatorSourcesInvalid_0114');
65
+ (0, common_1.fail)('publishEmulatorSourcesInvalid_0114');
62
66
  }
63
- common_1.progress('Reading configuration ...');
67
+ (0, common_1.progress)('Reading configuration ...');
64
68
  if (type !== 'release') {
65
- common_1.progress('Publishing emulator package ...');
66
- yield publishEmulator(baseDir, source, fields);
67
- common_1.logDone(`Successfully published emulator.`);
68
- common_1.logReset();
69
+ (0, common_1.progress)('Publishing emulator package ...');
70
+ yield publishEmulator(fullBase, source, opts, interactive);
71
+ (0, common_1.logDone)(`Successfully published emulator.`);
72
+ (0, common_1.logReset)();
69
73
  }
70
74
  if (type !== 'emulator') {
71
- common_1.progress('Publishing release files ...');
72
- yield publishRelease(baseDir, source, provider, fields);
73
- common_1.logDone(`Successfully published release.`);
74
- common_1.logReset();
75
+ (0, common_1.progress)('Publishing release files ...');
76
+ yield publishRelease(fullBase, source, provider, opts, interactive);
77
+ (0, common_1.logDone)(`Successfully published release.`);
78
+ (0, common_1.logReset)();
75
79
  }
76
80
  });
77
81
  }