@zohodesk/react-cli 0.0.1-beta.173 → 0.0.1-beta.174
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 +20 -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/postcss-plugins/hoverActivePlugin.js +30 -13
- package/lib/postcss-plugins/variableModificationPlugin/index.js +2 -2
- package/lib/schemas/index.js +1 -0
- 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,26 @@
|
|
2
2
|
|
3
3
|
A CLI tool for build modern web application and libraries
|
4
4
|
|
5
|
+
# 0.0.1-beta.174
|
6
|
+
|
7
|
+
cli has been updated to fix compose issue faced when classname:hover exists and classname does not before compose
|
8
|
+
|
9
|
+
**Issue Fix:-**
|
10
|
+
* In react-cli version `0.0.1-beta.173`, when we use `start` command throws error issue fixed
|
11
|
+
* while using `cssVariableReplacementOptions`, compose issue faced in css files, when classname:hover exists and classname does not exist issue fixed
|
12
|
+
|
13
|
+
**Feature:-**
|
14
|
+
* `react-cli.test.classnameFormat` option added to change CssModules (Ex: import style from "./a.module.css" ) className transform template unittest case.
|
15
|
+
`classnameFormat` default value `[classname]` you can customize it. Example: `[classname]-[hash]`
|
16
|
+
|
17
|
+
**Changes:-**
|
18
|
+
* `jsonFile_test_*.json` files deleted after they used.
|
19
|
+
|
5
20
|
# 0.0.1-beta.173
|
6
21
|
|
7
22
|
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
23
|
|
9
|
-
Features
|
24
|
+
**Features:**
|
10
25
|
1. variables are converted from px to custom variables ( options are consumed from `cssVariableReplacementOptions.json` present in source folder )
|
11
26
|
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
27
|
3. To enable the console display of errors that are generated, `errorInConsole` is to be made `true` in `cssVariableReplacementOptions.json`
|
@@ -82,6 +97,10 @@ Changes:-
|
|
82
97
|
1. `enableChunkHash` option enabled for dev mode, use it as `react-cli.app.enableChunkHash` in `package.json`
|
83
98
|
2. `--enable_efc=true` option added to enable efc by terminal
|
84
99
|
3. unwanted pem files removed
|
100
|
+
# 0.0.1-exp.167.1
|
101
|
+
Features:-
|
102
|
+
* In docs we have added `Description` for Component Props- check out it in `PropTypes` tab
|
103
|
+
|
85
104
|
|
86
105
|
# 0.0.1-beta.167
|
87
106
|
|
@@ -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')
|
@@ -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 === '') {
|
@@ -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
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.174",
|
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
|
})
|