@tramvai/cli 2.63.0 → 2.65.9

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 (416) hide show
  1. package/README.md +46 -38
  2. package/lib/api/analyze/providers/shared.js +1 -1
  3. package/lib/api/analyze/providers/shared.js.map +1 -1
  4. package/lib/api/benchmark/index.d.ts +1 -1
  5. package/lib/api/build/child-app.js +3 -2
  6. package/lib/api/build/child-app.js.map +1 -1
  7. package/lib/api/build/module.js +1 -2
  8. package/lib/api/build/module.js.map +1 -1
  9. package/lib/api/build/providers/shared.js +1 -1
  10. package/lib/api/build/providers/shared.js.map +1 -1
  11. package/lib/api/index.d.ts +6 -2
  12. package/lib/api/index.js +3 -3
  13. package/lib/api/index.js.map +1 -1
  14. package/lib/api/shared/types/withConfig.d.ts +3 -2
  15. package/lib/api/start/providers/application/shared.js +1 -1
  16. package/lib/api/start/providers/application/shared.js.map +1 -1
  17. package/lib/api/start/providers/child-app/shared.js +8 -7
  18. package/lib/api/start/providers/child-app/shared.js.map +1 -1
  19. package/lib/api/start/providers/module/shared.js +14 -13
  20. package/lib/api/start/providers/module/shared.js.map +1 -1
  21. package/lib/api/start/utils/banner.js +3 -2
  22. package/lib/api/start/utils/banner.js.map +1 -1
  23. package/lib/api/start/utils/tips/tips.js +10 -8
  24. package/lib/api/start/utils/tips/tips.js.map +1 -1
  25. package/lib/api/start-prod/providers/application.js +5 -5
  26. package/lib/api/start-prod/providers/application.js.map +1 -1
  27. package/lib/api/start-prod/providers/child-app.js +2 -2
  28. package/lib/api/start-prod/providers/child-app.js.map +1 -1
  29. package/lib/api/start-prod/providers/shared.js +3 -3
  30. package/lib/api/start-prod/providers/shared.js.map +1 -1
  31. package/lib/builder/webpack/devServer/client.js +18 -15
  32. package/lib/builder/webpack/devServer/client.js.map +1 -1
  33. package/lib/builder/webpack/devServer/notifier.d.ts +2 -2
  34. package/lib/builder/webpack/devServer/notifier.js +3 -3
  35. package/lib/builder/webpack/devServer/notifier.js.map +1 -1
  36. package/lib/builder/webpack/devServer/pool/process/pool.js +3 -2
  37. package/lib/builder/webpack/devServer/pool/process/pool.js.map +1 -1
  38. package/lib/builder/webpack/devServer/pool/thread/pool.js +7 -0
  39. package/lib/builder/webpack/devServer/pool/thread/pool.js.map +1 -1
  40. package/lib/builder/webpack/devServer/server.js +7 -2
  41. package/lib/builder/webpack/devServer/server.js.map +1 -1
  42. package/lib/builder/webpack/providers/analyze/shared.js +3 -3
  43. package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
  44. package/lib/builder/webpack/providers/build/application/server.js.map +1 -1
  45. package/lib/builder/webpack/providers/build/client.js +3 -3
  46. package/lib/builder/webpack/providers/build/client.js.map +1 -1
  47. package/lib/builder/webpack/providers/build/server.js +1 -1
  48. package/lib/builder/webpack/providers/build/server.js.map +1 -1
  49. package/lib/builder/webpack/tokens.d.ts +313 -3
  50. package/lib/builder/webpack/tokens.js.map +1 -1
  51. package/lib/builder/webpack/utils/copyBuildFile.d.ts +2 -1
  52. package/lib/builder/webpack/utils/copyBuildFile.js +2 -3
  53. package/lib/builder/webpack/utils/copyBuildFile.js.map +1 -1
  54. package/lib/builder/webpack/utils/copyStatsJsonFile.d.ts +2 -1
  55. package/lib/builder/webpack/utils/copyStatsJsonFile.js +1 -1
  56. package/lib/builder/webpack/utils/copyStatsJsonFile.js.map +1 -1
  57. package/lib/cli/CLI.d.ts +2 -2
  58. package/lib/cli/CLI.js +2 -2
  59. package/lib/cli/CLI.js.map +1 -1
  60. package/lib/cli/index.js.map +1 -1
  61. package/lib/commands/analyze/command.d.ts +1 -1
  62. package/lib/commands/analyze/command.js.map +1 -1
  63. package/lib/commands/benchmark/command.d.ts +1 -1
  64. package/lib/commands/benchmark/command.js.map +1 -1
  65. package/lib/commands/build/command.d.ts +1 -1
  66. package/lib/commands/build/command.js.map +1 -1
  67. package/lib/commands/new/new.js +0 -1
  68. package/lib/commands/new/new.js.map +1 -1
  69. package/lib/commands/new/questions/packageManager.d.ts +1 -1
  70. package/lib/commands/new/questions/packageManager.js.map +1 -1
  71. package/lib/commands/new/questions/template.d.ts +1 -1
  72. package/lib/commands/new/questions/template.js.map +1 -1
  73. package/lib/commands/new/questions/testingFramework.d.ts +1 -1
  74. package/lib/commands/new/questions/testingFramework.js.map +1 -1
  75. package/lib/commands/new/questions/type.d.ts +1 -1
  76. package/lib/commands/new/questions/type.js.map +1 -1
  77. package/lib/commands/new/steps/initializationGit.d.ts +1 -1
  78. package/lib/commands/new/steps/initializationGit.js.map +1 -1
  79. package/lib/commands/start/command.d.ts +1 -1
  80. package/lib/commands/start/command.js.map +1 -1
  81. package/lib/commands/start-prod/command.d.ts +1 -1
  82. package/lib/commands/start-prod/command.js.map +1 -1
  83. package/lib/commands/static/application.js +4 -4
  84. package/lib/commands/static/application.js.map +1 -1
  85. package/lib/commands/static/command.d.ts +1 -1
  86. package/lib/commands/static/command.js.map +1 -1
  87. package/lib/commands/static/generate.js +2 -2
  88. package/lib/commands/static/generate.js.map +1 -1
  89. package/lib/commands/static/server.d.ts +2 -1
  90. package/lib/commands/static/server.js +1 -1
  91. package/lib/commands/static/server.js.map +1 -1
  92. package/lib/commands/static/staticServer.d.ts +2 -1
  93. package/lib/commands/static/staticServer.js +1 -1
  94. package/lib/commands/static/staticServer.js.map +1 -1
  95. package/lib/commands/update/updatePackageJson.js +3 -0
  96. package/lib/commands/update/updatePackageJson.js.map +1 -1
  97. package/lib/config/configManager.d.ts +12 -73
  98. package/lib/config/configManager.js +61 -92
  99. package/lib/config/configManager.js.map +1 -1
  100. package/lib/config/showConfig.d.ts +1 -1
  101. package/lib/config/showConfig.js +1 -1
  102. package/lib/config/showConfig.js.map +1 -1
  103. package/lib/config/validate.d.ts +5 -4
  104. package/lib/config/validate.js +2 -9
  105. package/lib/config/validate.js.map +1 -1
  106. package/lib/di/tokens/config.d.ts +106 -1
  107. package/lib/di/tokens/config.js.map +1 -1
  108. package/lib/external/config.d.ts +2 -2
  109. package/lib/library/babel/index.js +1 -0
  110. package/lib/library/babel/index.js.map +1 -1
  111. package/lib/library/swc/index.js +1 -1
  112. package/lib/library/swc/index.js.map +1 -1
  113. package/lib/library/webpack/application/client/common.js +6 -4
  114. package/lib/library/webpack/application/client/common.js.map +1 -1
  115. package/lib/library/webpack/application/client/dev.js +9 -8
  116. package/lib/library/webpack/application/client/dev.js.map +1 -1
  117. package/lib/library/webpack/application/client/prod/optimization/splitChunks.js +40 -39
  118. package/lib/library/webpack/application/client/prod/optimization/splitChunks.js.map +1 -1
  119. package/lib/library/webpack/application/client/prod.js +3 -4
  120. package/lib/library/webpack/application/client/prod.js.map +1 -1
  121. package/lib/library/webpack/application/server/common.js +5 -5
  122. package/lib/library/webpack/application/server/common.js.map +1 -1
  123. package/lib/library/webpack/application/server/dev.js +3 -6
  124. package/lib/library/webpack/application/server/dev.js.map +1 -1
  125. package/lib/library/webpack/application/server/prod.js +3 -4
  126. package/lib/library/webpack/application/server/prod.js.map +1 -1
  127. package/lib/library/webpack/blocks/apiResolve.js +1 -1
  128. package/lib/library/webpack/blocks/apiResolve.js.map +1 -1
  129. package/lib/library/webpack/blocks/configResolve.js +2 -2
  130. package/lib/library/webpack/blocks/configResolve.js.map +1 -1
  131. package/lib/library/webpack/blocks/configToEnv.js +5 -2
  132. package/lib/library/webpack/blocks/configToEnv.js.map +1 -1
  133. package/lib/library/webpack/blocks/css.d.ts +3 -1
  134. package/lib/library/webpack/blocks/css.js +17 -6
  135. package/lib/library/webpack/blocks/css.js.map +1 -1
  136. package/lib/library/webpack/blocks/extractCssPlugin.d.ts +4 -3
  137. package/lib/library/webpack/blocks/extractCssPlugin.js +4 -6
  138. package/lib/library/webpack/blocks/extractCssPlugin.js.map +1 -1
  139. package/lib/library/webpack/blocks/filesClient.d.ts +3 -2
  140. package/lib/library/webpack/blocks/filesClient.js +7 -7
  141. package/lib/library/webpack/blocks/filesClient.js.map +1 -1
  142. package/lib/library/webpack/blocks/filesServer.d.ts +2 -1
  143. package/lib/library/webpack/blocks/filesServer.js +3 -3
  144. package/lib/library/webpack/blocks/filesServer.js.map +1 -1
  145. package/lib/library/webpack/blocks/js.d.ts +2 -1
  146. package/lib/library/webpack/blocks/js.js +1 -1
  147. package/lib/library/webpack/blocks/js.js.map +1 -1
  148. package/lib/library/webpack/blocks/nodeClient.d.ts +2 -1
  149. package/lib/library/webpack/blocks/nodeClient.js +2 -2
  150. package/lib/library/webpack/blocks/nodeClient.js.map +1 -1
  151. package/lib/library/webpack/blocks/optimize.d.ts +2 -1
  152. package/lib/library/webpack/blocks/optimize.js +3 -3
  153. package/lib/library/webpack/blocks/optimize.js.map +1 -1
  154. package/lib/library/webpack/blocks/pagesResolve.js +1 -1
  155. package/lib/library/webpack/blocks/pagesResolve.js.map +1 -1
  156. package/lib/library/webpack/blocks/postcssAssets.d.ts +2 -1
  157. package/lib/library/webpack/blocks/postcssAssets.js +2 -2
  158. package/lib/library/webpack/blocks/postcssAssets.js.map +1 -1
  159. package/lib/library/webpack/blocks/serverInline.d.ts +2 -1
  160. package/lib/library/webpack/blocks/serverInline.js.map +1 -1
  161. package/lib/library/webpack/blocks/ts.d.ts +2 -1
  162. package/lib/library/webpack/blocks/ts.js.map +1 -1
  163. package/lib/library/webpack/child-app/client/common.d.ts +2 -2
  164. package/lib/library/webpack/child-app/client/common.js +1 -1
  165. package/lib/library/webpack/child-app/client/common.js.map +1 -1
  166. package/lib/library/webpack/child-app/client/dev.d.ts +2 -2
  167. package/lib/library/webpack/child-app/client/dev.js +6 -5
  168. package/lib/library/webpack/child-app/client/dev.js.map +1 -1
  169. package/lib/library/webpack/child-app/client/prod.d.ts +2 -2
  170. package/lib/library/webpack/child-app/client/prod.js.map +1 -1
  171. package/lib/library/webpack/child-app/common.d.ts +2 -2
  172. package/lib/library/webpack/child-app/common.js.map +1 -1
  173. package/lib/library/webpack/child-app/server/common.d.ts +2 -2
  174. package/lib/library/webpack/child-app/server/common.js +1 -1
  175. package/lib/library/webpack/child-app/server/common.js.map +1 -1
  176. package/lib/library/webpack/child-app/server/dev.d.ts +2 -2
  177. package/lib/library/webpack/child-app/server/dev.js.map +1 -1
  178. package/lib/library/webpack/child-app/server/prod.d.ts +2 -2
  179. package/lib/library/webpack/child-app/server/prod.js.map +1 -1
  180. package/lib/library/webpack/common/client/prod.d.ts +2 -1
  181. package/lib/library/webpack/common/client/prod.js +4 -5
  182. package/lib/library/webpack/common/client/prod.js.map +1 -1
  183. package/lib/library/webpack/common/main.d.ts +2 -1
  184. package/lib/library/webpack/common/main.js +3 -3
  185. package/lib/library/webpack/common/main.js.map +1 -1
  186. package/lib/library/webpack/common/server/prod.d.ts +2 -1
  187. package/lib/library/webpack/common/server/prod.js +4 -5
  188. package/lib/library/webpack/common/server/prod.js.map +1 -1
  189. package/lib/library/webpack/index.js +1 -2
  190. package/lib/library/webpack/index.js.map +1 -1
  191. package/lib/library/webpack/loaders/image-loader/index.d.ts +2 -1
  192. package/lib/library/webpack/loaders/image-loader/index.js.map +1 -1
  193. package/lib/library/webpack/loaders/pagesResolve.d.ts +10 -1
  194. package/lib/library/webpack/loaders/pagesResolve.js +4 -3
  195. package/lib/library/webpack/loaders/pagesResolve.js.map +1 -1
  196. package/lib/library/webpack/loaders/replaceContent.d.ts +6 -1
  197. package/lib/library/webpack/loaders/replaceContent.js +4 -3
  198. package/lib/library/webpack/loaders/replaceContent.js.map +1 -1
  199. package/lib/library/webpack/module/client/common.js +1 -1
  200. package/lib/library/webpack/module/client/common.js.map +1 -1
  201. package/lib/library/webpack/module/externals.d.ts +1 -1
  202. package/lib/library/webpack/module/externals.js.map +1 -1
  203. package/lib/library/webpack/module/resolveExternal.d.ts +1 -1
  204. package/lib/library/webpack/module/resolveExternal.js.map +1 -1
  205. package/lib/library/webpack/module/server/common.js +1 -1
  206. package/lib/library/webpack/module/server/common.js.map +1 -1
  207. package/lib/library/webpack/plugins/LazyModuleInitialization.d.ts +2 -2
  208. package/lib/library/webpack/plugins/LazyModuleInitialization.js +1 -0
  209. package/lib/library/webpack/plugins/LazyModuleInitialization.js.map +1 -1
  210. package/lib/library/webpack/plugins/WebpackBar/utils/index.d.ts +7 -7
  211. package/lib/library/webpack/plugins/WebpackBar/utils/index.js.map +1 -1
  212. package/lib/library/webpack/plugins/WebpackBar/utils/webpack.d.ts +2 -2
  213. package/lib/library/webpack/plugins/WebpackBar/utils/webpack.js.map +1 -1
  214. package/lib/library/webpack/types/webpack.d.ts +2 -2
  215. package/lib/library/webpack/utils/files.d.ts +4 -3
  216. package/lib/library/webpack/utils/files.js +2 -2
  217. package/lib/library/webpack/utils/files.js.map +1 -1
  218. package/lib/library/webpack/utils/transpiler.d.ts +3 -2
  219. package/lib/library/webpack/utils/transpiler.js +2 -2
  220. package/lib/library/webpack/utils/transpiler.js.map +1 -1
  221. package/lib/library/webpack/utils/workersPool.d.ts +3 -6
  222. package/lib/library/webpack/utils/workersPool.js +1 -1
  223. package/lib/library/webpack/utils/workersPool.js.map +1 -1
  224. package/lib/models/config.d.ts +2 -3
  225. package/lib/models/config.js +32 -3
  226. package/lib/models/config.js.map +1 -1
  227. package/lib/schema/ConfigSchema.d.ts +13 -4
  228. package/lib/schema/autogeneratedSchema.json +1808 -2074
  229. package/lib/typings/configEntry/application.d.ts +81 -86
  230. package/lib/typings/configEntry/child-app.d.ts +10 -29
  231. package/lib/typings/configEntry/cli.d.ts +254 -0
  232. package/lib/typings/configEntry/{CheckAsyncTsConfig.js → cli.js} +1 -1
  233. package/lib/typings/configEntry/cli.js.map +1 -0
  234. package/lib/typings/configEntry/common.d.ts +16 -276
  235. package/lib/typings/configEntry/common.js +15 -0
  236. package/lib/typings/configEntry/common.js.map +1 -1
  237. package/lib/typings/configEntry/module.d.ts +10 -29
  238. package/lib/typings/configEntry/package.d.ts +2 -1
  239. package/lib/ui/commander.js +1 -1
  240. package/lib/ui/commander.js.map +1 -1
  241. package/lib/utils/applyTemplate.js.map +1 -1
  242. package/lib/utils/safeRequire.js +5 -1
  243. package/lib/utils/safeRequire.js.map +1 -1
  244. package/lib/utils/webpackBuild.d.ts +2 -1
  245. package/lib/utils/webpackBuild.js +3 -3
  246. package/lib/utils/webpackBuild.js.map +1 -1
  247. package/package.json +13 -9
  248. package/schema.json +1802 -2068
  249. package/src/api/analyze/providers/shared.ts +3 -2
  250. package/src/api/benchmark/__integration__/__fixtures__/tramvai.json +1 -8
  251. package/src/api/benchmark/index.ts +1 -1
  252. package/src/api/build/__integration__/__fixtures__/app/App.tsx +0 -1
  253. package/src/api/build/__integration__/__fixtures__/app/index.tsx +14 -8
  254. package/src/api/build/__integration__/__fixtures__/app/server.tsx +0 -1
  255. package/src/api/build/__integration__/__fixtures__/tramvai.json +1 -10
  256. package/src/api/build/__integration__/build.test.ts +4 -13
  257. package/src/api/build/child-app.ts +4 -4
  258. package/src/api/build/module.ts +2 -4
  259. package/src/api/build/providers/shared.ts +2 -2
  260. package/src/api/index.ts +6 -2
  261. package/src/api/shared/types/withConfig.ts +5 -6
  262. package/src/api/start/__integration__/__fixtures__/app/index.tsx +11 -7
  263. package/src/api/start/__integration__/__fixtures__/tramvai.json +6 -17
  264. package/src/api/start/__integration__/start.test.ts +1 -12
  265. package/src/api/start/providers/application/shared.ts +2 -2
  266. package/src/api/start/providers/child-app/shared.ts +9 -14
  267. package/src/api/start/providers/module/shared.ts +19 -30
  268. package/src/api/start/utils/banner.ts +3 -2
  269. package/src/api/start/utils/tips/tips.ts +11 -8
  270. package/src/api/start-prod/providers/application.ts +10 -14
  271. package/src/api/start-prod/providers/child-app.ts +4 -5
  272. package/src/api/start-prod/providers/shared.ts +4 -8
  273. package/src/builder/webpack/devServer/client.ts +22 -15
  274. package/src/builder/webpack/devServer/notifier.ts +6 -6
  275. package/src/builder/webpack/devServer/pool/process/pool.ts +3 -3
  276. package/src/builder/webpack/devServer/pool/thread/pool.ts +7 -0
  277. package/src/builder/webpack/devServer/server.ts +13 -6
  278. package/src/builder/webpack/providers/analyze/shared.ts +3 -2
  279. package/src/builder/webpack/providers/build/application/server.ts +5 -1
  280. package/src/builder/webpack/providers/build/client.ts +3 -2
  281. package/src/builder/webpack/providers/build/server.ts +1 -1
  282. package/src/builder/webpack/tokens.ts +4 -3
  283. package/src/builder/webpack/utils/copyBuildFile.ts +4 -5
  284. package/src/builder/webpack/utils/copyStatsJsonFile.ts +5 -2
  285. package/src/cli/CLI.ts +6 -6
  286. package/src/cli/index.ts +1 -1
  287. package/src/commands/analyze/command.ts +1 -1
  288. package/src/commands/benchmark/command.ts +1 -1
  289. package/src/commands/build/command.ts +2 -2
  290. package/src/commands/new/new.ts +0 -1
  291. package/src/commands/new/questions/packageManager.ts +1 -1
  292. package/src/commands/new/questions/template.ts +1 -1
  293. package/src/commands/new/questions/testingFramework.ts +1 -1
  294. package/src/commands/new/questions/type.ts +1 -1
  295. package/src/commands/new/steps/initializationGit.ts +1 -1
  296. package/src/commands/new/templates/app/monorepo/tramvai.json.hbs +6 -32
  297. package/src/commands/new/templates/app/multirepo/tramvai.json.hbs +6 -23
  298. package/src/commands/new/templates/child-app/monorepo/tramvai.json.hbs +3 -18
  299. package/src/commands/new/templates/child-app/multirepo/tramvai.json.hbs +3 -9
  300. package/src/commands/start/command.ts +2 -2
  301. package/src/commands/start-prod/command.ts +2 -2
  302. package/src/commands/static/application.ts +5 -14
  303. package/src/commands/static/command.ts +1 -1
  304. package/src/commands/static/generate.ts +2 -2
  305. package/src/commands/static/server.ts +5 -2
  306. package/src/commands/static/staticServer.ts +6 -3
  307. package/src/commands/update/updatePackageJson.ts +6 -2
  308. package/src/config/configManager.spec.ts +49 -0
  309. package/src/config/configManager.ts +123 -197
  310. package/src/config/showConfig.ts +2 -2
  311. package/src/config/validate.ts +14 -25
  312. package/src/di/tokens/config.ts +2 -1
  313. package/src/library/babel/index.ts +1 -0
  314. package/src/library/swc/__integration__/swc.build.test.ts +3 -21
  315. package/src/library/swc/__integration__/swc.start.test.ts +3 -21
  316. package/src/library/swc/index.ts +1 -1
  317. package/src/library/webpack/application/client/common.ts +7 -7
  318. package/src/library/webpack/application/client/dev.ts +9 -9
  319. package/src/library/webpack/application/client/prod/optimization/splitChunks.ts +43 -44
  320. package/src/library/webpack/application/client/prod.ts +3 -5
  321. package/src/library/webpack/application/server/common.ts +5 -8
  322. package/src/library/webpack/application/server/dev.ts +5 -6
  323. package/src/library/webpack/application/server/prod.ts +3 -9
  324. package/src/library/webpack/blocks/apiResolve.ts +1 -1
  325. package/src/library/webpack/blocks/configResolve.ts +2 -2
  326. package/src/library/webpack/blocks/configToEnv.ts +5 -2
  327. package/src/library/webpack/blocks/css.ts +26 -17
  328. package/src/library/webpack/blocks/extractCssPlugin.ts +11 -10
  329. package/src/library/webpack/blocks/filesClient.ts +52 -50
  330. package/src/library/webpack/blocks/filesServer.ts +4 -3
  331. package/src/library/webpack/blocks/js.ts +3 -2
  332. package/src/library/webpack/blocks/nodeClient.ts +4 -3
  333. package/src/library/webpack/blocks/optimize.ts +5 -6
  334. package/src/library/webpack/blocks/pagesResolve.ts +1 -1
  335. package/src/library/webpack/blocks/postcssAssets.ts +6 -7
  336. package/src/library/webpack/blocks/serverInline.ts +2 -1
  337. package/src/library/webpack/blocks/ts.ts +2 -1
  338. package/src/library/webpack/child-app/client/common.ts +3 -3
  339. package/src/library/webpack/child-app/client/dev.ts +8 -8
  340. package/src/library/webpack/child-app/client/prod.ts +2 -2
  341. package/src/library/webpack/child-app/common.ts +2 -2
  342. package/src/library/webpack/child-app/server/common.ts +3 -3
  343. package/src/library/webpack/child-app/server/dev.ts +2 -2
  344. package/src/library/webpack/child-app/server/prod.ts +2 -2
  345. package/src/library/webpack/common/client/prod.ts +10 -6
  346. package/src/library/webpack/common/main.ts +9 -4
  347. package/src/library/webpack/common/server/prod.ts +10 -6
  348. package/src/library/webpack/index.ts +2 -3
  349. package/src/library/webpack/loaders/image-loader/index.ts +2 -1
  350. package/src/library/webpack/loaders/pagesResolve.ts +17 -5
  351. package/src/library/webpack/loaders/replaceContent.ts +11 -2
  352. package/src/library/webpack/module/client/common.ts +1 -1
  353. package/src/library/webpack/module/externals.ts +1 -1
  354. package/src/library/webpack/module/resolveExternal.ts +1 -1
  355. package/src/library/webpack/module/server/common.ts +1 -1
  356. package/src/library/webpack/plugins/LazyModuleInitialization.ts +6 -1
  357. package/src/library/webpack/plugins/WebpackBar/utils/index.ts +8 -8
  358. package/src/library/webpack/plugins/WebpackBar/utils/webpack.ts +1 -1
  359. package/src/library/webpack/types/webpack.ts +2 -2
  360. package/src/library/webpack/utils/files.ts +4 -3
  361. package/src/library/webpack/utils/transpiler.ts +6 -11
  362. package/src/library/webpack/utils/workersPool.ts +6 -9
  363. package/src/models/config.spec.ts +352 -0
  364. package/src/models/config.ts +41 -9
  365. package/src/schema/ConfigSchema.ts +15 -4
  366. package/src/schema/autogeneratedSchema.json +1808 -2074
  367. package/src/schema/tramvai.spec.ts +89 -184
  368. package/src/typings/configEntry/application.ts +85 -87
  369. package/src/typings/configEntry/child-app.ts +10 -30
  370. package/src/typings/configEntry/cli.ts +271 -0
  371. package/src/typings/configEntry/common.ts +26 -278
  372. package/src/typings/configEntry/module.ts +11 -30
  373. package/src/typings/configEntry/package.ts +3 -1
  374. package/src/ui/commander.ts +1 -1
  375. package/src/utils/applyTemplate.ts +2 -2
  376. package/src/utils/safeRequire.ts +6 -1
  377. package/src/utils/webpackBuild.ts +4 -3
  378. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.d.ts +0 -37
  379. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js +0 -241
  380. package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js.map +0 -1
  381. package/lib/library/webpack/plugins/DedupePlugin/index.d.ts +0 -1
  382. package/lib/library/webpack/plugins/DedupePlugin/index.js +0 -6
  383. package/lib/library/webpack/plugins/DedupePlugin/index.js.map +0 -1
  384. package/lib/typings/configEntry/CheckAsyncTsConfig.d.ts +0 -13
  385. package/lib/typings/configEntry/CheckAsyncTsConfig.js.map +0 -1
  386. package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.spec.ts +0 -95
  387. package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.ts +0 -307
  388. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/index.js +0 -3
  389. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/index.js +0 -1
  390. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/package.json +0 -7
  391. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/package.json +0 -7
  392. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/index.js +0 -3
  393. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/index.js +0 -1
  394. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/package.json +0 -7
  395. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/package.json +0 -7
  396. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/index.js +0 -3
  397. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/index.js +0 -1
  398. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/package.json +0 -7
  399. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/package.json +0 -7
  400. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/index.js +0 -1
  401. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/package.json +0 -7
  402. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/index.js +0 -3
  403. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/index.js +0 -1
  404. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/package.json +0 -8
  405. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/package.json +0 -8
  406. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/index.js +0 -3
  407. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/index.js +0 -1
  408. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/package.json +0 -8
  409. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/package.json +0 -8
  410. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package-lock.json +0 -0
  411. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package.json +0 -14
  412. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/src/index.js +0 -9
  413. package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/tramvai.json +0 -67
  414. package/src/library/webpack/plugins/DedupePlugin/__integration__/DedupePlugin.test.ts +0 -90
  415. package/src/library/webpack/plugins/DedupePlugin/index.ts +0 -1
  416. package/src/typings/configEntry/CheckAsyncTsConfig.ts +0 -15
@@ -5,15 +5,14 @@ import {
5
5
  CONFIG_ENTRY_TOKEN,
6
6
  CONFIG_MANAGER_TOKEN,
7
7
  } from '../../../di/tokens';
8
- import type { Params } from '../index';
9
- import { ConfigManager } from '../../index';
10
- import type { ConfigEntry } from '../../../typings/configEntry/common';
8
+ import { createConfigManager } from '../../../config/configManager';
9
+ import type { ChildAppConfigEntry } from '../../../typings/configEntry/child-app';
11
10
 
12
11
  export const childAppProviders: readonly Provider[] = [
13
12
  provide({
14
13
  provide: CONFIG_MANAGER_TOKEN,
15
- useFactory: ({ configEntry, parameters }: { configEntry: ConfigEntry; parameters: Params }) => {
16
- return new ConfigManager(configEntry, {
14
+ useFactory: ({ configEntry, parameters }) => {
15
+ return createConfigManager(configEntry as ChildAppConfigEntry, {
17
16
  ...parameters,
18
17
  env: 'production',
19
18
  staticPort: parameters.staticPort ?? 4040,
@@ -5,11 +5,7 @@ import fastifyCompress from '@fastify/compress';
5
5
  import fastifyStatic from '@fastify/static';
6
6
  import zlib from 'zlib';
7
7
  import { CLOSE_HANDLER_TOKEN, INIT_HANDLER_TOKEN, PROCESS_HANDLER_TOKEN } from '../tokens';
8
- import {
9
- COMMAND_PARAMETERS_TOKEN,
10
- CONFIG_MANAGER_TOKEN,
11
- STATIC_SERVER_TOKEN,
12
- } from '../../../di/tokens';
8
+ import { CONFIG_MANAGER_TOKEN, STATIC_SERVER_TOKEN } from '../../../di/tokens';
13
9
  import { createServer } from '../../start/utils/createServer';
14
10
  import { stopServer } from '../../start/utils/stopServer';
15
11
  import { listenServer } from '../../start/utils/listenServer';
@@ -75,12 +71,12 @@ export const sharedProviders: readonly Provider[] = [
75
71
 
76
72
  if (isApplication(configManager)) {
77
73
  await app.register(fastifyStatic, {
78
- root: configManager.getBuildPath(),
79
- prefix: `/${configManager.build.options.outputClient.replace(/\/$/, '')}/`,
74
+ root: configManager.buildPath,
75
+ prefix: `/${configManager.output.client.replace(/\/$/, '')}/`,
80
76
  });
81
77
  } else if (isChildApp(configManager)) {
82
78
  await app.register(fastifyStatic, {
83
- root: configManager.getBuildPath(),
79
+ root: configManager.buildPath,
84
80
  prefix: `/${configManager.name}/`,
85
81
  });
86
82
  }
@@ -11,28 +11,35 @@ import type { STATIC_SERVER_TOKEN } from '../../../di/tokens';
11
11
  import { CONFIG_ROOT_DIR_TOKEN, UI_OS_NOTIFY_TOKEN } from '../../../di/tokens';
12
12
  import { WEBPACK_WATCHING_TOKEN, CLOSE_HANDLER_TOKEN } from '../tokens';
13
13
  import { close } from '../../../utils/close';
14
+ import { isApplication, isChildApp, isModule } from '../../../config/validate';
14
15
 
15
16
  const getPrefix = (configManager: ConfigManager): string => {
16
- switch (configManager.type) {
17
- case 'application':
18
- return '/';
19
- case 'child-app':
20
- return `/${configManager.name}`;
21
- case 'module':
22
- return `/${configManager.name}/:version`;
17
+ if (isApplication(configManager)) {
18
+ return '/';
19
+ }
20
+
21
+ if (isChildApp(configManager)) {
22
+ return `/${configManager.name}`;
23
+ }
24
+
25
+ if (isModule(configManager)) {
26
+ return `/${configManager.name}/:version`;
23
27
  }
24
28
 
25
29
  throw new Error(`${configManager.type} is not supported`);
26
30
  };
27
31
 
28
32
  const getHotModulePrefix = (configManager: ConfigManager): string => {
29
- switch (configManager.type) {
30
- case 'application':
31
- return `/${configManager.build.options.outputClient}`;
32
- case 'child-app':
33
- return `/${configManager.name}`;
34
- case 'module':
35
- return `/${configManager.name}/:version`;
33
+ if (isApplication(configManager)) {
34
+ return `/${configManager.output.client}`;
35
+ }
36
+
37
+ if (isChildApp(configManager)) {
38
+ return `/${configManager.name}`;
39
+ }
40
+
41
+ if (isModule(configManager)) {
42
+ return `/${configManager.name}/:version`;
36
43
  }
37
44
 
38
45
  throw new Error(`${configManager.type} is not supported`);
@@ -78,7 +85,7 @@ export const createDevServer = ({
78
85
  },
79
86
  });
80
87
 
81
- if (configManager.hotRefresh) {
88
+ if (configManager.hotRefresh.enabled) {
82
89
  app.use(getHotModulePrefix(configManager), webpackHotMiddleware(compiler, { log: false }));
83
90
  }
84
91
 
@@ -1,7 +1,7 @@
1
1
  import type webpack from 'webpack';
2
2
  import WebpackBuildNotifierPlugin from 'webpack-build-notifier';
3
3
  import type { ConfigManager } from '../../../config/configManager';
4
- import type { ApplicationConfigEntry } from '../../../typings/configEntry/application';
4
+ import type { CliConfigEntry } from '../../../typings/configEntry/cli';
5
5
 
6
6
  const getStatsByType = (stats: webpack.MultiStats, type: string) => {
7
7
  return stats.stats.find((st) => {
@@ -11,21 +11,21 @@ const getStatsByType = (stats: webpack.MultiStats, type: string) => {
11
11
 
12
12
  export const notifier = (
13
13
  compiler: webpack.MultiCompiler,
14
- configManager: ConfigManager<ApplicationConfigEntry>
14
+ configManager: ConfigManager<CliConfigEntry>
15
15
  ) => {
16
16
  const clientNotifier = new WebpackBuildNotifierPlugin({
17
17
  successSound: false,
18
18
  warningSound: false,
19
- ...configManager.serve?.notifications,
20
- ...configManager.serve?.notifications?.client,
19
+ ...configManager.notifications,
20
+ ...configManager.notifications?.client,
21
21
  });
22
22
  const serverNotifier = new WebpackBuildNotifierPlugin({
23
23
  // отлкючаем нотификацию для одного из нотификатора, чтобы не дублировать
24
24
  suppressSuccess: 'always',
25
25
  successSound: false,
26
26
  warningSound: false,
27
- ...configManager.serve?.notifications,
28
- ...configManager.serve?.notifications?.server,
27
+ ...configManager.notifications,
28
+ ...configManager.notifications?.server,
29
29
  });
30
30
 
31
31
  compiler.hooks.done.tap('webpack-build-notifier', (stats) => {
@@ -22,7 +22,7 @@ export const ProcessWorkerBridge: WorkerBridgeFactory<Worker> = (di) => {
22
22
  cluster.setupMaster({
23
23
  // указываем другой файл для работы cluster.fork
24
24
  exec: path.resolve(__dirname, './worker.js'),
25
- execArgv: [].concat(
25
+ execArgv: ([] as string[]).concat(
26
26
  configManager.debug ? DEBUG_ARGV : [],
27
27
  configManager.trace ? TRACE_ARGV : []
28
28
  ),
@@ -43,8 +43,8 @@ export const ProcessWorkerBridge: WorkerBridgeFactory<Worker> = (di) => {
43
43
  PORT_SERVER: `${configManager.port}`,
44
44
  });
45
45
 
46
- worker.process.stdout.pipe(stdout);
47
- worker.process.stderr.pipe(stderr);
46
+ worker.process.stdout?.pipe(stdout);
47
+ worker.process.stderr?.pipe(stderr);
48
48
 
49
49
  return worker;
50
50
  },
@@ -15,6 +15,13 @@ export const ThreadWorkerBridge: WorkerBridgeFactory<Worker> = (di) => {
15
15
  // WARN: potentially dangerous code that will lead to bugs in case of run parallel builds from once process
16
16
  // as nodejs do not support this for threads - https://github.com/nodejs/node/issues/41673
17
17
  // but it is not a very popular usage anyway
18
+ // Found issues:
19
+ // 1. babel-plugin-lodash will reload configs when the cwd is changed
20
+ // and if this happens between file compilations
21
+ // it'll lead to obscure errors inside this plugin as it won't resolve
22
+ // previously resolved modules and there will be the mess
23
+ // [source code](https://github.com/lodash/babel-plugin-lodash/blob/master/src/config.js#L18)
24
+ // but it currently affects only jest tests probably because of jest's workers usage
18
25
  process.chdir(di.get(CONFIG_ROOT_DIR_TOKEN));
19
26
 
20
27
  const worker = new Worker(path.resolve(__dirname, './worker.js'), {
@@ -59,9 +59,13 @@ export const serverRunner = ({
59
59
  const file = `${Object.keys(config.entryPoints.entries())[0]}.js`;
60
60
  const filename = path.resolve(config.output.get('path'), file);
61
61
  // настоящая ссылка на файл используется для отладки в debug режиме
62
- const realFilename = `http://${configManager.staticHost}:${configManager.staticPort}/${configManager.build.options.outputServer}/${file}`;
62
+ const realFilename = `http://${configManager.staticHost}:${configManager.staticPort}/${configManager.output.server}/${file}`;
63
63
  const serverCompiler = compiler.compilers.find((comp) => comp.name === 'server');
64
64
 
65
+ if (!serverCompiler) {
66
+ throw new Error('Server compiler has not found');
67
+ }
68
+
65
69
  const fs = serverCompiler.outputFileSystem as any;
66
70
  // ThreadWorkerPool is experimental
67
71
  // it doesn't work well when running integration tests in tramvai repo
@@ -76,11 +80,11 @@ export const serverRunner = ({
76
80
  ? ThreadWorkerBridge
77
81
  : ProcessWorkerBridge
78
82
  );
79
- let worker: Worker;
83
+ let worker: Worker | null;
80
84
  let serverInvalidated = true;
81
- let workerPort: number;
82
- let resolveWorkerPort: () => void;
83
- let workerPortPromise: Promise<void>;
85
+ let workerPort: number | null;
86
+ let resolveWorkerPort: () => void | null;
87
+ let workerPortPromise: Promise<void> | null;
84
88
  let hasExitedUnexpectedly = false;
85
89
 
86
90
  const proxy = createProxyServer({
@@ -248,8 +252,11 @@ export const serverRunner = ({
248
252
  workerPort = null;
249
253
  workerPortPromise = null;
250
254
 
255
+ if (worker) {
256
+ pool.release(worker);
257
+ }
258
+
251
259
  worker = null;
252
- pool.release(worker);
253
260
 
254
261
  console.error(EXITED_UNEXPECTEDLY);
255
262
  });
@@ -3,6 +3,7 @@ import { provide } from '@tinkoff/dippy';
3
3
  import chalk from 'chalk';
4
4
  import rimraf from 'rimraf';
5
5
  import webpack from 'webpack';
6
+ import type { ConfigManager } from '../../../../api';
6
7
  import {
7
8
  CLI_PACKAGE_MANAGER,
8
9
  CLI_ROOT_DIR_TOKEN,
@@ -78,7 +79,7 @@ export const analyzeSharedProviders: Provider[] = [
78
79
  multi: true,
79
80
  useFactory: ({ configManager }) => {
80
81
  return function clearBuildDir() {
81
- return rimraf.sync(`${configManager.getBuildPath()}/**`, {});
82
+ return rimraf.sync(`${configManager.buildPath}/**`, {});
82
83
  };
83
84
  },
84
85
  deps: {
@@ -90,7 +91,7 @@ export const analyzeSharedProviders: Provider[] = [
90
91
  multi: true,
91
92
  useFactory: ({ configManager, rootDir, packageManager }) => {
92
93
  return async function prepareImageOptimization() {
93
- if (configManager.build?.configurations?.imageOptimization?.enabled) {
94
+ if (configManager.imageOptimization?.enabled) {
94
95
  await npmRequire({
95
96
  cliRootDir: rootDir,
96
97
  packageManager,
@@ -1,6 +1,8 @@
1
1
  import type { Provider } from '@tinkoff/dippy';
2
2
  import { provide } from '@tinkoff/dippy';
3
+ import type { ConfigManager } from '../../../../../config/configManager';
3
4
  import { CONFIG_MANAGER_TOKEN } from '../../../../../di/tokens';
5
+ import type { ApplicationConfigEntry } from '../../../../../typings/configEntry/application';
4
6
  import { CLOSE_HANDLER_TOKEN } from '../../../tokens';
5
7
  import { copyStatsJsonFileToServerDirectory } from '../../../utils/copyStatsJsonFile';
6
8
 
@@ -10,7 +12,9 @@ export const buildApplicationServerProviders: Provider[] = [
10
12
  multi: true,
11
13
  useFactory: ({ configManager }) => {
12
14
  return async function copyStatsFiles() {
13
- return copyStatsJsonFileToServerDirectory(configManager);
15
+ return copyStatsJsonFileToServerDirectory(
16
+ configManager as ConfigManager<ApplicationConfigEntry>
17
+ );
14
18
  };
15
19
  },
16
20
  deps: {
@@ -2,6 +2,7 @@ import type { Provider } from '@tinkoff/dippy';
2
2
  import { provide } from '@tinkoff/dippy';
3
3
  import rimraf from 'rimraf';
4
4
  import webpack from 'webpack';
5
+ import type { ConfigManager } from '../../../../config/configManager';
5
6
  import {
6
7
  CLI_PACKAGE_MANAGER,
7
8
  CLI_ROOT_DIR_TOKEN,
@@ -47,7 +48,7 @@ export const buildClientProviders: Provider[] = [
47
48
  multi: true,
48
49
  useFactory: ({ configManager }) => {
49
50
  return function clearBuildDir() {
50
- return rimraf.sync(`${configManager.getBuildPath()}/**`, {});
51
+ return rimraf.sync(`${configManager.buildPath}/**`, {});
51
52
  };
52
53
  },
53
54
  deps: {
@@ -59,7 +60,7 @@ export const buildClientProviders: Provider[] = [
59
60
  multi: true,
60
61
  useFactory: ({ configManager, rootDir, packageManager }) => {
61
62
  return async function prepareImageOptimization() {
62
- if (configManager.build?.configurations?.imageOptimization?.enabled) {
63
+ if (configManager.imageOptimization?.enabled) {
63
64
  await npmRequire({
64
65
  cliRootDir: rootDir,
65
66
  packageManager,
@@ -29,7 +29,7 @@ export const buildServerProviders: Provider[] = [
29
29
  multi: true,
30
30
  useFactory: ({ configManager }) => {
31
31
  return function clearBuildDir() {
32
- return rimraf.sync(`${configManager.getBuildPath()}/**`, {});
32
+ return rimraf.sync(`${configManager.buildPath}/**`, {});
33
33
  };
34
34
  },
35
35
  deps: {
@@ -5,14 +5,15 @@ import type { EventEmitter } from 'events';
5
5
  import type { ConfigManager } from '../../config/configManager';
6
6
  import type { GetBuildStats } from '../../typings/build/Builder';
7
7
  import type { AnalyzePlugin } from './types';
8
+ import type { CliConfigEntry } from '../../typings/configEntry/cli';
8
9
 
9
- export const CLIENT_CONFIG_MANAGER_TOKEN = createToken<ConfigManager>(
10
+ export const CLIENT_CONFIG_MANAGER_TOKEN = createToken<ConfigManager<CliConfigEntry>>(
10
11
  'builder-webpack clientConfigManager'
11
12
  );
12
- export const CLIENT_MODERN_CONFIG_MANAGER_TOKEN = createToken<ConfigManager>(
13
+ export const CLIENT_MODERN_CONFIG_MANAGER_TOKEN = createToken<ConfigManager<CliConfigEntry>>(
13
14
  'builder-webpack clientModernConfigManager'
14
15
  );
15
- export const SERVER_CONFIG_MANAGER_TOKEN = createToken<ConfigManager>(
16
+ export const SERVER_CONFIG_MANAGER_TOKEN = createToken<ConfigManager<CliConfigEntry>>(
16
17
  'builder-webpack serverConfigManager'
17
18
  );
18
19
  export const WEBPACK_CLIENT_CONFIG_TOKEN = createToken<Config>('builder-webpack clientConfig');
@@ -1,6 +1,7 @@
1
1
  import * as fs from 'fs-extra';
2
2
  import path from 'path';
3
3
  import type { ConfigManager } from '../../../config/configManager';
4
+ import type { ApplicationConfigEntry } from '../../../typings/configEntry/application';
4
5
 
5
6
  export function copyBuildFile({
6
7
  config,
@@ -8,16 +9,14 @@ export function copyBuildFile({
8
9
  fromType,
9
10
  fileName,
10
11
  }: {
11
- config: ConfigManager;
12
+ config: ConfigManager<ApplicationConfigEntry>;
12
13
  fromType: 'client' | 'server';
13
14
  inputPath?: string;
14
15
  fileName: string;
15
16
  }) {
16
17
  const inputPathBase =
17
- inputPath ||
18
- (fromType === 'client' ? config.build.options.outputClient : config.build.options.outputServer);
19
- const outputPathBase =
20
- fromType === 'client' ? config.build.options.outputServer : config.build.options.outputClient;
18
+ inputPath || (fromType === 'client' ? config.output.client : config.output.server);
19
+ const outputPathBase = fromType === 'client' ? config.output.server : config.output.client;
21
20
 
22
21
  return fs.copy(
23
22
  path.resolve(config.rootDir, inputPathBase, fileName),
@@ -2,12 +2,15 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { copyBuildFile } from './copyBuildFile';
4
4
  import type { ConfigManager } from '../../../config/configManager';
5
+ import type { ApplicationConfigEntry } from '../../../typings/configEntry/application';
5
6
 
6
- export const copyStatsJsonFileToServerDirectory = async (clientConfigManager: ConfigManager) => {
7
+ export const copyStatsJsonFileToServerDirectory = async (
8
+ clientConfigManager: ConfigManager<ApplicationConfigEntry>
9
+ ) => {
7
10
  const STATS_JSON_FILE_NAME = 'stats.json';
8
11
  const STATS_JSON_FILE_NAME_MODERN = 'stats.modern.json';
9
12
 
10
- const statsJsonFileDirectoryPath = clientConfigManager.build.options.outputClient;
13
+ const statsJsonFileDirectoryPath = clientConfigManager.output.client;
11
14
 
12
15
  const statsJsonFilePath = path.resolve(
13
16
  clientConfigManager.rootDir,
package/src/cli/CLI.ts CHANGED
@@ -14,21 +14,21 @@ export class CLI {
14
14
 
15
15
  commands: Command[];
16
16
 
17
- runTask = (name, params) => {
17
+ runTask = (name: string, params: any) => {
18
18
  const task = this.tasks.find((item) => item.name === name);
19
19
 
20
20
  if (!task) {
21
- console.error('Не найдена задача: ', name, params);
21
+ throw new Error(`Task ${name} not found`);
22
22
  }
23
23
 
24
24
  return task.run(params);
25
25
  };
26
26
 
27
- runCommand = (name, params) => {
27
+ runCommand = (name: string, params: any) => {
28
28
  const command = this.commands.find((item) => item.name === name);
29
29
 
30
30
  if (!command) {
31
- console.error('Не найдена команда: ', name, params);
31
+ throw new Error(`Command ${name} not found`);
32
32
  }
33
33
 
34
34
  return command.run(params);
@@ -69,11 +69,11 @@ export class CLI {
69
69
  this.commands = commandsMap.map((CommandItem) => new CommandItem(this.context));
70
70
  }
71
71
 
72
- async run(argv) {
72
+ async run(argv: any) {
73
73
  return this.createCommandLineUI(argv);
74
74
  }
75
75
 
76
- protected createCommandLineUI(argv): Promise<CommandResult> {
76
+ protected createCommandLineUI(argv: any): Promise<CommandResult> {
77
77
  return new Promise((resolve) => {
78
78
  commander(this.commands, resolve)(argv);
79
79
  });
package/src/cli/index.ts CHANGED
@@ -95,7 +95,7 @@ export async function cliInitialized(cliArgs = process.argv) {
95
95
  );
96
96
 
97
97
  return await cliInstance.run(cliArgs);
98
- } catch (e) {
98
+ } catch (e: any) {
99
99
  logger.event({
100
100
  type: 'error',
101
101
  event: 'GLOBAL:ERROR',
@@ -31,7 +31,7 @@ class AnalyzeCommand extends CLICommand<Params> {
31
31
  {
32
32
  name: '--fileCache',
33
33
  value: '[fileCache]',
34
- transformer: (value) => value !== 'false',
34
+ transformer: (value: string) => value !== 'false',
35
35
  description: 'Enable/disable persistent file cache for used cli builder',
36
36
  },
37
37
  ];
@@ -20,7 +20,7 @@ export class BenchmarkCommand extends CLICommand<Params> {
20
20
  {
21
21
  name: '--rs, --resolveSymlinks',
22
22
  value: '[resolveSymlinks]',
23
- transformer: (value) => value !== 'false',
23
+ transformer: (value: string) => value !== 'false',
24
24
  description:
25
25
  'Pass value to `resolve.symlinks` in webpack (https://webpack.js.org/configuration/resolve/#resolve-symlinks)`',
26
26
  },
@@ -27,7 +27,7 @@ class BuildCommand extends CLICommand<Params> {
27
27
  {
28
28
  name: '--rs, --resolveSymlinks',
29
29
  value: '[resolveSymlinks]',
30
- transformer: (value) => value !== 'false',
30
+ transformer: (value: string) => value !== 'false',
31
31
  description:
32
32
  'Pass value to `resolve.symlinks` in webpack (https://webpack.js.org/configuration/resolve/#resolve-symlinks)`',
33
33
  },
@@ -54,7 +54,7 @@ class BuildCommand extends CLICommand<Params> {
54
54
  {
55
55
  name: '--fileCache',
56
56
  value: '[fileCache]',
57
- transformer: (value) => value !== 'false',
57
+ transformer: (value: string) => value !== 'false',
58
58
  description: 'Enable/disable persistent file cache for used cli builder',
59
59
  },
60
60
  {
@@ -42,7 +42,6 @@ export default async function createNew(context: Context, params: Params): Promi
42
42
  type: 'application',
43
43
  name,
44
44
  root: directoryName,
45
- commands: {},
46
45
  };
47
46
 
48
47
  const {
@@ -2,7 +2,7 @@ type PackageManagers = 'npm' | 'yarn';
2
2
 
3
3
  const choices = ['npm', 'yarn'];
4
4
 
5
- const packageManagerQuestion = (answer) => ({
5
+ const packageManagerQuestion = (answer: string) => ({
6
6
  type: 'list' as const,
7
7
  name: 'packageManager' as const,
8
8
  message: 'Choose a package manager for the project',
@@ -13,7 +13,7 @@ const choices = [
13
13
  },
14
14
  ];
15
15
 
16
- const templateQuestion = (answer) => ({
16
+ const templateQuestion = (answer: string) => ({
17
17
  type: 'list' as const,
18
18
  name: 'template' as const,
19
19
  message: 'Choose a template for your project',
@@ -2,7 +2,7 @@ type TestingFrameworks = 'none' | 'jest';
2
2
 
3
3
  const choices = ['none', 'jest'];
4
4
 
5
- const testingFrameworkQuestion = (answer) => ({
5
+ const testingFrameworkQuestion = (answer: string) => ({
6
6
  type: 'list' as const,
7
7
  name: 'testingFramework' as const,
8
8
  message: 'Choose a test framework for your project',
@@ -13,7 +13,7 @@ const choices = [
13
13
  },
14
14
  ];
15
15
 
16
- const typeQuestion = (answer) => ({
16
+ const typeQuestion = (answer: string) => ({
17
17
  type: 'list' as const,
18
18
  name: 'type' as const,
19
19
  message: 'Choose a type for your project',
@@ -1,7 +1,7 @@
1
1
  import execa from 'execa';
2
2
  import chalk from 'chalk';
3
3
 
4
- export async function initializationGit(localDir) {
4
+ export async function initializationGit(localDir: string) {
5
5
  console.log(`${chalk.blue('[GIT]')} Initializing git`);
6
6
 
7
7
  await execa('git', ['init'], { cwd: localDir, stdio: 'inherit' });
@@ -5,38 +5,12 @@
5
5
  "name": "{{configEntry.name}}",
6
6
  "root": "apps/{{configEntry.name}}",
7
7
  "type": "application",
8
- "commands": {
9
- "build": {
10
- "options": {
11
- "server": "apps/{{configEntry.name}}/index.ts"
12
- },
13
- "configurations": {
14
- "sourceMap": true,
15
- "modern": true,
16
- "granularChunks": true,
17
- "postcss": {
18
- "config": "apps/{{configEntry.name}}/postcss"
19
- },
20
- "alias": {
21
- "~shared": "./apps/{{configEntry.name}}/shared",
22
- "~entities": "./apps/{{configEntry.name}}/entities",
23
- "~features": "./apps/{{configEntry.name}}/features",
24
- "~widgets": "./apps/{{configEntry.name}}/widgets",
25
- "~pages": "./apps/{{configEntry.name}}/pages",
26
- "~processes": "./apps/{{configEntry.name}}/processes",
27
- "~app": "./apps/{{configEntry.name}}/app"
28
- },
29
- "fileSystemPages": {
30
- "enable": true
31
- }
32
- }
33
- },
34
- "serve": {
35
- "configurations": {
36
- "hotRefresh": true,
37
- "modern": true
38
- }
39
- }
8
+ "sourceMap": true,
9
+ "postcss": {
10
+ "config": "apps/{{configEntry.name}}/postcss"
11
+ },
12
+ "fileSystemPages": {
13
+ "enabled": true
40
14
  }
41
15
  }
42
16
  }
@@ -5,29 +5,12 @@
5
5
  "name": "{{configEntry.name}}",
6
6
  "root": "src",
7
7
  "type": "application",
8
- "commands": {
9
- "build": {
10
- "options": {
11
- "server": "src/index.ts"
12
- },
13
- "configurations": {
14
- "sourceMap": true,
15
- "modern": true,
16
- "granularChunks": true,
17
- "postcss": {
18
- "config": "src/postcss"
19
- },
20
- "fileSystemPages": {
21
- "enable": true
22
- }
23
- }
24
- },
25
- "serve": {
26
- "configurations": {
27
- "hotRefresh": true,
28
- "modern": true
29
- }
30
- }
8
+ "sourceMap": true,
9
+ "postcss": {
10
+ "config": "src/postcss"
11
+ },
12
+ "fileSystemPages": {
13
+ "enabled": true
31
14
  }
32
15
  }
33
16
  }
@@ -5,24 +5,9 @@
5
5
  "name": "{{configEntry.name}}",
6
6
  "root": "child-apps/{{configEntry.name}}",
7
7
  "type": "child-app",
8
- "commands": {
9
- "build": {
10
- "configurations": {
11
- "postcss": {
12
- "config": "apps/{{configEntry.name}}/postcss"
13
- },
14
- "alias": {
15
- "~shared": "./apps/{{configEntry.name}}/shared",
16
- "~entities": "./apps/{{configEntry.name}}/entities",
17
- "~features": "./apps/{{configEntry.name}}/features",
18
- "~widgets": "./apps/{{configEntry.name}}/widgets",
19
- "~pages": "./apps/{{configEntry.name}}/pages",
20
- "~processes": "./apps/{{configEntry.name}}/processes",
21
- "~app": "./apps/{{configEntry.name}}/app"
22
- }
23
- }
24
- }
25
- }
8
+ "postcss": {
9
+ "config": "apps/{{configEntry.name}}/postcss"
10
+ },
26
11
  }
27
12
  }
28
13
  }