@zohodesk/client_build_tool 0.0.6-exp.35 → 0.0.6-exp.36

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.
@@ -281,7 +281,9 @@ var _default = {
281
281
  i18nTemplate: ''
282
282
  },
283
283
  manifestJson: {
284
- enable: false
284
+ enable: false,
285
+ i18nManifestJson: false,
286
+ licenseManifest: false
285
287
  },
286
288
  changeRuntimeChunkChar: '~',
287
289
  serviceWorker: {
@@ -14,14 +14,14 @@ var _modeUtils = require("./modeUtils");
14
14
  // NOTE: array[0] is dev mode file templates and array[1] is prod mode file templates
15
15
  const defaultTemplates = {
16
16
  html: ['index.html', 'index.[contenthash].html'],
17
- js: ['js/[name].js', 'js/[name].[contenthash].js'],
18
- chunkjs: ['js-chunk/[name].js', 'js-chunks/[name].[contenthash].js'],
19
- i18njs: ['i18n-chunk/[locale]/[name].i18n.js', 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js'],
17
+ js: ['js/[name].js', 'js/[name].[contenthash]_.js'],
18
+ chunkjs: ['js-chunk/[name].js', 'js-chunks/[name].[contenthash]_.js'],
19
+ i18njs: ['i18n-chunk/[locale]/[name].i18n.js', 'i18n-chunk/[locale]/[name].[chunkhash]_.i18n.js'],
20
20
  i18nchunkjs: ['i18n-chunk/[locale]/[name].i18n.js', // 'i18n-chunk/[locale]/[name].[chunkhash].i18n.js'
21
- 'i18n-chunk/[locale]/[name].[contenthash].i18n.js'],
21
+ 'i18n-chunk/[locale]/[name].[contenthash]_.i18n.js'],
22
22
  i18nmanifest: ['i18n-manifest.json', 'i18n-manifest.json'],
23
23
  workerjs: ['js/[name].js', 'js/[name].[contenthash].js'],
24
- css: ['css/[name].css', 'css/[name].[contenthash].css'],
24
+ css: ['css/[name].css', 'css/[name].[contenthash]_.css'],
25
25
 
26
26
  /**
27
27
  * NOTE: when you change (cssdir) this line it will have affect on Below files will be affected
@@ -29,7 +29,7 @@ const defaultTemplates = {
29
29
  * pluginConfigs/configMiniCSSExtractPlugin.js
30
30
  * pluginConfigs/configRtlCssPlugin.js
31
31
  * */
32
- cssdir: ['css/[name].[dir].css', 'css/[name].[contenthash].[dir].css'],
32
+ cssdir: ['css/[name].[dir].css', 'css/[name].[contenthash]_.[dir].css'],
33
33
  image: ['images/[name][ext]', 'images/[name].[contenthash][ext]'],
34
34
  font: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
35
35
  svg: ['fonts/[name][ext]', 'fonts/[name].[contenthash][ext]'],
@@ -5,8 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addFilesNamesToManifestJson = addFilesNamesToManifestJson;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _removeHashFromFileName = require("./removeHashFromFileName");
9
11
 
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  function addFilesNamesToManifestJson({
11
15
  manifestJson,
12
16
  option,
@@ -15,9 +19,11 @@ function addFilesNamesToManifestJson({
15
19
  }) {
16
20
  const json = manifestJson;
17
21
  Object.keys(assets).forEach(filename => {
22
+ const fileName = _path.default.parse(filename).base;
23
+
18
24
  if (option.test(filename)) {
19
- const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(filename, hashDigestLength);
20
- json[filenameNameWithoutHash] = filename;
25
+ const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(fileName, hashDigestLength);
26
+ json[filenameNameWithoutHash] = fileName;
21
27
  }
22
28
  });
23
29
  return json;
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createInitialEntriesForManifestJson = createInitialEntriesForManifestJson;
7
7
 
8
+ var _path = _interopRequireDefault(require("path"));
9
+
8
10
  var _removeHashFromFileName = require("./removeHashFromFileName");
9
11
 
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  function createInitialEntriesForManifestJson(initialFileNames, hashLength) {
11
15
  const initialEntries = {};
12
- initialFileNames.forEach(fileName => {
16
+ initialFileNames.forEach(filename => {
17
+ const fileName = _path.default.parse(filename).base;
18
+
13
19
  const filenameNameWithoutHash = (0, _removeHashFromFileName.removeHashFromFileName)(fileName, hashLength);
14
20
  initialEntries[filenameNameWithoutHash] = fileName;
15
21
  });
@@ -22,7 +22,7 @@ function createManifestJson({
22
22
  if (option.needInitialEntries) {
23
23
  const initialFileNames = (0, _findInitialFileNames.findInitialFileNames)(compilation);
24
24
  const initialEntries = (0, _createInitialEntries.createInitialEntriesForManifestJson)(initialFileNames, hashDigestLength);
25
- manifestJson.initialEntries = initialEntries;
25
+ manifestJson.entryFiles = initialEntries;
26
26
  }
27
27
 
28
28
  const outputJson = (0, _addFilesNamesToManifestJson.addFilesNamesToManifestJson)({
@@ -40,10 +40,13 @@ function optimizationConfig(options) {
40
40
  splitChunks: (0, _splitChunksConfig.splitChunksConfig)(options),
41
41
  minimizer: [// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
42
42
  // '...',
43
- new _terserWebpackPlugin.default({
43
+ excludeList !== '' ? new _terserWebpackPlugin.default({
44
44
  exclude: excludeList,
45
45
  extractComments: false // Do not extract comments to .LICENSE.txt files
46
46
 
47
+ }) : new _terserWebpackPlugin.default({
48
+ extractComments: false // Do not extract comments to .LICENSE.txt files
49
+
47
50
  }), (0, _configCSSMinifierPlugin.configCSSMinifierPlugin)(options)].filter(Boolean),
48
51
  moduleIds: 'named',
49
52
  runtimeChunk: {
@@ -22,7 +22,7 @@ function configCSSMinifierPlugin(options) {
22
22
  // return new UglifyCSSPlugin();
23
23
 
24
24
 
25
- return new _cssMinimizerWebpackPlugin.default({
25
+ return excludeList !== '' ? new _cssMinimizerWebpackPlugin.default({
26
26
  exclude: excludeList
27
- });
27
+ }) : new _cssMinimizerWebpackPlugin.default();
28
28
  }
@@ -9,24 +9,36 @@ var _ManifestJsonPlugin = require("../custom_plugins/ManifestJsonPlugin");
9
9
 
10
10
  function configManifestJsonPlugin(options) {
11
11
  const {
12
- manifestJson
13
- } = options;
12
+ enable,
13
+ i18nManifestJson,
14
+ licenseManifest
15
+ } = options.manifestJson;
14
16
 
15
- if (!manifestJson.enable) {
17
+ if (!enable) {
16
18
  return null;
17
19
  }
18
20
 
19
- return new _ManifestJsonPlugin.AddFileToManifestJson([{
21
+ const params = [{
20
22
  outputJsonFileName: 'manifest.json',
21
23
  test: f => !/\.i18n\.js$|\.LICENSE\.txt$|\.map$/.test(f),
22
24
  needInitialEntries: true
23
- }, {
24
- outputJsonFileName: 'i18nManifest.json',
25
- test: f => /\.i18n\.js$/g.test(f),
26
- needInitialEntries: false
27
- }, {
28
- outputJsonFileName: 'licenseManifest.json',
29
- test: f => /\.LICENSE\.txt$/g.test(f),
30
- needInitialEntries: false
31
- }]);
25
+ }];
26
+
27
+ if (i18nManifestJson) {
28
+ params.push({
29
+ outputJsonFileName: 'i18nManifest.json',
30
+ test: f => /\.i18n\.js$/g.test(f),
31
+ needInitialEntries: false
32
+ });
33
+ }
34
+
35
+ if (licenseManifest) {
36
+ params.push({
37
+ outputJsonFileName: 'licenseManifest.json',
38
+ test: f => /\.LICENSE\.txt$/g.test(f),
39
+ needInitialEntries: false
40
+ });
41
+ }
42
+
43
+ return new _ManifestJsonPlugin.AddFileToManifestJson(params);
32
44
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.27",
3
+ "version": "0.0.6-exp.36",
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.35",
3
+ "version": "0.0.6-exp.36",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {