forked from zuriby/Faker.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new gulp tasks using latest gulp APIs
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
this task will generate the jsdoc based HTML documentation found in the /doc/ folder | ||
*/ | ||
|
||
const { src, dest } = require('gulp'); | ||
const mustache = require('gulp-mustache'); | ||
const rename = require('gulp-rename'); | ||
const jsdoc = require('gulp-jsdoc3'); | ||
|
||
const config = require('../../conf.json'); | ||
|
||
module.exports = function jdsoc (cb) { | ||
src(['./README.md', './lib/*.js'], { read: false }) | ||
.pipe(jsdoc(config, cb)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
this task will generate the Readme.md file found in the project root | ||
*/ | ||
|
||
const { src, dest } = require('gulp'); | ||
const mustache = require('gulp-mustache'); | ||
const rename = require('gulp-rename'); | ||
|
||
module.exports = function readme (cb) { | ||
var API = '', LOCALES = ''; | ||
var faker = require('../../index'); | ||
|
||
// generate locale list | ||
for (var locale in faker.locales) { | ||
LOCALES += ' * ' + locale + '\n'; | ||
} | ||
|
||
var keys = Object.keys(faker); | ||
keys = keys.sort(); | ||
|
||
// generate nice tree of api for docs | ||
keys.forEach(function(module){ | ||
// ignore certain properties | ||
var ignore = ['locale', 'localeFallback', 'definitions', 'locales']; | ||
if (ignore.indexOf(module) !== -1) { | ||
return; | ||
} | ||
API += '* ' + module + '\n'; | ||
for (var method in faker[module]) { | ||
API += ' * ' + method + '\n'; | ||
} | ||
}); | ||
|
||
return src('build/src/docs.md') | ||
.pipe(mustache({ | ||
'API': API, | ||
'LOCALES': LOCALES, | ||
'startYear': 2010, | ||
'currentYear': new Date().getFullYear() | ||
})) | ||
.pipe(rename("../Readme.md")) | ||
.pipe(dest('build/')); | ||
|
||
}; |