@zohodesk/react-cli 0.0.1-beta.165 → 0.0.1-beta.168

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 (47) hide show
  1. package/README.md +64 -1
  2. package/bin/cli.js +18 -1
  3. package/cert/Tsicsezwild-22-23.crt +37 -0
  4. package/cert/Tsicsezwild-22-23.key +27 -0
  5. package/docs/CustomChunks.md +26 -0
  6. package/docs/DevStart.md +18 -0
  7. package/docs/InstallNode.md +28 -0
  8. package/docs/TODOS.md +10 -0
  9. package/docs/warnings_while_install.txt +35 -0
  10. package/lib/common/splitChunks.js +57 -10
  11. package/lib/common/testPattern.js +69 -0
  12. package/lib/configs/jest.config.js +6 -1
  13. package/lib/configs/webpack.dev.config.js +9 -15
  14. package/lib/configs/webpack.docs.config.js +32 -35
  15. package/lib/configs/webpack.impact.config.js +5 -13
  16. package/lib/configs/webpack.prod.config.js +4 -3
  17. package/lib/loaderUtils/configsAssetsLoaders.js +88 -0
  18. package/lib/loaderUtils/getCSSLoaders.js +14 -13
  19. package/lib/schemas/index.js +19 -2
  20. package/lib/servers/devBuild.js +102 -0
  21. package/lib/servers/getCliPath.js +24 -0
  22. package/lib/servers/httpsOptions.js +2 -3
  23. package/lib/servers/nowatchserver.js +9 -84
  24. package/lib/servers/server.js +20 -5
  25. package/lib/utils/repoClone.js +5 -2
  26. package/lib/utils/rtl.js +19 -2
  27. package/lib/utils/useExitCleanup.js +55 -0
  28. package/npm8.md +9 -0
  29. package/package.json +2 -1
  30. package/postpublish.js +6 -0
  31. package/cert/cert.pem +0 -37
  32. package/cert/key.pem +0 -27
  33. package/cert/passphrase.pem +0 -1
  34. package/eslint/NOTES.md +0 -3
  35. package/eslint/a23.c +0 -16
  36. package/eslint/a28.c +0 -25
  37. package/eslint/a29.c +0 -25
  38. package/eslint/a30.c +0 -29
  39. package/eslint/a31.c +0 -23
  40. package/eslint/a35.c +0 -23
  41. package/eslint/a36.c +0 -18
  42. package/eslint/a37.c +0 -25
  43. package/eslint/a38.c +0 -28
  44. package/eslint/a39.c +0 -17
  45. package/eslint/a40.c +0 -32
  46. package/eslint/mockapi.html +0 -18
  47. package/eslint/mockapi.md +0 -5
@@ -8,12 +8,19 @@ var _pluginUtils = require("../pluginUtils");
8
8
 
9
9
  var _loaderUtils = require("../loaderUtils");
10
10
 
11
+ var _libAlias = require("./libAlias");
12
+
13
+ var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
14
+
11
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
16
 
13
17
  let options = (0, _utils.getOptions)();
14
18
  let {
19
+ unstableDepsInverse,
15
20
  docs: {
16
21
  componentFolder,
22
+ disableES5Transpile,
23
+ enableChunkHash,
17
24
  cssUniqueness,
18
25
  hasRTL,
19
26
  rtlExclude,
@@ -25,72 +32,61 @@ let {
25
32
  }
26
33
  } = options;
27
34
  let appPath = process.cwd();
35
+ const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
28
36
 
29
37
  module.exports = isSSTest => ({
30
38
  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"]
39
+ main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
40
+ vendor: ['react', 'react-dom', 'redux', 'react-redux']
33
41
  },
34
- devtool: "none",
35
- mode: "development",
42
+ devtool: 'none',
43
+ mode: 'development',
36
44
  output: {
37
- path: _path.default.join(appPath, "build"),
38
- filename: "js/[name].js",
39
- publicPath: "/docs/",
40
- library: "Component",
41
- libraryTarget: "umd"
45
+ path: _path.default.join(appPath, 'build'),
46
+ filename: 'js/[name].js',
47
+ publicPath: '/docs/',
48
+ library: 'Component',
49
+ libraryTarget: 'umd'
42
50
  },
43
51
  plugins: (0, _pluginUtils.getDocsPlugins)(isSSTest, options),
44
52
  module: {
45
53
  rules: [{
46
54
  test: /\.js$/,
47
55
  use: [{
48
- loader: "babel-loader",
56
+ loader: 'babel-loader',
49
57
  options: {
50
- presets: [[require.resolve("@babel/preset-env"), {
58
+ presets: [[require.resolve('@babel/preset-env'), {
51
59
  modules: false
52
- }], require.resolve("@babel/preset-react")],
53
- plugins: [[require.resolve("@babel/plugin-transform-runtime"), {
60
+ }], require.resolve('@babel/preset-react')],
61
+ plugins: [[require.resolve('@babel/plugin-transform-runtime'), {
54
62
  helpers: true,
55
63
  regenerator: false
56
- }], require.resolve("@babel/plugin-syntax-dynamic-import"), require.resolve("@babel/plugin-syntax-object-rest-spread")],
64
+ }], require.resolve('@babel/plugin-syntax-dynamic-import'), require.resolve('@babel/plugin-syntax-object-rest-spread')],
57
65
  cacheDirectory: true
58
66
  }
59
67
  }],
60
68
  include: _path.default.join(appPath, folder)
61
69
  }, {
62
70
  test: /\.docs\.js$/,
63
- use: require.resolve("../loaders/docsLoader.js"),
71
+ use: require.resolve('../loaders/docsLoader.js'),
64
72
  include: _path.default.join(appPath, folder),
65
73
  exclude: /node_modules/
66
74
  }, {
67
75
  test: /(\.module)?\.css$/,
68
76
  use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
69
- }, {
70
- test: /\.jpe?g$|\.gif$|\.png$/,
71
- use: ["url-loader?limit=1000&name=./images/[name].[ext]"]
72
- }, {
73
- test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
74
- use: ["url-loader?limit=1000&name=./fonts/[name].[ext]"]
75
- }, {
76
- test: /\.svg$/,
77
- use: ["url-loader?limit=1&name=./fonts/[name].[ext]"]
78
- }, {
77
+ }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
79
78
  test: /\.html$/,
80
79
  use: {
81
- loader: "html-loader",
80
+ loader: 'html-loader',
82
81
  options: {
83
- attrs: [":data-src"],
84
- interpolate: "require"
82
+ attrs: [':data-src'],
83
+ interpolate: 'require'
85
84
  }
86
85
  }
87
- }, {
88
- test: /\.ogg$/,
89
- use: ["file-loader?name=./fonts/[name].[ext]"]
90
86
  }, {
91
87
  test: /\.tmpl$/,
92
88
  use: [{
93
- loader: "html-loader",
89
+ loader: 'html-loader',
94
90
  options: {
95
91
  minimize: {
96
92
  removeComments: true,
@@ -104,12 +100,13 @@ module.exports = isSSTest => ({
104
100
  }]
105
101
  },
106
102
  externals: {
107
- ZC: "$ZC"
103
+ ZC: '$ZC'
108
104
  },
109
105
  resolve: {
110
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
106
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
107
+ alias: disableES5Transpile ? _libAlias.libAlias : {}
111
108
  },
112
109
  resolveLoader: {
113
- modules: [_path.default.resolve(__dirname, "..", "..", "node_modules"), "node_modules"]
110
+ modules: unstableDepsInverse ? ['node_modules', _path.default.resolve(__dirname, '..', '..', 'node_modules')] : [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules']
114
111
  }
115
112
  });
@@ -8,6 +8,8 @@ var _loaderUtils = require("../loaderUtils");
8
8
 
9
9
  var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/getLibraryImactPlugins"));
10
10
 
11
+ var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
12
+
11
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
14
 
13
15
  let options = (0, _utils.getOptions)();
@@ -18,6 +20,7 @@ let {
18
20
  hasRTL,
19
21
  rtlExclude,
20
22
  cssHashSelectors,
23
+ enableChunkHash,
21
24
  classNamePrefix
22
25
  },
23
26
  app: {
@@ -25,6 +28,7 @@ let {
25
28
  }
26
29
  } = options;
27
30
  let appPath = process.cwd();
31
+ const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
28
32
  module.exports = {
29
33
  entry: {
30
34
  main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
@@ -65,16 +69,7 @@ module.exports = {
65
69
  }, {
66
70
  test: /(\.module)?\.css$/,
67
71
  use: (0, _loaderUtils.getCSSLoaders)(hasRTL, rtlExclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
68
- }, {
69
- test: /\.jpe?g$|\.gif$|\.png$/,
70
- use: ['url-loader?limit=1000&name=./images/[name].[ext]']
71
- }, {
72
- test: /\.woff2|\.woff$|\.ttf$|\.eot$/,
73
- use: ['url-loader?limit=1000&name=./fonts/[name].[ext]']
74
- }, {
75
- test: /\.svg$/,
76
- use: ['url-loader?limit=1&name=./fonts/[name].[ext]']
77
- }, {
72
+ }, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
78
73
  test: /\.html$/,
79
74
  use: {
80
75
  loader: 'html-loader',
@@ -83,9 +78,6 @@ module.exports = {
83
78
  interpolate: 'require'
84
79
  }
85
80
  }
86
- }, {
87
- test: /\.ogg$/,
88
- use: ['file-loader?name=./fonts/[name].[ext]']
89
81
  }, {
90
82
  test: /\.tmpl$/,
91
83
  use: [{
@@ -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
  };
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.configAudioLoader = configAudioLoader;
7
+ exports.configFontLoader = configFontLoader;
8
+ exports.configImageLoader = configImageLoader;
9
+ exports.configSVGLoader = configSVGLoader;
10
+ exports.createNameTemplate = createNameTemplate;
11
+ // function getLoaderOptionQueryString(params) {
12
+ const ImageExtRegex = /\.jpe?g$|\.gif$|\.png$/;
13
+ const FontExtRegex = /\.woff2|\.woff$|\.ttf$|\.eot$/;
14
+ const SVGExtRegex = /\.svg$/;
15
+ const AudioExtRegex = /\.ogg$/;
16
+
17
+ function createLoaderOptionQueryString(loaderName, nameTemplate, limit = 1000) {
18
+ return `${loaderName}?limit=${limit}&name=${nameTemplate}`;
19
+ }
20
+
21
+ function configImageLoader(nameTemplate) {
22
+ return {
23
+ test: ImageExtRegex,
24
+ use: createLoaderOptionQueryString('url-loader', `./images/${nameTemplate}`)
25
+ };
26
+ }
27
+
28
+ function configFontLoader(nameTemplate) {
29
+ return {
30
+ test: FontExtRegex,
31
+ use: createLoaderOptionQueryString('url-loader', `./fonts/${nameTemplate}`)
32
+ };
33
+ }
34
+
35
+ function configSVGLoader(nameTemplate) {
36
+ return {
37
+ test: SVGExtRegex,
38
+ use: createLoaderOptionQueryString('url-loader', `./fonts/${nameTemplate}`, 1)
39
+ };
40
+ }
41
+
42
+ function configAudioLoader(nameTemplate) {
43
+ return {
44
+ test: AudioExtRegex,
45
+ use: createLoaderOptionQueryString('file-loader', `./fonts/${nameTemplate}`, 1)
46
+ };
47
+ }
48
+
49
+ function createNameTemplate(enableChunkHash) {
50
+ const ext = `${enableChunkHash ? '.[hash:20]' : ''}.[ext]`;
51
+ return `[name]${ext}`;
52
+ }
53
+ /*
54
+ export function createImageAndFontsAndSVGLoaders(enableChunkHash) {
55
+ const nameTemplate = createNameTemplate(enableChunkHash);
56
+ return [
57
+ configImageLoader(nameTemplate),
58
+ configFontLoader(nameTemplate),
59
+ configSVGLoader(nameTemplate),
60
+ configAudioLoader(nameTemplate)
61
+ ];
62
+ }
63
+ */
64
+
65
+ /*
66
+ export function createLoaderOptionObject(
67
+ loaderName,
68
+ nameTemplate,
69
+ fallback,
70
+ limit = 1000
71
+ ) {
72
+ return {
73
+ loader: loaderName,
74
+ options: {
75
+ limit,
76
+ name: nameTemplate,
77
+ fallback
78
+ }
79
+ };
80
+ }
81
+
82
+ function configLoaderObject(filter, loaderAndOptions) {
83
+ return {
84
+ test: filter,
85
+ use: loaderAndOptions
86
+ };
87
+ }
88
+ */
@@ -39,6 +39,18 @@ let getCSSLoaders = (hasRTL, rtlExclude, classNameBlob, cssUniqueness, selectorR
39
39
  cssLoaderOptions.modules.getLocalIdent = (0, _cssClassNameGenerate.default)(cssUniqueness, cssHashSelectors, classNamePrefix);
40
40
  }
41
41
 
42
+ const postcssPlugins = [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), hasRTL && require('../postcss-plugins/ExcludeRTLPlugin')({
43
+ ignore: rtlExcludeLocal,
44
+ plugins: [require('@zohodesk/postcss-rtl')({
45
+ addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
46
+ if (prefix === '[dir]') {
47
+ return selector;
48
+ }
49
+
50
+ return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
51
+ }
52
+ })]
53
+ })].filter(Boolean);
42
54
  return [cssSelectorZipPath && {
43
55
  loader: require.resolve('../loaders/selectorMappingLoader')
44
56
  }, {
@@ -54,23 +66,12 @@ let getCSSLoaders = (hasRTL, rtlExclude, classNameBlob, cssUniqueness, selectorR
54
66
  options: {
55
67
  devCssFileBountry
56
68
  }
57
- }, hasRTL || selectorReplace || valueReplacer ? {
69
+ }, postcssPlugins.length > 0 ? {
58
70
  loader: 'postcss-loader',
59
71
  options: {
60
72
  ident: 'postcss',
61
73
  plugins: function () {
62
- return [valueReplacer && require('../postcss-plugins/ValueReplacer')(valueReplacer), selectorReplace && require('postcss-selector-replace')(selectorReplace), hasRTL && require('../postcss-plugins/ExcludeRTLPlugin')({
63
- ignore: rtlExcludeLocal,
64
- plugins: [require('@zohodesk/postcss-rtl')({
65
- addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
66
- if (prefix === '[dir]') {
67
- return selector;
68
- }
69
-
70
- return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
71
- }
72
- })]
73
- })].filter(Boolean);
74
+ return postcssPlugins;
74
75
  }
75
76
  }
76
77
  } : null].filter(Boolean);
@@ -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'
@@ -60,7 +65,10 @@ var _default = {
60
65
  dirVarName: 'document.dir'
61
66
  },
62
67
  efc: {
63
- hasEFC: false,
68
+ hasEFC: {
69
+ value: false,
70
+ cli: 'enable_efc'
71
+ },
64
72
  createSDkFile: false,
65
73
  nameScope: 'ZOHODESK',
66
74
  version: 'default',
@@ -148,7 +156,10 @@ var _default = {
148
156
  disableES5Transpile: false,
149
157
  isReactMig: false,
150
158
  hasWidget: false,
151
- hasEFC: false,
159
+ hasEFC: {
160
+ value: false,
161
+ cli: 'enable_efc'
162
+ },
152
163
  enableChunkHash: {
153
164
  value: false,
154
165
  cli: 'hash_enable'
@@ -256,7 +267,9 @@ var _default = {
256
267
  value: true,
257
268
  cli: 'css_unique'
258
269
  },
270
+ enableChunkHash: false,
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'
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPaths = getPaths;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _child_process = require("child_process");
13
+
14
+ var _utils = require("../utils");
15
+
16
+ var _getCliPath = require("./getCliPath");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
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
24
+
25
+ const {
26
+ app: {
27
+ outputFolder
28
+ }
29
+ } = options;
30
+ const {
31
+ cssSelectorZipPath
32
+ } = options.impactService;
33
+ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
34
+
35
+ const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
36
+
37
+ function execSyncDefalut(command) {
38
+ console.log(' command running ==>', command);
39
+ return (0, _child_process.execSync)(command, {
40
+ stdio: 'inherit'
41
+ });
42
+ }
43
+
44
+ const isQuiet = 'q';
45
+ const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
46
+
47
+ if (_fs.default.existsSync(outputFolderLocation)) {
48
+ execSyncDefalut(`rm -rf ${outputFolder}`);
49
+ console.log(`previous ${outputFolder} removed`);
50
+ }
51
+
52
+ if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
53
+ execSyncDefalut('rm build.zip');
54
+ console.log('previous build.zip removed');
55
+ } // execSyncDefalut(`${webpack } --version`);
56
+ // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
57
+
58
+
59
+ console.log('webpack compilation starts...');
60
+ const startTime = Date.now(); // const result = spawnSync(
61
+ // webpack,
62
+ // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
63
+ // args
64
+ // ),
65
+ // { stdio: 'inherit' }
66
+ // );
67
+ // --disable_watch=true
68
+
69
+ const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
70
+ result && console.log(result);
71
+
72
+ if (result && result.stderr) {
73
+ throw result.stderr;
74
+ }
75
+
76
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
77
+
78
+ if (zipname) {
79
+ execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
80
+ console.log('build.zip file created');
81
+ const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
82
+ execSyncDefalut(`rm -rf ${zipname}`);
83
+
84
+ if (result && result.stderr) {
85
+ console.log('zip file not created', cssSelectorZipPath);
86
+ console.error(result.stderr);
87
+ } else {
88
+ console.log('zip file created', cssSelectorZipPath);
89
+ }
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
92
+
93
+
94
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
95
+
96
+ function getPaths() {
97
+ return {
98
+ zipname,
99
+ cssSelectorZipPath,
100
+ outputFolderLocation
101
+ };
102
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCliPath = getCliPath;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = require("os");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ let appPath = process.cwd();
15
+ const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
16
+ let isWindows = (0, _os.platform)().toLowerCase() === 'win32';
17
+
18
+ const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
19
+
20
+ const suffixExt = isWindows ? '.cmd' : '';
21
+
22
+ function getCliPath(libName) {
23
+ return _getCliPath(libName) + suffixExt;
24
+ }
@@ -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;
@@ -1,25 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _fs = _interopRequireDefault(require("fs"));
4
-
5
3
  var _path = _interopRequireDefault(require("path"));
6
4
 
7
5
  var _https = _interopRequireDefault(require("https"));
8
6
 
9
- var _os = require("os");
10
-
11
7
  var _express = _interopRequireDefault(require("express"));
12
8
 
13
9
  var _ws = _interopRequireDefault(require("ws"));
14
10
 
15
- var _child_process = require("child_process");
16
-
17
11
  var _httpProxyMiddleware = require("http-proxy-middleware");
18
12
 
19
13
  var _utils = require("../utils");
20
14
 
21
15
  var _httpsOptions = require("./httpsOptions");
22
16
 
17
+ var _devBuild = require("./devBuild");
18
+
23
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
20
 
25
21
  // import webpack from 'webpack';
@@ -28,95 +24,25 @@ let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
28
24
  let {
29
25
  app: {
30
26
  context,
31
- server,
32
- outputFolder
27
+ server
33
28
  }
34
29
  } = options;
35
30
  let {
36
31
  host,
37
32
  port,
38
33
  domain,
39
- mode,
40
34
  disableContextURL,
41
35
  hasMock,
42
36
  mockPort
43
37
  } = server;
44
- let isCompatableHttp2 = Number(process.version.substr(1).split('.')[0]) >= 8;
38
+ let isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
45
39
  let contextURL = disableContextURL ? '' : `/${context}`;
46
40
  let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
47
41
  const {
48
- cssSelectorZipPath
49
- } = options.impactService;
50
- const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
51
-
52
- let outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
53
-
54
- function execSyncDefalut(command) {
55
- console.log(' command running ==>', command);
56
- return (0, _child_process.execSync)(command, {
57
- stdio: 'inherit'
58
- });
59
- }
60
-
61
- let appPath = process.cwd();
62
- const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
63
- const isQuiet = 'q';
64
- let isWindows = (0, _os.platform)().toLowerCase() === 'win32';
65
-
66
- const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
67
-
68
- const suffixExt = isWindows ? '.cmd' : '';
69
-
70
- function getCliPath(libName) {
71
- return _getCliPath(libName) + suffixExt;
72
- }
73
-
74
- let webpack = getCliPath('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
75
-
76
- if (_fs.default.existsSync(outputFolderLocation)) {
77
- execSyncDefalut(`rm -rf ${outputFolder}`);
78
- console.log(`previous ${outputFolder} removed`);
79
- }
80
-
81
- if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
82
- execSyncDefalut('rm build.zip');
83
- console.log('previous build.zip removed');
84
- } // execSyncDefalut(`${webpack } --version`);
85
- // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
86
-
87
-
88
- console.log('webpack compilation starts...');
89
- let startTime = Date.now(); // let result = spawnSync(
90
- // webpack,
91
- // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
92
- // args
93
- // ),
94
- // { stdio: 'inherit' }
95
- // );
96
-
97
- let result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
98
- result && console.log(result);
99
-
100
- if (result && result.stderr) {
101
- throw result.stderr;
102
- }
103
-
104
- console.log(`compailation done in ${Date.now() - startTime}ms`);
105
-
106
- if (zipname) {
107
- execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
108
- console.log('build.zip file created');
109
- let result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
110
- execSyncDefalut(`rm -rf ${zipname}`);
111
-
112
- if (result && result.stderr) {
113
- console.log('zip file not created', cssSelectorZipPath);
114
- console.error(result.stderr);
115
- } else {
116
- console.log('zip file created', cssSelectorZipPath);
117
- }
118
- }
119
-
42
+ zipname,
43
+ cssSelectorZipPath,
44
+ outputFolderLocation
45
+ } = (0, _devBuild.getPaths)();
120
46
  const app = (0, _express.default)();
121
47
 
122
48
  if (hasMock) {
@@ -271,5 +197,4 @@ app.listen(httpPort, err => {
271
197
  domain,
272
198
  port: httpPort
273
199
  }, 'ht' + 'tp')}${contextURL}/`);
274
- });
275
- console.log(`compailation done in ${Date.now() - startTime}ms`);
200
+ });