@zohodesk/react-cli 0.0.1-beta.173 → 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 +27 -1
- package/lib/configs/jest.config.js +8 -12
- package/lib/configs/libAlias.js +10 -3
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
- package/lib/loaderUtils/getCSSLoaders.js +1 -1
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +62 -0
- package/lib/pluginUtils/getDevPlugins.js +14 -34
- package/lib/pluginUtils/getProdPlugins.js +24 -42
- package/lib/postcss-plugins/hoverActivePlugin.js +40 -19
- package/lib/postcss-plugins/variableModificationPlugin/index.js +2 -2
- package/lib/schemas/index.js +3 -4
- package/package.json +1 -3
- package/templates/docs/css/style.css +1 -1
- package/templates/docs/index.html +9 -1
package/README.md
CHANGED
@@ -2,11 +2,33 @@
|
|
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
|
+
|
12
|
+
# 0.0.1-beta.174
|
13
|
+
|
14
|
+
cli has been updated to fix compose issue faced when classname:hover exists and classname does not before compose
|
15
|
+
|
16
|
+
**Issue Fix:-**
|
17
|
+
* In react-cli version `0.0.1-beta.173`, when we use `start` command throws error issue fixed
|
18
|
+
* while using `cssVariableReplacementOptions`, compose issue faced in css files, when classname:hover exists and classname does not exist issue fixed
|
19
|
+
|
20
|
+
**Feature:-**
|
21
|
+
* `react-cli.test.classnameFormat` option added to change CssModules (Ex: import style from "./a.module.css" ) className transform template unittest case.
|
22
|
+
`classnameFormat` default value `[classname]` you can customize it. Example: `[classname]-[hash]`
|
23
|
+
|
24
|
+
**Changes:-**
|
25
|
+
* `jsonFile_test_*.json` files deleted after they used.
|
26
|
+
|
5
27
|
# 0.0.1-beta.173
|
6
28
|
|
7
29
|
Conversion for Variables from Variables to px in Supportapp completed (`variableIgnore.js` && `pxParserPostcss.js` to be referred to), and px to custom variables through the new `variableModificationPlugin`. Error Log generation can also be converted on enabling
|
8
30
|
|
9
|
-
Features
|
31
|
+
**Features:**
|
10
32
|
1. variables are converted from px to custom variables ( options are consumed from `cssVariableReplacementOptions.json` present in source folder )
|
11
33
|
2. To enable the error log generation `errorLog` is to be made `true` in `cssVariableReplacementOptions.json` ( it will take a little longer than usual build time )
|
12
34
|
3. To enable the console display of errors that are generated, `errorInConsole` is to be made `true` in `cssVariableReplacementOptions.json`
|
@@ -82,6 +104,10 @@ Changes:-
|
|
82
104
|
1. `enableChunkHash` option enabled for dev mode, use it as `react-cli.app.enableChunkHash` in `package.json`
|
83
105
|
2. `--enable_efc=true` option added to enable efc by terminal
|
84
106
|
3. unwanted pem files removed
|
107
|
+
# 0.0.1-exp.167.1
|
108
|
+
Features:-
|
109
|
+
* In docs we have added `Description` for Component Props- check out it in `PropTypes` tab
|
110
|
+
|
85
111
|
|
86
112
|
# 0.0.1-beta.167
|
87
113
|
|
@@ -8,17 +8,11 @@ var _libAlias = require("./libAlias");
|
|
8
8
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
10
|
|
11
|
-
|
12
|
-
// '^@components(.*)$': '<rootDir>/src/components$1',
|
13
|
-
|
14
|
-
let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, key) => {
|
15
|
-
previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
|
16
|
-
return previousValue;
|
17
|
-
}, {});
|
11
|
+
const appPath = process.cwd();
|
18
12
|
|
19
13
|
const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
|
20
14
|
|
21
|
-
|
15
|
+
const commonConfig = {
|
22
16
|
coverageReporters: ['json', 'html', 'json-summary', 'text'],
|
23
17
|
collectCoverage: true,
|
24
18
|
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
@@ -27,9 +21,11 @@ let commonConfig = {
|
|
27
21
|
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
28
22
|
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
29
23
|
},
|
30
|
-
moduleNameMapper:
|
31
|
-
|
32
|
-
|
24
|
+
moduleNameMapper: _libAlias.jestModuleNameMapper,
|
25
|
+
// moduleNameMapper: {
|
26
|
+
// ...moduleNameMapper,
|
27
|
+
// '\\.(css|less)$': 'identity-obj-proxy'
|
28
|
+
// },
|
33
29
|
transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
|
34
30
|
// transformIgnorePatterns: ['/node_modules.*?.js$'],
|
35
31
|
moduleFileExtensions: ['js'],
|
@@ -42,7 +38,7 @@ let commonConfig = {
|
|
42
38
|
};
|
43
39
|
|
44
40
|
module.exports = (...args) => {
|
45
|
-
|
41
|
+
const [appFolder, forCommittedFiles = false] = args;
|
46
42
|
|
47
43
|
if (forCommittedFiles) {
|
48
44
|
return Object.assign({}, commonConfig, {
|
package/lib/configs/libAlias.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.libAlias = void 0;
|
6
|
+
exports.libAlias = exports.jestModuleNameMapper = void 0;
|
7
7
|
// the reason for alias at the time was code tree shaking
|
8
8
|
// tree shaking was most compactable with ES module system
|
9
9
|
// FIXME: But there is a posiblity when these package does not have lib,
|
@@ -27,5 +27,12 @@ const libAlias = {
|
|
27
27
|
'@zohodesk/timetracker/lib': '@zohodesk/timetracker/es',
|
28
28
|
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
29
29
|
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
30
|
-
};
|
31
|
-
|
30
|
+
}; // '^@root(.*)$': '<rootDir>/src$1',
|
31
|
+
// '^@components(.*)$': '<rootDir>/src/components$1',
|
32
|
+
|
33
|
+
exports.libAlias = libAlias;
|
34
|
+
const jestModuleNameMapper = Object.keys(libAlias).reduce((previousValue, key) => {
|
35
|
+
previousValue[`^${key}(.*)$`] = `${libAlias[key]}$1`;
|
36
|
+
return previousValue;
|
37
|
+
}, {});
|
38
|
+
exports.jestModuleNameMapper = jestModuleNameMapper;
|
@@ -6,23 +6,32 @@ var _postcssHashClassname = _interopRequireDefault(require("postcss-hash-classna
|
|
6
6
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
8
8
|
|
9
|
+
var _utils = require("../../utils");
|
10
|
+
|
9
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
12
|
|
11
13
|
let count = 0;
|
14
|
+
const options = (0, _utils.getOptions)();
|
15
|
+
const {
|
16
|
+
classnameFormat
|
17
|
+
} = options.test;
|
12
18
|
module.exports = {
|
13
19
|
process: function (src) {
|
14
20
|
count++;
|
15
|
-
|
21
|
+
const opts = {
|
16
22
|
hashType: 'md5',
|
17
|
-
digestType: 'base32'
|
23
|
+
digestType: 'base32',
|
24
|
+
maxLength: 6,
|
25
|
+
type: '.json',
|
26
|
+
classnameFormat: classnameFormat,
|
27
|
+
outputName: `jsonFile_test_${count}`
|
18
28
|
};
|
19
|
-
|
20
|
-
opts.type = '.json';
|
21
|
-
opts.outputName = `jsonFile_test_${count}`;
|
22
|
-
let processor = (0, _postcss.default)([(0, _postcssHashClassname.default)(opts)]);
|
29
|
+
const processor = (0, _postcss.default)([(0, _postcssHashClassname.default)(opts)]);
|
23
30
|
processor.process(src).css;
|
24
31
|
|
25
|
-
|
32
|
+
const jsonMap = _fs.default.readFileSync(`jsonFile_test_${count}.json`, 'UTF-8');
|
33
|
+
|
34
|
+
_fs.default.unlinkSync(`jsonFile_test_${count}.json`);
|
26
35
|
|
27
36
|
return `module.exports =${jsonMap}`;
|
28
37
|
}
|
@@ -93,7 +93,7 @@ const getCSSLoaders = (plugins, exclude, mediaQueryHoverActiveString, cssVariabl
|
|
93
93
|
}), ...excludeEmptyCheckPlugin({
|
94
94
|
enable: plugins.cssVariableReplacement,
|
95
95
|
ignore: cssVariableReplacementExcludeLocal,
|
96
|
-
plugins: [require('../postcss-plugins/variableModificationPlugin/index')(cssVariableReplacementConfig)]
|
96
|
+
plugins: [fs.existsSync(cssVariableReplacementConfig) && require('../postcss-plugins/variableModificationPlugin/index')(cssVariableReplacementConfig)]
|
97
97
|
})].filter(Boolean);
|
98
98
|
return [cssSelectorZipPath && {
|
99
99
|
loader: require.resolve('../loaders/selectorMappingLoader')
|
@@ -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 = '/',
|
@@ -33,9 +33,24 @@ function isHoverPresent(atrule) {
|
|
33
33
|
return hoverPresent;
|
34
34
|
}
|
35
35
|
|
36
|
+
function checkForUsualClass(root, sel) {
|
37
|
+
let present = false;
|
38
|
+
sel.split(',').forEach(value => {
|
39
|
+
if (value.includes('hover')) {
|
40
|
+
const valueNoHover = value.replace(':hover', '').trim();
|
41
|
+
root.walkRules(rule => {
|
42
|
+
if (rule.selector === valueNoHover) {
|
43
|
+
present = true;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
});
|
48
|
+
return present;
|
49
|
+
}
|
50
|
+
|
36
51
|
module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHoverActiveString => rootOriginal => {
|
37
52
|
const hoverRules = [];
|
38
|
-
|
53
|
+
const positionsObj = {};
|
39
54
|
hoverMedQuerySuffix = mediaQueryHoverActiveString.hover;
|
40
55
|
hoverNoneMedQuerySuffix = mediaQueryHoverActiveString.none;
|
41
56
|
|
@@ -145,16 +160,16 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
145
160
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
146
161
|
//console.log(hovMed, actMed);
|
147
162
|
let newSelector = '';
|
148
|
-
|
163
|
+
const {
|
149
164
|
hovMed,
|
150
165
|
actMed
|
151
166
|
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
152
|
-
|
153
|
-
|
167
|
+
const hovQueries = [];
|
168
|
+
const actQueries = [];
|
154
169
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
155
|
-
|
170
|
+
const subrule = _subrule.trim();
|
156
171
|
|
157
|
-
|
172
|
+
const clone = rule.clone();
|
158
173
|
|
159
174
|
if (subrule.includes('hover')) {
|
160
175
|
clone.selector = subrule;
|
@@ -172,13 +187,13 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
172
187
|
});
|
173
188
|
|
174
189
|
if (hovQueries.length > 0) {
|
175
|
-
|
190
|
+
const clone = rule.clone();
|
176
191
|
clone.selector = hovQueries.join(',');
|
177
192
|
hovMed.append(clone);
|
178
193
|
}
|
179
194
|
|
180
195
|
if (actQueries.length > 0) {
|
181
|
-
|
196
|
+
const clone = rule.clone();
|
182
197
|
clone.selector = actQueries.join(',');
|
183
198
|
actMed.append(clone.clone({
|
184
199
|
selector: clone.selector.replace(/:hover/gi, ':active')
|
@@ -197,7 +212,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
197
212
|
|
198
213
|
function mediaQuery(rule, index) {
|
199
214
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
200
|
-
|
215
|
+
const {
|
201
216
|
hovMed,
|
202
217
|
actMed
|
203
218
|
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
@@ -219,9 +234,9 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
219
234
|
function commaQuery(rule, index) {
|
220
235
|
//console.log("comma" , rule.selector.split('\n'));
|
221
236
|
let newSelector = '';
|
222
|
-
|
237
|
+
const hovQueries = [];
|
223
238
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
224
|
-
|
239
|
+
const subrule = _subrule.trim();
|
225
240
|
|
226
241
|
if (subrule.includes('hover')) {
|
227
242
|
// hoverRules.push({ rule: clone, index });
|
@@ -232,7 +247,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
232
247
|
});
|
233
248
|
|
234
249
|
if (hovQueries.length > 0) {
|
235
|
-
|
250
|
+
const clone = rule.clone();
|
236
251
|
clone.selector = hovQueries.join(',');
|
237
252
|
hoverRules.push({
|
238
253
|
rule: clone,
|
@@ -241,7 +256,9 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
241
256
|
}
|
242
257
|
|
243
258
|
if (handleHoverAndHoverActiveIgnore(index)) {
|
244
|
-
|
259
|
+
if (checkForUsualClass(rootOriginal, rule.selector)) {
|
260
|
+
rule.selector = newSelector.substring(0, newSelector.length - 2).trim();
|
261
|
+
}
|
245
262
|
}
|
246
263
|
|
247
264
|
if (rule.selector === '') {
|
@@ -358,11 +375,15 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', mediaQueryHover
|
|
358
375
|
hoverRule.rule.remove();
|
359
376
|
}
|
360
377
|
}
|
361
|
-
}
|
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
|
+
// });
|
362
388
|
|
363
|
-
rootOriginal.walkAtRules(atrule => {
|
364
|
-
if (atrule !== undefined && atrule.nodes !== undefined && atrule.nodes.length === 0 || atrule.nodes === undefined) {
|
365
|
-
atrule.remove();
|
366
|
-
}
|
367
|
-
});
|
368
389
|
});
|
@@ -134,9 +134,9 @@ module.exports = postcss.plugin('postcss-variable-report', cssVariableReplacemen
|
|
134
134
|
let regValStr = '';
|
135
135
|
replacementArray.forEach((val, index) => {
|
136
136
|
if (index !== replacementArray.length - 1) {
|
137
|
-
regValStr += `${val.replace('$$', '\\d+')}|`;
|
137
|
+
regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}|`;
|
138
138
|
} else {
|
139
|
-
regValStr += `${val.replace('$$', '\\d+')}`;
|
139
|
+
regValStr += `${val.replace('$$', '\\d+').replace('(', '\\(').replace(')', '\\)')}`;
|
140
140
|
}
|
141
141
|
});
|
142
142
|
const valRegex = new RegExp(regValStr, 'gi');
|
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,
|
@@ -325,6 +326,7 @@ var _default = {
|
|
325
326
|
}
|
326
327
|
},
|
327
328
|
test: {
|
329
|
+
classnameFormat: '[classname]',
|
328
330
|
srcBranch: {
|
329
331
|
value: 'master',
|
330
332
|
cli: 'src_branch'
|
@@ -342,7 +344,6 @@ var _default = {
|
|
342
344
|
cli: 'branch_name'
|
343
345
|
},
|
344
346
|
impactServerDomain: {
|
345
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
346
347
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
347
348
|
cli: 'impact_server_domain'
|
348
349
|
},
|
@@ -365,7 +366,6 @@ var _default = {
|
|
365
366
|
cli: 'service_name'
|
366
367
|
},
|
367
368
|
impactServerDomain: {
|
368
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
369
369
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
370
370
|
cli: 'impact_server_domain'
|
371
371
|
},
|
@@ -403,7 +403,7 @@ var _default = {
|
|
403
403
|
cli: 'path_to_sub_projs'
|
404
404
|
},
|
405
405
|
tokenGit: {
|
406
|
-
value: '
|
406
|
+
value: '',
|
407
407
|
cli: 'git_token'
|
408
408
|
},
|
409
409
|
changesOnly: {
|
@@ -584,7 +584,6 @@ var _default = {
|
|
584
584
|
},
|
585
585
|
impactServerDomain: {
|
586
586
|
value: 'ht' + 'tp://desk-automation.csez.zohocorpin.com:8080',
|
587
|
-
//value: 'ht' + 'tp://desk-qa-impact.tsi.zohocorpin.com:8080',
|
588
587
|
cli: 'impact_server_domain'
|
589
588
|
},
|
590
589
|
impactRun: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zohodesk/react-cli",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.175",
|
4
4
|
"description": "A CLI tool for build modern web application and libraries",
|
5
5
|
"scripts": {
|
6
6
|
"init": "node ./lib/utils/init.js",
|
@@ -78,7 +78,6 @@
|
|
78
78
|
"html-webpack-inject-attributes-plugin": "1.0.6",
|
79
79
|
"html-webpack-plugin": "4.3.0",
|
80
80
|
"http-proxy-middleware": "1.0.5",
|
81
|
-
"identity-obj-proxy": "3.0.0",
|
82
81
|
"jest": "26.4.0",
|
83
82
|
"jsdom": "16.4.0",
|
84
83
|
"loader-utils": "2.0.0",
|
@@ -93,7 +92,6 @@
|
|
93
92
|
"postcss": "7.0.32",
|
94
93
|
"postcss-combine-media-query": "1.0.1",
|
95
94
|
"postcss-hash-classname": "0.4.0",
|
96
|
-
"postcss-import": "14.1.0",
|
97
95
|
"postcss-loader": "3.0.0",
|
98
96
|
"postcss-mobile-hover": "1.0.2",
|
99
97
|
"postcss-selector-replace": "1.0.2",
|
@@ -438,6 +438,7 @@
|
|
438
438
|
Components[propComName].propTypes) ||
|
439
439
|
{};
|
440
440
|
let currentCompProps = Object.keys(propsObj) || [];
|
441
|
+
let currentCompPropsDescription = window.componentList && window.componentList[propComName] && window.componentList[propComName].propsDescription || (Components[propComName] && Components[propComName].propsDescription) || {};
|
441
442
|
let currentCompDefault = Window.componentList && window.componentList[propComName] && window.componentList[propComName].defaultProps || (Components[propComName] && Components[propComName].defaultProps) || {};
|
442
443
|
let componentsObj=componentObj && this.filter(Object.keys(componentObj),'').map((item,i)=>{
|
443
444
|
return ({key:item,value:componentObj[item],length:Object.keys(componentObj[item]).length})
|
@@ -767,6 +768,7 @@
|
|
767
768
|
<span className="brR">Type</span>
|
768
769
|
<span className="brR">isRequired</span>
|
769
770
|
<span className="brR ">Default Props</span>
|
771
|
+
<span className="brR ">Description</span>
|
770
772
|
</div>
|
771
773
|
{
|
772
774
|
currentCompProps.map((value, i) => {
|
@@ -796,9 +798,15 @@
|
|
796
798
|
</span>
|
797
799
|
<span className="defaultProps">
|
798
800
|
<div className="bn">
|
799
|
-
{JSON.stringify(currentCompDefault[value])}
|
801
|
+
{JSON.stringify(currentCompDefault[value] || '')}
|
800
802
|
</div>
|
801
803
|
</span>
|
804
|
+
<span className="defaultProps">
|
805
|
+
<div className="bn">
|
806
|
+
{JSON.stringify(currentCompPropsDescription[value] || '')}
|
807
|
+
</div>
|
808
|
+
</span>
|
809
|
+
|
802
810
|
</div>
|
803
811
|
);
|
804
812
|
})
|