-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathinstall.js
38 lines (28 loc) · 1.34 KB
/
install.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
const os = require('os');
const fs = require('fs');
const path = require('path');
const process = require('process');
const execSync = require('child_process').execSync;
const rootDir = path.dirname(require.main.filename);
process.chdir(rootDir + '/api');
let outputComposer = execSync('composer install');
console.log(outputComposer.toString());
let outputCopyEnvAPI = os.type() === 'Windows_NT' ? execSync('copy .env.example .env') : execSync('cp .env.example .env');
console.log(outputCopyEnvAPI.toString());
let outputKeyGenerate = execSync('php artisan key:generate');
console.log(outputKeyGenerate.toString());
process.chdir(rootDir + '/web');
let outputNPMInstall = execSync('npm install');
console.log(outputNPMInstall.toString());
let outputCopyEnvWEB = os.type() === 'Windows_NT' ? execSync('copy .env.example .env') : execSync('cp .env.example .env');
console.log(outputCopyEnvWEB.toString());
if (!fs.existsSync(path.join(rootDir, '.vscode'))) {
fs.mkdirSync(path.join(rootDir, '.vscode'));
console.log('.vscode folder created.');
const settingsData = {
'eslint.workingDirectories': ['./web']
};
const settingsJson = JSON.stringify(settingsData, null, 2);
fs.writeFileSync(path.join(rootDir, '.vscode/settings.json'), settingsJson);
console.log('settings.json file created.');
}