1 | #!/usr/bin/env node
|
2 |
|
3 | var
|
4 | fs = require('fs-extra'),
|
5 | path = require('path'),
|
6 | pkg = require('../package.json'),
|
7 | version = pkg.version,
|
8 | npm = require('npm'),
|
9 | dir = path.dirname();
|
10 |
|
11 | // install gulp modules
|
12 | npm.load(function (err) {
|
13 | // catch errors
|
14 | npm.commands.install(['gulp', 'gulp-sass', 'gulp-browserify', 'gulp-uglify', 'gulp-jshint', 'gulp-minify-css', 'gulp-notify', 'gulp-rename', 'gulp-replace', 'jshint-stylish'], function (err, data) {
|
15 | // log the error or data
|
16 | });
|
17 | npm.on('log', function (message) {
|
18 | // log the progress of the installation
|
19 | console.log(message);
|
20 | });
|
21 | });
|
22 |
|
23 |
|
24 | // copy gulpfile over
|
25 | fs.readFile(path.join(__dirname, '../gulpfile.js'), 'utf8', function (err,data) {
|
26 | if (err) {
|
27 | return console.log(err);
|
28 | }
|
29 | write('gulpfile.js', data);
|
30 | });
|
31 |
|
32 | function write(path, str, mode) {
|
33 | fs.writeFileSync(path, str, { mode: mode || 0666 });
|
34 | console.log(' \x1b[36mcreate\x1b[0m : ' + path);
|
35 | }
|
36 |
|
37 | console.log('Gulp Boilerplate created ' + version); |
\ | No newline at end of file |