@zohodesk/client_build_tool 0.0.1-0.exp.0.0.3

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 (259) hide show
  1. package/.babelrc +12 -0
  2. package/.lintstagedrc +3 -0
  3. package/.vscode/settings.json +5 -0
  4. package/CHANGELOG.md +84 -0
  5. package/ConfigurationDocumentation.md +567 -0
  6. package/ContributionGuide.md +2 -0
  7. package/NOTES-Dec12.md +12 -0
  8. package/README.md +184 -0
  9. package/README_backup.md +100 -0
  10. package/TODO.md +35 -0
  11. package/cli.js +31 -0
  12. package/docs/BabelCustomizations.md +55 -0
  13. package/docs/CSSCustomPluginsDocumentation.md +71 -0
  14. package/docs/CustomChunksConfiguration.md +0 -0
  15. package/docs/EFCFileTemplate.md +0 -0
  16. package/docs/MockApi.md +61 -0
  17. package/docs/NameTemplateUtility.md +93 -0
  18. package/docs/ServiseWorkerTemplate.md +0 -0
  19. package/docs/SupportedBrowserVersions.md +61 -0
  20. package/helpDocs/check.js +7 -0
  21. package/helpDocs/commmands/build.md +0 -0
  22. package/helpDocs/commmands/start.md +0 -0
  23. package/helpDocs/examples/buildWithContentHash.md +0 -0
  24. package/helpDocs/examples/startDevServer.md +0 -0
  25. package/helpDocs/examples/startWithMockAPI.md +0 -0
  26. package/helpDocs/node18-env.md +30 -0
  27. package/helpDocs/troubleshootings/NewMachineSetup.md +71 -0
  28. package/helpDocs/troubleshootings/README.md +9 -0
  29. package/helpDocs/troubleshootings/hg_install.sh +18 -0
  30. package/helpDocs/troubleshootings/newMachineMac.sh +86 -0
  31. package/helpDocs/troubleshootings/newMachineUbundu.bash +84 -0
  32. package/lib/allCommandsConfigs.js +25 -0
  33. package/lib/commands/build/commandExecutor.js +17 -0
  34. package/lib/commands/build/config.js +12 -0
  35. package/lib/commands/build/optionsProcessor.js +35 -0
  36. package/lib/commands/build/preProcessor.js +12 -0
  37. package/lib/commands/buildEs/commandExecutor.js +33 -0
  38. package/lib/commands/buildEs/config.js +12 -0
  39. package/lib/commands/buildEs/preProcessor.js +17 -0
  40. package/lib/commands/buildLib/commandExecutor.js +33 -0
  41. package/lib/commands/buildLib/config.js +12 -0
  42. package/lib/commands/buildLib/preProcessor.js +17 -0
  43. package/lib/commands/mockserver/commandExecutor.js +43 -0
  44. package/lib/commands/mockserver/config.js +12 -0
  45. package/lib/commands/pre_process/commandExecutor.js +18 -0
  46. package/lib/commands/pre_process/config.js +12 -0
  47. package/lib/commands/start/commandExecutor.js +12 -0
  48. package/lib/commands/start/config.js +12 -0
  49. package/lib/commands/start/optionsProcessor.js +30 -0
  50. package/lib/commands/start/preProcessor.js +12 -0
  51. package/lib/commands/template/commandExecutor.js +28 -0
  52. package/lib/commands/template/config.js +12 -0
  53. package/lib/commands/version/commandExecutor.js +14 -0
  54. package/lib/commands/version/config.js +12 -0
  55. package/lib/commandsRouter.js +74 -0
  56. package/lib/index.js +12 -0
  57. package/lib/logger.js +34 -0
  58. package/lib/schemas/applyValuesToSchema/index.js +34 -0
  59. package/lib/schemas/applyValuesToSchema/isObject.js +10 -0
  60. package/lib/schemas/applyValuesToSchema/isValid.js +14 -0
  61. package/lib/schemas/cliArgsToObject.js +39 -0
  62. package/lib/schemas/defaultConfigValues.js +393 -0
  63. package/lib/schemas/defaultConfigValuesOnly.js +200 -0
  64. package/lib/schemas/deprecatedOptionsHandler.js +67 -0
  65. package/lib/schemas/getNpmVersion.js +22 -0
  66. package/lib/schemas/giveDefaultValue.js +18 -0
  67. package/lib/schemas/npmConfigToObject.js +35 -0
  68. package/lib/schemas/readOptions.js +87 -0
  69. package/lib/schemas/readOptionsForConfigFile.js +42 -0
  70. package/lib/shared/babel/addDefaultPlugins.js +15 -0
  71. package/lib/shared/babel/babelWebConfig.js +54 -0
  72. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +23 -0
  73. package/lib/shared/babel/getBabelPlugin.js +42 -0
  74. package/lib/shared/babel/runBabelForJSFile.js +24 -0
  75. package/lib/shared/babel/runBabelForTsFile.js +30 -0
  76. package/lib/shared/bundler/webpack/common/decidePublicPath.js +57 -0
  77. package/lib/shared/bundler/webpack/common/hashUtils.js +20 -0
  78. package/lib/shared/bundler/webpack/common/libAlias.js +31 -0
  79. package/lib/shared/bundler/webpack/common/modeUtils.js +39 -0
  80. package/lib/shared/bundler/webpack/common/nameTemplates.js +105 -0
  81. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
  82. package/lib/shared/bundler/webpack/configCustomLoaders.js +10 -0
  83. package/lib/shared/bundler/webpack/cssLoaders.js +16 -0
  84. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +83 -0
  85. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +119 -0
  86. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +46 -0
  87. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +109 -0
  88. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +112 -0
  89. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +47 -0
  90. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +190 -0
  91. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
  92. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +174 -0
  93. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +76 -0
  94. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +223 -0
  95. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  96. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +73 -0
  97. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +88 -0
  98. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
  99. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
  100. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
  101. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +76 -0
  102. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +39 -0
  103. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +50 -0
  104. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +68 -0
  105. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
  106. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
  107. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +43 -0
  108. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
  109. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectAstKeys.js +98 -0
  110. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +66 -0
  111. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +13 -0
  112. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
  113. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
  114. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +129 -0
  115. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +60 -0
  116. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +30 -0
  117. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +23 -0
  118. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +35 -0
  119. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +18 -0
  120. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +46 -0
  121. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +18 -0
  122. package/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
  123. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +193 -0
  124. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +62 -0
  125. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +84 -0
  126. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
  127. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +27 -0
  128. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +73 -0
  129. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +20 -0
  130. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +78 -0
  131. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +51 -0
  132. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +16 -0
  133. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +120 -0
  134. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +13 -0
  135. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +71 -0
  136. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +22 -0
  137. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +55 -0
  138. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +49 -0
  139. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +62 -0
  140. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +362 -0
  141. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +80 -0
  142. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +14 -0
  143. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +57 -0
  144. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +87 -0
  145. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +13 -0
  146. package/lib/shared/bundler/webpack/devtoolConfig.js +13 -0
  147. package/lib/shared/bundler/webpack/entryConfig.js +28 -0
  148. package/lib/shared/bundler/webpack/externals.js +17 -0
  149. package/lib/shared/bundler/webpack/getCSSLoaders.js +29 -0
  150. package/lib/shared/bundler/webpack/getFilenameFromModule.js +24 -0
  151. package/lib/shared/bundler/webpack/jsLoaders.js +30 -0
  152. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +12 -0
  153. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +18 -0
  154. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +56 -0
  155. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
  156. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +37 -0
  157. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
  158. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +86 -0
  159. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +65 -0
  160. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +21 -0
  161. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +94 -0
  162. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +201 -0
  163. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +7 -0
  164. package/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
  165. package/lib/shared/bundler/webpack/optimizationConfig.js +56 -0
  166. package/lib/shared/bundler/webpack/outputConfig.js +38 -0
  167. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +40 -0
  168. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +36 -0
  169. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +28 -0
  170. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +27 -0
  171. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +63 -0
  172. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +20 -0
  173. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +76 -0
  174. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +46 -0
  175. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +51 -0
  176. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +56 -0
  177. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +113 -0
  178. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +41 -0
  179. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
  180. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +44 -0
  181. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +24 -0
  182. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +24 -0
  183. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +21 -0
  184. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
  185. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +31 -0
  186. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +28 -0
  187. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +40 -0
  188. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +20 -0
  189. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +32 -0
  190. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +25 -0
  191. package/lib/shared/bundler/webpack/plugins.js +77 -0
  192. package/lib/shared/bundler/webpack/resolvers.js +82 -0
  193. package/lib/shared/bundler/webpack/splitChunksConfig.js +116 -0
  194. package/lib/shared/bundler/webpack/statsConfig.js +30 -0
  195. package/lib/shared/bundler/webpack/tsLoaders.js +17 -0
  196. package/lib/shared/bundler/webpack/utils/index.js +31 -0
  197. package/lib/shared/bundler/webpack/utils/object-manipulation.js +87 -0
  198. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +34 -0
  199. package/lib/shared/bundler/webpack/webpackBuild.js +27 -0
  200. package/lib/shared/bundler/webpack/webpackConfig.js +58 -0
  201. package/lib/shared/commands-utils/doBasicRequirementCheck.js +17 -0
  202. package/lib/shared/commands-utils/getCliPath.js +39 -0
  203. package/lib/shared/commands-utils/index.js +29 -0
  204. package/lib/shared/commands-utils/log.js +13 -0
  205. package/lib/shared/commands-utils/readArgsFormCommandLine.js +11 -0
  206. package/lib/shared/commands-utils/readOptionFormCommandLine.js +11 -0
  207. package/lib/shared/commands-utils/spawnSyncIO.js +38 -0
  208. package/lib/shared/constants.js +48 -0
  209. package/lib/shared/fileUtils/copyFile.js +38 -0
  210. package/lib/shared/fileUtils/directoryIterator.js +21 -0
  211. package/lib/shared/fileUtils/watchRun.js +112 -0
  212. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +21 -0
  213. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +10 -0
  214. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +66 -0
  215. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +136 -0
  216. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +32 -0
  217. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +20 -0
  218. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +20 -0
  219. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +24 -0
  220. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +43 -0
  221. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +52 -0
  222. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +139 -0
  223. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +90 -0
  224. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +57 -0
  225. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +347 -0
  226. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +55 -0
  227. package/lib/shared/postcss/getAllowedPostCssPlugins.js +30 -0
  228. package/lib/shared/postcss/getSpecificPostCssPlugin.js +58 -0
  229. package/lib/shared/postcss/runPostCssForCssFile.js +37 -0
  230. package/lib/shared/pre_process/runPreProcess.js +58 -0
  231. package/lib/shared/server/configWebpackDevMiddleware.js +41 -0
  232. package/lib/shared/server/corsHandling.js +30 -0
  233. package/lib/shared/server/getIp.js +30 -0
  234. package/lib/shared/server/getServerURL.js +36 -0
  235. package/lib/shared/server/httpsOptions.js +46 -0
  236. package/lib/shared/server/initExpressApp.js +19 -0
  237. package/lib/shared/server/initialHTMLHandling.js +99 -0
  238. package/lib/shared/server/mockApiHandler.js +67 -0
  239. package/lib/shared/server/mockServer.js +41 -0
  240. package/lib/shared/server/serveContextFiles.js +27 -0
  241. package/lib/shared/server/serverBywebpackDevMiddleware.js +35 -0
  242. package/lib/shared/server/startHttpServer.js +26 -0
  243. package/lib/shared/server/startHttpsServer.js +38 -0
  244. package/lib/shared/server/unwanted/addHttp2Server.js +41 -0
  245. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
  246. package/lib/shared/server/unwanted/mockApiSupport.js +19 -0
  247. package/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
  248. package/lib/shared/server/urlConcat.js +32 -0
  249. package/lib/shared/utils/requireLocalOrGlobal.js +81 -0
  250. package/lib/shared/utils/utils.js +1 -0
  251. package/lib/shared/utils/versionPrint.js +20 -0
  252. package/npm-shrinkwrap.json +5657 -0
  253. package/package.json +64 -0
  254. package/polyfillForOldNodeVersion.js +10 -0
  255. package/templates/app/README.MD +30 -0
  256. package/templates/app/package.json +12 -0
  257. package/templates/library/README.MD +28 -0
  258. package/templates/library/package.json +11 -0
  259. package/templates/wms/index.html +43 -0
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # Client Build Tool
2
+
3
+ This is a build tool for react based web applications.
4
+
5
+ Supported and Tested Environment
6
+
7
+ | Name | Version |
8
+ | :--: | :------: |
9
+ | node | v18.11.0 |
10
+ | npm | 8.19.2 |
11
+
12
+ OS : Mac , ubuntu
13
+
14
+ # client_build_tool
15
+
16
+ A CLI tool for build modern web application and libraries
17
+
18
+ # Installation
19
+
20
+ Below Steps:-
21
+
22
+ > `npm i -g @zohodesk/client_build_tool`
23
+
24
+ # Usage
25
+
26
+ ## Step 1
27
+
28
+ > `cbt template app <your-project-folder> && cd <your-project-folder>`
29
+
30
+ ## Step 2
31
+
32
+ Now to run app
33
+
34
+ > `npm run start`
35
+
36
+ ---
37
+
38
+ Happy Code :>) 🤟
39
+
40
+ # "Client Build Tool (CBT): Streamline and Optimize Your Client-side Build Process"
41
+
42
+ ## Description:
43
+
44
+ CBT is a powerful client-side build tool designed to streamline and optimize your development workflow. With CBT, you can effortlessly manage and configure your project's build process, automating tasks, and improving efficiency. It provides an intuitive interface and a comprehensive set of features to simplify the build pipeline, allowing you to focus more on coding and less on tedious configuration.
45
+
46
+ ## Key Features:
47
+
48
+ - **Integrated Dev Server:** Run your application locally with a built-in development server for quick feedback and real-time updates.
49
+ - **Mock API Server:** Seamlessly integrate a mock API server to simulate backend interactions during development.
50
+ - **Intelligent CSS Processing:** Automatically process and optimize CSS files, including customizable class name generation and advanced postcss plugins.
51
+ - **Internationalization Support:** Easily manage internationalization (i18n) with efficient chunk splitting and language-specific resource loading.
52
+ - **CDN Mapping:** Effortlessly map assets to a Content Delivery Network (CDN) for faster delivery and improved performance.
53
+ - **Comprehensive Configuration:** Fine-tune your build process with extensive configuration options, including source maps, Babel customizations, and more.
54
+ - **Service Worker Integration:** Enable service worker functionality for offline support and improved caching capabilities.
55
+ - **Customizable Build Artifacts:** Define custom chunks, modify HTML templates, and generate a manifest.json file for better control over your build output.
56
+ - **User-friendly Interface:** CBT provides a user-friendly interface, making it easy to configure, customize, and monitor your build process.
57
+
58
+ With CBT, you can optimize your client-side development workflow, increase productivity, and deliver high-quality applications faster. Start using CBT today and experience the power of efficient and streamlined client-side builds.
59
+
60
+ # Commands
61
+
62
+ The following commands are available options for the `cbt` (Client Build Tool) CLI. You can execute these commands by prefixing them with `cbt`. For example, `cbt start`.
63
+
64
+ - **preProcessor:** Runs the preProcessor.js in the app to set the variables before the build or run the dev mode.
65
+
66
+ - **start**: Starts the development server with mode support. You can specify the mode as either `dev` or `prod`. This command is used for local development and testing.
67
+
68
+ - **build**: Executes the build command with mode support. You can specify the mode as either `dev` or `prod`. This command compiles and bundles your application for deployment.
69
+
70
+ - **build:lib**: Transpile the `src` folder to the `lib` folder, generating CommonJS modules. This command is specifically designed for building libraries that require CommonJS module format.
71
+
72
+ - **build:es**: Transpile the `src` folder to the `es` folder, generating modules using import statements. This command is useful for building libraries that use ECMAScript module syntax.
73
+
74
+ - **version**: Prints the version of the CBT CLI tool.
75
+
76
+ - **template**: Creates an initial template or skeleton for your project. You can specify the option as `app`. This command sets up a basic project structure and configuration files to get you started quickly.
77
+
78
+ - **mock:server**: Starts an external mock API server. This command enables you to run a separate server specifically for mocking API responses during development and testing.
79
+
80
+ > Note: Make sure to replace `start` in the examples above with the actual command or script that you use to run the Client Build Tool CLI.
81
+
82
+ These commands provide flexibility and control over your client-side build process, allowing you to start the development server, build your application, transpile libraries, create templates, run a mock API server, and more.
83
+
84
+ For more [Details](ConfigurationDocumentation.md)
85
+
86
+
87
+ version details :-
88
+
89
+ # 0.0.8
90
+
91
+ - Main version
92
+
93
+ # 0.0.9
94
+
95
+ fixes :-
96
+
97
+ - service worker wrong i18n entry fixed
98
+
99
+ - preload plc undefined url fixed
100
+
101
+ # Changelog and Release Notes
102
+ # v0.0.10 (12-05-2025)
103
+ **Feature:-**
104
+ - `alias` support for `build:es` and `build:lib`
105
+ - Add babel-plugin-module-resolver dependencies
106
+ - Modify getBabelPlugin to include module resolver with aliases
107
+
108
+ **Bug Fix:-**
109
+ - Enhance runBabelForTSFile to handle both .tsx and .ts file extensions
110
+ - Update mockApiHandler to ensure mock function is called correctly
111
+
112
+ **Change:-**
113
+ - Refactor defaultConfigValues.js to include cli options for enableRTLSplit
114
+
115
+ **Feature:-**
116
+ - externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
117
+ - to use externals, we use the following pattern in `app > externals` :
118
+
119
+ For example
120
+ ```
121
+ externals: {
122
+ <key> : <value>
123
+ }
124
+ ```
125
+
126
+ ## v0.0.6 (4-09-2023)
127
+
128
+ **Feature:-**
129
+ - Generating bundle integrity report json file for the build assets only in production mode. To use this feature we need to add `stats > enable` or cli flags `enable_stats`.
130
+ - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
131
+ - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
132
+ only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
133
+ - added support for glob pattern for custom chunks split logic.
134
+ - added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
135
+
136
+ **Change:-**
137
+ - i18n name not generated issue fix.
138
+ - public path not correctly set issue fix.
139
+ - changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
140
+ ## v0.0.5 (6-08-2023)
141
+
142
+ **Changes:--**
143
+ - Typo fix in i18nRuntimeDealerPlugin.js
144
+ - fixing some bugs in resolvers.js file
145
+
146
+ ## v0.0.3 (1-08-2023)
147
+
148
+ **Changes:--**
149
+ - `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
150
+ - unwanted files deleted from build
151
+
152
+ **Issue Fix:--**
153
+ - The issue with the source map not being created in the build has been fixed."
154
+
155
+
156
+ ## v0.0.2 (28-04-2023)
157
+
158
+ **Features:-**
159
+
160
+ - `devModeContentHashAllowedTypes` support added for some project there will be a need for hash even though they run dev mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devModeContentHashAllowedTypes)
161
+ - `devLikeHash` support for disable content hash for file names in production mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devLikeHash)
162
+ - `disableReactDevWarning` disable react dev warning such as prop-type warnings will be removed in dev mode build or server. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#disableReactDevWarning) can be enabled via `--disable_react_dev_warning` too.
163
+ - `statsLogConfig` support to customize default webpack log after build finished. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#statsLogConfig) can be enabled via `--disable_react_dev_warning` too.
164
+ - `enableChunkHash` renamed as `enableFileNameHashing`
165
+
166
+ - `pre_processor` command to run the preprocessor.js file.preProcessor runs in build, start, buildEs, buildLib commands bu default. and we have watch mode support as well with the option (`-w`)
167
+ - `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
168
+ - `removeAttribute` option changes as `babelCustomizations.removeAttribute`
169
+ - `removePropTypes` support for remove the prop types package in the output build.
170
+ - `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
171
+ - `manifestJson` default value set as false.
172
+ - `customAttributes` support for add attributes to html, link , script tag in the output build.
173
+
174
+
175
+ ## v0.0.1 (18-04-2023)
176
+
177
+ First Release
178
+ **Features:-**
179
+
180
+ - 'start' command to run react app
181
+ - 'build' command to create build for react app
182
+ - 'build:lib' command to create lib for react library
183
+ - 'build:es' command to create es for react library
184
+ - 'templates' command to create es for react library
@@ -0,0 +1,100 @@
1
+ # Client Build Tool
2
+
3
+ This is a build tool for react based web applications.
4
+
5
+ Supported and Tested Environment
6
+
7
+ | Name | Version |
8
+ | :--: | :------: |
9
+ | node | v18.11.0 |
10
+ | npm | 8.19.2 |
11
+
12
+ OS : Mac , ubuntu
13
+
14
+ # client_build_tool
15
+
16
+ A CLI tool for build modern web application and libraries
17
+
18
+ # Installation
19
+
20
+ Below Steps:-
21
+
22
+ > `npm i -g @zohodesk/client_build_tool`
23
+
24
+ # Usage
25
+
26
+ ## Step 1
27
+
28
+ > `cbt template app <your-project-folder> && cd <your-project-folder>`
29
+
30
+ ## Step 2
31
+
32
+ Now to run app
33
+
34
+ > `npm run start`
35
+
36
+ ---
37
+
38
+ Happy Code :>) 🤟
39
+
40
+ # "Client Build Tool (CBT): Streamline and Optimize Your Client-side Build Process"
41
+
42
+ ## Description:
43
+
44
+ CBT is a powerful client-side build tool designed to streamline and optimize your development workflow. With CBT, you can effortlessly manage and configure your project's build process, automating tasks, and improving efficiency. It provides an intuitive interface and a comprehensive set of features to simplify the build pipeline, allowing you to focus more on coding and less on tedious configuration.
45
+
46
+ ## Key Features:
47
+
48
+ - **Integrated Dev Server:** Run your application locally with a built-in development server for quick feedback and real-time updates.
49
+ - **Mock API Server:** Seamlessly integrate a mock API server to simulate backend interactions during development.
50
+ - **Intelligent CSS Processing:** Automatically process and optimize CSS files, including customizable class name generation and advanced postcss plugins.
51
+ - **Internationalization Support:** Easily manage internationalization (i18n) with efficient chunk splitting and language-specific resource loading.
52
+ - **CDN Mapping:** Effortlessly map assets to a Content Delivery Network (CDN) for faster delivery and improved performance.
53
+ - **Comprehensive Configuration:** Fine-tune your build process with extensive configuration options, including source maps, Babel customizations, and more.
54
+ - **Service Worker Integration:** Enable service worker functionality for offline support and improved caching capabilities.
55
+ - **Customizable Build Artifacts:** Define custom chunks, modify HTML templates, and generate a manifest.json file for better control over your build output.
56
+ - **User-friendly Interface:** CBT provides a user-friendly interface, making it easy to configure, customize, and monitor your build process.
57
+
58
+ With CBT, you can optimize your client-side development workflow, increase productivity, and deliver high-quality applications faster. Start using CBT today and experience the power of efficient and streamlined client-side builds.
59
+
60
+ # Commands
61
+
62
+ The following commands are available options for the `cbt` (Client Build Tool) CLI. You can execute these commands by prefixing them with `cbt`. For example, `cbt start`.
63
+
64
+ - **preProcessor:** Runs the preProcessor.js in the app to set the variables before the build or run the dev mode.
65
+
66
+ - **start**: Starts the development server with mode support. You can specify the mode as either `dev` or `prod`. This command is used for local development and testing.
67
+
68
+ - **build**: Executes the build command with mode support. You can specify the mode as either `dev` or `prod`. This command compiles and bundles your application for deployment.
69
+
70
+ - **build:lib**: Transpile the `src` folder to the `lib` folder, generating CommonJS modules. This command is specifically designed for building libraries that require CommonJS module format.
71
+
72
+ - **build:es**: Transpile the `src` folder to the `es` folder, generating modules using import statements. This command is useful for building libraries that use ECMAScript module syntax.
73
+
74
+ - **version**: Prints the version of the CBT CLI tool.
75
+
76
+ - **template**: Creates an initial template or skeleton for your project. You can specify the option as `app`. This command sets up a basic project structure and configuration files to get you started quickly.
77
+
78
+ - **mock:server**: Starts an external mock API server. This command enables you to run a separate server specifically for mocking API responses during development and testing.
79
+
80
+ > Note: Make sure to replace `start` in the examples above with the actual command or script that you use to run the Client Build Tool CLI.
81
+
82
+ These commands provide flexibility and control over your client-side build process, allowing you to start the development server, build your application, transpile libraries, create templates, run a mock API server, and more.
83
+
84
+ For more [Details](ConfigurationDocumentation.md)
85
+
86
+
87
+ version details :-
88
+
89
+ # 0.0.8
90
+
91
+ - Main version
92
+
93
+ # 0.0.9
94
+
95
+ fixes :-
96
+
97
+ - service worker wrong i18n entry fixed
98
+
99
+ - preload plc undefined url fixed
100
+
package/TODO.md ADDED
@@ -0,0 +1,35 @@
1
+
2
+
3
+
4
+ [*] public path check template
5
+ [ ] public path dev build url and url less, prod url less check
6
+ [ ] initial html similarity check
7
+ [ ] initial chunks check ,
8
+ [ ] initial efc chunks check
9
+ [ ] efc creation check
10
+ [ ] css tag order check
11
+ [*] css tags creation check
12
+
13
+ 10 Aug 2023
14
+ [ ] enableFileNameHashing to dev mode for conflicting svg files.
15
+ [ ] customLoaders
16
+ [ ] preprocess runner same as react-cli need to run.
17
+ [ ] need to check about `i18nChunkSplit:propertiesPattern`
18
+ [*] need to check `publicPaths` for cbt same as react-cli need to run. we can use CDN Mapping
19
+
20
+ 8 Apr 2023
21
+
22
+ [*] `HIGH` react-cli global modulePath and global certificate
23
+ [ ] `Low` Docs separation
24
+
25
+
26
+
27
+ every folders must have unit testcases, only 100%
28
+
29
+ code for newbie edit already exits code
30
+ testing startagy
31
+
32
+
33
+
34
+ KT react-cli
35
+ *
package/cli.js ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { polyfillForOldNodeVersion } = require('./polyfillForOldNodeVersion');
4
+
5
+ polyfillForOldNodeVersion();
6
+
7
+ const { verboseLogger } = require('./lib/logger');
8
+ const { route } = require('./lib/commandsRouter');
9
+ const {
10
+ readArgsFormCommandLine,
11
+ readOptionFormCommandLine,
12
+ doBasicRequirementCheck
13
+ } = require('./lib/shared/commands-utils');
14
+ const { versionPrint } = require('./lib/shared/utils/versionPrint');
15
+
16
+ // process.traceDeprecation = true;
17
+
18
+ verboseLogger('hello there, this is client build tool verbose logging..');
19
+ versionPrint(verboseLogger);
20
+
21
+ const option = readOptionFormCommandLine();
22
+ const args = readArgsFormCommandLine();
23
+
24
+ // // like machine support and node support and npm support
25
+ // // if it is ok then do the proper work.
26
+
27
+ if (doBasicRequirementCheck()) {
28
+ // runProperCommand(option, args)
29
+ verboseLogger(`the command was ${option}`, args);
30
+ route(option);
31
+ }
@@ -0,0 +1,55 @@
1
+ ## Babel Customizations Configuration Documentation
2
+
3
+ The `babelCustomizations` object in the provided code represents a set of customizations that can be applied to the Babel configuration within the context of the Client Build Tool (CBT). These customizations allow you to fine-tune how JavaScript code is transpiled and transformed during the build process. Below is the documentation for the individual customizations:
4
+
5
+ ### babelCustomizations.browserList
6
+
7
+ > Type: (null or string array)
8
+
9
+ This configuration option allows you to define a custom `browserslist` for Babel, which specifies the targeted browsers and their versions. If set to `null`, the default `browserslist` of the environment will be used.
10
+
11
+ ### babelCustomizations.removeAttribute
12
+
13
+ This customization is used to remove specific HTML attributes from JSX elements during transpilation.
14
+
15
+ - **enable** (boolean): Determines whether the removal of attributes is enabled (`true`) or not (`false`).
16
+
17
+ - **options** (object): Contains settings related to attribute removal.
18
+
19
+ - **attributeNames** (string array): Specifies the names of HTML attributes that should be removed from JSX elements during transpilation.
20
+
21
+ ### babelCustomizations.removePropTypes
22
+
23
+ This customization is used to remove `prop-types` declarations from React components.
24
+
25
+ - **enable** (boolean): Determines whether the removal of `prop-types` is enabled (`true`) or not (`false`).
26
+
27
+ - **options** (object): Contains settings related to `prop-types` removal.
28
+
29
+ - **mode** ('remove'): Specifies the removal mode. Currently, only `'remove'` mode is supported.
30
+
31
+ - **removeImport** (boolean): Determines whether the import statement for `prop-types` should also be removed when `prop-types` declarations are removed.
32
+
33
+ ### babelCustomizations.devConsoleExclude
34
+
35
+ This customization is used to exclude certain types of console messages from the build output in development mode.
36
+
37
+ - **enable** (boolean or object): If a boolean, determines whether console message exclusion is enabled (`true`) or not (`false`). If an object, it can have two properties:
38
+
39
+ - **value** (boolean): Determines whether the exclusion is enabled (`true`) or not (`false`).
40
+
41
+ - **cli** (string): Provides an option to control the behavior through the CLI by using the specified command line argument.
42
+
43
+ - **options** (object): Contains settings related to console message exclusion.
44
+
45
+ - **exclude** (string array): Specifies the types of console messages that should be excluded from the build output. For example, `['error', 'warn']` would exclude both error and warning messages.
46
+
47
+ ### babelCustomizations.plugins
48
+
49
+ > Type: (array)
50
+
51
+ This customization allows you to specify an array of Babel plugins that will be applied during transpilation.
52
+
53
+ - **plugins** (array): An array of Babel plugins that will be used for transpilation.
54
+
55
+ By customizing the `babelCustomizations` configuration, you can tailor the Babel transpilation process to meet the specific requirements of your project, such as removing certain attributes, optimizing for development console messages, or adding custom Babel plugins.
@@ -0,0 +1,71 @@
1
+ ## CSS Custom Plugins Documentation
2
+
3
+ The following documentation provides an overview of the CSS custom plugins available in the Client Build Tool (CBT) configuration. These plugins allow you to extend the functionality of PostCSS, a powerful tool for transforming CSS using JavaScript plugins. Each plugin can be customized based on your specific requirements. Here are the available CSS custom plugins:
4
+
5
+ ### rtlSplit
6
+
7
+ - **enableRTLSplit** (boolean): Specifies whether to enable Right-to-Left (RTL) splitting. When enabled, this plugin generates separate CSS files for RTL layouts. The default value is `false`.
8
+
9
+ - **templateLabel** (string): Specifies the template label used for RTL splitting. The default value is `'{{--dir}}'`.
10
+
11
+ - **disableMinifySelector** (boolean): Specifies whether to disable minification of CSS selectors during RTL splitting. The default value is `false`.
12
+
13
+ - **dirVarName** (string): Specifies the variable name used to store the direction (LTR or RTL). The default value is `'document.dir'`.
14
+
15
+ ### selectorWeight
16
+
17
+ - **enable** (boolean): Specifies whether to enable the selector weight plugin. When enabled, this plugin calculates the weight of CSS selectors based on specificity. The default value is `false`.
18
+
19
+ - **patterns** (array): Specifies an array of file patterns to apply the selector weight plugin. The default value is an empty array.
20
+
21
+ - **configFile** (null): Specifies the configuration file for the selector weight plugin. The default value is `null`.
22
+
23
+ - **defaultSelector** (string): Specifies the default selector used by the selector weight plugin. The default value is an empty string.
24
+
25
+ - **customFileDetails** (string): Specifies custom file details for the selector weight plugin. The default value is an empty string.
26
+
27
+ - **excludeStrings** (array): Specifies an array of strings to exclude from the selector weight calculations. The default value is an empty array.
28
+
29
+ ### valueReplacer
30
+
31
+ - **enable** (boolean): Specifies whether to enable the value replacer plugin. When enabled, this plugin replaces values in CSS properties based on specified patterns. The default value is `false`.
32
+
33
+ - **patterns** (array): Specifies an array of patterns to match CSS property values for replacement. The default value is an empty array.
34
+
35
+ - **config** (array): Specifies an array of configuration options for the value replacer plugin. The default value is an empty array.
36
+
37
+ ### selectorReplace
38
+
39
+ - **enable** (boolean): Specifies whether to enable the selector replace plugin. When enabled, this plugin replaces CSS selectors based on specified patterns. The default value is `false`.
40
+
41
+ - **patterns** (array): Specifies an array of patterns to match CSS selectors for replacement. The default value is an empty array.
42
+
43
+ - **before** (array): Specifies an array of strings or regular expressions to match selector patterns that should be replaced before the main replacement. The default value is an empty array.
44
+
45
+ - **after** (array): Specifies an array of strings or regular expressions to match selector patterns that should be replaced after the main replacement. The default value is an empty array.
46
+
47
+ ### hoverActive
48
+
49
+ - **enable** (boolean): Specifies whether to enable the hover and active plugin. When enabled, this plugin generates CSS for hover and active states based on specified patterns. The default value is `false`.
50
+
51
+ - **patterns** (array): Specifies an array of patterns to match CSS selectors for generating hover and active states. The default value is an empty array.
52
+
53
+ - **hover** (string): Specifies the CSS pseudo-class for the hover state. The default value is `'(hover: hover)'`.
54
+
55
+ - **active** (string): Specifies the CSS pseudo-class for the active state. The default value is `'(hover: none)'`.
56
+
57
+ ### cssVariableReplacement
58
+
59
+ - **enable** (boolean): Specifies whether to enable the CSS variable replacement plugin. When enabled, this plugin replaces CSS variables based on specified patterns. The default value is `false`.
60
+
61
+ - **patterns** (array): Specifies an array of patterns to match CSS variable names for replacement. The default value is an empty array.
62
+
63
+ - **configFile** (null): Specifies the configuration file for the CSS variable replacement plugin. The default value is `null`.
64
+
65
+ ### rtl
66
+
67
+ - **enable** (boolean): Specifies whether to enable the RTL plugin. When enabled, this plugin generates RTL-specific CSS based on specified patterns. The default value is `false`.
68
+
69
+ - **patterns** (array): Specifies an array of patterns to match CSS selectors for RTL transformation. The default value is an empty array.
70
+
71
+ These custom plugins provide additional functionality and customization options for transforming CSS during the build process. You can enable or disable each plugin as needed and configure them according to your project's requirements.
File without changes
File without changes
@@ -0,0 +1,61 @@
1
+ # Mock Api
2
+
3
+ ## Explanation:-
4
+
5
+ This api is for run mock api.
6
+ The reason for this feature is we usually run dev server as just to server react page not for api request.
7
+ So when we need Mock Api or api request related this not on server (some java server).
8
+ But do it in node js, this api.
9
+
10
+ ## Ways to use Mock api
11
+
12
+ There is two ways to run mock api.
13
+
14
+ 1. Run mock api with dev server
15
+ 2. Run mock api separate from dev server but api can be called through dev server.
16
+
17
+ ### Run mock api with dev server
18
+
19
+ In this way of running you do not need to run extra you do not have to run separate command.
20
+ But every change you do in mock api you need to stop and restart.
21
+
22
+ To run this you have to enable mock server and just un dev server as usual `cbt start`
23
+
24
+ ### Run mock api separate from dev server
25
+
26
+ This api is for run mock api in separate nodemon.
27
+
28
+ So to run this you have to enable mock api and run `cbt mock:server`.
29
+
30
+ ## Configuration
31
+
32
+ To config this mock api
33
+ you can need to add `mockServer` key in **cbt.config.js** or **package.json** file (`client-build-config` or `react-cli`) ==> `mockServer`
34
+
35
+ | option | type | default |
36
+ | :---------------: | :-----: | :--------------: |
37
+ | enable | Boolean | false |
38
+ | separateSeverPort | Number | null |
39
+ | disableNodemon | Boolean | false |
40
+ | mockEntryFile | String | mockapi/index.js |
41
+ | mockPrefix | String | /api/ |
42
+
43
+ ### **enable**:
44
+
45
+ Specifies whether the application's mocking functionality is enabled or disabled. When set to `true`, the application will use the mock server. When set to `false`, the mock server will be disabled. By default, the value is set to `false`.
46
+
47
+ ### **separateSeverPort**:
48
+
49
+ Specifies the port to be used by the mock server. If the `enable` option is set to `true`, the application will use this port to run the mock server. This configuration parameter should be set to a valid port number. In this case, the port number is set to `8080`.
50
+
51
+ ### **disableNodemon**:
52
+
53
+ Specifies whether nodemon, a utility that automatically restarts the application upon file changes, should be disabled. When set to `true`, nodemon will be disabled. When set to `false`, nodemon will remain enabled. By default, the value is set to `false`.
54
+
55
+ ### **mockEntryFile**:
56
+
57
+ Specifies the entry file for the mock server. This file is the starting point for the mock server's execution. The value should be a string representing the file path. In this case, the entry file is set to `mockapi/index.js`.
58
+
59
+ ### **mockPrefix**:
60
+
61
+ Specifies the URL prefix for the mock server's API endpoints. The value should be a string representing the desired prefix. In this case, the prefix is set to `/api/`.
@@ -0,0 +1,93 @@
1
+ ## Name Template Utility Documentation
2
+
3
+ The provided code snippet represents a utility module for generating name templates used in the build process of the Client Build Tool (CBT). The module contains functions for creating name templates and determining whether a file is an internationalization file. Let's document the different parts of the code:
4
+
5
+ ### Import Statements
6
+
7
+ ```javascript
8
+ import { isDevelopmentMode, isProductionMode } from './modeUtils';
9
+ ```
10
+
11
+ This import statement brings in the `isDevelopmentMode` and `isProductionMode` functions from the `modeUtils` module.
12
+
13
+ ### Templates Object
14
+
15
+ The `templates` object represents a collection of different name templates used for various types of files during the build process. Each key-value pair in the object represents a file type and its corresponding name templates.
16
+
17
+ ### createNameTemplate Function
18
+
19
+ The `createNameTemplate` function is used to generate a name template for a specific file type based on whether a hash should be included in the file name. It takes in the `name` and `useHash` parameters and returns the appropriate name template based on the `useHash` value.
20
+
21
+ ### nameTemplates Function
22
+
23
+ The `nameTemplates` function is a utility function that determines the name template for a specified file type based on the provided options. It takes in the `type` and `options` parameters and returns the corresponding name template.
24
+
25
+ ### isI18nFile Function
26
+
27
+ The `isI18nFile` function is a utility function that checks whether a given URL represents an internationalization file. It takes in the `url` parameter and returns `true` if the URL ends with `.i18n.js`, indicating it is an internationalization file.
28
+
29
+ ### Export Statements
30
+
31
+ The module exports the `nameTemplates` function, allowing it to be used in other parts of the build process. The `isI18nFile` function is not exported and is intended for internal use within the module.
32
+
33
+ By using these utility functions, you can generate name templates for different types of files during the build process. These name templates play a crucial role in determining the output file names and paths, enabling effective asset management and caching strategies.
34
+
35
+ Please note that the provided code snippet represents a partial implementation, and there may be additional code or dependencies required for the utility module to function correctly within the overall CBT system.
36
+
37
+ ## File Templates Configuration Documentation
38
+
39
+ The `templates` object in the provided code represents a collection of file templates used in the build process of the Client Build Tool (CBT). The object contains various file types as keys, and each key holds an array of file templates for development and production modes. Here is the documentation for the file templates:
40
+
41
+ ```javascript
42
+ const templates = {
43
+ html: ['index.html', 'index.[contenthash].html'],
44
+ js: ['js/[name].js', 'js/[name].[contenthash].js'],
45
+ chunkjs: ['js-chunks/[name].js', 'js-chunks/[name].[contenthash].js'],
46
+ i18njs: [
47
+ 'i18n-chunks/[locale]/[name].i18n.js',
48
+ 'i18n-chunks/[locale]/[name].[chunkhash].i18n.js'
49
+ ],
50
+ i18nchunkjs: [
51
+ 'i18n-chunks/[locale]/[name].i18n.js',
52
+ // 'i18n-chunks/[locale]/[name].[chunkhash].i18n.js'
53
+ 'i18n-chunks/[locale]/[name].[contenthash].i18n.js'
54
+ ],
55
+ i18nmanifest: ['i18n-manifest.json', 'i18n-manifest.json'],
56
+ workerjs: ['js/[name].js', 'js/[name].[contenthash].js'],
57
+ css: ['css/[name].css', 'css/[name].[contenthash].css'],
58
+ cssdir: ['css/[name].[dir].css', 'css/[name].[contenthash].[dir].css'],
59
+ image: ['images/[name][ext]', 'images/[name].[contenthash][ext]'],
60
+ font: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
61
+ svg: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
62
+ audio: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
63
+ video: ['videos/[name][ext]', 'videos/[name].[contenthash][ext]']
64
+ };
65
+ ```
66
+
67
+ The `templates` object contains file templates for various types of assets used in the build process. Each key-value pair represents a file type and its corresponding file templates.
68
+
69
+ Here are some key points regarding the file templates:
70
+
71
+ - **html**: Contains file templates for HTML files. The development mode template is `'index.html'`, and the production mode template includes a `[contenthash]` placeholder, resulting in `'index.[contenthash].html'`.
72
+
73
+ - **js**: Contains file templates for JavaScript files. The development mode template is `'js/[name].js'`, where `[name]` is replaced by the actual name of the JavaScript file. The production mode template includes a `[contenthash]` placeholder, resulting in `'js/[name].[contenthash].js'`.
74
+
75
+ - **chunkjs**: Contains file templates for chunk JavaScript files. The templates follow a similar pattern to the `js` templates.
76
+
77
+ - **i18njs**: Contains file templates for internationalization JavaScript files. The templates include a `[locale]` placeholder, representing the locale, and a `[chunkhash]` placeholder in the production mode template.
78
+
79
+ - **i18nchunkjs**: Contains alternative file templates for internationalization JavaScript files. The production mode template uses a `[contenthash]` placeholder instead of `[chunkhash]`.
80
+
81
+ - **i18nmanifest**: Contains file templates for the internationalization manifest file. The same template is used for both development and production modes.
82
+
83
+ - **workerjs**: Contains file templates for worker JavaScript files. The templates follow a similar pattern to the `js` templates.
84
+
85
+ - **css**: Contains file templates for CSS files. The templates follow a similar pattern to the `js` templates.
86
+
87
+ - **cssdir**: Contains file templates for CSS files with directory placeholders. The templates include a `[dir]` placeholder in the file name. Changing this line may affect other files and plugins in the build process.
88
+
89
+ - **image**, **font**, **svg**, **audio**, **video**: Contains file templates for different types of static assets. The templates follow specific patterns based on the file extensions and include placeholders like `[name]`, `[contenthash]`, and `[ext]` to generate dynamic file names.
90
+
91
+ These file templates are used by the build process to determine the output file names and paths for different assets. They allow for effective asset management and caching strategies during development and production modes.
92
+
93
+ Please note that the provided code snippet represents a partial implementation, and there may be additional code or dependencies required to fully utilize the file templates within the overall CBT system.
File without changes