@zohodesk/client_build_tool 0.0.11-exp.15.4 → 0.0.11-exp.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/README.md +102 -0
  2. package/README_backup.md +100 -0
  3. package/docs/DYNAMIC_TEMPLATE_EXAMPLE.md +129 -0
  4. package/docs/I18N_SINGLE_FILE_MODE.md +126 -0
  5. package/example-single-file-config.js +59 -0
  6. package/lib/allCommandsConfigs.js +2 -7
  7. package/lib/commands/build/commandExecutor.js +1 -5
  8. package/lib/commands/build/config.js +2 -3
  9. package/lib/commands/build/optionsProcessor.js +2 -5
  10. package/lib/commands/build/preProcessor.js +0 -2
  11. package/lib/commands/buildEs/commandExecutor.js +0 -5
  12. package/lib/commands/buildEs/config.js +2 -3
  13. package/lib/commands/buildEs/preProcessor.js +0 -2
  14. package/lib/commands/buildLib/commandExecutor.js +0 -5
  15. package/lib/commands/buildLib/config.js +2 -3
  16. package/lib/commands/buildLib/preProcessor.js +0 -2
  17. package/lib/commands/mockserver/commandExecutor.js +2 -9
  18. package/lib/commands/mockserver/config.js +2 -3
  19. package/lib/commands/pre_process/commandExecutor.js +0 -2
  20. package/lib/commands/pre_process/config.js +2 -3
  21. package/lib/commands/start/commandExecutor.js +0 -2
  22. package/lib/commands/start/config.js +2 -3
  23. package/lib/commands/start/optionsProcessor.js +2 -4
  24. package/lib/commands/start/preProcessor.js +0 -2
  25. package/lib/commands/template/commandExecutor.js +0 -7
  26. package/lib/commands/template/config.js +2 -3
  27. package/lib/commands/version/commandExecutor.js +0 -3
  28. package/lib/commands/version/config.js +2 -3
  29. package/lib/commandsRouter.js +5 -21
  30. package/lib/index.js +0 -2
  31. package/lib/logger.js +0 -5
  32. package/lib/schemas/applyValuesToSchema/index.js +0 -8
  33. package/lib/schemas/applyValuesToSchema/isObject.js +0 -1
  34. package/lib/schemas/applyValuesToSchema/isValid.js +0 -2
  35. package/lib/schemas/cliArgsToObject.js +2 -6
  36. package/lib/schemas/defaultConfigValues.js +21 -12
  37. package/lib/schemas/defaultConfigValuesOnly.js +4 -7
  38. package/lib/schemas/deprecatedOptionsHandler.js +7 -16
  39. package/lib/schemas/getNpmVersion.js +0 -5
  40. package/lib/schemas/giveDefaultValue.js +0 -3
  41. package/lib/schemas/npmConfigToObject.js +2 -5
  42. package/lib/schemas/readOptions.js +10 -30
  43. package/lib/schemas/readOptionsForConfigFile.js +2 -12
  44. package/lib/shared/babel/addDefaultPlugins.js +0 -2
  45. package/lib/shared/babel/babelWebConfig.js +1 -10
  46. package/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +0 -4
  47. package/lib/shared/babel/getBabelPlugin.js +2 -7
  48. package/lib/shared/babel/runBabelForJSFile.js +1 -4
  49. package/lib/shared/babel/runBabelForTsFile.js +1 -5
  50. package/lib/shared/bundler/webpack/common/decidePublicPath.js +0 -5
  51. package/lib/shared/bundler/webpack/common/libAlias.js +3 -3
  52. package/lib/shared/bundler/webpack/common/modeUtils.js +0 -5
  53. package/lib/shared/bundler/webpack/common/nameTemplates.js +11 -18
  54. package/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +2 -3
  55. package/lib/shared/bundler/webpack/configCustomLoaders.js +0 -1
  56. package/lib/shared/bundler/webpack/cssLoaders.js +0 -2
  57. package/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +1 -20
  58. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +20 -25
  59. package/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +4 -9
  60. package/lib/shared/bundler/webpack/custom_plugins/CustomScriptLoadingPlugin.js +3 -23
  61. package/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +8 -19
  62. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nGroupRuntimeModule.js +2 -6
  63. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexHtmlInjectorPlugin.js +81 -0
  64. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/I18nNumericIndexPlugin.js +135 -60
  65. package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js +20 -26
  66. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +5 -26
  67. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +13 -16
  68. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +19 -53
  69. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +2 -17
  70. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +0 -13
  71. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +11 -21
  72. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +0 -4
  73. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +4 -14
  74. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +3 -13
  75. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +3 -12
  76. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +2 -7
  77. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +0 -2
  78. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +2 -3
  79. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +2 -4
  80. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +8 -13
  81. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -14
  82. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +0 -1
  83. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +1 -3
  84. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +0 -4
  85. package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +5 -25
  86. package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +3 -10
  87. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +1 -6
  88. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +1 -6
  89. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +0 -6
  90. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +0 -1
  91. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +0 -7
  92. package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +0 -1
  93. package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +13 -17
  94. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +6 -15
  95. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +4 -13
  96. package/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +4 -6
  97. package/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +0 -10
  98. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +0 -3
  99. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +4 -20
  100. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +10 -12
  101. package/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +2 -3
  102. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +7 -20
  103. package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +0 -1
  104. package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +7 -10
  105. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +1 -6
  106. package/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +1 -16
  107. package/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +4 -11
  108. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +3 -10
  109. package/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +27 -62
  110. package/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +3 -15
  111. package/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +0 -1
  112. package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +2 -12
  113. package/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +2 -7
  114. package/lib/shared/bundler/webpack/defaultVendorPatternList.js +2 -6
  115. package/lib/shared/bundler/webpack/devtoolConfig.js +0 -1
  116. package/lib/shared/bundler/webpack/entryConfig.js +0 -4
  117. package/lib/shared/bundler/webpack/externals.js +0 -1
  118. package/lib/shared/bundler/webpack/getCSSLoaders.js +1 -6
  119. package/lib/shared/bundler/webpack/getFilenameFromModule.js +1 -5
  120. package/lib/shared/bundler/webpack/jsLoaders.js +6 -10
  121. package/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +0 -2
  122. package/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +2 -3
  123. package/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +3 -12
  124. package/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +0 -1
  125. package/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +2 -10
  126. package/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +0 -2
  127. package/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +0 -12
  128. package/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +1 -15
  129. package/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +1 -4
  130. package/lib/shared/bundler/webpack/loaderConfigs/i18nIdReplaceLoaderConfig.js +8 -16
  131. package/lib/shared/bundler/webpack/loaders/i18nIdReplaceLoader.js +22 -29
  132. package/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +2 -2
  133. package/lib/shared/bundler/webpack/loaders/workerLoader.js +8 -19
  134. package/lib/shared/bundler/webpack/optimizationConfig.js +5 -13
  135. package/lib/shared/bundler/webpack/outputConfig.js +1 -9
  136. package/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +5 -9
  137. package/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +0 -5
  138. package/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +4 -9
  139. package/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +3 -8
  140. package/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +1 -16
  141. package/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +0 -4
  142. package/lib/shared/bundler/webpack/pluginConfigs/configCustomScriptLoadingStrategyPlugin.js +0 -16
  143. package/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +0 -5
  144. package/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +0 -5
  145. package/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +2 -8
  146. package/lib/shared/bundler/webpack/pluginConfigs/configI18nIndexingPlugin.js +5 -9
  147. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericHtmlInjector.js +19 -25
  148. package/lib/shared/bundler/webpack/pluginConfigs/configI18nNumericIndexPlugin.js +92 -0
  149. package/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +3 -9
  150. package/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +0 -2
  151. package/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +0 -7
  152. package/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +3 -7
  153. package/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +1 -5
  154. package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +1 -4
  155. package/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +0 -4
  156. package/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +3 -8
  157. package/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +1 -6
  158. package/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +3 -8
  159. package/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +0 -4
  160. package/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +1 -8
  161. package/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +1 -6
  162. package/lib/shared/bundler/webpack/plugins.js +3 -30
  163. package/lib/shared/bundler/webpack/resolvers.js +3 -17
  164. package/lib/shared/bundler/webpack/splitChunksConfig.js +2 -15
  165. package/lib/shared/bundler/webpack/statsConfig.js +2 -5
  166. package/lib/shared/bundler/webpack/tsLoaders.js +2 -4
  167. package/lib/shared/bundler/webpack/utils/index.js +1 -12
  168. package/lib/shared/bundler/webpack/utils/object-manipulation.js +2 -16
  169. package/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +0 -7
  170. package/lib/shared/bundler/webpack/webpackBuild.js +1 -8
  171. package/lib/shared/bundler/webpack/webpackConfig.js +0 -17
  172. package/lib/shared/commands-utils/doBasicRequirementCheck.js +0 -3
  173. package/lib/shared/commands-utils/getCliPath.js +5 -9
  174. package/lib/shared/commands-utils/index.js +0 -3
  175. package/lib/shared/commands-utils/log.js +0 -2
  176. package/lib/shared/commands-utils/readArgsFormCommandLine.js +0 -1
  177. package/lib/shared/commands-utils/readOptionFormCommandLine.js +0 -1
  178. package/lib/shared/commands-utils/spawnSyncIO.js +5 -13
  179. package/lib/shared/constants.js +9 -29
  180. package/lib/shared/fileUtils/copyFile.js +1 -8
  181. package/lib/shared/fileUtils/directoryIterator.js +0 -4
  182. package/lib/shared/fileUtils/watchRun.js +3 -24
  183. package/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +1 -6
  184. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +2 -3
  185. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +6 -13
  186. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +6 -26
  187. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +6 -9
  188. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +0 -3
  189. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +2 -7
  190. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +0 -2
  191. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +4 -9
  192. package/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +0 -10
  193. package/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +16 -29
  194. package/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +0 -17
  195. package/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +4 -9
  196. package/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +27 -63
  197. package/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +5 -13
  198. package/lib/shared/postcss/getAllowedPostCssPlugins.js +0 -3
  199. package/lib/shared/postcss/getSpecificPostCssPlugin.js +7 -17
  200. package/lib/shared/postcss/runPostCssForCssFile.js +1 -9
  201. package/lib/shared/pre_process/runPreProcess.js +0 -11
  202. package/lib/shared/server/configWebpackDevMiddleware.js +1 -8
  203. package/lib/shared/server/corsHandling.js +2 -6
  204. package/lib/shared/server/getIp.js +1 -7
  205. package/lib/shared/server/getServerURL.js +0 -6
  206. package/lib/shared/server/httpsOptions.js +0 -11
  207. package/lib/shared/server/initExpressApp.js +1 -4
  208. package/lib/shared/server/initialHTMLHandling.js +7 -16
  209. package/lib/shared/server/mockApiHandler.js +8 -16
  210. package/lib/shared/server/mockServer.js +0 -7
  211. package/lib/shared/server/serveContextFiles.js +1 -5
  212. package/lib/shared/server/serverBywebpackDevMiddleware.js +4 -9
  213. package/lib/shared/server/startHttpServer.js +0 -3
  214. package/lib/shared/server/startHttpsServer.js +1 -9
  215. package/lib/shared/server/unwanted/addHttp2Server.js +2 -7
  216. package/lib/shared/server/unwanted/configWebpackDevMiddleware.js +1 -8
  217. package/lib/shared/server/unwanted/mockApiSupport.js +0 -2
  218. package/lib/shared/server/unwanted/websocketMockSetup.js +1 -7
  219. package/lib/shared/server/urlConcat.js +3 -8
  220. package/lib/shared/utils/requireLocalOrGlobal.js +10 -25
  221. package/lib/shared/utils/versionPrint.js +1 -6
  222. package/npm-shrinkwrap.json +2 -2
  223. package/package.json +1 -1
  224. package/packages/client_build_tool/test-i18n-config.js +22 -0
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'buildLib',
9
9
  alias: ['build:lib', 'build_lib'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.preProcessor = preProcessor;
7
-
8
7
  var _runPreProcess = require("../../shared/pre_process/runPreProcess");
9
-
10
8
  function preProcessor(options) {
11
9
  const {
12
10
  extraArgs = []
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commandExecutor = commandExecutor;
7
-
8
7
  var _path = require("path");
9
-
10
8
  var _logger = require("../../logger");
11
-
12
9
  var _spawnSyncIO = require("../../shared/commands-utils/spawnSyncIO");
13
-
14
10
  var _constants = require("../../shared/constants");
15
-
16
11
  function commandExecutor(options) {
17
12
  const {
18
13
  extraArgs
@@ -23,21 +18,19 @@ function commandExecutor(options) {
23
18
  mockEntryFile,
24
19
  disableNodemon
25
20
  } = options.mockServer;
26
-
27
21
  if (!enable) {
28
22
  (0, _logger.messageLogger)('mock server not enabled');
29
23
  return;
30
24
  }
31
-
32
25
  if (!separateSeverPort) {
33
26
  (0, _logger.messageLogger)('mock server not port enabled');
34
27
  return;
35
28
  }
36
-
37
29
  const absolutePath = (0, _path.join)(__dirname, '..', '..', 'shared', 'server', 'mockServer.js');
38
30
  const mockFile = (0, _constants.joinWithAppPath)(mockEntryFile);
39
31
  (0, _logger.verboseLogger)('Mock server is running path', absolutePath);
40
32
  (0, _logger.verboseLogger)('App mock server is path', mockFile);
41
33
  (0, _logger.messageLogger)('mock server is running.....');
42
- (0, _spawnSyncIO.spawnSyncIO)(disableNodemon ? 'node' : 'nodemon', [absolutePath, '--watch', (0, _path.dirname)(mockFile), ...extraArgs]); // webpackBuild(options);
34
+ (0, _spawnSyncIO.spawnSyncIO)(disableNodemon ? 'node' : 'nodemon', [absolutePath, '--watch', (0, _path.dirname)(mockFile), ...extraArgs]);
35
+ // webpackBuild(options);
43
36
  }
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'mockServer',
9
9
  alias: ['mockserver', 'mock_server', 'mock-server', 'mock:server'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commandExecutor = commandExecutor;
7
-
8
7
  var _runPreProcess = require("../../shared/pre_process/runPreProcess");
9
-
10
8
  function commandExecutor(options) {
11
9
  const {
12
10
  extraArgs = []
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'pre_process',
9
9
  alias: ['preprocess', 'pre:process', 'preProcess'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commandExecutor = commandExecutor;
7
-
8
7
  var _serverBywebpackDevMiddleware = require("../../shared/server/serverBywebpackDevMiddleware");
9
-
10
8
  function commandExecutor(options) {
11
9
  (0, _serverBywebpackDevMiddleware.run)(options);
12
10
  }
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'start',
9
9
  alias: ['dstart', 'devSeverStart'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.optionsProcessor = optionsProcessor;
7
-
8
7
  var _decidePublicPath = require("../../shared/bundler/webpack/common/decidePublicPath");
9
-
10
8
  var _constants = require("../../shared/constants");
11
-
12
9
  function optionsProcessor(options) {
13
10
  const {
14
11
  context,
@@ -18,7 +15,8 @@ function optionsProcessor(options) {
18
15
  const serverExtras = (0, _decidePublicPath.modifiedServerOptions)(options);
19
16
  const publicPath = noPublicPath ? undefined : (0, _decidePublicPath.decidePublicPath)(serverExtras);
20
17
  const contextFolderPath = (0, _constants.joinWithAppPath)(context);
21
- const defaultAppliedOptions = { ...options,
18
+ const defaultAppliedOptions = {
19
+ ...options,
22
20
  // eslint-disable-next-line no-nested-ternary
23
21
  mode: options.mode === null ? 'dev' : mode === 'prod' ? 'prod' : 'dev',
24
22
  serverExtras,
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.preProcessor = preProcessor;
7
-
8
7
  var _runPreProcess = require("../../shared/pre_process/runPreProcess");
9
-
10
8
  function preProcessor(options) {
11
9
  (0, _runPreProcess.runPreProcess)(options, 'nodemon');
12
10
  }
@@ -4,25 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commandExecutor = commandExecutor;
7
-
8
7
  var _constants = require("../../shared/constants");
9
-
10
8
  var _logger = require("../../logger");
11
-
12
9
  var _spawnSyncIO = require("../../shared/commands-utils/spawnSyncIO");
13
-
14
10
  const supportedTemplates = ['app', 'library'];
15
-
16
11
  function commandExecutor(options) {
17
12
  const {
18
13
  extraArgs = []
19
14
  } = options;
20
15
  const [templateName, ...args] = extraArgs;
21
-
22
16
  if (!supportedTemplates.includes(templateName)) {
23
17
  (0, _logger.messageLogger)(`template not supported "${templateName}" only these \n${supportedTemplates.join('\n ')} are supported`);
24
18
  return;
25
19
  }
26
-
27
20
  (0, _spawnSyncIO.spawnSyncIO)('cp', ['-r', (0, _constants.getTemplatePath)(templateName)].concat(args));
28
21
  }
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'template',
9
9
  alias: ['template', 'templates'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.commandExecutor = commandExecutor;
7
-
8
7
  var _logger = require("../../logger");
9
-
10
8
  var _versionPrint = require("../../shared/utils/versionPrint");
11
-
12
9
  function commandExecutor() {
13
10
  (0, _versionPrint.versionPrint)(_logger.messageLogger);
14
11
  }
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = {
7
+ var _default = exports.default = {
8
8
  name: 'version',
9
9
  alias: ['v', '-v', '--v', '-version', '--version'],
10
10
  dirname: __dirname
11
- };
12
- exports.default = _default;
11
+ };
@@ -5,53 +5,39 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.route = route;
7
7
  exports.runCommand = runCommand;
8
-
9
8
  var _fs = require("fs");
10
-
11
9
  var _path = require("path");
12
-
13
10
  var _allCommandsConfigs = _interopRequireDefault(require("./allCommandsConfigs"));
14
-
15
11
  var _logger = require("./logger");
16
-
17
12
  var _readOptions = require("./schemas/readOptions");
18
-
19
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
14
  function runCommand(commandName, options) {
22
15
  // eslint-disable-next-line no-use-before-define
23
16
  const commandConfig = findCommandConfig(commandName);
24
-
25
17
  if (!commandConfig) {
26
18
  return;
27
19
  }
28
-
29
20
  const {
30
21
  dirname
31
22
  } = commandConfig;
32
-
33
23
  function runRespectiveFile(name, data) {
34
24
  const commandExecutorPath = (0, _path.join)(dirname, `${name}.js`);
35
-
36
25
  if ((0, _fs.existsSync)(commandExecutorPath)) {
37
26
  // eslint-disable-next-line import/no-dynamic-require, global-require
38
27
  const commandExecutor = require(commandExecutorPath);
39
-
40
28
  return (commandExecutor[name] || commandExecutor.default)(data);
41
29
  }
42
-
43
30
  (0, _logger.verboseLogger)('file not found', commandExecutorPath);
44
31
  return null;
45
32
  }
46
-
47
33
  const processedOption = runRespectiveFile('optionsProcessor', options) || options;
48
- runRespectiveFile('deprecationHandler', processedOption); // runRespectiveFile("errorHandler", () => {
49
-
34
+ runRespectiveFile('deprecationHandler', processedOption);
35
+ // runRespectiveFile("errorHandler", () => {
50
36
  runRespectiveFile('preProcessor', processedOption);
51
37
  runRespectiveFile('commandExecutor', processedOption);
52
- runRespectiveFile('postProcessor', processedOption); // });
38
+ runRespectiveFile('postProcessor', processedOption);
39
+ // });
53
40
  }
54
-
55
41
  function route(commandName) {
56
42
  try {
57
43
  const options = (0, _readOptions.getOptions)();
@@ -60,7 +46,6 @@ function route(commandName) {
60
46
  (0, _logger.errorLogger)(error);
61
47
  }
62
48
  }
63
-
64
49
  function findCommandConfig(option) {
65
50
  // eslint-disable-next-line no-restricted-syntax
66
51
  for (const commandConfig of _allCommandsConfigs.default) {
@@ -68,7 +53,6 @@ function findCommandConfig(option) {
68
53
  return commandConfig;
69
54
  }
70
55
  }
71
-
72
56
  (0, _logger.warnLogger)('Un known command', option, 'please check the document');
73
57
  return null;
74
58
  }
package/lib/index.js CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.run = run;
7
-
8
7
  var _commandsRouter = require("./commandsRouter");
9
-
10
8
  function run(commandName, options) {
11
9
  return (0, _commandsRouter.runCommand)(commandName, options);
12
10
  }
package/lib/logger.js CHANGED
@@ -8,27 +8,22 @@ exports.errorLogger = errorLogger;
8
8
  exports.messageLogger = messageLogger;
9
9
  exports.verboseLogger = verboseLogger;
10
10
  exports.warnLogger = warnLogger;
11
-
12
11
  /* eslint-disable no-console */
13
12
  function verboseLogger(...args) {
14
13
  // TODO: need to be remove when publish happens
15
14
  process.env.VERBOSE === 'true' && console.log('\x1b[33m [verbose] \x1b[0m', ...args);
16
15
  }
17
-
18
16
  function warnLogger(...args) {
19
17
  console.warn(...args);
20
18
  }
21
-
22
19
  function messageLogger(...args) {
23
20
  console.log(...args);
24
21
  }
25
-
26
22
  function debugLogger(...args) {
27
23
  // TODO: need to be remove when publish happens
28
24
  console.trace();
29
25
  console.log(...args);
30
26
  }
31
-
32
27
  function errorLogger(...args) {
33
28
  console.error(...args);
34
29
  }
@@ -4,29 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.applyValuesToSchema = applyValuesToSchema;
7
-
8
7
  var _isObject = require("./isObject");
9
-
10
8
  var _isValid = require("./isValid");
11
-
12
9
  function applyValuesToSchema(schemas, customOptions, processEnv) {
13
10
  const output = {};
14
-
15
11
  function decideValue(schema, key, customOptions) {
16
12
  const specificSchema = schema[key];
17
13
  const correspondingValue = customOptions && customOptions[key];
18
-
19
14
  if ((0, _isObject.isObject)(specificSchema)) {
20
15
  if (typeof specificSchema.cli === 'string') {
21
16
  return processEnv[specificSchema.cli] ?? (0, _isValid.isValid)(correspondingValue, specificSchema.value);
22
17
  }
23
-
24
18
  return applyValuesToSchema(specificSchema, correspondingValue, processEnv);
25
19
  }
26
-
27
20
  return (0, _isValid.isValid)(correspondingValue, specificSchema);
28
21
  }
29
-
30
22
  Object.keys(schemas).forEach(key => {
31
23
  output[key] = decideValue(schemas, key, customOptions);
32
24
  });
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isObject = isObject;
7
-
8
7
  function isObject(obj) {
9
8
  return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
10
9
  }
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isValid = isValid;
7
-
8
7
  function isValid(correspondingValue, specificSchema) {
9
8
  if (typeof correspondingValue === 'number' && Number.isNaN(correspondingValue)) {
10
9
  return specificSchema;
11
10
  }
12
-
13
11
  return correspondingValue ?? specificSchema;
14
12
  }
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.cliArgsToObject = cliArgsToObject;
7
-
8
7
  var _giveDefaultValue = require("./giveDefaultValue");
9
-
10
8
  /**
11
9
  * experimental argument parsing logic
12
10
  * @param {Array} cliArgs is when we use cli the options or args
@@ -21,16 +19,14 @@ function cliArgsToObject(cliArgs) {
21
19
  const processEnv = {};
22
20
  cliArgs.forEach(option => {
23
21
  if (/^--./.test(option)) {
24
- const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
25
-
22
+ const equIndex = option.indexOf('=');
23
+ // equIndex = equIndex === -1 ? option.length : equIndex;
26
24
  let key = option.slice(2, equIndex);
27
25
  let value = (0, _giveDefaultValue.giveDefaultValue)(option.slice(equIndex + 1));
28
-
29
26
  if (equIndex === -1) {
30
27
  key = option.slice(2);
31
28
  value = true;
32
29
  }
33
-
34
30
  key = key.replace(/-|:/g, '_');
35
31
  processEnv[key] = value;
36
32
  }
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _os = require("os");
9
-
10
8
  // NOTE: Don't use 'config_file' as cli option it was reserved
11
- var _default = {
9
+ var _default = exports.default = {
12
10
  context: {
13
11
  value: 'app',
14
12
  cli: 'context'
@@ -159,8 +157,8 @@ var _default = {
159
157
  rtl: {
160
158
  enable: false,
161
159
  patterns: []
162
- } // postcss - plugins end
163
-
160
+ }
161
+ // postcss - plugins end
164
162
  },
165
163
  customPlugins: ['...']
166
164
  },
@@ -181,14 +179,26 @@ var _default = {
181
179
  value: false,
182
180
  cli: 'i18n_indexing'
183
181
  },
184
- jsResourcePath: null,
185
- propertiesFolderPath: null,
186
- numericMapPath: null,
187
- numericFilenameTemplate: 'i18n-chunk/[locale]/numeric.i18n.js',
188
- dynamicFilenameTemplate: 'i18n-chunk/[locale]/dynamic.i18n.js',
182
+ outputFolder: 'i18n-chunk',
183
+ jsResourcePath: './deskapp/properties/JSResources.properties',
184
+ propertiesFolderPath: './deskapp/properties',
185
+ numericMapPath: './deskapp/properties/i18n-numeric-map.json',
186
+ numericFilenameTemplate: '[locale]/numeric.i18n.js',
187
+ dynamicFilenameTemplate: '[locale]/dynamic.i18n.js',
188
+ singleFileTemplate: '[locale].js',
189
+ // Template for single-file mode
189
190
  jsonpFunc: 'window.loadI18nChunk',
190
191
  htmlTemplateLabel: '{{--user-locale}}',
191
192
  localeVarName: 'window.userLangCode',
193
+ singleFile: false,
194
+ includeContentHash: false,
195
+ generateManifest: false,
196
+ manifestPath: null,
197
+ // Custom manifest path
198
+ loaderOptions: {
199
+ includePaths: [],
200
+ excludePaths: ['node_modules', 'tests']
201
+ },
192
202
  customGroups: null
193
203
  },
194
204
  publicFolders: {
@@ -366,5 +376,4 @@ var _default = {
366
376
  enable: false,
367
377
  options: null
368
378
  }
369
- };
370
- exports.default = _default;
379
+ };
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _os = require("os");
9
-
10
8
  // NOTE: Don't use 'config_file' as cli option it was reserved
11
- var _default = {
9
+ var _default = exports.default = {
12
10
  context: 'app',
13
11
  devtool: 'hidden-cheap-source-map',
14
12
  enableFileNameHashing: false,
@@ -82,8 +80,8 @@ var _default = {
82
80
  rtl: {
83
81
  enable: false,
84
82
  patterns: []
85
- } // postcss - plugins end
86
-
83
+ }
84
+ // postcss - plugins end
87
85
  },
88
86
  customPlugins: []
89
87
  },
@@ -183,5 +181,4 @@ var _default = {
183
181
  options: null,
184
182
  excludeKeys: null
185
183
  }
186
- };
187
- exports.default = _default;
184
+ };
@@ -4,63 +4,54 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.deprecatedOptionsHandler = deprecatedOptionsHandler;
7
-
8
7
  var _logger = require("../logger");
9
-
10
8
  function nestedSelect(obj, key) {
11
9
  let temp = obj;
12
10
  const keys = key.split('.');
13
-
14
11
  for (let i = 0; i < keys.length && temp; i++) {
15
12
  const element = keys[i];
16
13
  temp = temp[element];
17
14
  }
18
-
19
15
  return temp;
20
16
  }
21
-
22
17
  function nestedUpdate(obj, key, value) {
23
18
  let temp = obj;
24
19
  const keys = key.split('.');
25
20
  let i = 0;
26
-
27
21
  for (; i < keys.length - 1 && temp; i++) {
28
22
  const element = keys[i];
29
23
  temp = temp[element];
30
24
  }
31
-
32
25
  if (temp) {
33
26
  temp[keys[i]] = value;
34
27
  }
35
28
  }
36
-
37
29
  function deprecatedOptionsHandler(options) {
38
30
  function checkAndUpdateAndPrintWaring(oldKey, newkey) {
39
31
  const oldVal = nestedSelect(options, oldKey);
40
- const newVal = nestedSelect(options, newkey); // console.log({ oldVal, newVal });
32
+ const newVal = nestedSelect(options, newkey);
33
+
34
+ // console.log({ oldVal, newVal });
41
35
 
42
36
  if (oldVal !== undefined && newVal === undefined) {
43
37
  nestedUpdate(options, newkey, newVal);
44
38
  (0, _logger.warnLogger)(`"${oldKey}" deprecated use "${newkey}" instead`);
45
39
  }
46
- } // return;
47
-
40
+ }
48
41
 
49
- checkAndUpdateAndPrintWaring('app.context', 'context'); // TODO handle deprecations here
42
+ // return;
43
+ checkAndUpdateAndPrintWaring('app.context', 'context');
44
+ // TODO handle deprecations here
50
45
  // we will finish this logic later when options are confirmed
51
-
52
46
  if (nestedSelect(options, 'app.hasRTL') === true) {
53
47
  nestedUpdate(options, 'app.plugins.hasRTL', true);
54
48
  }
55
-
56
49
  if (nestedSelect(options, 'docs.hasRTL') === true) {
57
50
  nestedUpdate(options, 'docs.plugins.hasRTL', true);
58
51
  }
59
-
60
52
  if (nestedSelect(options, 'app.rtlExclude.length') > 0) {
61
53
  nestedUpdate(options, 'app.exclude.rtl', nestedSelect(options, 'app.rtlExclude'));
62
54
  }
63
-
64
55
  if (nestedSelect(options, 'docs.rtlExclude.length') > 0) {
65
56
  nestedUpdate(options, 'docs.exclude.rtl', nestedSelect(options, 'docs.rtlExclude'));
66
57
  }
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getNpmVersion = getNpmVersion;
7
-
8
7
  var _child_process = require("child_process");
9
-
10
8
  var _logger = require("../logger");
11
-
12
9
  function getNpmVersion() {
13
10
  let vers = '6';
14
-
15
11
  try {
16
12
  [vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
17
13
  } catch (error) {
18
14
  (0, _logger.messageLogger)(error);
19
15
  }
20
-
21
16
  return vers;
22
17
  }
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.giveDefaultValue = giveDefaultValue;
7
-
8
7
  function giveDefaultValue(value) {
9
8
  if (value === true || value === 'true') {
10
9
  return true;
11
10
  }
12
-
13
11
  if (value === false || value === 'false' || value === '') {
14
12
  return false;
15
13
  }
16
-
17
14
  return value;
18
15
  }
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.npmConfigToObject = npmConfigToObject;
7
-
8
7
  var _logger = require("../logger");
9
-
10
- const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
8
+ const NPM_CONFIG_PREFIX = 'npm_config_';
9
+ // TODO: we have to do option parse logic little better
11
10
  // if user use react-cli strictly without using npm scripts options won't work,
12
11
  // So we have to write our own option parse logic or some other library
13
12
  // console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
@@ -24,11 +23,9 @@ function npmConfigToObject() {
24
23
  });
25
24
  keysWithColon.forEach(key => {
26
25
  const nKey = key.replace(/:/g, '_');
27
-
28
26
  if (processEnv[nKey]) {
29
27
  (0, _logger.warnLogger)('there is some options conflict', key, nKey);
30
28
  }
31
-
32
29
  processEnv[nKey] = processEnv[key];
33
30
  });
34
31
  return processEnv;