@fishawack/lab-env 1.6.3

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 (58) hide show
  1. package/.gitattributes +1 -0
  2. package/CHANGELOG.md +234 -0
  3. package/README.md +197 -0
  4. package/cli.js +71 -0
  5. package/commands/artisan.js +15 -0
  6. package/commands/check.js +16 -0
  7. package/commands/clean.js +16 -0
  8. package/commands/composer.js +15 -0
  9. package/commands/connect.js +15 -0
  10. package/commands/content.js +10 -0
  11. package/commands/create/cmds/delete.js +27 -0
  12. package/commands/create/cmds/diagnose.js +77 -0
  13. package/commands/create/cmds/new.js +48 -0
  14. package/commands/create/libs/prompts.js +60 -0
  15. package/commands/create/libs/utilities.js +50 -0
  16. package/commands/create/libs/vars.js +95 -0
  17. package/commands/create/services/api.js +3 -0
  18. package/commands/create/services/bitbucket.js +92 -0
  19. package/commands/create/services/egnyte.js +31 -0
  20. package/commands/create/services/git.js +31 -0
  21. package/commands/create/services/gitlab.js +30 -0
  22. package/commands/create/services/guide.js +296 -0
  23. package/commands/create/services/test.js +138 -0
  24. package/commands/deploy.js +23 -0
  25. package/commands/docker/build.js +10 -0
  26. package/commands/docker/config.js +10 -0
  27. package/commands/docker/down.js +10 -0
  28. package/commands/docker/mocha.js +10 -0
  29. package/commands/docker/rebuild.js +10 -0
  30. package/commands/docker/up.js +15 -0
  31. package/commands/docker/volumes.js +27 -0
  32. package/commands/execute.js +21 -0
  33. package/commands/install.js +15 -0
  34. package/commands/npm.js +15 -0
  35. package/commands/nuke.js +17 -0
  36. package/commands/origin.js +126 -0
  37. package/commands/php.js +15 -0
  38. package/commands/production.js +10 -0
  39. package/commands/regenerate.js +16 -0
  40. package/commands/reinstall.js +16 -0
  41. package/commands/run.js +25 -0
  42. package/commands/setup.js +27 -0
  43. package/commands/start.js +33 -0
  44. package/commands/test.js +22 -0
  45. package/commands/uninstall.js +15 -0
  46. package/commands/watch.js +20 -0
  47. package/core/0.0.19/Dockerfile +234 -0
  48. package/core/0.0.19/docker-compose.yml +27 -0
  49. package/core/0.0.19/entrypoint.sh +4 -0
  50. package/globals.js +85 -0
  51. package/intercept.sh +37 -0
  52. package/laravel/8/docker-compose.yml +49 -0
  53. package/laravel/8/nginx/nginx.conf +37 -0
  54. package/laravel/8/php/custom.conf +7 -0
  55. package/package.json +33 -0
  56. package/wordpress/5.7.2/apache/.htaccess +25 -0
  57. package/wordpress/5.7.2/apache/uploads.ini +6 -0
  58. package/wordpress/5.7.2/docker-compose.yml +42 -0
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ * text=auto
package/CHANGELOG.md ADDED
@@ -0,0 +1,234 @@
1
+ ## Changelog
2
+
3
+ ### 1.6.3 (2021-09-16)
4
+ * [Bug] Fixed mySql volume path now syntax has been deprecated
5
+
6
+ ### 1.6.2 (2021-08-26)
7
+ * [Bug] Fixed missing const
8
+
9
+ ### 1.6.1 (2021-08-25)
10
+ * [Bug] Fixed a typo
11
+ * [Bug] Removed need for esm module, use es5 syntax throughout
12
+
13
+ ### 1.6.0 (2021-08-25)
14
+ * [Feature] Diagnose command now checks gitlab credentials
15
+ * [Feature] Diagnose now checks for ssh keys and ssh folder
16
+ * [Feature] Diagnose now checks for ssh config and settings
17
+ * [Feature] Diagnose now prompts for dev type and skips certain tests for freelancers
18
+ * [Change] All ssh keys and config now mounted into container
19
+
20
+ ### 1.5.0 (2021-08-25)
21
+ * [Feature] Diagnose command now prompts for fixes if available
22
+ * [Feature] Diagnose now checks egnyte details are correct
23
+ * [Feature] Diagnose now attempts to connect to bitbucket before trying to fork
24
+
25
+ ### 1.4.0 (2021-08-24)
26
+ * [Feature] Added boilerplate-laravel and boilerplate-wordpress
27
+ * [Change] Debug flag set on wordpress by default
28
+ * [Bug] Fork the sprinkle-base instead of sprinkle
29
+
30
+ ### 1.3.0 (2021-08-23)
31
+ * [Feature] Can now interface with lab-env via the fw namespace
32
+ * [Feature] Added thre new commands - new/delete/diagnose
33
+ * [Feature] Added lab-cli features into lab-env
34
+ * [Change] Bumped update-notifier
35
+
36
+ ### 1.2.0 (2021-08-05)
37
+ * [Feature] New volumes command
38
+ * [Change] Nuke now uses volumes command
39
+
40
+ ### 1.1.3 (2021-07-23)
41
+ * [Bug] Deploy command now correctly throws errors
42
+
43
+ ### 1.1.2 (2021-07-23)
44
+ * [Bug] Moved env.sh load to .profile rather than entrypoint as that fires on each login
45
+
46
+ ### 1.1.1 (2021-07-23)
47
+ * [Feature] Deploy scripts for wordpress/laravel now defer to deploy.sh just like the setup scripts do
48
+ * [Bug] Setup/Deploy now preface script with /bin/bash to circumvent permission issues
49
+
50
+ ### 1.1.0 (2021-07-23)
51
+ * [Feature] Connect command now takes a service or defaults to core if none provided
52
+ * [Feature] Auto load a env.sh file if it exists in the project root
53
+ * [Change] Laravel uses app working directory to be consistent
54
+ * [Change] Laravel/Wordpress both use the core config rather than duplicating
55
+ * [Change] Moved configs internally to consistent folder structure
56
+ * [Change] Bumped core `0.0.17` to `0.0.18`
57
+
58
+ ### 1.0.0 (2021-07-20)
59
+ * [Change] Look in _Scripts for setup.sh on laravel/wordpress builds
60
+ * [Change] Intercept all npm commands
61
+
62
+ ### 0.21.1 (2021-06-30)
63
+ * [Bug] Use xvfb-run on production command now that webdriverio is used instead of casperjs for ui tests
64
+
65
+ ### 0.21.0 (2021-06-28)
66
+ * [Feature] Added in support for wordpress
67
+ * [Feature] Intercept sed commands in setup.sh
68
+ * [Change] Renamed nginx to web in console table
69
+ * [Change] Renamed node to core in console table
70
+
71
+ ### 0.20.2 (2021-06-09)
72
+ * [Bug] Don't throw errors on lab-env nuke if no files there to nuke
73
+ * [Bug] Suppress 130 exit code errors when stopping watch
74
+
75
+ ### 0.20.1 (2021-05-27)
76
+ * [Bug] Always shut down containers if they've been automatically up'd
77
+ * [Bug] Updates to nginx.conf to fix cors issues for assets
78
+
79
+ ### 0.20.0 (2021-05-25)
80
+ * [Change] Output error message from lab-env intself
81
+ * [Bug] New check for Gitlab variable to toggle TTY setting on docker compose exec
82
+
83
+ ### 0.19.0 (2021-05-25)
84
+ * [Change] Bumped core `0.0.16` to `0.0.17`
85
+
86
+ ### 0.18.0 (2021-05-25)
87
+ * [Change] Locked dart-sass version to 1.34.0
88
+ * [Change] Install dart-sass from github rather than dartsass pub
89
+
90
+ ### 0.17.0 (2021-04-28)
91
+ * [Change] Intercept chmod/chown
92
+ * [Change] Run ./setup.sh script directly on laravel builds
93
+ * [Bug] Set shell to bash explicitly
94
+
95
+ ### 0.16.0 (2021-04-28)
96
+ * [Feature] BrowserSync ports are now mapped to the ports shown
97
+ * [Change] Bumped core `0.0.15` to `0.0.16`
98
+ * [Change] Core stays alive in frontend builds so that tests can be more consistent
99
+ * [Change] Ports are now shown in a table view rather than an echo statement
100
+ * [Change] Laravel now uses core instead of node container
101
+ * [Change] Now the core being used more of the base lab-env commands can now be used
102
+ * [Change] Replaced hardcoded working directory with $PWD in core dockerfile profile overrides
103
+ * [Change] Test command more consistent now core used in laravel
104
+ * [Change] Nuke removes only volumes created by project
105
+ * [Change] Core now sets Lang to en_US.UTF-8
106
+ * [Change] The check for laravel now looks in composer for laravel framework now that mix removed
107
+
108
+ ### 0.15.0 (2021-04-23)
109
+ * [Change] All commands now work work with laravel build
110
+ * [Change] Network now named default to be more consistent with core projects
111
+ * [Bug] Ports are now correctly checked and mapped in laravel projects
112
+ * [Bug] Network now correctly removes after stand alone run commands on laravel projects
113
+
114
+ ### 0.14.0 (2021-04-20)
115
+ * [Feature] Can now detect and process laravel 8 builds
116
+ * [Feature] When running inside a laravel project there's 4 new commands - php, node, artisan, composer
117
+ * [Bug] Use node process.cwd instead of bash $PWD as $PWD has issues with case sensitivity
118
+ * [Misc] Internally split out all commands and refactored lab-env code
119
+
120
+ ### 0.13.0 (2021-04-06)
121
+ * [Change] Bumped core `0.0.14` to `0.0.15`
122
+ * [Bug] Added missing chrome flags to sprinkle stand alone banner process so they work inside the container
123
+
124
+ ### 0.12.1 (2021-03-17)
125
+ * [Bug] Create full slugs from bitbucket project names to handle spaces and symbols
126
+ * [Bug] Handle spaces in local path to project repo
127
+
128
+ ### 0.12.0 (2021-03-12)
129
+ * [Feature] New `reinstall` command
130
+ * [Change] Removed the `docker-nuke` and `docker-clean` commands in favor of adding docker system commands to the docs.
131
+ * [Bug] No longer throw error when removing the network if the network was never created
132
+
133
+ ### 0.11.0 (2021-03-08)
134
+ * [Change] Bumped core `0.0.13` to `0.0.14`
135
+ * [Bug] Network now deleted after lab-env finishes
136
+ * [Bug] npm version command now doesn't trigger npm install custom scripts
137
+ * [Bug] Listen for exit code 131
138
+
139
+ ### 0.10.2 (2021-03-01)
140
+ * [Change] Bumped core `0.0.12` to `0.0.13`
141
+
142
+ ### 0.10.1 (2021-03-01)
143
+ * [Bug] Ftp passive overwrite now done by finding exact string
144
+
145
+ ### 0.10.0 (2021-02-18)
146
+ * [Feature] New uninstall command
147
+ * [Change] Bumped core `0.0.11` to `0.0.12`
148
+ * [Bug] Locked npm to version 6 to fix bin issue
149
+ * [Bug] Capture SIGINT calls and silence them
150
+ * [Bug] Capture ELIFECYCLE calls and silence them
151
+
152
+ ### 0.9.6 (2021-02-16)
153
+ * [Change] Bumped core `0.0.10` to `0.0.11`
154
+ * [Bug] Moved from colons to || true in bash profile to fix issue with banner repo's not chaining setup command
155
+
156
+ ### 0.9.5 (2021-02-16)
157
+ * [Change] Bumped core `0.0.9` to `0.0.10`
158
+ * [Bug] Overwrite lftp uploads to egnyte so they don't do it in parallel as it isn't supported by egnyte
159
+ * [Bug] Overwrite lftp upload on deploys so they upload regardless of timestamps
160
+ * [Bug] Only installs chrome and firefox on selinium custom downloads
161
+
162
+ ### 0.9.4 (2021-02-12)
163
+ * [Change] Bumped core `0.0.8` to `0.0.9`
164
+ * [Change] Stream npx and sed commands just so things don't look like they've hung
165
+ * [Bug] Bug fix for repo's with dots in their name
166
+ * [Bug] Overwrite npm variables in package.jsons' as they aren't supported in windows/linux enviroments
167
+
168
+ ### 0.9.3 (2021-02-11)
169
+ * [Bug] Trim repo names
170
+
171
+ ### 0.9.2 (2021-02-11)
172
+ * [Bug] Removed `git-repo-name` dep as it didn't handle dots in repo names
173
+
174
+ ### 0.9.1 (2021-02-11)
175
+ * [Bug] `lab-env origin` command now sets permissions for groups
176
+ * [Bug] `lab-env origin` command no longer checks out branches to set remote tracking
177
+
178
+ ### 0.9.0 (2021-02-10)
179
+ * [Feature] `lab-env origin` command now creates the group and project on gitlab if it doesn't exist
180
+ * [Feature] Added chalk as a dep for some nice coloring
181
+
182
+ ### 0.8.1 (2021-02-05)
183
+ * [Bug] added process.exit(1) to properly exit the cli on error
184
+
185
+ ### 0.8.0 (2021-02-05)
186
+ * [Change] Bumped core `0.0.7` to `0.0.8`
187
+ * [Change] yargs wrapped in try catch to catch cli errors
188
+ * [Change] Removed all exit 0's from cli, should fail properly or gitlab doesn't know when jobs failed
189
+ * [Bug] Removed empty spaces in .bash_profile to stop future errors in docker
190
+
191
+ ### 0.7.0 (2021-02-01)
192
+ * [Change] Bumped core `0.0.6` to `0.0.7`
193
+ * [Bug] Added apt-get update call before pulling imagemagick to stop issue with updates
194
+
195
+ ### 0.6.0 (2021-01-29)
196
+ * [Change] Bumped core `0.0.5` to `0.0.6`
197
+ * [Bug] Added more lang settings
198
+ * [Bug] Fixes weren't being applied to config-grunt node_modules
199
+
200
+ ### 0.5.0 (2021-01-29)
201
+ * [Change] Added save exact flag to npm
202
+ * [Change] Bumped core `0.0.4` to `0.0.5`
203
+ * [Bug] Added lang to dockerfile to fix Unicode characters breaking scripts
204
+
205
+ ### 0.4.0 (2021-01-22)
206
+ * [Feature] Added origin command
207
+ * [Feature] Added rebuild command
208
+ * [Change] Bumped core `0.0.3` to `0.0.4`
209
+ * [Change] Locked chrome and firefox browser versions as well as webdriver drivers
210
+ * [Change] Update notifier now checks instantly
211
+
212
+ ### 0.3.0 (2021-01-20)
213
+ * [Change] Bumped core `0.0.2` to `0.0.3`
214
+
215
+ ### 0.2.0 (2021-01-20)
216
+ * [Feature] Can now pass flags to run and start commands
217
+ * [Feature] Watch command
218
+ * [Change] lab-env docker-nuke and docker-clean now use dockers system functions
219
+ * [Bug] Insert polling option into browser-sync task to fix windows browser reloading
220
+ * [Bug] Hardcoded the cli name to fix windows showing cli.js
221
+ * [Bug] Only overwrite git commit if git not initialized
222
+ * [Bug] Overwrite ftp to no longer toggle passive as passive is default on these days and it was turning it back off
223
+ * [Bug] chmod the id_rsa as windows doesn't persist file permissions and was defaulting to 777
224
+ * [Bug] Now correctly throws errors on git/npm overwritten commands so they can be chained correctly
225
+ * [Docs] Added pre/post publish scripts
226
+
227
+ ### 0.1.0 (2021-01-12)
228
+ * [Bug] Added flag `--disable-dev-shm-usage` to chrome to fix issue when pdf'ing large repo's
229
+ * [Change] Bumped core `0.0.1` to `0.0.2`
230
+ * [Change] Always use the latest core until the first major release of `1.0.0` is done
231
+ * [Docs] Added readme and changelog to repo
232
+
233
+ ### 0.0.1 (2021-01-11)
234
+ * [Misc] Initial release
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ ## Background
2
+
3
+ ### What
4
+
5
+ A command line utility to spin up and manage FW specific docker containers.
6
+
7
+ ### Why
8
+
9
+ To automate the spinning up of our tech stack and to provide a consistent environment for dev and production.
10
+
11
+ ## Dependencies
12
+
13
+ Click on the following links and follow the instructions.
14
+
15
+ * [Docker](https://docs.docker.com/get-docker/)
16
+ * [npm](https://nodejs.org/en/download/)
17
+
18
+ Alternatively you can install via `brew` or `choco` depending on your platform.
19
+
20
+ ### Mac
21
+
22
+ Install brew package manager
23
+
24
+ ```bash
25
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
26
+ ```
27
+
28
+ Install dependencies
29
+
30
+ ```bash
31
+ brew install node
32
+ brew cask install docker
33
+ ```
34
+
35
+ Optionally install `git`
36
+
37
+ ```bash
38
+ brew install git
39
+ ```
40
+
41
+ ### Windows
42
+
43
+ Install choco package manager.
44
+
45
+ > The install command needs to be run in an administrative powershell terminal.
46
+
47
+ ```bash
48
+ Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
49
+ ```
50
+
51
+ Install dependancies
52
+
53
+ ```bash
54
+ choco install nodejs
55
+ choco install docker-desktop
56
+ ```
57
+
58
+ Optionally install `git`
59
+
60
+ ```bash
61
+ choco install git
62
+ ```
63
+
64
+ ## Getting started
65
+
66
+ ### Install
67
+
68
+ ```bash
69
+ npm install @fishawack/lab-env -g
70
+ ```
71
+
72
+ ### Basic usage
73
+
74
+ ```bash
75
+ lab-env setup && lab-env start
76
+ ```
77
+
78
+ ## Commands
79
+
80
+ To see the full command list and a description of each command run the following command.
81
+
82
+ ```bash
83
+ lab-env --help
84
+ ```
85
+
86
+ ## Troubleshooting
87
+
88
+ ### Permission denied when mounting nginx conf (Laravel)
89
+
90
+ #### Problem
91
+
92
+ This happens when your using NodeJs installed into the root filesystem (/usr/local/bin), you may see errors similar to this:
93
+
94
+ ```bash
95
+ ERROR: for nginx Cannot start service nginx: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting "/usr/local/lib/node_modules/@fishawack/lab-env/laravel/8/nginx/nginx.conf" to rootfs at "/var/lib/docker/overlay2/1ea9b758b732df7b4fe4dd5e1bd57836967bfde1d9a1ae44ca1a5c0d6e95db5c/merged/etc/nginx/conf.d/default.conf" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
96
+ ```
97
+
98
+ #### Solution
99
+
100
+ Purge your NodeJs installation and install it via NVM [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm)
101
+
102
+ ### mySql creds
103
+
104
+
105
+ ### No space left
106
+
107
+ #### Problem
108
+
109
+ Docker has 64gb of space by default. If you see the below message you need to have a sping clean and free up some space or give docker more memory.
110
+
111
+ ```bash
112
+ npm WARN tar ENOSPC: no space left on device, write
113
+ ```
114
+
115
+ #### Solution
116
+
117
+ [Clean](#lab-env-troubleshooting-memory-limit) up your docker.
118
+
119
+ ### mySql creds
120
+
121
+ #### Problem
122
+
123
+ When a project is first setup the mysql container will create any tables needed based on whats found in the .env file. If the database details are modified in the .env file after the first run those new tables will not be created resulting in the site not being able to connect to mysql.
124
+
125
+ ```bash
126
+ Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = fide and table_name = migrations)
127
+ ```
128
+
129
+ #### Solution
130
+
131
+ The volume needs removing and re-setting up, the easiest way to do this is to commit everything in and re-setup the project.
132
+
133
+ ```bash
134
+ # Commit/Stash so you don't lose any work
135
+ git stash
136
+
137
+ lab-env nuke
138
+ lab-env setup
139
+
140
+ git stash pop
141
+ ```
142
+
143
+ ### Watch / Case sensitive issues
144
+
145
+ #### Problem
146
+
147
+ As of docker desktop 3.2.2, if you cd into a directory without correctly matching the case of the folders in your working tree, then you can run into some strange issues, one of them being laravel mix not triggering a watch on javascript or sass files correctly but still working fine for html/twig/blade files.
148
+
149
+ #### Solution
150
+
151
+ Always match the case as it exists in your directory structure.
152
+
153
+ ```bash
154
+ // Bad (but will work fine for the most part)
155
+ cd /Users/mmellor/sites/boilerplate
156
+
157
+ // Good (notice the case in the 'Sites' folder name)
158
+ cd /Users/mmellor/Sites/boilerplate
159
+ ```
160
+
161
+ ### Memory limit
162
+
163
+ By default Docker will assign 64gb of memory for Docker to utilize. After a while of using `lab-env` and potentially other docker setups you may come close to or exceed that limit. To see how much memory docker is using type the following command.
164
+
165
+ ```bash
166
+ docker system df -v
167
+ ```
168
+
169
+ If you want a full clean up of docker then running the following command will remove all containers, volumes, images and caches.
170
+
171
+ ```bash
172
+ docker system prune --all --volumes -f
173
+ ```
174
+
175
+ If you just want to remove the images and containers so they can be built fresh then run the following.
176
+
177
+ ```bash
178
+ docker system prune --all -f
179
+ ```
180
+
181
+ You can also run the slightly less impactful clean command but this command wouldn't do much if you're only use of docker is through `lab-env` as this tool doesn't currently persist any containers between runs.
182
+
183
+ ```bash
184
+ docker system prune -f
185
+ ```
186
+
187
+ If you notice it's mainly the volumes that are taking up all the space then you can either clean out all volumes (this will remove every projects node_modules folder meaning they'll need re-installing).
188
+
189
+ ```bash
190
+ docker volume rm $(docker volume ls -q)
191
+ ```
192
+
193
+ Or you can target specific node_modules and hand pick which ones to remove. For example:
194
+
195
+ ```bash
196
+ docker volume rm boilerplate_node_modules
197
+ ```
package/cli.js ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+
3
+ const _ = require('./globals.js');
4
+
5
+ const updateNotifier = require('update-notifier');
6
+ const pkg = require('./package.json');
7
+ updateNotifier({pkg, updateCheckInterval: 0}).notify();
8
+
9
+ const execSync = require('child_process').execSync;
10
+
11
+ const getPort = require('get-port');
12
+
13
+ const yargs = require('yargs/yargs');
14
+ const { hideBin } = require('yargs/helpers');
15
+
16
+ const args = hideBin(process.argv);
17
+
18
+ (async () => {
19
+ process.env.PORT = await getPort({port: getPort.makeRange(3000, 3100)});
20
+ process.env.PORT_OPT = +process.env.PORT + 1;
21
+ process.env.REPO = _.repo;
22
+ process.env.CWD = process.cwd();
23
+
24
+ if(_.platform === "laravel" || _.platform === "wordpress"){
25
+ process.env.PORT_WEB = await getPort({port: getPort.makeRange(8000, 8100)});
26
+ process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
27
+ }
28
+
29
+ try{
30
+ let cli = yargs(args)
31
+ .scriptName("fw")
32
+ .parserConfiguration({
33
+ 'unknown-options-as-args': true
34
+ });
35
+
36
+ // Repo commands
37
+ let commands = ['start', 'watch', 'setup', 'content', 'production', 'test', 'deploy', 'reinstall', 'install', 'uninstall', 'run', 'check', 'clean', 'nuke', 'regenerate', 'connect', 'execute', 'origin', 'npm'];
38
+
39
+ if(_.platform === "laravel"){
40
+ commands.push('artisan', 'composer', 'php');
41
+ }
42
+
43
+ commands.forEach(d => cli.command(...require(`./commands/${d}.js`)));
44
+
45
+ // Docker commands
46
+ ['build', 'config', 'down', 'mocha', 'rebuild', 'up', 'volumes'].forEach(d => cli.command(...require(`./commands/docker/${d}.js`)));
47
+
48
+ // Create commands
49
+ ['new', 'diagnose', 'delete'].forEach(d => cli.command(...require(`./commands/create/cmds/${d}.js`)));
50
+
51
+ cli.demandCommand(1, '')
52
+ .wrap(null)
53
+ .strict()
54
+ .argv;
55
+ } catch(e){
56
+ if(e.status !== 130){
57
+ console.log(e.message);
58
+ }
59
+
60
+ shutdown();
61
+
62
+ process.exit(1);
63
+ }
64
+
65
+ shutdown();
66
+ })();
67
+
68
+ // Remove network leftover by docker-compose run
69
+ function shutdown(){
70
+ try{ execSync(`docker network rm ${_.repo_safe}_default &>/dev/null`, _.opts); } catch(e){}
71
+ }