-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwasabi-init
35 lines (30 loc) · 1.07 KB
/
wasabi-init
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
console.log("Initializing a wasabi project");
var fs = require('fs');
// Make contracts directory
if (!fs.existsSync('./contracts')){
fs.mkdirSync('./contracts');
}
// Make config directory
if (!fs.existsSync('./config')){
fs.mkdirSync('./config');
}
var wasabiConfig = fs.readFileSync(__dirname + '/static/default.json', 'utf8');
// Add dummy config
fs.writeFile('./config/default.json', wasabiConfig, { flag: 'wx' }, function (err) {
if (err) throw err;
//console.log("It's saved!");
});
// Add app directory
if (!fs.existsSync('./app')){
fs.mkdirSync('./app');
}
if (!fs.existsSync('./app/js')){
fs.mkdirSync('./app/js');
}
// Add wasabi files
var wasabiJs = fs.readFileSync(__dirname + '/static/wasabi.js', 'utf8');
var appJs = fs.readFileSync(__dirname + '/static/app.js', 'utf8');
var indexHtml = fs.readFileSync(__dirname + '/static/index.html', 'utf8');
fs.writeFileSync('./app/wasabi.js', wasabiJs, { encoding: 'utf8' });
fs.writeFileSync('./app/js/app.js', appJs, { encoding: 'utf8' });
fs.writeFileSync('./app/index.html', indexHtml, { encoding: 'utf8' });