@zohodesk/client_build_tool 0.0.6-exp.23 → 0.0.6-exp.25

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.
package/README.md CHANGED
@@ -86,6 +86,80 @@ For more [Details](ConfigurationDocumentation.md)
86
86
 
87
87
 
88
88
 
89
+ **Feature:-**
90
+ - externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
91
+ - to use externals, we use the following pattern in `app > externals` :
92
+
93
+ For example
94
+ ```
95
+ externals: {
96
+ <key> : <value>
97
+ }
98
+ ```
99
+
100
+ ## v0.0.6 (4-09-2023)
101
+
102
+ **Feature:-**
103
+ - 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`.
104
+ - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
105
+ - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
106
+ only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
107
+ - added support for glob pattern for custom chunks split logic.
108
+ - added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
109
+
110
+ **Change:-**
111
+ - i18n name not generated issue fix.
112
+ - public path not correctly set issue fix.
113
+ - changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
114
+ ## v0.0.5 (6-08-2023)
115
+
116
+ **Changes:--**
117
+ - Typo fix in i18nRuntimeDealerPlugin.js
118
+ - fixing some bugs in resolvers.js file
119
+
120
+ ## v0.0.3 (1-08-2023)
121
+
122
+ **Changes:--**
123
+ - `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
124
+ - unwanted files deleted from build
125
+
126
+ **Issue Fix:--**
127
+ - The issue with the source map not being created in the build has been fixed."
128
+
129
+
130
+ ## v0.0.2 (28-04-2023)
131
+
132
+ **Features:-**
133
+
134
+ - `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)
135
+ - `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)
136
+ - `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.
137
+ - `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.
138
+ - `enableChunkHash` renamed as `enableFileNameHashing`
139
+
140
+ - `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`)
141
+ - `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
142
+ - `removeAttribute` option changes as `babelCustomizations.removeAttribute`
143
+ - `removePropTypes` support for remove the prop types package in the output build.
144
+ - `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
145
+ - `manifestJson` default value set as false.
146
+ - `customAttributes` support for add attributes to html, link , script tag in the output build.
147
+
148
+
149
+ ## v0.0.1 (18-04-2023)
150
+
151
+ First Release
152
+ **Features:-**
153
+
154
+ - 'start' command to run react app
155
+ - 'build' command to create build for react app
156
+ - 'build:lib' command to create lib for react library
157
+ - 'build:es' command to create es for react library
158
+ - 'templates' command to create es for react library
159
+ # Changelog and Release Notes
160
+
161
+
162
+
89
163
  **Feature:-**
90
164
  - externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
91
165
  - to use externals, we use the following pattern in `app > externals` :
package/README_backup.md CHANGED
@@ -82,3 +82,77 @@ The following commands are available options for the `cbt` (Client Build Tool) C
82
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
83
 
84
84
  For more [Details](ConfigurationDocumentation.md)
85
+ # Changelog and Release Notes
86
+
87
+
88
+
89
+ **Feature:-**
90
+ - externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
91
+ - to use externals, we use the following pattern in `app > externals` :
92
+
93
+ For example
94
+ ```
95
+ externals: {
96
+ <key> : <value>
97
+ }
98
+ ```
99
+
100
+ ## v0.0.6 (4-09-2023)
101
+
102
+ **Feature:-**
103
+ - 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`.
104
+ - Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
105
+ - added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
106
+ only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
107
+ - added support for glob pattern for custom chunks split logic.
108
+ - added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
109
+
110
+ **Change:-**
111
+ - i18n name not generated issue fix.
112
+ - public path not correctly set issue fix.
113
+ - changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
114
+ ## v0.0.5 (6-08-2023)
115
+
116
+ **Changes:--**
117
+ - Typo fix in i18nRuntimeDealerPlugin.js
118
+ - fixing some bugs in resolvers.js file
119
+
120
+ ## v0.0.3 (1-08-2023)
121
+
122
+ **Changes:--**
123
+ - `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
124
+ - unwanted files deleted from build
125
+
126
+ **Issue Fix:--**
127
+ - The issue with the source map not being created in the build has been fixed."
128
+
129
+
130
+ ## v0.0.2 (28-04-2023)
131
+
132
+ **Features:-**
133
+
134
+ - `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)
135
+ - `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)
136
+ - `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.
137
+ - `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.
138
+ - `enableChunkHash` renamed as `enableFileNameHashing`
139
+
140
+ - `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`)
141
+ - `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
142
+ - `removeAttribute` option changes as `babelCustomizations.removeAttribute`
143
+ - `removePropTypes` support for remove the prop types package in the output build.
144
+ - `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
145
+ - `manifestJson` default value set as false.
146
+ - `customAttributes` support for add attributes to html, link , script tag in the output build.
147
+
148
+
149
+ ## v0.0.1 (18-04-2023)
150
+
151
+ First Release
152
+ **Features:-**
153
+
154
+ - 'start' command to run react app
155
+ - 'build' command to create build for react app
156
+ - 'build:lib' command to create lib for react library
157
+ - 'build:es' command to create es for react library
158
+ - 'templates' command to create es for react library
package/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
-
2
+ console.log("hellobab")
3
3
  const { polyfillForOldNodeVersion } = require('./polyfillForOldNodeVersion');
4
4
 
5
5
  polyfillForOldNodeVersion();
@@ -13,7 +13,7 @@ var _default = {
13
13
  value: 'app',
14
14
  cli: 'context'
15
15
  },
16
- devtool: 'source-map',
16
+ devtool: 'cheap-eval-source-map',
17
17
  statsLogConfig: null,
18
18
  stats: {
19
19
  enable: {
@@ -228,9 +228,10 @@ var _default = {
228
228
  }
229
229
  },
230
230
  createSeparateSMap: {
231
- value: false,
231
+ value: true,
232
232
  cli: 'enable_smap'
233
233
  },
234
+ nameTemplateCustomization: null,
234
235
  babelCustomizations: {
235
236
  browserList: null,
236
237
  // NOTE: need to consider
@@ -323,6 +324,12 @@ var _default = {
323
324
  cssAttributes: null,
324
325
  i18nAttributes: null
325
326
  },
326
- externals: null
327
+ externals: null,
328
+ typeScript: {
329
+ enable: {
330
+ value: false,
331
+ cli: 'type_script_enable'
332
+ }
333
+ }
327
334
  };
328
335
  exports.default = _default;
@@ -25,8 +25,11 @@ function babelWebConfig(options, mode) {
25
25
  plugins: babelPlugins,
26
26
  browserList
27
27
  } = options.babelCustomizations;
28
+ const {
29
+ enable: typeScriptEnable
30
+ } = options.typeScript;
28
31
  return {
29
- presets: [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react')],
32
+ presets: typeScriptEnable ? [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')] : [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react')],
30
33
  plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options)).filter(Boolean)
31
34
  };
32
35
  }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.runBabelForTSFile = runBabelForTSFile;
7
+
8
+ var _core = require("@babel/core");
9
+
10
+ var _babelWebConfig = require("./babelWebConfig");
11
+
12
+ var _copyFile = require("../fileUtils/copyFile");
13
+
14
+ function runBabelForTSFile({
15
+ filename,
16
+ outputFile,
17
+ options,
18
+ mode = 'es'
19
+ }) {
20
+ const {
21
+ enable
22
+ } = options.typeScript;
23
+
24
+ if (enable) {
25
+ // const jsSourceCode = readFileSync(filename).toString();
26
+ const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
27
+ const result = (0, _core.transformFileSync)(filename, babelConfig);
28
+ (0, _copyFile.writeFile)(outputFile.replace('.tsx', '.js'), result.code);
29
+ }
30
+ }
@@ -12,7 +12,7 @@ var _modeUtils = require("./modeUtils");
12
12
  // NOTE: these below code can be done in js,
13
13
  // we did copy paste in order to avoid unnecessary confusion
14
14
  // NOTE: array[0] is dev mode file templates and array[1] is prod mode file templates
15
- const templates = {
15
+ const defaultTemplates = {
16
16
  html: ['index.html', 'index.[contenthash].html'],
17
17
  js: ['js/[name].js', 'js/[name].[contenthash].js'],
18
18
  chunkjs: ['js-chunk/[name].js', 'js-chunks/[name].[contenthash].js'],
@@ -54,12 +54,16 @@ function nameTemplates(type, options) {
54
54
  const {
55
55
  enableFileNameHashing,
56
56
  mode,
57
- devLikeHash
57
+ devLikeHash,
58
+ nameTemplateCustomization
58
59
  } = options;
59
60
  let {
60
61
  devModeContentHashAllowedTypes
61
62
  } = options;
62
63
  devModeContentHashAllowedTypes = devModeContentHashAllowedTypes || defaultDevModeContentHashAllowedTypes;
64
+ const templates = { ...defaultTemplates,
65
+ ...nameTemplateCustomization
66
+ };
63
67
  const templateName = templates[type];
64
68
 
65
69
  if (!templateName) {
@@ -12,7 +12,7 @@ function babelLoaderConfig(options) {
12
12
  return {
13
13
  loader: 'babel-loader',
14
14
  options: { ...babelConfig,
15
- cacheDirectory: true
15
+ cacheDirectory: false
16
16
  }
17
17
  };
18
18
  }
@@ -23,7 +23,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
23
 
24
24
  @return {Boolean} : true or false
25
25
  */
26
- function checkIsPatternsMatchFilename(patterns, filename) {
26
+ function checkIsPatternsMatchFilename(patterns, filename = '') {
27
+ // console.log(filename, patterns);
27
28
  if (!filename) {
28
29
  return false;
29
30
  }
@@ -34,21 +35,22 @@ function checkIsPatternsMatchFilename(patterns, filename) {
34
35
 
35
36
  if (typeof patterns === 'function') {
36
37
  return patterns(filename);
37
- }
38
+ } // if (typeof patterns === 'string') {
39
+ // // eslint-disable-next-line no-param-reassign
40
+ // patterns = [patterns];
41
+ // }
38
42
 
39
- if (typeof patterns === 'string') {
40
- // eslint-disable-next-line no-param-reassign
41
- patterns = [patterns];
42
- }
43
43
 
44
44
  if (Array.isArray(patterns)) {
45
45
  return patterns.length ? (0, _ignore.default)({
46
46
  allowRelativePaths: true
47
47
  }).add(patterns).ignores(filename) : true;
48
- } // eslint-disable-next-line no-throw-literal
48
+ } // console.log('work');
49
+ // eslint-disable-next-line no-new
49
50
 
50
51
 
51
- throw `UnKnown pattern Error ${JSON.stringify(patterns)}`;
52
+ return new RegExp(patterns); // eslint-disable-next-line no-throw-literal
53
+ // throw `UnKnown pattern Error ${JSON.stringify(patterns)}`;
52
54
  }
53
55
 
54
56
  function modifyAsExclude(patterns) {
@@ -62,7 +62,8 @@ function moduleResolver(options) {
62
62
  modules: useAppNodeModulesAsPreferred(preferLocalFirst, [nodeModulesPath, _constants.cliNodeModulesPath].filter(Boolean)),
63
63
  alias: { ...(defaultAlias ? _libAlias.libAlias : {}),
64
64
  ...(alias || {})
65
- }
65
+ },
66
+ extensions: ['.ts', '.js', '.json', '.tsx']
66
67
  };
67
68
  }
68
69
 
@@ -51,6 +51,7 @@ function splitChunksConfig(options) {
51
51
  const cacheGroupName = cacheGroupObj.cacheGroupName || cacheGroupObj.name; // eslint-disable-next-line no-use-before-define
52
52
 
53
53
  const obj = getCacheGroup(cacheGroupObj, index);
54
+ obj.chunks = 'all';
54
55
  customChunksConfig[cacheGroupName] = obj;
55
56
  });
56
57
  const splitChunksConfig = {
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tsLoaders = tsLoaders;
7
+
8
+ var _babelLoaderConfig = require("./loaderConfigs/babelLoaderConfig");
9
+
10
+ function tsLoaders(options) {
11
+ return [{
12
+ test: /\.tsx$/,
13
+ exclude: /node_modules/,
14
+ use: [(0, _babelLoaderConfig.babelLoaderConfig)(options)] // include: path.join(appPath, folder)
15
+
16
+ }];
17
+ }
@@ -11,6 +11,8 @@ var _outputConfig = require("./outputConfig");
11
11
 
12
12
  var _jsLoaders = require("./jsLoaders");
13
13
 
14
+ var _tsLoaders = require("./tsLoaders");
15
+
14
16
  var _cssLoaders = require("./cssLoaders");
15
17
 
16
18
  var _assetLoaders = require("./loaderConfigs/assetLoaders");
@@ -35,18 +37,20 @@ var _externals = require("./externals");
35
37
 
36
38
  var _configCustomLoaders = require("./configCustomLoaders");
37
39
 
40
+ const source = 'eval-source-map';
41
+
38
42
  function webpackConfigCreator(options) {
39
43
  return {
40
44
  entry: (0, _entryConfig.entryConfig)(options),
41
45
  mode: (0, _modeUtils.getWebpackMode)(options),
42
46
  output: (0, _outputConfig.outputConfig)(options),
43
- devtool: (0, _devtoolConfig.devtoolConfig)(options),
47
+ devtool: source,
44
48
  stats: (0, _statsConfig.statsConfig)(options),
45
49
  optimization: (0, _optimizationConfig.optimizationConfig)(options),
46
50
  module: {
47
51
  /* strictExportPresence for break the build when imported module not present in respective file */
48
52
  // strictExportPresence: true,
49
- rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
53
+ rules: [...(0, _jsLoaders.jsLoaders)(options), ...(0, _tsLoaders.tsLoaders)(options), ...(0, _cssLoaders.cssLoaders)(options), (0, _configWebWorkerLoader.configWebWorkerLoader)(options), (0, _configHtmlTemplateLoader.configHtmlTemplateLoader)(options), ...(0, _assetLoaders.assetLoaders)(options), ...(0, _configCustomLoaders.configCustomLoaders)(options)]
50
54
  },
51
55
  plugins: (0, _plugins.plugins)(options),
52
56
  externals: (0, _externals.externals)(options),
@@ -11,6 +11,8 @@ var _watcher = _interopRequireDefault(require("watcher"));
11
11
 
12
12
  var _runBabelForJSFile = require("../babel/runBabelForJSFile");
13
13
 
14
+ var _runBabelForTsFile = require("../babel/runBabelForTsFile");
15
+
14
16
  var _runPostCssForCssFile = require("../postcss/runPostCssForCssFile");
15
17
 
16
18
  var _directoryIterator = require("./directoryIterator");
@@ -23,6 +25,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
25
 
24
26
  const isJs = ext => ext === '.js';
25
27
 
28
+ const isTs = ext => ext === '.ts' || ext === '.tsx';
29
+
26
30
  const isCss = ext => ext === '.css';
27
31
 
28
32
  function watchRun({
@@ -54,6 +58,13 @@ function watchRun({
54
58
  outputFile,
55
59
  options
56
60
  });
61
+ } else if (isTs(ext)) {
62
+ (0, _runBabelForTsFile.runBabelForTSFile)({
63
+ filename,
64
+ outputFile,
65
+ options,
66
+ mode
67
+ });
57
68
  } else {
58
69
  (0, _copyFile.copyFile)(filename, outputFile);
59
70
  }
@@ -81,7 +92,8 @@ function watchRun({
81
92
  const watcher = new _watcher.default(src, {
82
93
  recursive: true,
83
94
  ignoreInitial: true,
84
- ignore: filename => filename.indexOf('__tests__') !== -1
95
+ ignore: filename => filename.indexOf('__tests__') !== -1 // remove the test cases
96
+
85
97
  });
86
98
  watcher.on('all', (event, filename) => {
87
99
  if (event === 'unlink' || event === 'unlinkDir') {