@redhat-cloud-services/frontend-components-config 4.6.39 → 4.7.0

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/bin/fec.js CHANGED
@@ -56,6 +56,15 @@ const argv = yargs
56
56
  describe: 'Path to webpack config',
57
57
  })
58
58
  })
59
+ .option('clouddotEnv', {
60
+ describe: "Set platform environment ['stage', 'prod', 'qa', 'ci']",
61
+ type: 'string',
62
+ })
63
+ .option('uiEnv', {
64
+ describe: "Set Chrome environment ['beta', 'stable']",
65
+ type: 'string',
66
+ })
67
+ .example('$0 dev --clouddotEnv=stage --uiEnv=stable', 'Example of usage in non-interactive environments')
59
68
  .help()
60
69
  .argv;
61
70
 
@@ -66,7 +75,10 @@ const scripts = {
66
75
  static(argv, cwd)
67
76
  },
68
77
  'patch-etc-hosts': patchHosts,
69
- dev: devScript,
78
+ dev: (argv, cwd) => {
79
+ validateFECConfig(cwd)
80
+ devScript(argv, cwd)
81
+ },
70
82
  build: buildScript
71
83
  };
72
84
 
@@ -74,7 +86,7 @@ const args = [ argv, cwd ];
74
86
 
75
87
  function run() {
76
88
  if (!argv._.length || argv._.length === 0) {
77
- console.error('Script name name must be specified. Run fec --help for more information.');
89
+ console.error('Script name must be specified. Run fec --help for more information.');
78
90
  process.exit(1);
79
91
  }
80
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/frontend-components-config",
3
- "version": "4.6.39",
3
+ "version": "4.7.0",
4
4
  "description": "Config plugins and settings for RedHat Cloud Services project.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -21,7 +21,7 @@
21
21
  "homepage": "https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#readme",
22
22
  "dependencies": {
23
23
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.8",
24
- "@redhat-cloud-services/frontend-components-config-utilities": "^1.5.27",
24
+ "@redhat-cloud-services/frontend-components-config-utilities": "^1.5.28",
25
25
  "assert": "^2.0.0",
26
26
  "axios": "^0.27.2",
27
27
  "babel-loader": "^8.2.5",
@@ -39,7 +39,28 @@ async function devScript(argv, cwd) {
39
39
  } else {
40
40
  configPath = resolve(__dirname, './dev.webpack.config.js');
41
41
  }
42
- await setEnv(cwd);
42
+
43
+ const clouddotEnvOptions = ['stage', 'prod', 'qa', 'ci'];
44
+ const uiEnvOptions = ['beta', 'stable'];
45
+ if (argv?.clouddotEnv && argv?.uiEnv) {
46
+ if (clouddotEnvOptions.includes(argv.clouddotEnv) && uiEnvOptions.includes(argv.uiEnv)) {
47
+ process.env.BETA = argv.uiEnv;
48
+ process.env.CLOUDOT_ENV = argv.clouddotEnv;
49
+ process.env.FEC_ROOT_DIR = cwd;
50
+ } else {
51
+ console.error(
52
+ 'Incorrect argument value:\n--clouddotEnv must be one of: [',
53
+ clouddotEnvOptions.toString(),
54
+ ']\n--uiEnv must be one of: [',
55
+ uiEnvOptions.toString(),
56
+ ']\nRun fec --help for more information.'
57
+ );
58
+ process.exit(1);
59
+ }
60
+ } else {
61
+ await setEnv(cwd);
62
+ }
63
+
43
64
  spawn(`npm exec -- webpack serve -c ${configPath}`, [], {
44
65
  stdio: [process.stdout, process.stdout, process.stdout],
45
66
  cwd,