@zohodesk/react-cli 0.0.1-beta.166 → 0.0.1-beta.167.1

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,52 @@
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
4
 
5
+
6
+ # 0.0.1-beta.167.1
7
+ In this version we merged changes from [0.0.1-betaa.138.1](#0.0.1-betaa.138.1).
8
+ and with [0.0.1-beta.167](#0.0.1-beta.167) version changes.
9
+
10
+ # 0.0.1-beta.167
11
+
12
+ SSL certificate update
13
+ this version has same as `0.0.1-exp.166.1`, `0.0.1-exp.166.2` and below and some minor changes
14
+ Features:-
15
+
16
+ - `--shallow_clone` option to `react-cli clone` this option will be usefull for shallow cloning repos in build time we don't need commit messages it will be 2x fast this way
17
+ - Example `react-cli clone --clone_type=git --clone_url=https://some.url --shallow_clone`
18
+ - `cliRootPath` option added for npm workspace related path problems
19
+ - Usage `package.json` , "react-cli" => "cliRootPath" stright key
20
+ - `unstableDepsInverse` option added for use app need library first priority over react-cli packages
21
+ - Usage `package.json` , "react-cli" => "unstableDepsInverse" stright key
22
+
23
+ Issue Fix :-
24
+
25
+ - In devmode initial html not recived after second rebuild issue fix.
26
+ - typo fix `devBulid` to `devBuild`.
27
+ - `disableES5Transpile` option missed in docs now added.
28
+ - docs libAlias not work as app for example in app we always take `es` folder to build for treshaking and reasons,
29
+ But that option not enabled in docs. now it is enabled.
30
+ - In `react-cli devbuild` command options not working properly,
31
+ when above command run via terminal not via npm run script options not working
32
+ So we send that options to webpack then it works as expected.
33
+ this behaviour need to check across os and need to be cross check with other commends as well for now we only fixed this
34
+
35
+ # 0.0.1-exp.166.2
36
+
37
+ Changes:-
38
+
39
+ - `-w` option (watch option) added for `react-cli rtl`
40
+ - Example `react-cli rtl ./src ./lib -w`
41
+ <!-- need to handle `react-cli rtl` options correctly -->
42
+ - disableES5Transpile option libAlias added for docs
43
+
44
+ # 0.0.1-exp.166.1
45
+
46
+ Changes:-
47
+
48
+ - `__testUtils__/globals.js` to jest is not mantatory
49
+ - disableES5Transpile option libAlias added
50
+
5
51
  # 0.0.1-beta.166
6
52
 
7
53
  this version has same as `# 0.0.1-exp.164.1`, `# 0.0.1-exp.164.2` and below and some minor changes
@@ -222,6 +268,11 @@ impact servise related changes:-
222
268
  - babel runtime plugin issue fix in prod config
223
269
  - few enhancements
224
270
 
271
+ # 0.0.1-betaa.138.1
272
+ - new feature added for custom extra attribute for dynamically added tags by webpack.
273
+ - To enable this feature you need to enable "react-cli" => "app" => "customAttributes" => "enable"
274
+ - For more [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/9eea8df14e55584b2114b5e484ca8b751a4ba191/src/plugins/CustomAttributePlugin.md)
275
+
225
276
  # 0.0.1-beta.138
226
277
 
227
278
  - sstest library version updated
package/bin/cli.js CHANGED
@@ -13,6 +13,7 @@ const options = getOptions();
13
13
 
14
14
  const { esLint: esLintOptions } = options || {};
15
15
  const { preprocess } = options;
16
+ let { cliRootPath } = options;
16
17
  const {
17
18
  ignoreFilePaths: esLintIgnorePaths,
18
19
  fix: esLintFix,
@@ -28,8 +29,12 @@ const appPath = process.cwd();
28
29
 
29
30
  const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
30
31
 
32
+ if (!cliRootPath) {
33
+ cliRootPath = path.join(__dirname, '..');
34
+ }
35
+
31
36
  const _getCliPath = !isNodeModuleUnderAppFolder
32
- ? libName => path.join(__dirname, '..', 'node_modules', '.bin', libName)
37
+ ? libName => path.join(cliRootPath, 'node_modules', '.bin', libName)
33
38
  : libName => libName;
34
39
  const suffixExt = isWindows ? '.cmd' : '';
35
40
 
@@ -0,0 +1,37 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIGXjCCBUagAwIBAgIRAMKJgToWlDYncIf54wIl/K4wDQYJKoZIhvcNAQELBQAw
3
+ gY8xCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGV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ShRuG
15
+ +0qwfychuIy4jG0ZHGFn5adhBhspxGjgYqxJo9fdQBjU0ciH91B6IeUCgYEA4IEU
16
+ GW9rJoVB86HVdaadq2VmuOdyGa+tLkPh8v47vPGB/vpRlThuuRRc51Oq+SRh7bC7
17
+ FO4cjOa6VpM9dkeAc2GFPs+uyzzU8yRxeqO3gicvXC1sApaca9uv8Vp3WDacnlsu
18
+ shVM+RXKLEi8/JHrcr9BCvSlycvZy8t+QUp6LicCgYBE1ocBJ1bTQEESlHfbj2OL
19
+ eYEBzXCkW4Il5fbmoT3keMr/gzOLgPGDGYY3cuD0IBQzPor5jsd5wnTMVHujwlNS
20
+ TtOtN0kCY6m+tLeiRMLyeO/8rq5/BrOrB17qQS0XhggVAq5FIMNKtYof3bEUCMSz
21
+ fVR6Zk9APZvMt9CXiSuz4QKBgFHDMMrCpUd2KLrOKaubbrjJSUv2Hrv0GyJKXrPc
22
+ m20Il8uA5s1trAWDwQIOmqn58iBayQeqYIOAVETLgwrcp49d6OUjRgmGsheLIjkD
23
+ /wVLuBfeAwQ+TeGKNN21kNlzqj6R/sOktk/Q+7x9ETb6/cDgnpOa3fZMY5mxFt44
24
+ fZ7pAoGBAN8ep49qQWxChYfqu75d3dkCcbF6UeWS+mDZ1QDkiJ5hGlDWDAC7EUma
25
+ jf7c56wBydih+2XKFq2BWxyFcfzzxKJrNeMhGANi/yJ1QrECyrwVWnhP+OFfG5vR
26
+ O+PzUCwZGet0PHG6r6IuvpGMCdZDYCt+fZSvIRJtmvIrtZWGKQly
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,18 @@
1
+ # DevServer Start
2
+
3
+ ## command
4
+
5
+ > `react-cli start`
6
+
7
+ ## Options
8
+
9
+ we have to typs of options command line arguments and package.json option specifying
10
+
11
+ ### First package.json option specifying
12
+
13
+ 1. `react-cli.app.context`
14
+ 1. `react-cli.app.server`
15
+ 1. `react-cli.app.server`
16
+ 1. `react-cli.app.server`
17
+ 1. `react-cli.app.server`
18
+ 1. `react-cli.app.server`
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _fs = require("fs");
4
+
3
5
  var _path = _interopRequireDefault(require("path"));
4
6
 
5
7
  var _libAlias = require("./libAlias");
@@ -13,6 +15,9 @@ let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, ke
13
15
  previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
14
16
  return previousValue;
15
17
  }, {});
18
+
19
+ const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
20
+
16
21
  let commonConfig = {
17
22
  coverageReporters: ['json', 'html', 'json-summary', 'text'],
18
23
  collectCoverage: true,
@@ -28,7 +33,7 @@ let commonConfig = {
28
33
  transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
29
34
  // transformIgnorePatterns: ['/node_modules.*?.js$'],
30
35
  moduleFileExtensions: ['js'],
31
- setupFiles: [_path.default.resolve(appPath, '__testUtils__', 'globals.js'), _path.default.resolve(__dirname, '..', 'jest', 'setup.js')],
36
+ setupFiles: [(0, _fs.existsSync)(appGlobals) && appGlobals, _path.default.resolve(__dirname, '..', 'jest', 'setup.js')].filter(Boolean),
32
37
  globals: {
33
38
  __DEVELOPMENT__: true,
34
39
  __DOCS__: false,
@@ -16,6 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
 
17
17
  let options = (0, _utils.getOptions)();
18
18
  let {
19
+ unstableDepsInverse,
19
20
  app: {
20
21
  folder,
21
22
  context,
@@ -131,10 +132,10 @@ module.exports = {
131
132
  ZC: '$ZC'
132
133
  },
133
134
  resolve: {
134
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
135
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
135
136
  alias: disableES5Transpile ? _libAlias.libAlias : {}
136
137
  },
137
138
  resolveLoader: {
138
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
139
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
139
140
  }
140
141
  };
@@ -8,12 +8,16 @@ var _pluginUtils = require("../pluginUtils");
8
8
 
9
9
  var _loaderUtils = require("../loaderUtils");
10
10
 
11
+ var _libAlias = require("./libAlias");
12
+
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
13
15
  let options = (0, _utils.getOptions)();
14
16
  let {
17
+ unstableDepsInverse,
15
18
  docs: {
16
19
  componentFolder,
20
+ disableES5Transpile,
17
21
  cssUniqueness,
18
22
  hasRTL,
19
23
  rtlExclude,
@@ -28,39 +32,39 @@ let appPath = process.cwd();
28
32
 
29
33
  module.exports = isSSTest => ({
30
34
  entry: {
31
- main: [_path.default.resolve(__dirname, "..", "hooks", "docsProptypeHook.js"), _path.default.join(appPath, componentFolder, "index.js")],
32
- vendor: ["react", "react-dom", "redux", "react-redux"]
35
+ main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
36
+ vendor: ['react', 'react-dom', 'redux', 'react-redux']
33
37
  },
34
- devtool: "none",
35
- mode: "development",
38
+ devtool: 'none',
39
+ mode: 'development',
36
40
  output: {
37
- path: _path.default.join(appPath, "build"),
38
- filename: "js/[name].js",
39
- publicPath: "/docs/",
40
- library: "Component",
41
- libraryTarget: "umd"
41
+ path: _path.default.join(appPath, 'build'),
42
+ filename: 'js/[name].js',
43
+ publicPath: '/docs/',
44
+ library: 'Component',
45
+ libraryTarget: 'umd'
42
46
  },
43
47
  plugins: (0, _pluginUtils.getDocsPlugins)(isSSTest, options),
44
48
  module: {
45
49
  rules: [{
46
50
  test: /\.js$/,
47
51
  use: [{
48
- loader: "babel-loader",
52
+ loader: 'babel-loader',
49
53
  options: {
50
- presets: [[require.resolve("@babel/preset-env"), {
54
+ presets: [[require.resolve('@babel/preset-env'), {
51
55
  modules: false
52
- }], require.resolve("@babel/preset-react")],
53
- plugins: [[require.resolve("@babel/plugin-transform-runtime"), {
56
+ }], require.resolve('@babel/preset-react')],
57
+ plugins: [[require.resolve('@babel/plugin-transform-runtime'), {
54
58
  helpers: true,
55
59
  regenerator: false
56
- }], require.resolve("@babel/plugin-syntax-dynamic-import"), require.resolve("@babel/plugin-syntax-object-rest-spread")],
60
+ }], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('@babel/plugin-syntax-object-rest-spread')],
57
61
  cacheDirectory: true
58
62
  }
59
63
  }],
60
64
  include: _path.default.join(appPath, folder)
61
65
  }, {
62
66
  test: /\.docs\.js$/,
63
- use: require.resolve("../loaders/docsLoader.js"),
67
+ use: require.resolve('../loaders/docsLoader.js'),
64
68
  include: _path.default.join(appPath, folder),
65
69
  exclude: /node_modules/
66
70
  }, {
@@ -68,29 +72,29 @@ module.exports = isSSTest => ({
68
72
  use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
69
73
  }, {
70
74
  test: /\.jpe?g$|\.gif$|\.png$/,
71
- use: ["url-loader?limit=1000&name=./images/[name].[ext]"]
75
+ use: ['url-loader?limit=1000&name=./images/[name].[ext]']
72
76
  }, {
73
77
  test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
74
- use: ["url-loader?limit=1000&name=./fonts/[name].[ext]"]
78
+ use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
75
79
  }, {
76
80
  test: /\.svg$/,
77
- use: ["url-loader?limit=1&name=./fonts/[name].[ext]"]
81
+ use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
78
82
  }, {
79
83
  test: /\.html$/,
80
84
  use: {
81
- loader: "html-loader",
85
+ loader: 'html-loader',
82
86
  options: {
83
- attrs: [":data-src"],
84
- interpolate: "require"
87
+ attrs: [':data-src'],
88
+ interpolate: 'require'
85
89
  }
86
90
  }
87
91
  }, {
88
92
  test: /\.ogg$/,
89
- use: ["file-loader?name=./fonts/[name].[ext]"]
93
+ use: ['file-loader?name=./fonts/[name].[ext]']
90
94
  }, {
91
95
  test: /\.tmpl$/,
92
96
  use: [{
93
- loader: "html-loader",
97
+ loader: 'html-loader',
94
98
  options: {
95
99
  minimize: {
96
100
  removeComments: true,
@@ -104,12 +108,13 @@ module.exports = isSSTest => ({
104
108
  }]
105
109
  },
106
110
  externals: {
107
- ZC: "$ZC"
111
+ ZC: '$ZC'
108
112
  },
109
113
  resolve: {
110
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
114
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
115
+ alias: disableES5Transpile ? _libAlias.libAlias : {}
111
116
  },
112
117
  resolveLoader: {
113
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
118
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
114
119
  }
115
120
  });
@@ -17,6 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
  // import TerserPlugin from 'terser-webpack-plugin';
18
18
  let options = (0, _utils.getOptions)();
19
19
  let {
20
+ unstableDepsInverse,
20
21
  app: {
21
22
  folder,
22
23
  context,
@@ -80,7 +81,7 @@ module.exports = {
80
81
  concatenateModules: true,
81
82
  minimize: true,
82
83
  // by default if minimize: true in webpack minimize then webpack automaticaly add TerserPlugin,
83
- // So we are overrideing it.
84
+ // So we are overrideing it.
84
85
  // minimizer: [
85
86
  // new TerserPlugin({
86
87
  // cache: true,
@@ -208,10 +209,10 @@ module.exports = {
208
209
  ZC: '$ZC'
209
210
  },
210
211
  resolve: {
211
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
212
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
212
213
  alias: disableES5Transpile ? _libAlias.libAlias : {}
213
214
  },
214
215
  resolveLoader: {
215
- modules: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
216
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
216
217
  }
217
218
  };
@@ -31,6 +31,8 @@ var _plugins = require("../plugins");
31
31
 
32
32
  var _common = require("../common");
33
33
 
34
+ var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
35
+
34
36
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
35
37
 
36
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -41,6 +43,7 @@ let getDevPlugins = (options, publicPath) => {
41
43
  tpFolder,
42
44
  folder,
43
45
  instrumentScript,
46
+ customAttributes,
44
47
  devCssFileBountry,
45
48
  context,
46
49
  hasEFC: prevOptionForEnableEFC,
@@ -80,6 +83,7 @@ let getDevPlugins = (options, publicPath) => {
80
83
  NODE_ENV: JSON.stringify(mode === 'dev-no-warn' ? 'production' : 'development')
81
84
  }
82
85
  }), new _miniCssExtractPlugin.default({
86
+ attributes: customAttributes.cssAttributes,
83
87
  filename: cssLTRFileNameTempalte,
84
88
  // ignoreOrder: true,
85
89
  chunkFilename: cssLTRFileNameTempalte
@@ -194,6 +198,7 @@ let getDevPlugins = (options, publicPath) => {
194
198
  mainChunkName: 'main'
195
199
  }));
196
200
  instrumentScript && plugins.push(new _plugins.ScriptInstrumentPlugin());
201
+ customAttributes.enable && plugins.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
197
202
  hasShadowDOM && plugins.push(new _plugins.ShadowDOMSupportPlugin());
198
203
 
199
204
  if (devCssFileBountry) {
@@ -31,6 +31,8 @@ var _plugins = require("../plugins");
31
31
 
32
32
  var _common = require("../common");
33
33
 
34
+ var _CustomAttributePlugin = require("../plugins/CustomAttributePlugin");
35
+
34
36
  var _RtlCssPlugin = require("../plugins/RtlSplitPlugin/RtlCssPlugin");
35
37
 
36
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -59,6 +61,7 @@ let getProdPlugins = (options, publicPath = '') => {
59
61
  htmlTemplate: {
60
62
  inject
61
63
  },
64
+ customAttributes,
62
65
  tpHashMapping,
63
66
  cdnMapping,
64
67
  crossorigin
@@ -276,6 +279,7 @@ let getProdPlugins = (options, publicPath = '') => {
276
279
  }));
277
280
  }
278
281
 
282
+ customAttributes.enable && plugins.push(new _CustomAttributePlugin.CustomAttributePlugin(customAttributes));
279
283
  return plugins;
280
284
  };
281
285
 
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CustomAttributePlugin = void 0;
7
+
8
+ var _Template = _interopRequireDefault(require("webpack/lib/Template"));
9
+
10
+ var _htmlWebpackInjectAttributesPlugin = _interopRequireDefault(require("html-webpack-inject-attributes-plugin"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /* eslint-disable no-use-before-define */
15
+ class CustomAttributePlugin {
16
+ constructor(options) {
17
+ this.options = {
18
+ attributes: options.attributes,
19
+ useHTMLAttribute: options.attributes && !options.jsAttributes && !options.cssAttributes && !options.i18nAttributes,
20
+ jsAttributes: options.jsAttributes || options.attributes || {},
21
+ cssAttributes: options.cssAttributes || options.attributes || {},
22
+ i18nAttributes: options.i18nAttributes || options.attributes || {}
23
+ };
24
+ }
25
+
26
+ addCustomAttributeToDynamicScriptTags(mainTemplate) {
27
+ const {
28
+ jsAttributes,
29
+ cssAttributes,
30
+ i18nAttributes
31
+ } = this.options; // NOTE: To add custom Attributes to js Script tags
32
+
33
+ mainTemplate.hooks.jsonpScript.tap('CustomAttributePlugin', source => {
34
+ const str = attributeSetTemplate(jsAttributes, 'script');
35
+ return _Template.default.asString([source, ...str]);
36
+ }); // NOTE: To add custom Attributes to css link tags
37
+
38
+ mainTemplate.hooks.requireEnsure.tap('CustomAttributePlugin', source => {
39
+ const str = attributeSetTemplate(cssAttributes, 'linkTag');
40
+ const replacedStr = source.replace('head.appendChild(linkTag);', `${str.join('')}head.appendChild(linkTag);`); // console.log({ s: source, r: replacedStr });
41
+
42
+ return replacedStr;
43
+ }); // NOTE: To add custom Attributes to i18n split js Script tags
44
+
45
+ mainTemplate.hooks.requireEnsure.tap('CustomAttributePlugin', source => {
46
+ const str = attributeSetTemplate(i18nAttributes, 'scriptTag');
47
+ const replacedStr = source.replace('document.body.appendChild(scriptTag);', `${str.join('')}document.body.appendChild(scriptTag);`); // console.log({ s: source, r: replacedStr });
48
+
49
+ return replacedStr;
50
+ });
51
+ }
52
+
53
+ apply(compiler) {
54
+ // NOTE: we not using this, Reason currently this option is only need for EFC,
55
+ // So it do not needed.
56
+ const {
57
+ attributes,
58
+ useHTMLAttribute
59
+ } = this.options;
60
+ useHTMLAttribute && new _htmlWebpackInjectAttributesPlugin.default(attributes).apply(compiler);
61
+ compiler.hooks.thisCompilation.tap({
62
+ name: 'CustomAttributePlugin',
63
+ stage: 1,
64
+ fn: compilation => {
65
+ this.addCustomAttributeToDynamicScriptTags(compilation.mainTemplate);
66
+ }
67
+ });
68
+ }
69
+
70
+ }
71
+
72
+ exports.CustomAttributePlugin = CustomAttributePlugin;
73
+
74
+ function attributeSetTemplate(jsAttributes, variableName) {
75
+ let str = [];
76
+ Object.keys(jsAttributes).forEach(key => {
77
+ const val = jsAttributes[key];
78
+ str.push(`${variableName}.setAttribute(${JSON.stringify(key)}, ${JSON.stringify(val)});`);
79
+ }); // console.log({ str });
80
+
81
+ return str;
82
+ }
@@ -0,0 +1,35 @@
1
+ # CustomAttributePlugin
2
+ In this plugin we added all dynamic chunks tags (like js script tags , css script tags, i18n split script tags) to extra custom attribute
3
+
4
+ ## Options
5
+
6
+ ```json
7
+ {
8
+ "name": "some",
9
+ "react-cli": {
10
+ "app": {
11
+ "customAttributes": {// this is the all options
12
+ "enable": false,
13
+ "attributes": null,
14
+ "jsAttributes": null,
15
+ "cssAttributes": null,
16
+ "i18nAttributes": null
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ ### enable [Boolean]
23
+ this decides is this plugin or feature needs to be enabled of not.
24
+
25
+
26
+ ### attributes [Object]
27
+ It was object of key value pairs Example Given Option {"data-app-name":"myapp"}
28
+ Then all dynamically (js script tags , css script tags, i18n split script tags) added tags via webpack
29
+
30
+ ### jsAttributes [Object]
31
+ same as [attributes] but only for js script tags
32
+ ### cssAttributes [Object]
33
+ same as [attributes] but only for css script tags
34
+ ### i18nAttributes [Object]
35
+ same as [attributes] but only for i18n split script tags
@@ -14,6 +14,11 @@ var _getCurrentBranch = _interopRequireDefault(require("../utils/getCurrentBranc
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  var _default = {
17
+ cliRootPath: null,
18
+ unstableDepsInverse: {
19
+ value: false,
20
+ cli: 'unstable_deps_inverse'
21
+ },
17
22
  sslCertURL: {
18
23
  value: null,
19
24
  cli: 'ssl_cert_url'
@@ -105,6 +110,13 @@ var _default = {
105
110
  filenames: [],
106
111
  packages: []
107
112
  },
113
+ customAttributes: {
114
+ enable: false,
115
+ attributes: null,
116
+ jsAttributes: null,
117
+ cssAttributes: null,
118
+ i18nAttributes: null
119
+ },
108
120
  server: {
109
121
  host: {
110
122
  value: (0, _os.hostname)(),
@@ -257,6 +269,7 @@ var _default = {
257
269
  cli: 'css_unique'
258
270
  },
259
271
  folder: 'src',
272
+ disableES5Transpile: false,
260
273
  hasRTL: false,
261
274
  rtlExclude: [],
262
275
  cssHashSelectors: {
@@ -553,6 +566,10 @@ var _default = {
553
566
  value: null,
554
567
  cli: 'clone_revision'
555
568
  },
569
+ shallowClone: {
570
+ value: false,
571
+ cli: 'shallow_clone'
572
+ },
556
573
  projectName: {
557
574
  value: null,
558
575
  cli: 'clone_proj_name'
@@ -18,6 +18,9 @@ var _getCliPath = require("./getCliPath");
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
20
  const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
21
+ // NOTE: need to discuss about in below codes,
22
+ // when we run webpack the usable options that comes for npm run not working as automatical
23
+ // we are use this option always --disable_watch=true reason for now no need for
21
24
 
22
25
  const {
23
26
  app: {
@@ -61,8 +64,9 @@ const startTime = Date.now(); // const result = spawnSync(
61
64
  // ),
62
65
  // { stdio: 'inherit' }
63
66
  // );
67
+ // --disable_watch=true
64
68
 
65
- const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
69
+ const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
66
70
  result && console.log(result);
67
71
 
68
72
  if (result && result.stderr) {
@@ -83,8 +87,8 @@ if (zipname) {
83
87
  } else {
84
88
  console.log('zip file created', cssSelectorZipPath);
85
89
  }
86
- } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
87
- // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
90
+ } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
91
+ // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
88
92
 
89
93
 
90
94
  console.log(`compailation done in ${Date.now() - startTime}ms`);
@@ -12,8 +12,7 @@ var _path = _interopRequireDefault(require("path"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
14
  const httpsOptions = {
15
- key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/key.pem')),
16
- cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/cert.pem')),
17
- passphrase: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/passphrase.pem')).toString()
15
+ key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
16
+ cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
18
17
  };
19
18
  exports.httpsOptions = httpsOptions;
@@ -14,7 +14,7 @@ var _utils = require("../utils");
14
14
 
15
15
  var _httpsOptions = require("./httpsOptions");
16
16
 
17
- var _devBulid = require("./devBulid");
17
+ var _devBuild = require("./devBuild");
18
18
 
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
@@ -42,7 +42,7 @@ const {
42
42
  zipname,
43
43
  cssSelectorZipPath,
44
44
  outputFolderLocation
45
- } = (0, _devBulid.getPaths)();
45
+ } = (0, _devBuild.getPaths)();
46
46
  const app = (0, _express.default)();
47
47
 
48
48
  if (hasMock) {
@@ -69,7 +69,8 @@ if (mode === 'prod') {
69
69
  config = require('../configs/webpack.dev.config');
70
70
  } else {
71
71
  throw new Error('You must configure valid option in mode');
72
- }
72
+ } // console.log({ contextURL });
73
+
73
74
 
74
75
  let compiler = (0, _webpack.default)(config);
75
76
  let webpackServerOptions = {
@@ -144,15 +145,22 @@ app.post('/wmsmockapi', (req, res) => {
144
145
  res.send('success');
145
146
  });
146
147
  let webpackCompilation;
148
+ let initalHTML;
147
149
  compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
148
150
  webpackCompilation = compilation;
149
151
  });
152
+ compiler.hooks.done.tap('ReactCLI', () => {
153
+ const indexHtml = webpackCompilation.assets['index.html'];
154
+
155
+ if (indexHtml) {
156
+ initalHTML = indexHtml.source();
157
+ }
158
+ });
150
159
 
151
160
  if (contextURL) {
152
161
  app.use(contextURL, _express.default.static(context));
153
162
  app.use(`${contextURL}/*`, (req, res) => {
154
- let indexHtml = webpackCompilation.assets['index.html'];
155
- res.send(indexHtml && indexHtml.source());
163
+ res.send(initalHTML);
156
164
  });
157
165
  } else {
158
166
  app.use(_express.default.static(context));
@@ -28,6 +28,7 @@ let {
28
28
  branch,
29
29
  revision,
30
30
  projectName,
31
+ shallowClone,
31
32
  cacheDir,
32
33
  remoteName,
33
34
  shouldDelete
@@ -73,9 +74,11 @@ let cloneRepo = () => {
73
74
  }
74
75
  }
75
76
 
76
- (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
77
+ (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
77
78
 
78
- spawnSyncWithErrorLog(type, ['clone', url, revisionOrBranch, projectName], {
79
+ let oargs = ['clone', url, revisionOrBranch, projectName];
80
+ type === 'git' && shallowClone && oargs.push('--depth=1');
81
+ spawnSyncWithErrorLog(type, oargs, {
79
82
  cwd: cacheDir,
80
83
  stdio: 'inherit'
81
84
  });
package/lib/utils/rtl.js CHANGED
@@ -18,7 +18,10 @@ let src = _path.default.join(cwd, process.argv[2]);
18
18
 
19
19
  let dist = _path.default.join(cwd, process.argv[3]);
20
20
 
21
- (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
21
+ let canWacth = '-w' === process.argv[4];
22
+
23
+ // import { useExitCleanup } from './useExitCleanup';
24
+ function watchHandler(fromPath, toPath) {
22
25
  let css = _fs.default.readFileSync(fromPath);
23
26
 
24
27
  (0, _postcss.default)([(0, _postcssRtl.default)({
@@ -39,4 +42,18 @@ let dist = _path.default.join(cwd, process.argv[3]);
39
42
  _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
40
43
  }
41
44
  });
42
- });
45
+ }
46
+
47
+ (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
48
+ if (canWacth && fromPath) {
49
+ _fs.default.watchFile(fromPath, () => {
50
+ watchHandler(fromPath, toPath);
51
+ });
52
+ }
53
+
54
+ watchHandler(fromPath, toPath);
55
+ }); // if (canWacth) {
56
+ // useExitCleanup(() => {
57
+ // fs.unwatchFile(src, watchHandler);
58
+ // });
59
+ // }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useExitCleanup = useExitCleanup;
7
+ //so the program will not close instantly
8
+ let listeners = [];
9
+ let hasCalled = false;
10
+
11
+ function useExitCleanup(listener) {
12
+ if (!hasCalled) {
13
+ process.stdin.resume();
14
+ hasCalled = true;
15
+ }
16
+
17
+ listeners.push(listeners);
18
+ return () => {
19
+ listeners = listeners.filter(l => l !== listener);
20
+ };
21
+ }
22
+
23
+ function exitHandler(options, exitCode) {
24
+ if (options.cleanup) {
25
+ console.log('clean');
26
+ }
27
+
28
+ if (exitCode || exitCode === 0) {
29
+ console.log(exitCode);
30
+ }
31
+
32
+ if (options.exit) {
33
+ process.exit();
34
+ }
35
+ } //do something when app is closing
36
+
37
+
38
+ process.on('exit', exitHandler.bind(null, {
39
+ cleanup: true
40
+ })); //catches ctrl+c event
41
+
42
+ process.on('SIGINT', exitHandler.bind(null, {
43
+ exit: true
44
+ })); // catches "kill pid" (for example: nodemon restart)
45
+
46
+ process.on('SIGUSR1', exitHandler.bind(null, {
47
+ exit: true
48
+ }));
49
+ process.on('SIGUSR2', exitHandler.bind(null, {
50
+ exit: true
51
+ })); //catches uncaught exceptions
52
+
53
+ process.on('uncaughtException', exitHandler.bind(null, {
54
+ exit: true
55
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/react-cli",
3
- "version": "0.0.1-beta.166",
3
+ "version": "0.0.1-beta.167.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",
@@ -10,6 +10,7 @@
10
10
  "build": "babel src -d lib --copy-files",
11
11
  "prepare": "npm run clean && npm run build",
12
12
  "lint": "eslint src ./bin/cli.js",
13
+ "postpublish": "node postpublish.js",
13
14
  "expublish": "npm publish --tag experimental-version"
14
15
  },
15
16
  "engines": {
package/postpublish.js ADDED
@@ -0,0 +1,6 @@
1
+ const { execSync } = require('child_process');
2
+ const { version } = require('./package.json');
3
+ console.log(`going to add git tag... v${version}`);
4
+
5
+ execSync(`git tag -a v${version}`, { stdio: 'inherit' });
6
+ execSync(`git push origin v${version}`, { stdio: 'inherit' });