@zohodesk/client_build_tool 0.0.6-exp.24 → 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
@@ -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) {
@@ -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 = {
@@ -37,12 +37,14 @@ var _externals = require("./externals");
37
37
 
38
38
  var _configCustomLoaders = require("./configCustomLoaders");
39
39
 
40
+ const source = 'eval-source-map';
41
+
40
42
  function webpackConfigCreator(options) {
41
43
  return {
42
44
  entry: (0, _entryConfig.entryConfig)(options),
43
45
  mode: (0, _modeUtils.getWebpackMode)(options),
44
46
  output: (0, _outputConfig.outputConfig)(options),
45
- devtool: (0, _devtoolConfig.devtoolConfig)(options),
47
+ devtool: source,
46
48
  stats: (0, _statsConfig.statsConfig)(options),
47
49
  optimization: (0, _optimizationConfig.optimizationConfig)(options),
48
50
  module: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.3",
3
+ "version": "0.0.6-exp.24",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.24",
3
+ "version": "0.0.6-exp.25",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -1,99 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
9
-
10
- var _nameTemplates = require("../common/nameTemplates");
11
-
12
- var _modeUtils = require("../common/modeUtils");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- // import { RuntimeGlobals, RuntimeModule } from 'webpack';
17
- // import { Template } from 'webpack';
18
- const pluginName = 'CdnChangePlugin'; // const MODULE_TYPE = 'css/mini-extract';
19
- // class CdnChangeRuntimePlugin extends RuntimeModule {
20
- // constructor(compiler, { variableName }) {
21
- // super('cdn loading', 10);
22
- // this.variableName = variableName;
23
- // }
24
- // generate() {
25
- // return `${RuntimeGlobals.getChunkCssFilename} = function(chunkId) {
26
- // const cssCdnUrl = window[${this.variableName}] || chunkId;
27
- // return cssCdnUrl;
28
- // }`;
29
- // }
30
- // }
31
-
32
- class CdnChangePlugin {
33
- constructor(options) {
34
- this.createSeparateSMap = options.createSeparateSMap;
35
- this.i18nTemplate = options.i18nTemplate || '{{__I18N_CDN__}}';
36
- this.variableName = options.variableName || '__CSS_CDN__';
37
- this.cssTemplate = options.cssTemplate || '{{__CSS_CDN__}}';
38
- this.jsTemplate = options.jsTemplate || '{{__JS_CDN__}}';
39
- this.mode = options.mode || 'prod';
40
- }
41
-
42
- apply(compiler) {
43
- // compiler.hooks.thisCompilation.tap(pluginName, compilation => {
44
- // const enabledChunks = new WeakSet();
45
- // const handler = (entryRuntimeChunk, set) => {
46
- // if (enabledChunks.has(entryRuntimeChunk)) {
47
- // return;
48
- // }
49
- // enabledChunks.add(entryRuntimeChunk);
50
- // set.add(RuntimeGlobals.getFullHash);
51
- // set.add(RuntimeGlobals.getChunkCssFilename);
52
- // compilation.addRuntimeModule(
53
- // entryRuntimeChunk,
54
- // new CdnChangeRuntimePlugin(set, {
55
- // compiler,
56
- // variableName: this.variableName
57
- // })
58
- // );
59
- // };
60
- // compilation.hooks.runtimeRequirementInTree
61
- // .for(RuntimeGlobals.ensureChunkHandlers)
62
- // .tap(pluginName, handler);
63
- // });
64
- compiler.hooks.compilation.tap(pluginName, compilation => {
65
- _htmlWebpackPlugin.default.getHooks(compilation).beforeAssetTagGeneration.tap(pluginName, (data, cb) => {
66
- const {
67
- createSeparateSMap,
68
- mode
69
- } = this; // eslint-disable-next-line no-param-reassign
70
-
71
- data.assets = { ...data.assets,
72
- css: data.assets.css.map(css => `${this.cssTemplate}${css}`),
73
- js: data.assets.js.map(js => {
74
- if (((0, _modeUtils.isProductionMode)(mode) || createSeparateSMap) && !(0, _nameTemplates.isI18nFile)(js)) {
75
- js = js.replace('js/', `{{--js-smap}}js/`); //eslint-disable-line
76
- }
77
-
78
- return `${(0, _nameTemplates.isI18nFile)(js) ? this.i18nTemplate : this.jsTemplate}${js}`;
79
- })
80
- };
81
- cb && cb(null, data);
82
- });
83
- });
84
- }
85
-
86
- }
87
-
88
- var _default = CdnChangePlugin; // Cdn Change Plugin for runtime chunks???
89
-
90
- /**
91
- * the filename of the script part of the chunk
92
- */
93
- // exports.getChunkScriptFilename = "__webpack_require__.u";
94
- // /**
95
- // * the filename of the css part of the chunk
96
- // */
97
- // exports.getChunkCssFilename = "__webpack_require__.k";
98
-
99
- exports.default = _default;