function dependenciesForModule(name) { var deps = []; expand('src/' + name + '/*.js') .map(fileContents) .forEach((contents) => { // var contents = String(buffer); // Strategy: find where module is declared, // and from there get everything inside the [] and split them by comma var moduleDeclIndex = contents.indexOf('angular.module('); var depArrayStart = contents.indexOf('[', moduleDeclIndex); var depArrayEnd = contents.indexOf(']', depArrayStart); var dependencies = contents.substring(depArrayStart + 1, depArrayEnd); dependencies.split(',').forEach((dep) => { if (dep.indexOf('mm.foundation.') > -1) { var depName = dep.trim().replace('mm.foundation.', '').replace(/['"]/g, ''); if (deps.indexOf(depName) < 0) { deps.push(depName); //Get dependencies for this new dependency deps = deps.concat(dependenciesForModule(depName)); } } }); }); return deps; }
function findModules() { var foundModules = {}; var modules = []; expand({ filter: 'isDirectory', cwd: '.' }, 'src/*').forEach((dir) => { var moduleName = dir.split('/')[1]; if (moduleName[0] === '_') { return; } if (buildModules.length && buildModules.indexOf(moduleName) === -1) { return; } findModule(moduleName, modules, foundModules); }); modules.sort((a, b) => { if (a.name < b.name) { return -1; } if (a.name > b.name) { return 1; } return 0; }); return modules; }
files.map(function (file) { var sources = expand(file, file.src) sources.map(function (source) { expandedFiles.push({ src: [path.join((file.cwd ? file.cwd : ''), source)], dest: path.join(file.dest, source).split('\\').join('/').replace('/' + from, '') }) }) })
/** * Copies all files except for the sass(-cache) files. Basically that is everything * that can be deployed further. * @param srcDir The source directory where compass ran. * @param destDir The Broccoli destination directory * @param options The options used to call broccoli-compass. * @returns Promise[] A collection promises for each directory or file that has to be copied. */ function copyRelevant(srcDir, destDir, options) { var result; var copyPromises = []; result = expand({ cwd: srcDir, dot:true, filter: 'isFile'}, ['**/*'].concat(options.exclude)); for(var i = 0; i < result.length; i++) { copyPromises.push( copyDir( path.join(srcDir, result[i]), path.join(destDir, result[i]))); } return rsvp.all(copyPromises); }
task.rebuild = function(cb) { var jsModules; var scssModules; var jsData; var scssData; jsModules = expand({ filter: 'isFile' }, ['./source/js/module/*/*.js']); scssModules = expand({ filter: 'isFile' }, [ './source/css/module/*.scss', '!./source/css/module/index.scss' ]); jsModules = jsModules.map(function(url) { var file = path.relative('./source/js/module', url); var name = path.basename(file, '.js'); var nameCamel = changeCase.camelCase(name); return { name: name, nameCamel: nameCamel, file: file }; }); scssModules = scssModules.map(function(url) { var file = path.relative('./source/css/module', url); var name = path.basename(file, '.scss'); var nameCamel = changeCase.camelCase(name); return { name: name, nameCamel: nameCamel, file: file }; }); jsData = parseTemplate('js', { modules: jsModules }, '_index'); scssData = parseTemplate('scss', { modules: scssModules }, '_index'); fs.outputFileSync(resolve('./source/js/module/index.js'), jsData); fs.outputFileSync(resolve('./source/css/module/index.scss'), scssData); cb(); };
/** * Copies all files except for the sass(-cache) files. Basically that is everything * that can be deployed further. * @param srcDir The source directory where compass ran. * @param destDir The Broccoli destination directory * @param options The options used to call broccoli-compass. * @returns Promise[] A collection promises for each directory or file that has to be copied. */ function copyRelevant(srcDir, destDir, options) { var sassDir = options.sassDir || 'sass'; var excludes = ['!' + sassDir + '/**', '!.sass-cache']; var result = expand({ cwd: srcDir }, ['*'].concat(excludes)); var resLength = result.length; var copyPromises = []; for(var i = 0; i < resLength; i++) { copyPromises.push( copyDir( path.join(srcDir, result[i]), path.join(destDir, result[i]))); } return rsvp.all(copyPromises); }
describe( 'strip-comments', function () { var stripComments = require( '../../lib/strip-comments' ); var fixtures = expand( path.resolve( __dirname, './strip-comments/fixtures/**/*.less' ) ); fixtures.forEach( function ( file ) { it( 'should remove the comments from the given input, file: ' + file, function () { var expected = stripComments( read( file ) ); var result = read( path.join( __dirname, './strip-comments/expected/', path.basename( file ) ) ); //write(path.join(__dirname, './expected', path.basename(file)), expected); expect( expected ).to.equal( result ); } ); } ); } );
function findModule(name, modules, foundModules) { if (foundModules[name]) { return; } foundModules[name] = true; function breakup(text, separator) { return text.replace(/[A-Z]/g, (match) => { return separator + match; }); } function ucwords(text) { return text.replace(/^([a-z])|\s+([a-z])/g, ($1) => $1.toUpperCase()); } var module = { name: name, moduleName: 'mm.foundation.' + name, displayName: ucwords(breakup(name, ' ')), srcFiles: expand('src/' + name + '/*.js'), tplFiles: expand('src/' + name + '/*.html'), dependencies: dependenciesForModule(name), docs: { md: expand('src/' + name + '/docs/*.md') .map(fileContents).map((content) => marked(content)).join('\n'), js: expand('src/' + name + '/docs/*.js') .map(fileContents).join('\n'), html: expand('src/' + name + '/docs/*.html') .map(fileContents).join('\n') } }; module.dependencies.forEach((name) => { findModule(name, modules, foundModules); }); modules.push(module); }
grunt.registerMultiTask('tsconfig', 'Creates typescript tsconfig.json based on options and fileGlobs.', function() { // Merge task-specific and/or target-specific options with these defaults. var options = this.options({}); var files = options.filesGlob; var dir = ''; if(this.data.rootDir) { if(this.data.rootDir.slice(this.data.rootDir.length-1) === '/') { dir = this.data.rootDir; } else { dir = this.data.rootDir+'/'; } } if(this.data.rootDir) { files = files.map(function(g) { if(g.indexOf('!') === 0) { return '!'+dir+g.slice(1); } return dir+g; }); options.additionalOptions.files = expand(files).map(function(file) { return file.replace(dir,''); });; } else { options.additionalOptions.files = expand(files); } grunt.file.write(dir+'tsconfig.json', JSON.stringify(options.additionalOptions, null, 2)); grunt.log.writeln('tsconfig created'); });
return new rsvp.Promise(function(resolve) { var result = expand({ cwd: srcDir }, '**/*.css'); if(options.cssDir) { var cssDir = options.cssDir; if(cssDir && cssDir !== '.') { result.push(cssDir); } } var resLength = result.length; for(var i = 0; i < resLength; i++) { // a async delete does not delete the hidden .sass-cache dir fse.removeSync(path.join(srcDir, result[i])); } resolve(); });
del('docs').then(function() { var srcBlobs = globExpand({filter: 'isFile', cwd: process.cwd()}, options.buildSrc); var program = childProcess.execFile( require.resolve('jsdoc/jsdoc.js'), ['-c', options.jsDocConfFile].concat(srcBlobs), { cwd: process.cwd(), env: process.env }, function() { done(); } ); program.stdin.pipe(process.stdin); program.stdout.pipe(process.stdout); program.stderr.pipe(process.stderr); });
function parseProject(name, projectSpec) { var project = {}; project.name = name; var cwdPath = path.relative(process.cwd(), path.dirname(projectFile)); project.expandedSources = expand({ filter: 'isFile', cwd: cwdPath }, projectSpec.sources || []); project.sources = projectSpec.sources; project.target = projectSpec.target || 'es5'; project.module = projectSpec.module || 'commonjs'; project.declaration = projectSpec.declaration == void 0 ? false : projectSpec.declaration; runWithDefault(function (val) { return project.out = val; }, projectSpec.out); runWithDefault(function (val) { return project.outDir = val; }, projectSpec.outDir); project.noImplicitAny = projectSpec.noImplicitAny == void 0 ? false : projectSpec.noImplicitAny; project.removeComments = projectSpec.removeComments == void 0 ? true : projectSpec.removeComments; runWithDefault(function (val) { return project.sourceMap = val; }, projectSpec.sourceMap, false); runWithDefault(function (val) { return project.sourceRoot = val; }, projectSpec.sourceRoot); runWithDefault(function (val) { return project.mapRoot = val; }, projectSpec.mapRoot); return project; }
"use strict"; const expand = require("glob-expand"); const prh = require("prh"); const assert = require("assert"); const ymlList = expand({ filter: "isFile", cwd: __dirname }, [ "**/*.yml", "!node_modules/**", ]); ymlList.forEach(yml => { try { const engine = prh.fromYAMLFilePath(yml); const changeSet = engine.makeChangeSet("./README.ja.md"); } catch (e) { console.log(`processing... ${yml}\n`); throw e; } }); console.log("😸 done");
module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: '.', frameworks: ['jspm', 'jasmine'], preprocessors: { 'src/**/*': ['generic', 'babel'], }, babelPreprocessor: { options: { sourceMap: 'inline', plugins: ['transform-es2015-modules-systemjs'], presets: ['es2015'], }, }, // list of files / patterns to load in the browser files: [ 'misc/test-lib/helpers.js', ], // list of files to exclude exclude: [ 'src/**/demo.js', ], customLaunchers: { Chrome_travis_ci: { base: 'Chrome', flags: ['--no-sandbox'], }, }, browsers: [ 'Chrome', 'Firefox', ], // test results reporter to use // possible values: dots || progress reporters: ['progress'], // web server port port: 9876, // cli runner port // runnerPort: 9100, // enable / disable colors in the output (reporters and logs) colors: true, // level of logging // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes // autoWatch: false, // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun: false, genericPreprocessor: { rules: [{ match: 'src/**/*.html', process: (content, file, done, log) => { const escapeContent = (content) => content .replace(/\\/g, '\\\\') .replace(/'/g, '\\\'') .replace(/\r?\n/g, '\\n\' +\n \''); const template = ` import angular from "angular"; angular.module('%s', []).run(['$templateCache', function($templateCache) { $templateCache.put('%s', '%s'); }]); `; const filepath = file.originalPath.replace(`${config.basePath}/`, ''); const cacheId = filepath.replace('src/', 'template/'); const htmlPath = filepath.replace('src/', 'template/'); file.path = `${file.originalPath}.js`; file.originalPath = file.path; try { done(util.format(template, htmlPath, htmlPath, escapeContent(content))); } catch (e) { log.error('%s\n at %s', e.message, file.originalPath); } }, }], }, jspm: { // Edit this to your needs serveFiles: ['jspm_packages/**/*.js', 'src/**/*.html', 'src/**/*.js'], loadFiles: expand(['src/**/*.spec.js', '!src/_*/**']), config: 'config.js', packages: 'jspm_packages/', }, }); };
it('should return all files matching this pattern as an array<String>', () => { let filepattern = '**/*.spec.js' expect(utils.expand(filepattern).length, expand({cwd: _basePath}, filepattern).length) })
.reduce(function(result, path) { return _.union(result, expand(path)); }, [])
return function(e, phantom){ function handleResults(file, result, queue){ suiteResults.success += result.success; suiteResults.failure += result.failure; coverage(file, result.__coverage__); if (verbose) { logger.log(''); } if (result.failure === 0) { logger.info(file); } else { logger.error(file); } if (queue.length){ loadSuite(queue.shift(), queue); } else { if (!verbose){ logger.warn('Files: ' + (suiteResults.files) + ' Tests: ' + (suiteResults.success + suiteResults.failure) + ' Success: ' + suiteResults.success + ' Failed: ' + suiteResults.failure); logger.log(''); } phantom.exit(); done(suiteResults.failure? false : true); } } function configureQUnit(page, test){ phantomHelper.evaluate(page, function(qunitConf) { QUnit.init(); QUnit.config.blocking = false; QUnit.config.requireExpects = true; QUnit.config.autorun = false; for (var props in qunitConf) { if (qunitConf.hasOwnProperty(props)) { QUnit.config[props] = qunitConf[props]; } } }, testOpt.qunit); } function initRequire(page, test){ phantomHelper.evaluate(page, function(requireConf, paths, test) { if (requireConf) { require = requireConf; } if (require.baseUrl) { require.baseUrl = 'file://' + paths.cwd + '/' + require.baseUrl; } if (require.paths) { for (var prop in require.paths) { if (require.paths.hasOwnProperty(prop)) { require.paths[prop] = 'file://'+ paths.cwd + '/' + require.paths[prop]; } } } var script = document.createElement('script'); script.type = 'text/javascript'; script.charset = 'utf-8'; script.setAttribute('data-main', 'file://'+ paths.cwd + '/'+ test); script.src = 'file://'+ paths.lib + '/../node_modules/requirejs/require.js'; document.head.appendChild(script); }, testOpt.require, {cwd: cwd, lib: __dirname}, test); } function injectDependency(page, dependencies, callback) { var dep = dependencies.shift(); page.injectJs(dep, function(){ if (dependencies.length) { injectDependency(page, dependencies, callback); } else { callback(); } }); } function executeTests(file, queue) { return phantom.createPage(function(e, page) { page.onConsoleMessage = function(text){ if (text.indexOf('logger.')===0 && verbose){ /* jshint evil: true */ eval(text); /* jshint evil: false */ } else { if (verbose){ logger.log(text); } } }; page.onError = function(e){ logger.log(JSON.stringify(e, null, 4)); done(false); }; var testRunning = false; page.open(__dirname +'/../assets/empty.html', function(){ if (testRunning) { return; } testRunning = true; var dependencies = [__dirname + '/helper.js', require.resolve('qunitjs')]; if (testOpt.include) { dependencies = dependencies.concat(testOpt.include.map(function(f){ return cwd + '/' + f; })); } injectDependency(page, dependencies, function(){ page.evaluate(function(){ current = { success: 0, failure: 0 }; window.onerror = function(){ current.failure++; }; QUnit.testStart = function(obj){ console.log('logger.trace("'+ obj.name.replace(/\"/g, '\\"') +'".bold)'); }; QUnit.log = function(testResult){ var result = testResult.result; current[(result)?'success':'failure']++; var expected = testResult.expected, actual = testResult.actual, message = testResult.message, makeCliFriendly = function (input) { if (input.toString() === 'isNaN' && typeof input !== 'string') { return 'isNaN'; } else if (typeof input === 'undefined') { return 'undefined'; } else if (typeof input === 'string') { return input; } else { return JSON.stringify(input); } }; if (result) { console.log('logger.info("'+ (message || 'test successful').replace(/([^\\])(\")/g, '$1\\"') +'")'); } else { console.log('logger.error("'+ (message || 'test failed').replace(/\n/g, '\\n').replace(/([^\\])(\")/g, '$1\\"') +'")'); if (typeof expected!== 'undefined') { console.log('logger.error(" expected: '+ makeCliFriendly(expected).replace(/([^\\])(\")/g, '$1\\"') +'")'); } if (typeof actual!== 'undefined') { console.log('logger.error(" actual: '+ makeCliFriendly(actual).replace(/([^\\])(\")/g, '$1\\"') + '")'); } } }; }, function(){ initRequire(page, file); configureQUnit(page); phantomHelper.waitFor(page, function(){ return !QUnit.config.queue.length; }, function(){ page.evaluate(function(){ if (window.__coverage__){ current.__coverage__ = window.__coverage__; } return current; }, function(e, result) { handleResults(file, result, queue); }); }, function(){ logger.error('script timeout'); done(false); }, 10000); }); }); }); }); } function loadSuite(file, queue){ if (verbose) { logger.log(''); logger.warn('TESTING:' + file); logger.log(''); } executeTests(file, queue); } function initialize(files){ suiteResults.files = files.length; if (suiteResults.files === 0) { logger.error('no test to be run'); done(false); } verbose = (suiteResults.files === 1 || testOpt.verbose); return files; } testOpt.tests = glob(testOpt.tests); var queue = initialize(testOpt.tests); loadSuite(queue.shift(), queue); };
gulp.task('templates:create', ['config:load'], function(done){ var expand = require('glob-expand'); //Fetch reports var reports = expand(Config.paths.reports); var reportSources = []; reports.forEach(function(report){ reportSources.push(fs.readFileSync(report, 'utf-8')); }); //Fetch elastic search mappings var mappingsFile = expand(Config.paths.elasticSearchMapping)[0]; var elasticSearchMapping = '()'; if(fs.existsSync(mappingsFile)) { elasticSearchMapping = fs.readFileSync(mappingsFile, 'utf-8'); } //Indicates which datasource is for query and which one is for search var template = '{ name: "<%= name %>", category: "<%= category %>", db: "<%= credentials.db %>" }'; var queryDatasource = _.chain(Config.credentials['28'].datasources) .filter(function(source){ return source.types.indexOf('query') !== -1; }) .map(function(source){ return _.template(template)(source); }).value()[0] || '()'; var searchDatasource = _.chain(Config.credentials['28'].datasources) .filter(function(source){ return source.types.indexOf('search') !== -1; }) .map(function(source){ return _.template(template)(source); }).value()[0] || '()'; //API documentation var queries = JSON.parse(fs.readFileSync('swagger/queries.json', 'utf-8')); queries.title = 'Cell Store Query API'; var templates = [ { src: 'tasks/templates/config.js.mustache', data: { cellstore: Config.credentials.cellstore, staging: { isCI: Config.isOnTravis, e2eReportsDir: Config.paths.e2eReportsDir, configId: Config.configId }, http: Config.credentials.http }, dest: 'tests/e2e/config/config.js' }, { src: 'tasks/templates/config.jq.mustache', data: { cellstore: Config.credentials.cellstore, sendmail: Config.credentials.sendmail, frontend: { url: Config.bucketName }, elasticSearchMapping: elasticSearchMapping, queryDatasource: queryDatasource, searchDatasource: searchDatasource }, dest: Config.paths.queries + '/modules/io/28/apps/config.jq' }, { src: 'tasks/templates/UpdateReportSchema.jq.mustache', data: { reports: reportSources.join(',') }, dest: Config.paths.queries + '/private/UpdateReportSchema.jq' }, { src: 'tasks/templates/api.md.mustache', data: { api: queries }, dest: 'documentation/api/queries.md' }, { src: 'tasks/templates/constants.js.mustache', data: { APPNAME: Config.projectName, API_URL: Config.credentials.cellstore.protocol + '://' + Config.projectName + '.' + Config.credentials['28'].portalDomain + '/v1', DEBUG: false, PROFILE: Config.credentials.cellstore.profile, EXCEL_RULE_TEMPLATE: fs.readFileSync(__dirname + '/templates/excel-rule.template', 'utf-8').toString().replace(/[\r\n]+/g,'\\n') }, dest: Config.paths.app + '/constants.js' } ]; templates.forEach(function(tpl){ var src = fs.readFileSync(tpl.src, 'utf-8'); var result = Mustache.render(src, tpl.data); mkdirp.sync(path.dirname(tpl.dest)); fs.writeFileSync(tpl.dest, result, 'utf-8'); $.util.log('created template: ' + tpl.dest); }); done(); });
module.exports = function () { var config = { concat: [], rename: [], browserify: [], copy: [], swig: {} }; var knownOptions = { string: [ 'theme', 'dist' ], boolean: [ 'minify', 'debug', 'bundle' ], default: { dist: 'dist/themes', theme: false, minify: false, debug: false, bundle: true } }; var options = minimist(process.argv.slice(2), knownOptions); global.debug = options.debug; global.bundle = options.bundle; var expandConfigFile = function (value) { var file = value.split('/').pop(), configKey = file.split('.').shift(), configValue = readJSON(path.join(process.cwd(), value)); if (Array.isArray(config[ configKey ])) { if (Array.isArray(configValue)) { configValue.forEach(function(configValueItem){ config[ configKey ].push(configValueItem); }); } else { config[ configKey ].push(configValue); } } if (typeof config[ configKey ] == 'undefined') { config[ configKey ] = configValue; } }; var expandConfigDirectory = function (value) { expand({ cwd: process.cwd(), filter: 'isFile' }, value + '/*.json').forEach(expandConfigFile); }; expand({ cwd: process.cwd(), filter: 'isDirectory' }, '.build/*').forEach(expandConfigDirectory); expand({ cwd: process.cwd(), filter: 'isFile' }, '.build/*.json').forEach(expandConfigFile); try { config.skins = readJSON(path.join(process.cwd(), 'src', 'skins.json')); } catch (err) { } if (! options.theme) { gutil.log(gutil.colors.red('You must specify a theme by using the --theme [theme_name] option.')); process.exit(1); } if (typeof config.dist !== 'undefined' && typeof config.dist[ options.theme ] !== 'undefined') { options.dist = config.dist[ options.theme ]; } extend(true, config, options); var lessOptions = { less: { paths: [ path.join(process.cwd(), 'bower_components'), path.join(process.cwd(), 'lib') ] } }; extend(true, config, lessOptions); var browserifyOptions = { browserifyOptions: { paths: [ path.join(process.cwd(), 'lib'), path.join(process.cwd(), config.dist, config.theme, 'js') ] } }; extend(true, config, browserifyOptions); if (options.debug) { require('time-require'); } return config; }();
/** * Wrap glob-expand package with this.basePath * @param {String} pattern * @returns {*} */ expand(pattern) { return expand({ cwd: this.basePath }, pattern) }
module.exports = function(config) { var opts = {}, owd = process.cwd(); if (!fs.existsSync(config.outputAbsolute)) { mkdirp.sync(config.outputAbsolute); } ncp(path.join(__dirname, 'assets'), path.join(config.outputAbsolute, '__assets'), function(err) { if (err) { console.log(err); } }); var matches = []; process.chdir(config.configDir); for (var section in config.files) { expand({ filter: 'isFile' }, config.files[section]).forEach(function(f) { matches.push(path.join(config.configDir, f)); }); } process.chdir(owd); config.assets = config.assets || []; config.assets.forEach(function(asset) { ncp(path.join(config.configDir, asset), path.join(config.outputAbsolute, '__assets', path.basename(asset)), function(err) { if (err) { console.log(err); } }); }); matches.forEach(function(file) { ext = path.extname(file).slice(1); input = fs.readFileSync(file, 'utf8'); fileRepo = path.relative(process.cwd(), file); key = fileRepo.replace(/\//g, '_').replace(/\./g, '_').toLowerCase(); dir = path.dirname(path.relative(process.cwd(), file)).toLowerCase(); if (dir === '.') { dir = ''; } dir = dir + '/'; files.push({ file: path.basename(path.relative(process.cwd(), file)), dir: dir, key: key }); if (ext === 'md') { foundsection = 1; var i = 1; input = marked(input); page = input.match(/<h([1-3])>(.*)<\/h[1-3]>/gi); for (var j in page) { details = { page: page[j].match(/<h[1-3]>(.*)<\/h[1-3]>/)[1], section: i++, h: page[j].match(/<h([1-3])>/)[1], key: key }; pages[key] = pages[key] || []; pages[key].push(details); } var content = '<div>' + input.replace(/<h([1-3])>(.*)<\/h[1-3]>/gi, anchorize) + '</div>'; blocks[key] = { md: true, file: file, fileRepo: fileRepo, key: key, block: content }; } else { opts.ext = ext; opts.ctypes = config.ctypes; opts.encode = false; opts.ignores = config.ignores || {}; noddocco.process(input, opts, function(err, noddoccoData) { if (err) { console.log(err); } else { blocks[key] = { file: file, fileRepo: fileRepo, key: key, blocks: noddoccoData }; for (var i in noddoccoData) { comment = noddoccoData[i].comments; page = comment.match(/<h([1-3])>(.*)<\/h[1-3]>/i); if (page) { details = { page: page[2], section: (+i + 1), h: page[1], key: key }; pages[key] = pages[key] || []; pages[key].push(details); } } } }); } }); // ### Write the documentation to disk // With the noddocco data generated for each file. Loop through the files and // write their contents to disk. // // By default, alongised individual file pages, Dockit will create a page which is all // the files processed into one, long html page. This page will be the `index.html` // This behaviour can be altered by the dockit configuration // // As the files are written to disk the progress is sent to the console. var displaypages = []; var orderedblocks = []; for (var i in pages) { orderedblocks.push(blocks[pages[i][0].key]); for (var j in pages[i]) { displaypages.push(pages[i][j]); } } console.log('writing...'); config.project = config.project || 'dockit generated docs'; var all, dest, data, output, generated = new Date(); all = 'all.html'; if (config.index === 'all.html') { config.index = 'index.html'; all = 'index.html'; } for (i in blocks) { dest = blocks[i].key + '.html'; data = { onAll: false, md: blocks[i].md || false, title: config.project, index: config.index, github: config.github, showall: config.all, all: all, allHash: config.allHash, current: blocks[i].key, files: files, favicon: config.favicon, generated: generated, pages: displaypages, data: [blocks[i]] }; output = tpl.main(data); if (dest === config.index) { dest = 'index.html'; } else if (dest.slice(0, 6) === 'readme') { fs.writeFileSync(path.join(config.outputAbsolute, 'index.html'), output); } fs.writeFileSync(path.join(config.outputAbsolute, dest), output); console.log(path.join(config.outputAbsolute, dest)); } if (config.all) { data = { all: all, md: false, allHash: config.allHash, onAll: true, title: config.project, index: config.index, github: config.github, showall: config.all, files: files, favicon: config.favicon, generated: generated, pages: displaypages, data: orderedblocks }; output = tpl.main(data); fs.writeFileSync(path.join(config.outputAbsolute, all), output); console.log(path.join(config.output, all)); } console.log('...done!'); };
var expandConfigDirectory = function (value) { expand({ cwd: process.cwd(), filter: 'isFile' }, value + '/*.json').forEach(expandConfigFile); };