source: frontend/node_modules/jake/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.6 KB
Line 
1let proc = require('child_process');
2
3const PROJECT_DIR = process.cwd();
4process.env.PROJECT_DIR = PROJECT_DIR;
5
6namespace('doc', function () {
7 task('generate', ['doc:clobber'], function () {
8 var cmd = '../node-jsdoc-toolkit/app/run.js -n -r=100 ' +
9 '-t=../node-jsdoc-toolkit/templates/codeview -d=./doc/ ./lib';
10 jake.logger.log('Generating docs ...');
11 jake.exec([cmd], function () {
12 jake.logger.log('Done.');
13 complete();
14 });
15 }, {async: true});
16
17 task('clobber', function () {
18 var cmd = 'rm -fr ./doc/*';
19 jake.exec([cmd], function () {
20 jake.logger.log('Clobbered old docs.');
21 complete();
22 });
23 }, {async: true});
24
25});
26
27desc('Generate docs for Jake');
28task('doc', ['doc:generate']);
29
30npmPublishTask('jake', function () {
31 this.packageFiles.include([
32 'Makefile',
33 'jakefile.js',
34 'README.md',
35 'package.json',
36 'usage.txt',
37 'lib/**',
38 'bin/**',
39 'test/**'
40 ]);
41 this.packageFiles.exclude([
42 'test/tmp'
43 ]);
44});
45
46jake.Task['publish:package'].directory = PROJECT_DIR;
47
48namespace('test', function () {
49
50 let integrationTest = task('integration', async function () {
51 let testArgs = [];
52 if (process.env.filter) {
53 testArgs.push(process.env.filter);
54 }
55 else {
56 testArgs.push('*.js');
57 }
58 let spawned = proc.spawn(`${PROJECT_DIR}/node_modules/.bin/mocha`, testArgs, {
59 stdio: 'inherit'
60 });
61 return new Promise((resolve, reject) => {
62 spawned.on('exit', () => {
63 resolve();
64 });
65 });
66
67 });
68 integrationTest.directory = `${PROJECT_DIR}/test/integration`;
69
70 let integrationClobber = task('integrationClobber', function () {
71 proc.execSync('rm -rf package.json pkg tmp_publish');
72 });
73 integrationClobber.directory = `${PROJECT_DIR}/test/integration`;
74
75 let unitTest = task('unit', async function () {
76 let testArgs = [];
77 if (process.env.filter) {
78 testArgs.push(process.env.filter);
79 }
80 else {
81 testArgs.push('*.js');
82 }
83 let spawned = proc.spawn(`${PROJECT_DIR}/node_modules/.bin/mocha`, testArgs, {
84 stdio: 'inherit'
85 });
86 });
87 unitTest.directory = `${PROJECT_DIR}/test/unit`;
88
89});
90
91desc('Runs all tests');
92task('test', ['test:unit', 'test:integration', 'test:integrationClobber']);
93
94desc('Runs eslint for both lib and test directories');
95task('lint', function (doFix) {
96
97 let cmd = 'eslint --format codeframe "lib/**/*.js" "test/**/*.js"';
98 if (doFix) {
99 cmd += ' --fix';
100 }
101 try {
102 proc.execSync(cmd);
103 }
104 catch (err) {
105 console.log(err.message);
106 console.log(err.stderr.toString());
107 console.log(err.stdout.toString());
108 fail('eslint failed');
109 }
110});
111
112
Note: See TracBrowser for help on using the repository browser.