@zohodesk/react-cli 0.0.1-beta.174 → 0.0.1-beta.175
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
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
A CLI tool for build modern web application and libraries
|
4
4
|
|
5
|
+
# 0.0.1-beta.175
|
6
|
+
**Issue Fix:-**
|
7
|
+
* When we use "hoverActive" @import in css not working issue fixed
|
8
|
+
|
9
|
+
**Features:**
|
10
|
+
* `minifiy` option supported for minimize index.html file in during build time. You can use this option as "react-cli.app.htmlTemplate.minify" the options are same as https://github.com/jantimon/html-webpack-plugin#minification
|
11
|
+
|
5
12
|
# 0.0.1-beta.174
|
6
13
|
|
7
14
|
cli has been updated to fix compose issue faced when classname:hover exists and classname does not before compose
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.configHtmlWebpackPlugins = configHtmlWebpackPlugins;
|
7
|
+
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
10
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
11
|
+
|
12
|
+
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
13
|
+
|
14
|
+
var _common = require("../common");
|
15
|
+
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
|
+
|
18
|
+
const defaultHTMLMiniFyOption = {
|
19
|
+
collapseWhitespace: true,
|
20
|
+
minifyCSS: true,
|
21
|
+
minifyJS: true,
|
22
|
+
keepClosingSlash: true,
|
23
|
+
removeComments: false,
|
24
|
+
removeRedundantAttributes: true,
|
25
|
+
removeScriptTypeAttributes: true,
|
26
|
+
removeStyleLinkTypeAttributes: true,
|
27
|
+
useShortDoctype: true
|
28
|
+
};
|
29
|
+
|
30
|
+
function configHtmlWebpackPlugins(plugins, {
|
31
|
+
enableChunkHash = false,
|
32
|
+
folder,
|
33
|
+
inject,
|
34
|
+
crossorigin,
|
35
|
+
hasEFC,
|
36
|
+
minify: minifyHtmlOptions = false
|
37
|
+
}) {
|
38
|
+
const optionsHtmlWebpack = {
|
39
|
+
chunksSortMode: 'none',
|
40
|
+
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
41
|
+
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
42
|
+
minify: minifyHtmlOptions === true ? defaultHTMLMiniFyOption : minifyHtmlOptions === null ? false : minifyHtmlOptions,
|
43
|
+
// : typeof minifyHtmlOptions === 'object'
|
44
|
+
// ? minifyHtmlOptions
|
45
|
+
// : minifyHtmlOptions,,
|
46
|
+
templateParameters: _common.templateParameters,
|
47
|
+
scriptLoading: 'defer',
|
48
|
+
inject: inject
|
49
|
+
};
|
50
|
+
console.log({
|
51
|
+
optionsHtmlWebpack
|
52
|
+
});
|
53
|
+
|
54
|
+
if (hasEFC) {
|
55
|
+
optionsHtmlWebpack.excludeChunks = ['efc', 'widget'];
|
56
|
+
}
|
57
|
+
|
58
|
+
plugins.push(new _htmlWebpackPlugin.default(optionsHtmlWebpack));
|
59
|
+
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
60
|
+
crossorigin: 'anonymous'
|
61
|
+
}));
|
62
|
+
}
|
@@ -15,10 +15,6 @@ var _lodashWebpackPlugin = _interopRequireDefault(require("lodash-webpack-plugin
|
|
15
15
|
|
16
16
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
17
17
|
|
18
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
19
|
-
|
20
|
-
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
21
|
-
|
22
18
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
19
|
|
24
20
|
var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
|
@@ -29,14 +25,14 @@ var _webpack = _interopRequireDefault(require("webpack"));
|
|
29
25
|
|
30
26
|
var _plugins = require("../plugins");
|
31
27
|
|
32
|
-
var _common = require("../common");
|
33
|
-
|
34
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
35
29
|
|
30
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
31
|
+
|
36
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
33
|
|
38
|
-
|
39
|
-
|
34
|
+
const getDevPlugins = (options, publicPath) => {
|
35
|
+
const {
|
40
36
|
app: {
|
41
37
|
tpFolder,
|
42
38
|
folder,
|
@@ -68,7 +64,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
68
64
|
const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
|
69
65
|
const cssLTRFileNameTempalte = enableRTLSplit ? 'css/[name].ltr.css' : 'css/[name].css';
|
70
66
|
const cssRTLFileNameTempalte = 'css/[name].rtl.css';
|
71
|
-
|
67
|
+
const plugins = [new _plugins.CleanUpStatsPlugin(), new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/domain$/, /moment$/), new _webpack.default.DefinePlugin({
|
72
68
|
__CLIENT__: true,
|
73
69
|
__TEST__: false,
|
74
70
|
__SERVER__: false,
|
@@ -126,7 +122,7 @@ let getDevPlugins = (options, publicPath) => {
|
|
126
122
|
propertiesFolder: i18n.propertiesFolder
|
127
123
|
}));
|
128
124
|
} else {
|
129
|
-
|
125
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
130
126
|
|
131
127
|
if (_fs.default.existsSync(i18nPath)) {
|
132
128
|
plugins.push(new _copyWebpackPlugin.default([{
|
@@ -146,20 +142,16 @@ let getDevPlugins = (options, publicPath) => {
|
|
146
142
|
collections: true,
|
147
143
|
shorthands: true
|
148
144
|
}));
|
145
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
|
146
|
+
enableChunkHash: false,
|
147
|
+
folder,
|
148
|
+
minify: false,
|
149
|
+
inject,
|
150
|
+
crossorigin,
|
151
|
+
hasEFC
|
152
|
+
});
|
149
153
|
|
150
154
|
if (hasEFC) {
|
151
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
152
|
-
chunksSortMode: 'none',
|
153
|
-
filename: 'index.html',
|
154
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
155
|
-
excludeChunks: ['efc', 'widget'],
|
156
|
-
templateParameters: _common.templateParameters,
|
157
|
-
scriptLoading: 'defer',
|
158
|
-
inject: inject
|
159
|
-
}));
|
160
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
161
|
-
crossorigin: 'anonymous'
|
162
|
-
}));
|
163
155
|
plugins.push(new _plugins.EFCPlugin({
|
164
156
|
isDevelopment: true,
|
165
157
|
i18nManifestFileName,
|
@@ -171,18 +163,6 @@ let getDevPlugins = (options, publicPath) => {
|
|
171
163
|
localeAttr: efcLocaleAttr // outputFile: 'zohodesk-efc-sdk-latest.js',
|
172
164
|
|
173
165
|
}));
|
174
|
-
} else {
|
175
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
176
|
-
chunksSortMode: 'none',
|
177
|
-
filename: 'index.html',
|
178
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
179
|
-
templateParameters: _common.templateParameters,
|
180
|
-
scriptLoading: 'defer',
|
181
|
-
inject: inject
|
182
|
-
}));
|
183
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
184
|
-
crossorigin: 'anonymous'
|
185
|
-
}));
|
186
166
|
}
|
187
167
|
|
188
168
|
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
@@ -21,24 +21,22 @@ var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plu
|
|
21
21
|
|
22
22
|
var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugin"));
|
23
23
|
|
24
|
-
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
25
|
-
|
26
|
-
var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
|
27
|
-
|
28
24
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
29
25
|
|
30
26
|
var _plugins = require("../plugins");
|
31
27
|
|
32
|
-
var _common = require("../common");
|
33
|
-
|
34
28
|
var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
|
35
29
|
|
30
|
+
var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
|
31
|
+
|
36
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
33
|
|
38
34
|
// eslint-disable-next-line no-unused-vars
|
39
|
-
|
35
|
+
const getProdPlugins = (options, publicPath = '') => {
|
40
36
|
let {
|
41
|
-
enableChunkHash
|
37
|
+
enableChunkHash
|
38
|
+
} = options.app;
|
39
|
+
const {
|
42
40
|
manifestFileName,
|
43
41
|
bundleAnalyze,
|
44
42
|
optimize,
|
@@ -56,13 +54,15 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
56
54
|
hasShadowDOM,
|
57
55
|
resourceHints,
|
58
56
|
serviceWorker,
|
59
|
-
htmlTemplate
|
60
|
-
inject
|
61
|
-
},
|
57
|
+
htmlTemplate,
|
62
58
|
tpHashMapping,
|
63
59
|
cdnMapping,
|
64
60
|
crossorigin
|
65
61
|
} = options.app;
|
62
|
+
const {
|
63
|
+
inject,
|
64
|
+
minify: minifyHtmlOptions
|
65
|
+
} = htmlTemplate;
|
66
66
|
const {
|
67
67
|
i18n
|
68
68
|
} = options;
|
@@ -79,9 +79,9 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
79
79
|
const hashTempalate = enableChunkHash ? '.[chunkhash:20]_' : '';
|
80
80
|
const cssLTRFileNameTempalte = `css/[name]${hashTempalate}${enableRTLSplit ? '.ltr' : ''}.css`;
|
81
81
|
const cssRTLFileNameTempalte = `css/[name]${hashTempalate}.rtl.css`;
|
82
|
-
|
82
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
83
83
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
84
|
-
|
84
|
+
const plugins = [new _caseSensitivePathsWebpackPlugin.default(), new _webpack.default.IgnorePlugin(/^\.\/locale$/, /moment$/), new _webpack.default.DefinePlugin({
|
85
85
|
__TEST__: false,
|
86
86
|
__DEVELOPMENT__: false,
|
87
87
|
__LOCAL_PRODUCTION__: isDevelopment,
|
@@ -132,7 +132,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
132
132
|
propertiesFolder: i18n.propertiesFolder
|
133
133
|
}));
|
134
134
|
} else {
|
135
|
-
|
135
|
+
const i18nPath = _path.default.join(process.cwd(), context, 'i18n');
|
136
136
|
|
137
137
|
if (_fs.default.existsSync(i18nPath)) {
|
138
138
|
plugins.push(new _copyWebpackPlugin.default([{
|
@@ -148,21 +148,16 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
148
148
|
to: `./${tpFolder}/`,
|
149
149
|
toType: 'dir'
|
150
150
|
}]));
|
151
|
+
(0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(plugins, {
|
152
|
+
enableChunkHash,
|
153
|
+
folder,
|
154
|
+
inject,
|
155
|
+
minify: minifyHtmlOptions,
|
156
|
+
crossorigin,
|
157
|
+
hasEFC
|
158
|
+
});
|
151
159
|
|
152
160
|
if (hasEFC) {
|
153
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
154
|
-
chunksSortMode: 'none',
|
155
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
156
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
157
|
-
excludeChunks: ['efc', 'widget'],
|
158
|
-
minify: false,
|
159
|
-
templateParameters: _common.templateParameters,
|
160
|
-
scriptLoading: 'defer',
|
161
|
-
inject: inject
|
162
|
-
}));
|
163
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
164
|
-
crossorigin: 'anonymous'
|
165
|
-
}));
|
166
161
|
plugins.push(new _plugins.EFCPlugin({
|
167
162
|
isDevelopment,
|
168
163
|
serverUrl: publicPath,
|
@@ -175,19 +170,6 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
175
170
|
localeAttr: efcLocaleAttr,
|
176
171
|
cdnVariableName: cdnMapping.isCdnEnabled ? cdnMapping.variableName : null
|
177
172
|
}));
|
178
|
-
} else {
|
179
|
-
plugins.push(new _htmlWebpackPlugin.default({
|
180
|
-
chunksSortMode: 'none',
|
181
|
-
filename: enableChunkHash ? 'index.[templatehash:20].html' : 'index.html',
|
182
|
-
template: _path.default.join(process.cwd(), folder, 'index.html'),
|
183
|
-
minify: false,
|
184
|
-
templateParameters: _common.templateParameters,
|
185
|
-
scriptLoading: 'defer',
|
186
|
-
inject: inject
|
187
|
-
}));
|
188
|
-
crossorigin && plugins.push(new _htmlWebpackInjectAttributesPlugin.default({
|
189
|
-
crossorigin: 'anonymous'
|
190
|
-
}));
|
191
173
|
}
|
192
174
|
|
193
175
|
plugins.push(new _plugins.I18NInjectIntoIndexPlugin({
|
@@ -201,7 +183,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
201
183
|
}));
|
202
184
|
|
203
185
|
if (publicPaths && !isDevelopment && !cdnMapping.isCdnEnabled) {
|
204
|
-
|
186
|
+
const {
|
205
187
|
callback
|
206
188
|
} = publicPaths;
|
207
189
|
plugins.push(callback ? new _plugins.PublicPathCallbackPlugin({
|
@@ -255,7 +237,7 @@ let getProdPlugins = (options, publicPath = '') => {
|
|
255
237
|
}
|
256
238
|
|
257
239
|
if (!isDevelopment && serviceWorker.enableSw) {
|
258
|
-
|
240
|
+
const {
|
259
241
|
filePath,
|
260
242
|
fileName = 'sw.js',
|
261
243
|
exitPath = '/',
|
@@ -375,11 +375,15 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
375
375
|
hoverRule.rule.remove();
|
376
376
|
}
|
377
377
|
}
|
378
|
-
}
|
378
|
+
} // rootOriginal.walkAtRules(atrule => {
|
379
|
+
// if (
|
380
|
+
// (atrule !== undefined &&
|
381
|
+
// atrule.nodes !== undefined &&
|
382
|
+
// atrule.nodes.length === 0) ||
|
383
|
+
// atrule.nodes === undefined
|
384
|
+
// ) {
|
385
|
+
// atrule.remove();
|
386
|
+
// }
|
387
|
+
// });
|
379
388
|
|
380
|
-
rootOriginal.walkAtRules(atrule => {
|
381
|
-
if (atrule !== undefined && atrule.nodes !== undefined && atrule.nodes.length === 0 || atrule.nodes === undefined) {
|
382
|
-
atrule.remove();
|
383
|
-
}
|
384
|
-
});
|
385
389
|
});
|
package/lib/schemas/index.js
CHANGED
@@ -253,6 +253,7 @@ var _default = {
|
|
253
253
|
replaceText: '//<!--AssetsFromBuild -->'
|
254
254
|
},
|
255
255
|
htmlTemplate: {
|
256
|
+
minify: null,
|
256
257
|
inject: true
|
257
258
|
},
|
258
259
|
removePropTypes: false,
|
@@ -343,7 +344,6 @@ var _default = {
|
|
343
344
|
cli: 'branch_name'
|
344
345
|
},
|
345
346
|
impactServerDomain: {
|
346
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
347
347
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
348
348
|
cli: 'impact_server_domain'
|
349
349
|
},
|
@@ -366,7 +366,6 @@ var _default = {
|
|
366
366
|
cli: 'service_name'
|
367
367
|
},
|
368
368
|
impactServerDomain: {
|
369
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
370
369
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
371
370
|
cli: 'impact_server_domain'
|
372
371
|
},
|
@@ -404,7 +403,7 @@ var _default = {
|
|
404
403
|
cli: 'path_to_sub_projs'
|
405
404
|
},
|
406
405
|
tokenGit: {
|
407
|
-
value: '
|
406
|
+
value: '',
|
408
407
|
cli: 'git_token'
|
409
408
|
},
|
410
409
|
changesOnly: {
|
@@ -585,7 +584,6 @@ var _default = {
|
|
585
584
|
},
|
586
585
|
impactServerDomain: {
|
587
586
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
588
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
589
587
|
cli: 'impact_server_domain'
|
590
588
|
},
|
591
589
|
impactRun: {
|