Add radar file walker
This commit is contained in:
@@ -9,27 +9,44 @@ import {
|
||||
srcPath,
|
||||
distPath,
|
||||
} from './file';
|
||||
import {
|
||||
getTree,
|
||||
createRadar,
|
||||
} from './radar';
|
||||
|
||||
const fileName = srcPath('v1/tools/grunt.md');
|
||||
|
||||
console.log('<<< start creating files');
|
||||
|
||||
waterfall([
|
||||
(callback) => {
|
||||
readFile(fileName, 'utf8', callback);
|
||||
},
|
||||
(data, callback) => {
|
||||
const item = frontmatter(data);
|
||||
const html = marked(item.body);
|
||||
|
||||
outputFile(distPath('test3.html'), html, callback);
|
||||
}
|
||||
],
|
||||
(err, results) => {
|
||||
if (!err) {
|
||||
console.log('done creating files >>>');
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
(async () => {
|
||||
try {
|
||||
const tree = await getTree();
|
||||
// console.log(JSON.stringify(tree, null, 2));
|
||||
const radar = await createRadar(tree);
|
||||
console.log(JSON.stringify(radar, null, 2));
|
||||
} catch(e) {
|
||||
console.error('error:', e);
|
||||
}
|
||||
);
|
||||
})()
|
||||
|
||||
//
|
||||
// const fileName = srcPath('v1/tools/grunt.md');
|
||||
//
|
||||
// console.log('<<< start creating files');
|
||||
//
|
||||
// waterfall([
|
||||
// (callback) => {
|
||||
// readFile(fileName, 'utf8', callback);
|
||||
// },
|
||||
// (data, callback) => {
|
||||
// const item = frontmatter(data);
|
||||
// const html = marked(item.body);
|
||||
//
|
||||
// outputFile(distPath('test3.html'), html, callback);
|
||||
// }
|
||||
// ],
|
||||
// (err, results) => {
|
||||
// if (!err) {
|
||||
// console.log('done creating files >>>');
|
||||
// } else {
|
||||
// console.error(err);
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
Reference in New Issue
Block a user