Skip to content

Commit 3bfc0c2

Browse files
committedDec 27, 2017
re-enable prestart script
1 parent fc997ae commit 3bfc0c2

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ jsdoc-conf.json
4848
jsdoc.json
4949
packages/nova-router/.npm
5050
npm-debug.log
51+
52+
.meteor/.id

‎.vulcan/prestart_vulcan.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env node
2+
3+
//Functions
4+
var fs = require('fs');
5+
function existsSync(filePath){
6+
try{
7+
fs.statSync(filePath);
8+
}catch(err){
9+
if(err.code == 'ENOENT') return false;
10+
}
11+
return true;
12+
}
13+
14+
function copySync(origin,target){
15+
try{
16+
fs.writeFileSync(target, fs.readFileSync(origin));
17+
}catch(err){
18+
if(err.code == 'ENOENT') return false;
19+
}
20+
return true;
21+
}
22+
23+
//Add Definition Colors
24+
const chalk = require('chalk');
25+
26+
//Vulcan letters
27+
console.log(chalk.gray(' ___ ___ '));
28+
console.log(chalk.gray(' '+String.fromCharCode(92))+chalk.redBright(String.fromCharCode(92))+chalk.dim.yellow(String.fromCharCode(92))+chalk.gray(String.fromCharCode(92)+' /')+chalk.dim.yellow('/')+chalk.yellowBright('/')+chalk.gray('/'));
29+
console.log(chalk.gray(' '+String.fromCharCode(92))+chalk.redBright(String.fromCharCode(92))+chalk.dim.yellow(String.fromCharCode(92))+chalk.gray(String.fromCharCode(92))+chalk.gray('/')+chalk.dim.yellow('/')+chalk.yellowBright('/')+chalk.gray('/ Vulcan.js'));
30+
console.log(chalk.gray(' '+String.fromCharCode(92))+chalk.redBright(String.fromCharCode(92))+chalk.dim.yellow(String.fromCharCode(92))+chalk.dim.yellow('/')+chalk.yellowBright('/')+chalk.gray('/ The full-stack React+GraphQL framework'));
31+
console.log(chalk.gray(' ──── '));
32+
33+
34+
var os = require('os');
35+
var exec = require('child_process').execSync;
36+
var options = {
37+
encoding: 'utf8'
38+
};
39+
//Check Meteor and install if not installed
40+
var checker = exec("meteor --version", options);
41+
if (!checker.includes("Meteor ")) {
42+
console.log("Vulcan requires Meteor but it's not installed. Trying to Install...");
43+
//Check platform
44+
if (os.platform()=='darwin') {
45+
//Mac OS platform
46+
console.log("🌋 "+chalk.bold.yellow("Good news you have a Mac and we will install it now! }"));
47+
console.log(exec("curl https://install.meteor.com/ | bash", options));
48+
} else if (os.platform()=='linux') {
49+
//GNU/Linux platform
50+
console.log("🌋 "+chalk.bold.yellow("Good news you are on GNU/Linux platform and we will install Meteor now!"));
51+
console.log(exec("curl https://install.meteor.com/ | bash", options));
52+
} else if (os.platform()=='win32') {
53+
//Windows NT platform
54+
console.log("> "+chalk.bold.yellow("Oh no! you are on a Windows platform and you will need to install Meteor Manually!"));
55+
console.log("> "+chalk.dim.yellow("Meteor for Windows is available at: ")+chalk.redBright("https://install.meteor.com/windows"));
56+
process.exit(-1)
57+
}
58+
} else {
59+
//Check exist file settings and create if not exist
60+
if (!existsSync("settings.json")) {
61+
console.log("> "+chalk.bold.yellow("Creating your own settings.json file...\n"));
62+
if (!copySync("sample_settings.json","settings.json")) {
63+
console.log("> "+chalk.bold.red("Error Creating your own settings.json file...check files and permissions\n"));
64+
process.exit(-1);
65+
}
66+
}
67+
68+
console.log("> "+chalk.bold.yellow("Happy hacking with Vulcan!"));
69+
console.log("> "+chalk.dim.yellow("The docs are available at: ")+chalk.redBright("http://docs.vulcanjs.org"));
70+
}

‎package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"engines": {
55
"npm": "^3.0"
66
},
7-
"scripts": {
7+
"scripts": {
8+
"prestart": "node .vulcan/prestart_vulcan.js",
89
"start": "meteor --settings settings.json",
910
"lint": "eslint --cache --ext .jsx,js packages"
1011
},

0 commit comments

Comments
 (0)
Please sign in to comment.