@zohodesk/react-cli 1.1.25-exp.6 → 1.1.26-exp.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -44,6 +44,32 @@ Now to run app
44
44
 
45
45
  # Change Logs
46
46
 
47
+ # 1.1.26 (06-09-2024)
48
+
49
+ **Features**
50
+
51
+ - Add a new className format that mirrors the class names used in the source code.
52
+ ```
53
+ app: {
54
+ displayClassName: true
55
+ }
56
+ ```
57
+
58
+ - option given to disable the HtmlWebpackPlugin.
59
+ ```
60
+ app: {
61
+ generateHtml: true
62
+ }
63
+ ```
64
+ - Control the rendering order of async CSS chunks.
65
+ ```
66
+ css: {
67
+ enable: true,
68
+ className: <ID of the tag before which all async CSS chunks should be rendered.>
69
+ }
70
+ ```
71
+
72
+
47
73
  # 1.1.25 (12-08-2024)
48
74
 
49
75
  - mp3 files support added
package/bin/cli.js CHANGED
@@ -13,7 +13,6 @@ const [, , option] = process.argv;
13
13
  const args = process.argv.slice(3);
14
14
  const appPath = process.cwd();
15
15
 
16
- console.log(args, option, 'hello')
17
16
  const options = getOptions({ start: true, build: true, docs: true }[option]);
18
17
 
19
18
  function spawnSync(...args) {
@@ -22,10 +22,14 @@ function moduleResolver(options) {
22
22
  disableES5Transpile
23
23
  } = options.app;
24
24
  const customAlias = options.alias;
25
+ console.log(moduleResolvePath);
25
26
  let required = moduleResolvePath && (0, _requireLocalOrGlobal.requireLocal)(moduleResolvePath);
27
+ console.log(required, 'requirwe');
26
28
 
27
29
  if (!required) {
30
+ console.log('this global');
28
31
  required = (0, _requireLocalOrGlobal.requireGlobal)('@zohodesk/client_packages_group');
32
+ console.log(required, 'what');
29
33
 
30
34
  if (required) {
31
35
  (0, _logger.messageLogger)('global `@zohodesk/client_packages_group` package taken as client_packages_group');
@@ -19,6 +19,8 @@ var _I18nSplitPlugin = _interopRequireDefault(require("../plugins/I18nSplitPlugi
19
19
 
20
20
  var _RequireVariablePublicPlugin = _interopRequireDefault(require("../plugins/RequireVariablePublicPlugin"));
21
21
 
22
+ var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
23
+
22
24
  var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
23
25
 
24
26
  var _webpack = _interopRequireDefault(require("webpack"));
@@ -33,17 +35,19 @@ var _VariableConversionCollector = _interopRequireDefault(require("../plugins/Va
33
35
 
34
36
  var _SelectorPlugin = _interopRequireDefault(require("../plugins/SelectorPlugin"));
35
37
 
38
+ var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
39
+
36
40
  var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
37
41
 
38
42
  var _EventsHandlingPlugin = require("../plugins/EventsHandlingPlugin");
39
43
 
40
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
45
 
42
- // import { configHtmlWebpackPlugins } from './configHtmlWebpackPlugins';
43
46
  // import { windowsModification } from '../loaderUtils/windowsModification';
44
47
  const getDevPlugins = (options, publicPath) => {
45
48
  const {
46
49
  app: {
50
+ generateHtml,
47
51
  tpFolder,
48
52
  folder,
49
53
  instrumentScript,
@@ -73,7 +77,8 @@ const getDevPlugins = (options, publicPath) => {
73
77
  localeAttr: efcLocaleAttr
74
78
  },
75
79
  css: {
76
- enableRTLSplit
80
+ enableRTLSplit,
81
+ cssOrderControler
77
82
  },
78
83
  i18n,
79
84
  unusedFiles,
@@ -161,15 +166,16 @@ const getDevPlugins = (options, publicPath) => {
161
166
  pluginsArr.push(new _lodashWebpackPlugin.default({
162
167
  collections: true,
163
168
  shorthands: true
164
- })); // configHtmlWebpackPlugins(pluginsArr, {
165
- // enableChunkHash: false,
166
- // folder,
167
- // minify: false,
168
- // inject,
169
- // crossorigin,
170
- // hasEFC,
171
- // customScriptLoadingStrategey,
172
- // });
169
+ }));
170
+ generateHtml && (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
171
+ enableChunkHash: false,
172
+ folder,
173
+ minify: false,
174
+ inject,
175
+ crossorigin,
176
+ hasEFC,
177
+ customScriptLoadingStrategey
178
+ });
173
179
 
174
180
  if (hasEFC) {
175
181
  pluginsArr.push(new _plugins.EFCPlugin({
@@ -194,6 +200,7 @@ const getDevPlugins = (options, publicPath) => {
194
200
  mainChunkName: 'main'
195
201
  }));
196
202
  instrumentScript && pluginsArr.push(new _plugins.ScriptInstrumentPlugin());
203
+ cssOrderControler.enable && pluginsArr.push(new _CssOrderControlPlugin.default(cssOrderControler));
197
204
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
198
205
  customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
199
206
  globalCacheObj: context
@@ -35,19 +35,23 @@ var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
35
35
 
36
36
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
37
37
 
38
+ var _CssOrderControlPlugin = _interopRequireDefault(require("../plugins/CssOrderControlPlugin"));
39
+
40
+ var _configHtmlWebpackPlugins = require("./configHtmlWebpackPlugins");
41
+
38
42
  var _StatsPlugin = _interopRequireDefault(require("../plugins/StatsPlugin"));
39
43
 
40
44
  var _EfcResourceCleanupPlugin = _interopRequireDefault(require("../plugins/EfcResourceCleanupPlugin"));
41
45
 
42
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
47
 
44
- // import { configHtmlWebpackPlugins } from './configHtmlWebpackPlugins';
45
48
  // eslint-disable-next-line no-unused-vars
46
49
  const getProdPlugins = (options, publicPath = '') => {
47
50
  let {
48
51
  enableChunkHash
49
52
  } = options.app;
50
53
  const {
54
+ generateHtml,
51
55
  manifestFileName,
52
56
  bundleAnalyze,
53
57
  optimize,
@@ -86,7 +90,8 @@ const getProdPlugins = (options, publicPath = '') => {
86
90
  i18n
87
91
  } = options;
88
92
  const {
89
- enableRTLSplit
93
+ enableRTLSplit,
94
+ cssOrderControler
90
95
  } = options.css;
91
96
  const {
92
97
  hasEFC: newOptionForEnableEFC,
@@ -172,15 +177,16 @@ const getProdPlugins = (options, publicPath = '') => {
172
177
  from: `${_path.default.join(process.cwd(), context, tpFolder)}/`,
173
178
  to: `./${tpFolder}/`,
174
179
  toType: 'dir'
175
- }])); // configHtmlWebpackPlugins(pluginsArr, {
176
- // enableChunkHash,
177
- // folder,
178
- // inject,
179
- // minify: minifyHtmlOptions,
180
- // customScriptLoadingStrategey,
181
- // crossorigin,
182
- // hasEFC
183
- // });
180
+ }]));
181
+ generateHtml && (0, _configHtmlWebpackPlugins.configHtmlWebpackPlugins)(pluginsArr, {
182
+ enableChunkHash,
183
+ folder,
184
+ inject,
185
+ minify: minifyHtmlOptions,
186
+ customScriptLoadingStrategey,
187
+ crossorigin,
188
+ hasEFC
189
+ });
184
190
 
185
191
  if (hasEFC) {
186
192
  pluginsArr.push(new _plugins.EFCPlugin({
@@ -299,6 +305,7 @@ const getProdPlugins = (options, publicPath = '') => {
299
305
  } // plugins.push(new VariableConversionCollector({}));
300
306
 
301
307
 
308
+ cssOrderControler.enable && pluginsArr.push(new _CssOrderControlPlugin.default(cssOrderControler));
302
309
  customAttributes.enable && pluginsArr.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
303
310
  customAttributes.enable && pluginsArr.push(new _EfcResourceCleanupPlugin.default(Object.assign({}, customAttributes, {
304
311
  globalCacheObj: context
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ class CssOrderControlPlugin {
9
+ constructor(options) {
10
+ this.options = {
11
+ className: options.className
12
+ };
13
+ }
14
+
15
+ apply(compiler) {
16
+ // NOTE: we not using this, Reason currently this option is only need for EFC,
17
+ // So it do not needed.
18
+ const className = this.options.className;
19
+ compiler.hooks.thisCompilation.tap({
20
+ name: 'CssOrderControlPlugin',
21
+ stage: 1,
22
+ fn: compilation => {
23
+ compilation.mainTemplate.hooks.requireEnsure.tap('CssOrderControlPlugin', source => {
24
+ // const str = attributeSetTemplate(cssAttributes, 'linkTag');
25
+ const replacedStr = source.replace('head.appendChild(linkTag);', `var referenceTag = document.getElementById('${className}');
26
+ head.insertBefore(linkTag, referenceTag);`); // console.log({ s: source, r: replacedStr });
27
+
28
+ return replacedStr;
29
+ });
30
+ }
31
+ });
32
+ }
33
+
34
+ }
35
+
36
+ exports.default = CssOrderControlPlugin;
@@ -52,6 +52,10 @@ var _default = {
52
52
  propertiesFolder: null
53
53
  },
54
54
  css: {
55
+ cssOrderControler: {
56
+ enable: false,
57
+ className: 'customCss'
58
+ },
55
59
  enableRTLSplit: false,
56
60
  valueReplacer: null,
57
61
  //valueReplacer: [
@@ -126,6 +130,10 @@ var _default = {
126
130
  cssDirStatement: null
127
131
  },
128
132
  app: {
133
+ generateHtml: {
134
+ value: true,
135
+ cli: 'generate_html'
136
+ },
129
137
  displayClassName: {
130
138
  value: false,
131
139
  cli: 'display_class_name'
@@ -25,19 +25,22 @@ function requireLocalOrGlobal(moduleName, opts = {}) {
25
25
  const {
26
26
  local = true
27
27
  } = opts;
28
- const isRelativePath = moduleName[0] === '.'; // NOTE: if starts with . then it only mean local
28
+ const isRelativePath = moduleName[0] === '.';
29
+ console.log(moduleName, 'module name'); // NOTE: if starts with . then it only mean local
29
30
 
30
31
  if (isRelativePath) {
31
32
  global = false;
32
33
  }
33
34
 
34
35
  try {
35
- const paths = [local && process.cwd(), global && globalNodeModules].filter(Boolean); // x({ paths, globalNodeModules, global, local, opts });
36
+ const paths = [local && process.cwd(), global && globalNodeModules].filter(Boolean);
37
+ console.log('path', process.cwd(), local, global); // x({ paths, globalNodeModules, global, local, opts });
36
38
 
37
39
  const moduleResolvePath = require.resolve(moduleName, {
38
40
  paths
39
41
  });
40
42
 
43
+ console.log(moduleResolvePath, 'moduleResolvePath');
41
44
  return require(moduleResolvePath);
42
45
  } catch (error) {
43
46
  // NOTE: since we return null we can check out side
@@ -51,7 +51,6 @@ keysWithColon.forEach(key => {
51
51
 
52
52
  processEnv[nkey] = processEnv[key];
53
53
  });
54
- console.log(processEnv.enable_stats, 'what is this');
55
54
 
56
55
  function getNpmVersion() {
57
56
  // require("child_process").
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "1.1.25-exp.6",
3
+ "version": "1.1.26-exp.1",
4
4
  "description": "A CLI tool for build modern web application and libraries",
5
5
  "scripts": {
6
6
  "init": "node ./lib/utils/init.js",
@@ -41,7 +41,7 @@
41
41
  "@babel/preset-env": "7.11.0",
42
42
  "@babel/preset-react": "7.10.4",
43
43
  "@babel/runtime": "7.11.2",
44
- "@zohodesk/client_packages_group": "1.0.2",
44
+ "@zohodesk/client_packages_group": "1.0.2-exp.4-redux",
45
45
  "@zohodesk/eslint-plugin-react-performance": "1.0.3",
46
46
  "@zohodesk/eslint-plugin-zsecurity": "0.0.1-beta.4",
47
47
  "@zohodesk/postcss-rtl": "1.5.2",