-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
61 lines (51 loc) · 1.9 KB
/
Gruntfile.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module.exports = (grunt) => {
const builder = require('./src');
const fs = require('fs');
const mz = require('mz');
const loader = new builder.loader(grunt);
loader.js({});
grunt.registerTask('generate-folder', 'Generate the actual files' , function(target) {
const folder = builder.config.folder;
const items = {};
const recursive = (recursiveFolder) => {
if (typeof(recursiveFolder) === 'string') {
items[recursiveFolder] = true;
return;
}
if (recursiveFolder instanceof Array) {
//items[recursiveFolder.join(', ')] = true;
return;
}
Object.keys(recursiveFolder).forEach((element) => {
const result = recursiveFolder[element];
if (result.hasOwnProperty('root')) {
items[result.root] = true;
}
recursive(result);
})
}
recursive(folder);
const folders = Object.keys(items);
let template = `
# Folders
Skeleton folders
\`\`\`js
`;
folders.sort().forEach((element) => template += `${element}
`);
template += '```';
fs.writeFileSync(`artifacts/readme/builds/folders.md`,template);
})
grunt.registerTask('debug', function() {
const done = this.async();
mz.child_process.exec('git config --list').then(function (stdout) {
const result = stdout.join('');
grunt.log.write(result);
done();
})
})
grunt.registerTask('default', [/*'debug',*/ 'generate-folder', 'cory-generate-tasks'].concat(builder.config.task.build.js));
// grunt.registerTask('default', ['debug'].concat(builder.config.task.build.js));
//grunt.registerTask('run', builder.config.task.run.js);
grunt.registerTask('run', 'watch:cory-js-test');
}