@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.
- package/.gitattributes +1 -0
- package/CHANGELOG.md +234 -0
- package/README.md +197 -0
- package/cli.js +71 -0
- package/commands/artisan.js +15 -0
- package/commands/check.js +16 -0
- package/commands/clean.js +16 -0
- package/commands/composer.js +15 -0
- package/commands/connect.js +15 -0
- package/commands/content.js +10 -0
- package/commands/create/cmds/delete.js +27 -0
- package/commands/create/cmds/diagnose.js +77 -0
- package/commands/create/cmds/new.js +48 -0
- package/commands/create/libs/prompts.js +60 -0
- package/commands/create/libs/utilities.js +50 -0
- package/commands/create/libs/vars.js +95 -0
- package/commands/create/services/api.js +3 -0
- package/commands/create/services/bitbucket.js +92 -0
- package/commands/create/services/egnyte.js +31 -0
- package/commands/create/services/git.js +31 -0
- package/commands/create/services/gitlab.js +30 -0
- package/commands/create/services/guide.js +296 -0
- package/commands/create/services/test.js +138 -0
- package/commands/deploy.js +23 -0
- package/commands/docker/build.js +10 -0
- package/commands/docker/config.js +10 -0
- package/commands/docker/down.js +10 -0
- package/commands/docker/mocha.js +10 -0
- package/commands/docker/rebuild.js +10 -0
- package/commands/docker/up.js +15 -0
- package/commands/docker/volumes.js +27 -0
- package/commands/execute.js +21 -0
- package/commands/install.js +15 -0
- package/commands/npm.js +15 -0
- package/commands/nuke.js +17 -0
- package/commands/origin.js +126 -0
- package/commands/php.js +15 -0
- package/commands/production.js +10 -0
- package/commands/regenerate.js +16 -0
- package/commands/reinstall.js +16 -0
- package/commands/run.js +25 -0
- package/commands/setup.js +27 -0
- package/commands/start.js +33 -0
- package/commands/test.js +22 -0
- package/commands/uninstall.js +15 -0
- package/commands/watch.js +20 -0
- package/core/0.0.19/Dockerfile +234 -0
- package/core/0.0.19/docker-compose.yml +27 -0
- package/core/0.0.19/entrypoint.sh +4 -0
- package/globals.js +85 -0
- package/intercept.sh +37 -0
- package/laravel/8/docker-compose.yml +49 -0
- package/laravel/8/nginx/nginx.conf +37 -0
- package/laravel/8/php/custom.conf +7 -0
- package/package.json +33 -0
- package/wordpress/5.7.2/apache/.htaccess +25 -0
- package/wordpress/5.7.2/apache/uploads.ini +6 -0
- package/wordpress/5.7.2/docker-compose.yml +42 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
['artisan [command...]', 'art'],
|
|
7
|
+
'run artisan command',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('command', {
|
|
10
|
+
describe: 'command to run',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} ${_.method} php bash -lc "php artisan ${argv.command.join(' ')}"`, _.opts)
|
|
15
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
'check',
|
|
7
|
+
'check if node modules are missing or outdated',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.option('verbose', {
|
|
10
|
+
alias: 'v',
|
|
11
|
+
describe: 'Show breakdown of packages',
|
|
12
|
+
type: 'boolean'
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
argv => execSync(`${_.docker} ${_.run}c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mDeps OK\\033[0m' || { echo -e '\\033[0;31mDeps missing or outdated\\033[0m'; }"`, _.opts)
|
|
16
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
'clean',
|
|
7
|
+
'cleans out dependencies',
|
|
8
|
+
yargs => {},
|
|
9
|
+
argv => {
|
|
10
|
+
execSync(`${_.docker} ${_.run}c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
11
|
+
|
|
12
|
+
if(_.platform === "laravel"){
|
|
13
|
+
execSync(`${_.docker} ${_.method} php bash -lc "git clean -xfd vendor/ 2>/dev/null || true"`, _.opts);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
'composer [command...]',
|
|
7
|
+
'run composer command',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('command', {
|
|
10
|
+
describe: 'command to run',
|
|
11
|
+
default: ''
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} ${_.method} php bash -lc "composer ${argv.command.join(' ')}"`, _.opts)
|
|
15
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
'connect [container]',
|
|
7
|
+
'jump into container',
|
|
8
|
+
yargs => {
|
|
9
|
+
yargs.positional('container', {
|
|
10
|
+
describe: 'container to connect to',
|
|
11
|
+
default: 'core'
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
argv => execSync(`${_.docker} ${_.method} ${argv.container} bash -l`, _.opts)
|
|
15
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const _ = require('../globals.js');
|
|
2
|
+
|
|
3
|
+
const execSync = require('child_process').execSync;
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
'content',
|
|
7
|
+
'pulls any external content and assets into the repo',
|
|
8
|
+
yargs => {},
|
|
9
|
+
argv => execSync(`${_.docker} ${_.run}c "npm run content"`, _.opts)
|
|
10
|
+
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const bitbucket = require('../services/bitbucket');
|
|
2
|
+
const utils = require('../libs/utilities');
|
|
3
|
+
|
|
4
|
+
module.exports = [
|
|
5
|
+
'delete <name>',
|
|
6
|
+
'Deletes a repository',
|
|
7
|
+
yargs => {
|
|
8
|
+
yargs.positional('name', {
|
|
9
|
+
describe: 'name of repo'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
yargs.option('confirm', {
|
|
13
|
+
alias: 'y',
|
|
14
|
+
describe: 'Confirm you want to run this command',
|
|
15
|
+
type: 'boolean'
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
async argv => {
|
|
19
|
+
if(argv.y){
|
|
20
|
+
if(await bitbucket.exists(argv.name)){
|
|
21
|
+
await bitbucket.remove(argv.name);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
console.log(utils.colorize('-y flag must be passed to confirm (this process cannot be undone)', 'info'));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const vars = require('../libs/vars');
|
|
2
|
+
const bitbucket = require('../services/bitbucket');
|
|
3
|
+
const egnyte = require("../services/egnyte");
|
|
4
|
+
const gitlab = require("../services/gitlab");
|
|
5
|
+
const guide = require("../services/guide");
|
|
6
|
+
const test = require("../services/test");
|
|
7
|
+
|
|
8
|
+
module.exports = [
|
|
9
|
+
['diagnose', 'diag'],
|
|
10
|
+
'Check if environment is setup correctly',
|
|
11
|
+
yargs => {},
|
|
12
|
+
async argv => {
|
|
13
|
+
try{
|
|
14
|
+
let preset = await guide.preset();
|
|
15
|
+
|
|
16
|
+
while(!await test.ssh()){
|
|
17
|
+
await guide.ssh();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
while(!await test.key()){
|
|
21
|
+
await guide.key();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
while(!await test.config()){
|
|
25
|
+
await guide.config();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
while(!await test.ignore()){
|
|
29
|
+
await guide.ignore();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
while(!await test.strict()){
|
|
33
|
+
await guide.strict();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
while(!await test.targets()){
|
|
37
|
+
await guide.targets();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
while(!await test.ftppass()){
|
|
41
|
+
await guide.ftppass();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
while(!await test.egnyte() || !await egnyte.check()){
|
|
45
|
+
await guide.egnyte();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if(preset === "permanent"){
|
|
49
|
+
while(!await test.misc()){
|
|
50
|
+
await guide.misc();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
while(!await test.bitbucket() || !await bitbucket.check()){
|
|
54
|
+
await guide.bitbucket();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
while(!await test.gitlab() || !await gitlab.check()){
|
|
58
|
+
await guide.gitlab();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const userRepoName = vars.misc.bitbucket.username.split('@')[0].replace(/\./, '-');
|
|
62
|
+
|
|
63
|
+
// Check ability to create and delete Bitbucket repos
|
|
64
|
+
if(!await bitbucket.exists(userRepoName)){
|
|
65
|
+
await bitbucket.fork(userRepoName, {name: 'boilerplate'});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await bitbucket.remove(userRepoName);
|
|
69
|
+
}
|
|
70
|
+
} catch(e){
|
|
71
|
+
if(e.message){
|
|
72
|
+
console.log(`\nError: ${e.message}`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const prompts = require('../libs/prompts');
|
|
2
|
+
const utilities = require('../libs/utilities');
|
|
3
|
+
const vars = require('../libs/vars');
|
|
4
|
+
const bitbucket = require('../services/bitbucket');
|
|
5
|
+
const execSync = require('child_process').execSync;
|
|
6
|
+
|
|
7
|
+
module.exports = [
|
|
8
|
+
'new [name]',
|
|
9
|
+
'Creates a new repository',
|
|
10
|
+
yargs => {
|
|
11
|
+
yargs.positional('name', {
|
|
12
|
+
describe: 'name of repo'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
yargs.option('template', {
|
|
16
|
+
alias: 't',
|
|
17
|
+
describe: 'Template to fork from',
|
|
18
|
+
type: 'string'
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
async argv => {
|
|
22
|
+
const answers = await prompts.generatePrompts(argv);
|
|
23
|
+
|
|
24
|
+
let template = vars.templates.find(d => d.name === answers.template);
|
|
25
|
+
|
|
26
|
+
if(!template){
|
|
27
|
+
console.log(utilities.colorize(`Template ${answers.template} not a valid template type`, 'error'));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let name = `${template.prefix ? `${template.prefix}-` : ''}${answers.name}`;
|
|
32
|
+
|
|
33
|
+
if(/^[a-zA-Z0-9-_.]+$/.test(name)){
|
|
34
|
+
// Create Remote Repositories
|
|
35
|
+
if(!await bitbucket.exists(name)){
|
|
36
|
+
if(await bitbucket.exists(template.name)){
|
|
37
|
+
await bitbucket.fork(name, template);
|
|
38
|
+
|
|
39
|
+
execSync(`echo "git clone ${vars.urls.bitbucketSSH}/${name}" | pbcopy`);
|
|
40
|
+
|
|
41
|
+
console.log(utilities.colorize(`git clone ${vars.urls.bitbucketSSH}/${name} (copied to clipboard)`, 'title'));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
console.log(utilities.colorize(`Repo name can contain only letters, digits, '_', '-' and '.'`, 'helper'));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const inquirer = require('inquirer');
|
|
2
|
+
|
|
3
|
+
const { templates } = require('./vars');
|
|
4
|
+
|
|
5
|
+
const addPrompt = module.exports.addPrompt = (type, prompts, flags) => {
|
|
6
|
+
switch(type) {
|
|
7
|
+
case 'templateType':
|
|
8
|
+
return prompts.push({
|
|
9
|
+
type: 'list',
|
|
10
|
+
name: 'templateType',
|
|
11
|
+
message: 'Which template type do you need?',
|
|
12
|
+
choices: templates.reduce((a, b) => {
|
|
13
|
+
if(a.indexOf(b.type) === -1){
|
|
14
|
+
a.push(b.type);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
}, []),
|
|
18
|
+
default: 'boilerplate'
|
|
19
|
+
});
|
|
20
|
+
case 'template':
|
|
21
|
+
return prompts.push({
|
|
22
|
+
type: 'list',
|
|
23
|
+
name: 'template',
|
|
24
|
+
message: 'What template do you need?',
|
|
25
|
+
choices: answers => templates.filter(d => d.type === answers.templateType),
|
|
26
|
+
default: 'boilerplate'
|
|
27
|
+
});
|
|
28
|
+
case 'name':
|
|
29
|
+
return prompts.push({
|
|
30
|
+
type: 'input',
|
|
31
|
+
name: 'name',
|
|
32
|
+
message: answers => {
|
|
33
|
+
let template = templates.find(d => d.name === (answers.template || flags.template)) || {};
|
|
34
|
+
|
|
35
|
+
return `What will the name of your new repo be?${template.prefix ? `\n (e.g. 'widaloo' becomes '${template.prefix}-widaloo')\n` : ''}`;
|
|
36
|
+
},
|
|
37
|
+
validate: input => input.length > 0
|
|
38
|
+
});
|
|
39
|
+
default:
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
module.exports.generatePrompts = async flags => {
|
|
45
|
+
const prompts = [];
|
|
46
|
+
|
|
47
|
+
// Push prompts to prompt array
|
|
48
|
+
flags.template || addPrompt('templateType', prompts, flags);
|
|
49
|
+
flags.template || addPrompt('template', prompts, flags);
|
|
50
|
+
flags.name || addPrompt('name', prompts, flags);
|
|
51
|
+
|
|
52
|
+
// Invoke prompts and retrieve answers
|
|
53
|
+
const answers = await inquirer.prompt(prompts);
|
|
54
|
+
|
|
55
|
+
// Return answer values, otherwise use default flag values
|
|
56
|
+
return {
|
|
57
|
+
...flags,
|
|
58
|
+
...answers
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const ora = require('ora');
|
|
3
|
+
|
|
4
|
+
// Text
|
|
5
|
+
module.exports.capitalize = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
6
|
+
|
|
7
|
+
const colorize = module.exports.colorize = (str, type) => {
|
|
8
|
+
switch (type) {
|
|
9
|
+
case 'success':
|
|
10
|
+
return chalk.green(str);
|
|
11
|
+
case 'error':
|
|
12
|
+
return chalk.red(str);
|
|
13
|
+
case 'title':
|
|
14
|
+
return chalk.hex('#edb879').bold(str);
|
|
15
|
+
case 'helper':
|
|
16
|
+
return chalk.hex('#41B883').bold(str);
|
|
17
|
+
case 'info':
|
|
18
|
+
return chalk.hex('#61dafb').bold(str);
|
|
19
|
+
case 'divider':
|
|
20
|
+
return chalk.yellow.bold(str);
|
|
21
|
+
default:
|
|
22
|
+
return str;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
module.exports.Spinner = class Spinner {
|
|
27
|
+
constructor(startMessage) {
|
|
28
|
+
this.ora = ora(colorize(startMessage, 'info')).start();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
update(message, status) {
|
|
32
|
+
if (status === 'fail') {
|
|
33
|
+
this.ora.fail(colorize(message, 'error'));
|
|
34
|
+
} else if (status === 'info') {
|
|
35
|
+
this.ora.info(colorize(message, 'info'));
|
|
36
|
+
} else {
|
|
37
|
+
this.ora.succeed(colorize(message, status || 'success'));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports.encode = (username, password) => {
|
|
43
|
+
const userPassBuffer = Buffer.from(`${username}:${password}`);
|
|
44
|
+
const base64data = userPassBuffer.toString('base64');
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
"Content-Type": "application/json",
|
|
48
|
+
"Authorization": `Basic ${base64data}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { encode } = require('./utilities');
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
var miscFile;
|
|
7
|
+
|
|
8
|
+
try{
|
|
9
|
+
miscFile = JSON.parse(fs.readFileSync(path.join(os.homedir(), 'targets', 'misc.json')));
|
|
10
|
+
} catch(e){
|
|
11
|
+
miscFile = {
|
|
12
|
+
bitbucket: {},
|
|
13
|
+
gitlab: {}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Misc
|
|
18
|
+
const misc = module.exports.misc = miscFile;
|
|
19
|
+
|
|
20
|
+
var ftppassFile;
|
|
21
|
+
|
|
22
|
+
try{
|
|
23
|
+
ftppassFile = JSON.parse(fs.readFileSync(path.join(os.homedir(), 'targets', '.ftppass'), { encoding: 'utf8' }));
|
|
24
|
+
} catch(e){
|
|
25
|
+
ftppassFile = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ftppass
|
|
29
|
+
module.exports.ftppass = ftppassFile;
|
|
30
|
+
|
|
31
|
+
// APIs
|
|
32
|
+
const bitbucketApi = module.exports.bitbucketApi = 'https://api.bitbucket.org/2.0/repositories';
|
|
33
|
+
|
|
34
|
+
module.exports.apis = {
|
|
35
|
+
bbWorkspaceAPI: `${bitbucketApi}/${misc.bitbucket.workspace}`
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// URLs
|
|
39
|
+
module.exports.urls = {
|
|
40
|
+
bitbucketSSH: `git@bitbucket.org:${misc.bitbucket.workspace}`
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Request Headers
|
|
44
|
+
module.exports.headers = {
|
|
45
|
+
bbHeaders: encode(misc.bitbucket.username, misc.bitbucket.password)
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
module.exports.templates = [
|
|
49
|
+
{
|
|
50
|
+
"name": "boilerplate",
|
|
51
|
+
"type": "boilerplate"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "boilerplate-vue",
|
|
55
|
+
"type": "boilerplate"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "boilerplate-wordpress",
|
|
59
|
+
"type": "boilerplate"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "boilerplate-laravel",
|
|
63
|
+
"type": "boilerplate"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "sprinkle-base",
|
|
67
|
+
"type": "framework",
|
|
68
|
+
"project": "SPRINK",
|
|
69
|
+
"prefix": "banners"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "stream",
|
|
73
|
+
"type": "framework",
|
|
74
|
+
"project": "STREAM",
|
|
75
|
+
"prefix": "stream"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "torpedo",
|
|
79
|
+
"type": "framework",
|
|
80
|
+
"project": "TOR",
|
|
81
|
+
"prefix": "torpedo"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "wave",
|
|
85
|
+
"type": "product",
|
|
86
|
+
"project": "WAVE",
|
|
87
|
+
"prefix": "wave"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "plant",
|
|
91
|
+
"type": "product",
|
|
92
|
+
"project": "PLAN",
|
|
93
|
+
"prefix": "plant"
|
|
94
|
+
}
|
|
95
|
+
];
|