-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
setup.js
executable file
·61 lines (50 loc) · 1.72 KB
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env node
const meow = require('meow');
const colors = require('colors');
const path = require('path');
const run = require('./_setup/runCommand.js');
const setupVersion = require('./_setup/setupVersion.js');
const versionsRecursively = require('./_setup/versionsRecursively.js');
const getVersions = require('./_setup/getVersions.js');
const program = require('./_setup/program.js');
const compileExample = require('./_setup/compileExample');
const cli = meow(`
Install all Laravel versions
$ node setup.js
Install given Laravel version
$ node setup.js {LaravelVersion}
Options
--verbose, -v Output composer / npm output
--ignore-example, -ix Do not update and build the example repo
Examples
$ node setup.js
$ node setup.js "7.*"
`, {
flags: {
verbose: {
type: 'boolean',
alias: 'v'
},
ignoreExample: {
type: 'boolean',
alias: 'ix'
}
}
});
async function main () {
const currentDirectory = process.cwd();
const exampleDirectory = path.resolve(currentDirectory, 'example');
if (cli.flags.ignoreExample === false) {
// Update the example
console.log(colors.green('🚀 Preparing example'))
console.log(' ')
await run('composer', ['update'], exampleDirectory, cli.flags.verbose)
await run('npm', ['install'], exampleDirectory, cli.flags.verbose)
await compileExample(exampleDirectory, cli.flags.verbose)
}
const useGivenVersions = getVersions(cli.input);
await versionsRecursively(useGivenVersions, async function (version) {
await setupVersion(version, currentDirectory, cli.flags.verbose)
});
}
program(process, cli, 'Preparing', main)