@fishawack/lab-env 4.4.0 → 4.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 4.5.0 (2022-11-21)
4
+ * [Feature] Preset choice on `fw diagnose` now gives commands suitable to option chosen
5
+ * [Feature] Added preset option of external to `fw diagnose` prompt
6
+ * [Change] Preset is now stored in `.lab-env` config
7
+ * [Change] Bumped diagnose version
8
+
3
9
  ### 4.4.0 (2022-11-17)
4
10
  * [Feature] Added newly setup AWS accounts to the client prompts on `fw provision`
5
11
  * [Bug] Increase nginx buffer size
package/cli.js CHANGED
@@ -28,7 +28,25 @@ const args = hideBin(process.argv);
28
28
  });
29
29
 
30
30
  // Repo commands
31
- let commands = ['start', 'watch', 'setup', 'content', 'production', 'test', 'deploy', 'reinstall', 'install', 'uninstall', 'run', 'check', 'clean', 'nuke', 'regenerate', 'connect', 'execute', 'origin', 'npm', 'script'];
31
+ let commands = ['start', 'watch', 'setup'];
32
+
33
+ if(_.config.preset !== 'external'){
34
+ commands.push('content');
35
+ }
36
+
37
+ commands.push('production', 'test');
38
+
39
+ if(_.config.preset === 'permanent'){
40
+ commands.push('deploy');
41
+ }
42
+
43
+ commands.push('reinstall', 'install', 'uninstall', 'run', 'check', 'clean', 'nuke', 'regenerate', 'connect', 'execute');
44
+
45
+ if(_.config.preset === 'permanent'){
46
+ commands.push('origin');
47
+ }
48
+
49
+ commands.push('npm', 'script');
32
50
 
33
51
  if(_.platform === "laravel"){
34
52
  commands.push('artisan');
@@ -55,8 +73,12 @@ const args = hideBin(process.argv);
55
73
  // Docker commands
56
74
  ['build', 'config', 'down', 'mocha', 'rebuild', 'up', 'volumes', 'compose'].forEach(d => cli.command(...require(`./commands/docker/${d}.js`)));
57
75
 
58
- // Create commands
59
- ['new', 'provision', 'deprovision', 'diagnose', 'delete', 'key', 'dekey'].forEach(d => cli.command(...require(`./commands/create/cmds/${d}.js`)));
76
+ if(_.config.preset === 'permanent'){
77
+ // Create commands
78
+ ['new', 'provision', 'deprovision', 'delete', 'key', 'dekey'].forEach(d => cli.command(...require(`./commands/create/cmds/${d}.js`)));
79
+ }
80
+
81
+ cli.command(...require(`./commands/create/cmds/diagnose.js`))
60
82
 
61
83
  cli.demandCommand(1, '')
62
84
  .wrap(null)
@@ -8,6 +8,7 @@ const _ = require('../../../globals.js');
8
8
  const path = require('path');
9
9
  const {writeFileSync} = require('fs');
10
10
  const os = require('os');
11
+ const { Spinner } = require('../libs/utilities');
11
12
 
12
13
  module.exports = [
13
14
  ['diagnose', 'diag'],
@@ -40,21 +41,23 @@ module.exports = [
40
41
  while(!await test.strict()){
41
42
  await guide.strict();
42
43
  };
43
-
44
- while(!await test.targets()){
45
- await guide.targets();
46
- }
47
-
48
- while(!await test.ftppass()){
49
- await guide.ftppass();
50
- }
51
-
52
- while(!await test.egnyte() || !await egnyte.check()){
53
- await guide.egnyte();
54
- };
55
44
 
56
- while(!await test.watertight()){
57
- await guide.watertight();
45
+ if(preset === "permanent" || preset === "freelancer"){
46
+ while(!await test.targets()){
47
+ await guide.targets();
48
+ }
49
+
50
+ while(!await test.ftppass()){
51
+ await guide.ftppass();
52
+ }
53
+
54
+ while(!await test.egnyte() || !await egnyte.check()){
55
+ await guide.egnyte();
56
+ };
57
+
58
+ while(!await test.watertight()){
59
+ await guide.watertight();
60
+ }
58
61
  }
59
62
 
60
63
  if(preset === "permanent"){
@@ -83,10 +86,11 @@ module.exports = [
83
86
  }
84
87
 
85
88
  // Update diagnosis version in ~/.lab-env config file
86
- if(_.config.diagnosis !== _.diagnosis){
87
- _.config.diagnosis = _.diagnosis;
88
- writeFileSync(path.join(os.homedir(), '', '.lab-env'), JSON.stringify(_.config, null, 4));
89
- }
89
+ let spinner = new Spinner(`Writing options to ${path.join(os.homedir(), '', '.lab-env')}`);
90
+ _.config.diagnosis = _.diagnosis;
91
+ _.config.preset = preset;
92
+ writeFileSync(path.join(os.homedir(), '', '.lab-env'), JSON.stringify(_.config, null, 4));
93
+ spinner.update(`Config updated at ${path.join(os.homedir(), '', '.lab-env')}`);
90
94
  } catch(e){
91
95
  if(e.message){
92
96
  console.log(`\nError: ${e.message}`);
@@ -186,7 +186,8 @@ module.exports.preset = async () => {
186
186
  message: 'What type of developer are you?',
187
187
  choices: [
188
188
  'permanent',
189
- 'freelancer'
189
+ 'freelancer',
190
+ 'external'
190
191
  ]
191
192
  }
192
193
  ]);
package/globals.js CHANGED
@@ -25,7 +25,7 @@ var exec;
25
25
  var running;
26
26
  var services;
27
27
  var branch;
28
- var diagnosis = '1.0.1';
28
+ var diagnosis = '2.0.1';
29
29
  var opts = {encoding: 'utf8', stdio: 'inherit', shell: '/bin/bash'};
30
30
 
31
31
  try{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {