source: frontend/node_modules/ejs/jakefile.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.5 KB
Line 
1var fs = require('fs');
2var path = require('path');
3var execSync = require('child_process').execSync;
4var exec = function (cmd) {
5 execSync(cmd, {stdio: 'inherit'});
6};
7
8/* global jake, task, desc, publishTask */
9
10task('build', ['lint', 'clean', 'browserify', 'minify'], function () {
11 console.log('Build completed.');
12});
13
14desc('Cleans browerified/minified files and package files');
15task('clean', ['clobber'], function () {
16 jake.rmRf('./ejs.js');
17 jake.rmRf('./ejs.min.js');
18 console.log('Cleaned up compiled files.');
19});
20
21desc('Lints the source code');
22task('lint', ['clean'], function () {
23 var epath = path.join('./node_modules/.bin/eslint');
24 exec(epath+' "**/*.js"');
25 console.log('Linting completed.');
26});
27
28task('browserify', function () {
29 var epath = path.join('./node_modules/browserify/bin/cmd.js');
30 exec(epath+' --standalone ejs lib/ejs.js > ejs.js');
31 console.log('Browserification completed.');
32});
33
34task('minify', function () {
35 var epath = path.join('./node_modules/uglify-js/bin/uglifyjs');
36 exec(epath+' ejs.js > ejs.min.js');
37 console.log('Minification completed.');
38});
39
40desc('Generates the EJS API docs for the public API');
41task('doc', function () {
42 jake.rmRf('out');
43 var epath = path.join('./node_modules/.bin/jsdoc');
44 exec(epath+' --verbose -c jsdoc.json lib/* docs/jsdoc/*');
45 console.log('Documentation generated in ./out.');
46});
47
48desc('Generates the EJS API docs for the public and private API');
49task('devdoc', function () {
50 jake.rmRf('out');
51 var epath = path.join('./node_modules/.bin/jsdoc');
52 exec(epath+' --verbose -p -c jsdoc.json lib/* docs/jsdoc/*');
53 console.log('Documentation generated in ./out.');
54});
55
56desc('Publishes the EJS API docs');
57task('docPublish', ['doc'], function () {
58 fs.writeFileSync('out/CNAME', 'api.ejs.co');
59 console.log('Pushing docs to gh-pages...');
60 var epath = path.join('./node_modules/.bin/git-directory-deploy');
61 exec(epath+' --directory out/');
62 console.log('Docs published to gh-pages.');
63});
64
65desc('Runs the EJS test suite');
66task('test', ['lint'], function () {
67 exec(path.join('./node_modules/.bin/mocha --u tdd'));
68});
69
70publishTask('ejs', ['build'], function () {
71 this.packageFiles.include([
72 'jakefile.js',
73 'README.md',
74 'LICENSE',
75 'package.json',
76 'ejs.js',
77 'ejs.min.js',
78 'lib/**',
79 'bin/**',
80 'usage.txt'
81 ]);
82});
83
84jake.Task.publish.on('complete', function () {
85 console.log('Updating hosted docs...');
86 console.log('If this fails, run jake docPublish to re-try.');
87 jake.Task.docPublish.invoke();
88});
Note: See TracBrowser for help on using the repository browser.