@zohodesk/react-cli 0.0.1-exp.161.3 → 0.0.1-exp.164.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.
Files changed (49) hide show
  1. package/.eslintrc.js +3 -7
  2. package/README.md +120 -9
  3. package/bin/cli.js +67 -21
  4. package/eslint/NOTES.md +3 -0
  5. package/eslint/a23.c +16 -0
  6. package/eslint/a28.c +25 -0
  7. package/eslint/a29.c +25 -0
  8. package/eslint/a30.c +29 -0
  9. package/eslint/a31.c +23 -0
  10. package/eslint/a35.c +23 -0
  11. package/eslint/a36.c +18 -0
  12. package/eslint/a37.c +25 -0
  13. package/eslint/a38.c +28 -0
  14. package/eslint/a39.c +17 -0
  15. package/eslint/a40.c +32 -0
  16. package/eslint/mockapi.html +18 -0
  17. package/eslint/mockapi.md +5 -0
  18. package/lib/common/criteriaHandler.js +91 -0
  19. package/lib/common/index.js +6 -6
  20. package/lib/common/splitChunks.js +54 -18
  21. package/lib/common/splitChunks1.js +95 -0
  22. package/lib/common/splitChunksNew.js +129 -0
  23. package/lib/common/testPattern.js +71 -0
  24. package/lib/configs/jest.config.js +12 -3
  25. package/lib/configs/libAlias.js +31 -0
  26. package/lib/configs/webpack.dev.config.js +6 -19
  27. package/lib/configs/webpack.prod.config.js +18 -21
  28. package/lib/loaderUtils/index.js +4 -4
  29. package/lib/pluginUtils/getDevPlugins.js +2 -0
  30. package/lib/pluginUtils/getProdPlugins.js +2 -0
  31. package/lib/pluginUtils/index.js +12 -12
  32. package/lib/plugins/EFCPlugin.js +43 -13
  33. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  34. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  35. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  36. package/lib/plugins/ManifestPlugin.js +8 -0
  37. package/lib/plugins/index.js +36 -36
  38. package/lib/postcss-plugins/RTLSplitPlugin.js +1 -1
  39. package/lib/schemas/index.js +15 -0
  40. package/lib/templates/linterConstant.js +1 -1
  41. package/lib/utils/cssClassNameGenerate.js +9 -2
  42. package/lib/utils/cssURLReplacer.js +1 -1
  43. package/lib/utils/getCurrentBranch.js +1 -1
  44. package/lib/utils/getOptions.js +55 -1
  45. package/lib/utils/index.js +21 -19
  46. package/lib/utils/jsonHelper.js +12 -3
  47. package/lib/utils/reinstallDependencies.js +1 -1
  48. package/npm8.md +9 -0
  49. package/package.json +4 -4
package/.eslintrc.js CHANGED
@@ -108,7 +108,9 @@ let commonConfigs = {
108
108
  'comma-dangle': [logLevel],
109
109
  'comma-spacing': [logLevel],
110
110
  'func-call-spacing': [logLevel],
111
- indent: [logLevel, 2, { SwitchCase: 1 }],
111
+ // reference to this https://stackoverflow.com/questions/56337176/prettier-and-eslint-indents-not-working-together
112
+ // when using prettier, we should disable eslint's indent rule
113
+ indent: ['off', 2, { SwitchCase: 1 }],
112
114
  'jsx-quotes': [logLevel, 'prefer-single'],
113
115
  'key-spacing': [logLevel],
114
116
  'keyword-spacing': [logLevel],
@@ -140,8 +142,6 @@ let commonConfigs = {
140
142
  'prefer-template': [logLevel],
141
143
  'prefer-rest-params': [logLevel],
142
144
  'no-useless-constructor': [logLevel],
143
- 'no-duplicate-imports': [logLevel],
144
- 'array-callback-return': [logLevel],
145
145
  'no-use-before-define': [logLevel],
146
146
 
147
147
  'react/default-props-match-prop-types': [logLevel],
@@ -152,7 +152,6 @@ let commonConfigs = {
152
152
  'react/no-this-in-sfc': [logLevel],
153
153
  'react/no-will-update-set-state': [logLevel],
154
154
  'react/no-unused-state': [logLevel],
155
- 'react/no-will-update-set-state': [logLevel],
156
155
  // 'react/require-default-props': [logLevel],
157
156
  // 'react/require-optimization': [logLevel],
158
157
 
@@ -171,9 +170,6 @@ let commonConfigs = {
171
170
  'react/jsx-no-duplicate-props': [logLevel],
172
171
  'react/no-deprecated': [logLevel],
173
172
  'react/no-children-prop': [logLevel],
174
- 'react/no-unused-state': [logLevel],
175
- 'react/destructuring-assignment': [logLevel],
176
- 'react/default-props-match-prop-types': [logLevel],
177
173
 
178
174
  'css-modules/no-unused-class': [logLevel, { camelCase: true }],
179
175
  'css-modules/no-undef-class': [logLevel, { camelCase: 'only' }]
package/README.md CHANGED
@@ -1,39 +1,150 @@
1
1
  # React CLI
2
2
 
3
3
  A CLI tool for build modern web application and libraries
4
+
5
+ # 0.0.1-exp.164.1
6
+
7
+ - extra features in custom chunks
8
+ - `minChunks`: `minChunks` is alies of `size` default value is `2`,
9
+ - `rules`: rules,
10
+ - `chunks`: by this option you can specify , default value is `all`,
11
+ - `priority`: priority default value is -10 \* (index + 2),
12
+ - `enforce`: enforce default value is true,
13
+ - `maxSize`: maxSize, default value is 0,
14
+ - `minSize`: minSize, default value is 20000,
15
+ - <!-- includeDepenency: includeDepenency default value is false -->
16
+
17
+ # 0.0.1-exp.165
18
+
19
+ - **Features :-**
20
+ - auto remove vendor excluded dependency's dependency
21
+
22
+ # 0.0.1-beta.164
23
+
24
+ - typo fix
25
+
26
+ # 0.0.1-beta.163
27
+
28
+ - **Issue Fix:-**
29
+
30
+ - if git not installed react-cli throws error for any command due to `getCurrentBranch` in `shemas/index.js` now fixed
31
+ - jest test cases not runnig issue fix (typo moduleNameMapper => libAlias)
32
+
33
+ - **Features :-**
34
+ - feature added for pre process logic
35
+ - tailer made requirement for preprocess, just write node js file
36
+ - mention file in `"react-cli" => "preprocess" => "runner"`
37
+ - option parse logic added for react-cli (exprimental)
38
+ - `--stop_nodemon` usally preprocessor run in `nodemon` so to stop it this option is provided
39
+
40
+ # 0.0.1-exp.162.2
41
+
42
+ - **Optimazation:-**
43
+ - double time minimize optimazation
44
+
45
+ # 0.0.1-beta.162.1
46
+
47
+ - **Issue Fix:-**
48
+ - if git not installed react-cli throws error for any command due to `getCurrentBranch` in `shemas/index.js` now fixed
49
+
50
+ # 0.0.1-beta.161.1
51
+
52
+ - **Features :-**
53
+ - feature added for pre process logic
54
+ - tailer made requirement for preprocess, just write node js file
55
+ - mention file in `"react-cli" => "preprocess" => "runner"`
56
+ - option parse logic added for react-cli (exprimental)
57
+
58
+ # 0.0.1-beta.162
59
+
60
+ - @zohodesk/datetimejs package updated to beta.8
61
+
62
+ # 0.0.1-beta.161
63
+
64
+ - **Features :-**
65
+ - feature added for efc `templateFilePath` in `package.json` option palce is `"react-cli" => "efc" => "templateFilePath"`
66
+ - `(('publicPath'))` this placeholder will be replace as publicPath string `publicPath`
67
+ - `(('getInitalAssets'))` this placeholder will be replace as function `getInitalAssets`
68
+ - `getInitalAssets` this function has two arguments `assetsType`, `lang`
69
+ - `assetsType` are `js`, `css`, `i18n`
70
+ - `lang` this argument only works when `i18n` is `assetsType`
71
+ - feature added for efc `cdnStatement`
72
+ - **Issue fixes:-**
73
+ - css classname hash change issue fix
74
+ - debug package conflit issue fix in nock in (react-cli test)
75
+ - manifest.json css file name correction issue for rtl and ltr
76
+
77
+ # 0.0.1-exp.161.2
78
+
79
+ - Features
80
+ - feature added for efc `templateFilePath` in `package.json` option palce is `"react-cli" => "efc" `
81
+ - `(('publicPath'))` this placeholder will be replace as publicPath string `publicPath`
82
+ - `(('getInitalAssets'))` this placeholder will be replace as function `getInitalAssets`
83
+ - `getInitalAssets` this function has two arguments `assetsType`, `lang`
84
+ - `assetsType` are `js`, `css`, `i18n`
85
+ - `lang` this argument only works when `i18n` is `assetsType`
86
+
87
+ # 0.0.1-exp.161.1
88
+
89
+ - Features
90
+ - feature added for efc `cdnStatement`
91
+ - Issue fixes:-
92
+ - css classname hash change issue fix
93
+ - debug package conflit issue fix in nock in (react-cli test)
94
+ - manifest.json css file name correction issue for rtl and ltr
95
+
4
96
  # 0.0.1-beta.160
97
+
5
98
  - @zohodesk/normalizer package version updated to 1.0.2
99
+
6
100
  # 0.0.1-beta.159
101
+
7
102
  - @zohodesk/datetimejs package updated to beta.7
103
+
104
+ # 0.0.1-exp.159
105
+
106
+ - isse fix:-
107
+ - when rtl ltr css split enable manifest json css filename keys comes with hash .
108
+
8
109
  # 0.0.1-beta.158
9
- - Removing source map files from service worker caching.
110
+
111
+ - Removing source map files from service worker caching.
112
+
10
113
  # 0.0.1-beta.157
11
- - Experimental version issue fix(Dummy version removed)
114
+
115
+ - Experimental version issue fix(Dummy version removed)
116
+
12
117
  # 0.0.1-beta.156
13
- - ReportPublish issue fix
118
+
119
+ - ReportPublish issue fix
14
120
 
15
121
  # 0.0.1-beta.155
16
- - get impacted library source files option added
122
+
123
+ - get impacted library source files option added
17
124
 
18
125
  # 0.0.1-beta.154
19
- - mockPrefix option for mock url prefix change
20
- - Issue fix:-
21
- - un wanted {{--js-smap}} in inital html without enable smap in build
126
+
127
+ - mockPrefix option for mock url prefix change
128
+ - Issue fix:-
129
+ - un wanted {{--js-smap}} in inital html without enable smap in build
22
130
 
23
131
  # 0.0.1-beta.153
132
+
24
133
  - Vendor include array added
25
134
  - If you need to include any thrid party js in vendor we can use this array
26
135
 
27
136
  # 0.0.1-beta.152
137
+
28
138
  impact servise related changes:-
139
+
29
140
  - nowatchstart option added. will be used like `react-cli nowatchstart <...options>` this will be used for src file changes no need to reflect (or no need to rebulid on file changes)
30
141
  - cssselector_zip option added. will be used like `--cssselector-zip=selectormapping.zip`
31
142
  only work in two ways
32
143
  1. `react-cli start --disable-watch --cssselector-zip=selectormapping.zip` app start command with `--disable-watch` flag and your usaul options
33
144
  2. `react-cli nowatchstart --cssselector-zip=selectormapping.zip` app start command's usaul options
34
145
  #### Urls are:-
35
- Below express path are added, For download zip files and
36
- - `/zips/${zipname}.zip` for css selector maps zip file (contains css_map filies and original css files)
146
+ Below express path are added, For download zip files and
147
+ - `/zips/${zipname}.zip` for css selector maps zip file (contains css_map filies and original css files)
37
148
  - `/zips/build.zip` build zip file (contains bundled all files)
38
149
 
39
150
  # 0.0.1-beta.151
package/bin/cli.js CHANGED
@@ -1,28 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- let path = require('path');
4
- let os = require('os');
5
- let { spawnSync } = require('child_process');
6
- let { getOptions } = require('../lib/utils/index.js');
3
+ const path = require('path');
4
+ const os = require('os');
5
+ const { existsSync } = require('fs');
6
+ const { spawnSync, spawn } = require('child_process');
7
+ const { getOptions } = require('../lib/utils/index.js');
7
8
 
8
- let { log } = require('../lib/utils');
9
+ const { log } = require('../lib/utils');
9
10
  //initPreCommitHook();
10
11
 
11
- let options = getOptions();
12
+ const options = getOptions();
12
13
 
13
- let { esLint: esLintOptions } = options || {};
14
- let {
14
+ const { esLint: esLintOptions } = options || {};
15
+ const { preprocess } = options;
16
+ const {
15
17
  ignoreFilePaths: esLintIgnorePaths,
16
18
  fix: esLintFix,
17
19
  isCI: isCI,
18
20
  reportPath: reportPath
19
21
  } = esLintOptions || {};
20
22
 
21
- let isWindows = os.platform().toLowerCase() === 'win32';
23
+ const isWindows = os.platform().toLowerCase() === 'win32';
22
24
 
23
- let [, , option] = process.argv;
24
- let args = process.argv.slice(3);
25
- let appPath = process.cwd();
25
+ const [, , option] = process.argv;
26
+ const args = process.argv.slice(3);
27
+ const appPath = process.cwd();
26
28
 
27
29
  const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
28
30
 
@@ -35,15 +37,55 @@ function getCliPath(libName) {
35
37
  return _getCliPath(libName) + suffixExt;
36
38
  }
37
39
 
38
- let webpack = getCliPath('webpack');
39
-
40
- let nodemon = getCliPath('nodemon');
41
- let babel = getCliPath('babel');
42
- let propertyToJson = getCliPath('propertyToJson');
43
- let esLint = getCliPath('eslint');
40
+ const webpack = getCliPath('webpack');
41
+
42
+ const nodemon = getCliPath('nodemon');
43
+ const babel = getCliPath('babel');
44
+ const propertyToJson = getCliPath('propertyToJson');
45
+ const esLint = getCliPath('eslint');
46
+
47
+ const preprocesserPath = preprocess.runner
48
+ ? path.join(process.cwd(), preprocess.runner)
49
+ : '';
50
+ const preprocessCli = preprocess.stopNodemon ? 'node' : nodemon;
51
+ if (preprocesserPath && existsSync(preprocesserPath)) {
52
+ // eslint-disable-next-line default-case
53
+ switch (option) {
54
+ case 'start':
55
+ case 'docs':
56
+ spawn(preprocessCli, [preprocesserPath], {
57
+ stdio: 'inherit',
58
+ cwd: preprocesserPath.slice(0, preprocesserPath.lastIndexOf('/') + 1)
59
+ });
60
+ // NOTE: it's ok if we not close this here
61
+ // Because when node server stops this program willbe closed So this nodemon will be killed as well
62
+ break;
63
+ case 'nowatchstart':
64
+ case 'build:library:es':
65
+ case 'build:component:es':
66
+ case 'build:library:cmjs':
67
+ case 'build:component:cmjs':
68
+ spawnSync('node', [preprocesserPath], {
69
+ stdio: 'inherit',
70
+ cwd: preprocesserPath.slice(0, preprocesserPath.lastIndexOf('/') + 1)
71
+ });
72
+ break;
73
+ }
74
+ }
44
75
 
45
76
  let result;
46
77
  switch (option) {
78
+ case 'preprocessor':
79
+ if (preprocesserPath && existsSync(preprocesserPath)) {
80
+ result = spawnSync(preprocessCli, [preprocesserPath], {
81
+ stdio: 'inherit',
82
+ cwd: preprocesserPath.slice(0, preprocesserPath.lastIndexOf('/') + 1)
83
+ });
84
+ process.exit(result.status);
85
+ } else {
86
+ console.error(`preProcessor not exists ${preprocesserPath}`);
87
+ }
88
+ break;
47
89
  case 'lint-setup': {
48
90
  result = spawnSync(
49
91
  'node',
@@ -155,10 +197,11 @@ switch (option) {
155
197
  break;
156
198
 
157
199
  case 'clean':
158
- args = args.map(arg => path.join(appPath, arg));
159
200
  result = spawnSync(
160
201
  'node',
161
- [require.resolve('../lib/utils/clean')].concat(args),
202
+ [require.resolve('../lib/utils/clean')].concat(
203
+ args.map(arg => path.join(appPath, arg))
204
+ ),
162
205
  { stdio: 'inherit' }
163
206
  );
164
207
  process.exit(result.status);
@@ -218,12 +261,15 @@ switch (option) {
218
261
  result = spawnSync(
219
262
  webpack,
220
263
  [
264
+ // '--progress',
265
+ // '--profile',
221
266
  '--config',
222
- require.resolve('../lib/configs/webpack.prod.config.js')
267
+ require.resolve('../lib/configs/webpack.prod.config.js'),
223
268
  ].concat(args),
224
269
  { stdio: 'inherit' }
225
270
  );
226
271
 
272
+ // console.log(result);
227
273
  process.exit(result.status);
228
274
  break;
229
275
 
@@ -0,0 +1,3 @@
1
+ Suggestions :
2
+
3
+ 1. 'lint-setup', 'add-lint-scripts' not need to exposed
package/eslint/a23.c ADDED
@@ -0,0 +1,16 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 23
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int i = 20, j = 22, k = 20, l = 10;
9
+
10
+ for (int m = 0; m <= 10; m++)
11
+ {
12
+ l = ++i + ++j - k--;
13
+ }
14
+ printf("%d\n", l);
15
+ return 0;
16
+ }
package/eslint/a28.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 28
4
+ int mark(int x)
5
+ {
6
+ if (x <= 0)
7
+ {
8
+ return 1;
9
+ }
10
+ return 0;
11
+ }
12
+
13
+ int main()
14
+ {
15
+ // Write C code here
16
+ int x = 2345, t, a = 0;
17
+ while (x > 0)
18
+ {
19
+ t = x % 10;
20
+ a += mark(t);
21
+ x /= 10;
22
+ }
23
+ printf("%d\n", a);
24
+ return 0;
25
+ }
package/eslint/a29.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 29
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int x = 777, y, s = 0, m, n, t, u;
9
+ y = x;
10
+ for (m = 0; y != 0; y /= 10)
11
+ {
12
+ u = y % 9;
13
+ for (n = m, t = 1; n >= 0; n--)
14
+ {
15
+ t *= 9;
16
+ }
17
+ if (u < 5)
18
+ {
19
+ u += 3;
20
+ }
21
+ s = s * u + t;
22
+ }
23
+ printf("%d\n", s);
24
+ return 0;
25
+ }
package/eslint/a30.c ADDED
@@ -0,0 +1,29 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 30
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int a[8] = {24, 27, 33, 27, 9, 43, 0, 3};
9
+ int i, sum = 0;
10
+ for (i = 0; i < 5; i = i + 1)
11
+ {
12
+ switch (a[i] % 3)
13
+ {
14
+ case 2:
15
+ sum = sum * sum;
16
+ break;
17
+ case 1:
18
+ sum += a[i];
19
+ break;
20
+ case 0:
21
+ sum -= a[i];
22
+ break;
23
+ default:
24
+ sum = sum * a[i];
25
+ }
26
+ }
27
+ printf("%d\n", sum);
28
+ return 0;
29
+ }
package/eslint/a31.c ADDED
@@ -0,0 +1,23 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 31
4
+
5
+ int main()
6
+ {
7
+ // Write C code here
8
+ int x = 16, y = 32, i = 0;
9
+ do
10
+ {
11
+ if (x % 2 == 0)
12
+ {
13
+ y /= 2;
14
+ }
15
+ if (y % 2 < 1)
16
+ {
17
+ x /= 2;
18
+ }
19
+ i++;
20
+ } while (x > 1);
21
+ printf("%d\n", i);
22
+ return 0;
23
+ }
package/eslint/a35.c ADDED
@@ -0,0 +1,23 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 34
4
+ int compute(int a, int b)
5
+ {
6
+ if (b == 1)
7
+ {
8
+ return a;
9
+ }
10
+ else
11
+ {
12
+ return a + compute(a, --b);
13
+ }
14
+ }
15
+
16
+ int main()
17
+ {
18
+ // Write C code here
19
+ int a = 37, b = 26, result = 0;
20
+ result = compute(a, b);
21
+ printf("%d\n", result);
22
+ return 0;
23
+ }
package/eslint/a36.c ADDED
@@ -0,0 +1,18 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 36
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char a[] = {'o', 'm', 'p', 'n', 'j', 'o'};
8
+ for (int i = 1; i <= 6; i++)
9
+ {
10
+ a[i - 1] = a[i - 1] + i;
11
+ }
12
+ for (int i = 0; i < 6; i++)
13
+ {
14
+ printf("%c\n", a[i]);
15
+ }
16
+ // printf("%d\n", result);
17
+ return 0;
18
+ }
package/eslint/a37.c ADDED
@@ -0,0 +1,25 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 37
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char name[] = {'o', 'h', 'o', 'z', 'p', 'r', 'o', 'c'};
8
+ for (int i = 0, j = 7; i <= 7; i++, j--)
9
+ {
10
+ if (name[i] < name[j])
11
+ {
12
+ name[i] = name[j];
13
+ }
14
+ else
15
+ {
16
+ name[i] = name[i];
17
+ }
18
+ }
19
+ for (int i = 0; i <= 7; i++)
20
+ {
21
+ printf("%c", name[i]);
22
+ }
23
+ // printf("%d\n", result);
24
+ return 0;
25
+ }
package/eslint/a38.c ADDED
@@ -0,0 +1,28 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 38
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ int a = 7798, d = 1, temp, result = 1;
8
+ temp = a;
9
+ while (d)
10
+ {
11
+ d = temp % 10;
12
+ temp = temp / 10;
13
+ d %= 4;
14
+ switch (d)
15
+ {
16
+ case 0:
17
+ result += (a / 100) + (a % 100);
18
+ case 1:
19
+ result += (a / 100) + (a % 100);
20
+ case 2:
21
+ result += (a / 100) + (a % 100);
22
+ case 3:
23
+ result += (a / 100) + (a % 100);
24
+ };
25
+ }
26
+ printf("%d\n", result);
27
+ return 0;
28
+ }
package/eslint/a39.c ADDED
@@ -0,0 +1,17 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 39
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ int a = 20, b = 15, c = 0;
8
+
9
+ while (b > 0)
10
+ {
11
+ a = c + a - b;
12
+ b = a + 1;
13
+ c = b - 1;
14
+ }
15
+ printf("%d\n", a);
16
+ return 0;
17
+ }
package/eslint/a40.c ADDED
@@ -0,0 +1,32 @@
1
+ // Online C compiler to run C program online
2
+ #include <stdio.h>
3
+ // 40
4
+ int main()
5
+ {
6
+ // Write C code here
7
+ char a[5] = {'i', 'j', 'k', 'l', 'm'};
8
+ int i;
9
+ for (i = 0; i < 5; i++)
10
+ {
11
+ // printf("%d\n", a[i]);
12
+ switch (i % 2)
13
+ {
14
+ case 0:
15
+ a[i] = a[i] + 2;
16
+ break;
17
+ case 1:
18
+ a[i] = a[i] + 3;
19
+ break;
20
+ default:
21
+ a[i] = a[i] + 3;
22
+ }
23
+ }
24
+
25
+ for (i = 0; i < 5; i++)
26
+ {
27
+ printf("%c", a[i]);
28
+ }
29
+ // printf("\nHello world");
30
+
31
+ return 0;
32
+ }
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <title>mock api</title>
7
+ </head>
8
+ <body>
9
+ <h1>We are going to see how to use mock api</h1>
10
+ <ul>
11
+ <li>
12
+ Step 1:-
13
+ you need to start the app with "react-cli"."app"."server"."hasMock" as "true" in package.json
14
+ <code>npm run start --app-port=9090</code>
15
+ </li>
16
+ </ul>
17
+ </body>
18
+ </html>
@@ -0,0 +1,5 @@
1
+ # We are going to see how to use `Mock api`
2
+
3
+ - Step 1:-
4
+ you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` and **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>
5
+ - Step 2:- you need to start the app with **"react-cli"."app"."server"."hasMock"** as `true` in package.json <code>npm run start --app-port=9090</code>