(cb) => mkdirp(path.join(cwd, 'shared', 'actions'), cb)
_createStorefrontDirectories: function() { mkdirp('storefront/assets', this._createDirectoryCallback.bind(this)); mkdirp('storefront/settings/routes', this._createDirectoryCallback.bind(this)); mkdirp('storefront/routes', this._createDirectoryCallback.bind(this)); mkdirp('storefront/components', this._createDirectoryCallback.bind(this)); },
log.debug = function() {}; } function run(opts) { downloadCss(opts) .then(writeCss.bind(null, opts)) .then(function() { console.log("Done."); }) .fail(function(err) { console.log('Failure', err, err.stack); }); } var modes = Object.keys(opts.modes); modes.sort(); modes.forEach(function(mode) { console.log(" - " + mode + ": " + opts.modes[mode]); }) mkdirp(path.dirname(opts.out), function(err) { if (!fs.existsSync(path.dirname(opts.out)) && err) throw new Error(err); mkdirp(opts.fontOut, function(err) { if (!fs.existsSync(opts.fontOut) && err) throw new Error(err); run(opts); }); });
function(cb) { mkdirp(dstDir, cb); },
gulp.task('make-build-dir', () => mkdirp(buildRoot)
_writetestOne (params, cb) { var self = this if (!params.func_name) { throw new Error('No func_name in ' + JSON.stringify(params)) } if (!params.headKeys) { throw new Error('No headKeys in ' + params.func_name) } if (!params.headKeys.example) { throw new Error('No example in ' + params.func_name) } var basename = path.basename(params.filepath) var subdir = path.dirname(params.filepath) var testpath = this.__test + '/languages/' + subdir + '/test-' + basename var testdir = path.dirname(testpath) var relativeSrcForTestDir = path.relative(testdir, self.__src) var relativeTestFileForRoot = path.relative(self.__root, testpath) // console.log(relativeSrcForTestDir) // process.exit(1) var testProps = '' if (params.headKeys.test) { testProps = params.headKeys.test[0][0] } var describeSkip = '' if (self.allowSkip && testProps.indexOf('skip-all') !== -1) { describeSkip = '.skip' } var codez = [] codez.push('// warning: This file is auto generated by `npm run build:tests`') codez.push('// Do not edit by hand!') // Add globals for (var global in self.globals) { codez.push('var ' + global + ' = ' + self.globals[global]) } // Set timezone for testing dates // Not ideal: http://stackoverflow.com/questions/8083410/how-to-set-default-timezone-in-node-js codez.push('process.env.TZ = \'UTC\'') codez.push('var ' + 'expect' + ' = require(\'chai\').expect') // Add language-wide dependencies // @todo: It would be great if we could remove this if (params.language === 'php') { codez.push(self._addRequire('ini_set', relativeSrcForTestDir + '/' + 'php/info/ini_set')) codez.push(self._addRequire('ini_get', relativeSrcForTestDir + '/' + 'php/info/ini_get')) if (params.func_name === 'localeconv') { codez.push(self._addRequire( 'setlocale', relativeSrcForTestDir + '/' + 'php/strings/setlocale' )) } if (params.func_name === 'i18n_loc_get_default') { codez.push(self._addRequire( 'i18n_loc_set_default', relativeSrcForTestDir + '/' + 'php/i18n/i18n_loc_set_default' )) } } // Add the main function to test codez.push(self._addRequire( params.func_name, relativeSrcForTestDir + '/' + params.filepath )) codez.push('') codez.push([ 'describe', describeSkip, '(\'src/', params.filepath, ' (tested in ', relativeTestFileForRoot, ')\', function () {' ].join('')) // Run each example for (var i in params.headKeys.example) { if (!params.headKeys.returns[i] || !params.headKeys.returns[i].length) { throw new Error('There is no return for example ' + i, test, params) } var humanIndex = parseInt(i, 10) + 1 var itSkip = '' if (self.allowSkip && testProps.indexOf('skip-' + humanIndex) !== -1) { itSkip = '.skip' } codez.push([ ' it', itSkip, '(\'should pass example ', (humanIndex), '\', function (done) {' ].join('')) var body = [] var testExpected = params.headKeys.returns[i].join('\n') body.push('var expected = ' + testExpected) // Execute line by line (see date.js why) // We need result be the last result of the example code for (var j in params.headKeys.example[i]) { if (parseInt(j, 10) === params.headKeys.example[i].length - 1) { // last action gets saved body.push('var result = ' + params.headKeys.example[i][j].replace('var $result = ', '')) } else { body.push(params.headKeys.example[i][j]) } } body.push('expect(result).to.deep.equal(expected)') body.push('done()') codez.push(indentString(body.join('\n'), ' ', 4)) codez.push(' })') } codez.push('})') codez.push('') var code = codez.join('\n') // Write to disk mkdirp(testdir, function (err) { if (err) { throw new Error(err) } debug('writing: ' + testpath) fs.writeFile(testpath, code, 'utf-8', cb) }) }
c.build( function(err,res){ if (err) throw(err); mkdir('build'); write('build/build.js', res.require + res.js); write('build/build.css', res.css); });
var tgt = relative(process.argv[2],src); var dst = join(process.argv[3],tgt); var out = "/dev/null" // __dirname var cmd='-terse -V -N clackn-copy -o '+out+' -j y -b y -wd '+process.argv[2]+' mkdir -p '+dst+' && cp -r '+src+' '+join(dst,'..'); throttle(10,function(ondone) { //mock(cmd,ondone); submit(cmd,ondone) }); } }); }); } else { // file console.log("!!! Not Copying: "+src); // get here for cache files in branches } }); } // === ARGUMENT HANDLING === if(process.argv.length!=4) { console.log('Usage : node '+__filename+' <src> <dst>'); process.exit(0); } console.log("SRC: "+process.argv[2]) console.log("DST: "+process.argv[3]) mkdirp(process.argv[3],function(err) { if(err) console.log(err); else walk(process.argv[2],process.argv[3]); })
item.wd_doc && item.wd_doc.forEach(function(doc) { doc && doc.desc && doc.desc.forEach(function(desc) { var signature = extractSignature(desc.line); res.data[jsonWireUrl].methods.push(signature || desc.line); }); }); }); Object.keys(res.data).forEach(function(key) { var item = res.data[key]; item.methods = item.methods.map(function(method, index) { var prev = index - 1; if (index && typeof method === 'string' && typeof item.methods[prev] === 'string') { item.methods[prev] += ' ' + method; return null; } return method; }).filter(Boolean); }); mkdirp(dataPath, function(error) { if (error) { console.log(error); return; } fs.writeFileSync(path.join(dataPath, 'methods.json'), JSON.stringify(res, null, 2)); });
gulp.task('init', ['clean'], function() { mkdirp(buildDir, function (err) { if (err) console.error(err) }); });
return new Promise(function(resolve, reject) { mkdirp(path, function(error) { if (error) { return reject(error); } resolve(); }); });
return action_parser(action_root).then(function (parser) { mkdirp(action_root, function () { parser.parse(params.value, l); }); }, function (err) { throw err; })
function copyApp () { mkdirp(finalDir, function AppFolderCreated (err) { if (err) return cb(err) copyAppTemplate() }) }
return new Promise(function(resolve, reject) { mkdirp(dir, function(err) { if (err) reject(err) else resolve() }) })
var writeFile = function (file, cb) { mkdirp(file.base, function () { gfs.writeFile(file.path, file.contents, cb); }); };
function Server (opts, cb) { if (!(this instanceof Server)) return new Server(opts, cb); opts = extend({ site: { title: 'flatsheet', email: '*****@*****.**', // if SITE_URL not set, assumes we are not in production: url: (process.env.SITE_URL || 'http://127.0.0.1:3333'), contact: 'flatsheet admin' } }, opts) var self = this; this.site = opts.site; var envFilePath = path.join((opts.dir || process.cwd()), '.env'); if (fs.existsSync(envFilePath)) { var envFile = fs.readFileSync(envFilePath); var secrets = dotenv.parse(envFile); } else { var secrets = { SENDGRID_USER: process.env.SENDGRID_USER, SENDGRID_PASS: process.env.SENDGRID_PASS } } /* * Set path for static files */ this.staticFiles = opts.staticFiles || path.join(__dirname, '..', 'public'); this.staticFileUrl = opts.staticFileUrl || '/public/' mkdirp(this.staticFiles, function (err) { if (err) console.error(err) }); /* * Set path for db */ this.dataDir = opts.dataDir || opts.db || path.join(__dirname, '..', 'data'); mkdirp(this.dataDir, function (err) { if (err) console.error(err); else initdb(self, cb); }); /* * Email */ var options = { auth: { api_user: secrets.SENDGRID_USER, api_key: secrets.SENDGRID_PASS } }; this.email = nodemailer.createTransport(sgTransport(options)); this.router = Router() /* * Set up the application's views */ this.views = {} this.viewsDir = path.join(__dirname, '/../views/'); this.viewData = { site: opts.site }; this.addViews(); if (opts.views) { if (opts.views[opts.views.length - 1] !== '/') opts.views += '/'; this.viewsOverrideDir = opts.views; this.overrideViews(); } }
_injectwebOne (params, cb) { var authors = {} this.authorKeys.forEach(function (key) { if (params.headKeys[key]) { authors[key] = _.flattenDeep(params.headKeys[key]) } }) var langPath = [ this.__root, '/website/source/', params.language ].join('') var langIndexPath = langPath + '/index.html' var catPath = langPath + '/' + params.category var catIndexPath = catPath + '/' + 'index.html' var funcPath = catPath + '/' + params.func_name + '.html' if (!this._injectwebBuffer[langIndexPath]) { var langTitle = '' langTitle += this.langDefaults[params.language].human + ' ' langTitle += this.langDefaults[params.language].packageType + 's ' langTitle += ' in JavaScript' var langData = Object.assign({}, this.langDefaults[params.language], { warning: 'This file is auto generated by `npm run web:inject`, do not edit by hand', type: 'language', layout: 'language', language: params.language, title: langTitle }) this._injectwebBuffer[langIndexPath] = '---' + '\n' + YAML.safeDump(langData).trim() + '\n' + '---' + '\n' } if (!this._injectwebBuffer[catIndexPath]) { var catTitle = '' catTitle += this.langDefaults[params.language].human + '\'s ' catTitle += params.category + ' ' catTitle += this.langDefaults[params.language].packageType + ' ' catTitle += ' in JavaScript' var catData = { warning: 'This file is auto generated by `npm run web:inject`, do not edit by hand', type: 'category', layout: 'category', language: params.language, category: params.category, title: catTitle } this._injectwebBuffer[catIndexPath] = '---' + '\n' + YAML.safeDump(catData).trim() + '\n' + '---' + '\n' } var functionTitle = this.langDefaults[params.language].function_title_template .replace(/\[language\]/g, this.langDefaults[params.language].human) .replace(/\[category\]/g, params.category) .replace(/\[function\]/g, params.func_name) .replace(/\[functiondashed\]/g, params.func_name.replace(/_/g, '-')) var functionDescription = this.langDefaults[params.language].function_description_template .replace(/\[language\]/g, this.langDefaults[params.language].human) .replace(/\[category\]/g, params.category) .replace(/\[function\]/g, params.func_name) .replace(/\[functiondashed\]/g, params.func_name.replace(/_/g, '-')) var funcData = { warning: 'This file is auto generated by `npm run web:inject`, do not edit by hand', examples: (params.headKeys.example || []).map(function (lines, i) { return lines.join('\n') }), estarget: (params.headKeys.estarget || []).map(function (lines, i) { return lines.join('\n') }).join('\n').trim() || 'es5', returns: (params.headKeys.returns || []).map(function (lines, i) { return lines.join('\n') }), dependencies: [], authors: authors || {}, notes: (params.headKeys.note || []).map(function (lines, i) { return lines.join('\n') }), type: 'function', layout: 'function', title: functionTitle, description: functionDescription, function: params.func_name, category: params.category, language: params.language, permalink: params.language + '/' + params.category + '/' + params.func_name + '/', alias: [ '/functions/' + params.language + '/' + params.func_name + '/', '/functions/' + params.category + '/' + params.func_name + '/', '/' + params.language + '/' + params.func_name + '/' ] } if (params.language === 'php') { funcData.alias.push('/functions/' + params.func_name + '/') } var buf = '---' + '\n' + YAML.safeDump(funcData).trim() + '\n' + '---' + '\n' buf += `{% codeblock lang:javascript %}${params.code}{% endcodeblock %}` mkdirp(path.dirname(funcPath), function (err) { if (err) { throw new Error('Could not mkdir for ' + funcPath + '. ' + err) } fs.writeFile(funcPath, buf, 'utf-8', cb) }) }
return exists || new Promise(function(resolve, reject) { mkdirp(filepath, _resolveWidthError(resolve, reject)); });
var mkdir = thunky(function(cb) { mkdirp(opts.tmp, cb); });
destination: function (req, file, cb) { mkdirp('public/uploads/ask/'+req.session.passport.user+'/'); cb(null, 'public/uploads/ask/'+req.session.passport.user); },
env.mkdirp = function (p, cb) { return mkdirp(path.join(dirPath, p), cb); };
return new Promise((resolve) => { mkdirp(dirname(path), () => { writeFile(path, data, opts, resolve); }); });
orchestrator.add('ensureDir', function (done) { mkdirp(destDir, function (err) { done(err); }); });
return new Promise((resolve) => { mkdirp(dirname(newPath), () => { rename(oldPath, newPath, resolve); }); });
_createSourceDirectories: function() { mkdirp('src/components', this._createDirectoryCallback.bind(this)); mkdirp('src/utils', this._createDirectoryCallback.bind(this)); },
function gify(input, output, opts, fn) { if (!input) throw new Error('input filename required'); if (!output) throw new Error('output filename required'); // options if ('function' == typeof opts) { fn = opts; opts = {}; } else { opts = opts || {}; } // dims var w = opts.width; var h = opts.height; var rate = opts.rate || 10; var delay = opts.delay || 'auto'; // auto delay if ('auto' == delay) { delay = 1000 / rate / 10 | 0; } // scale var scale; if (w) scale = w + ':-1'; else if (h) scale = '-1:' + h; else scale = '500:-1'; // tmpfile(s) var id = uid(10); var dir = '/tmp/' + id; var tmp = dir + '/%04d.png'; function gc(err) { debug('remove %s', dir); exec('rm -fr ' + dir); fn(err); } debug('mkdir -p %s', dir); mkdirp(dir, function(err){ if (err) return fn(err); // convert to gif var cmd = ['ffmpeg']; cmd.push('-i', input); cmd.push('-filter:v', 'scale=' + scale); cmd.push('-r', String(rate)); if (opts.start) cmd.push('-ss', String(opts.start)); if (opts.duration) cmd.push('-t', String(opts.duration)); cmd.push(tmp); cmd = escape(cmd); debug('exec `%s`', cmd); exec(cmd, function(err){ if (err) return gc(err); var cmd; cmd = ['gm', 'convert']; cmd.push('-delay', String(delay || 0)); cmd.push('-loop', '0'); cmd.push('/tmp/' + id + '/*.png'); cmd.push(output); cmd = escape(cmd); debug('exec `%s`', cmd); exec(cmd, gc); }); }); }
Mkdirp(buildDir, function(err) { if (err) exitWithError(err); if (argv.check) { DepsCheck.check(argv.os.map(function(os) { return os.platform; }), function(err, results) { if (err) exitWithError(err); DepsCheck.report(results); process.exit(); }); } else { // Each app will be process for each OS specified through the command line. // First we'll do a basic check if the app directories exist: argv.apps.forEach(function(appPath) { // Throw an error message if we can't figure out what html file is the app's // HTML entry point if (!Fs.existsSync(appPath)) exitWithError("Can't find app HTML (tried '" + appPath + "')"); }); // Then we'll check if the necessary xulrunner is present for all OSes to build: Async.eachSeries(argv.os, function(os, nextOS) { var fetcher = new Mozfetcher(buildDir, os.platform, os.arch); // Tack path to the xulrunner executable on `os`, to reuse later in run()! os.xulrunnerPath = fetcher.getXulrunnerPath(); fetcher.fetchIfNeeded(nextOS); }, function(err) { if (err) exitWithError(err); run(); }); } });
function mkdirp(path, _, callback) { mp(path, callback); }
AngularWebpackES6Generator.prototype.copyFiles = function copyFiles() { mkdirp("src"); mkdirp("e2e"); mkdirp("src/assets"); mkdirp("src/assets/images"); mkdirp("src/assets/js"); this.fs.copyTpl( this.templatePath('_package.json'), this.destinationPath('package.json'), this ); this.fs.copyTpl( this.templatePath('_webpack.config.js'), this.destinationPath('webpack.config.js'), this ); this.fs.copyTpl( this.templatePath('_postcss.config.js'), this.destinationPath('postcss.config.js'), this ); this.fs.copy( this.templatePath('_.gitignore'), this.destinationPath('.gitignore') ); this.fs.copy( this.templatePath('_.babelrc'), this.destinationPath('.babelrc') ); this.fs.copy( this.templatePath('_.eslintrc.json'), this.destinationPath('.eslintrc.json') ); this.fs.copy( this.templatePath('_karma.conf.js'), this.destinationPath('karma.conf.js') ); this.fs.copyTpl( this.templatePath('_spec.bundle.js'), this.destinationPath('spec.bundle.js'), this ); this.fs.copy( this.templatePath('_protractor.conf.js'), this.destinationPath('protractor.conf.js') ); this.fs.copyTpl( this.templatePath('_config/**/*'), this.destinationPath('config/'), this ); this.fs.copy( this.templatePath('_src/_favicon.ico'), this.destinationPath('src/favicon.ico') ); this.fs.copy( this.templatePath('_src/_tpl-index.ejs'), this.destinationPath('src/tpl-index.ejs') ); this.fs.copyTpl( this.templatePath('_src/_assets/_styles/_sass/_index.scss'), this.destinationPath('src/assets/styles/sass/index.scss'), this ); this.fs.copy( this.templatePath('_src/_assets/_images/**/*'), this.destinationPath('src/assets/images') ); this.fs.copyTpl( this.templatePath('_src/_app/_index.bootstrap.js'), this.destinationPath('src/app/index.bootstrap.js'), this ); this.fs.copyTpl( this.templatePath('_src/_app/_index.module.js'), this.destinationPath('src/app/index.module.js'), this ); this.fs.copy( this.templatePath('_src/_app/_index.components.js'), this.destinationPath('src/app/index.components.js') ); this.fs.copy( this.templatePath('_src/_app/_index.config.js'), this.destinationPath('src/app/index.config.js') ); this.fs.copyTpl( this.templatePath('_src/_app/_index.routes.js'), this.destinationPath('src/app/index.routes.js'), this ); this.fs.copy( this.templatePath('_src/_app/_index.run.js'), this.destinationPath('src/app/index.run.js') ); this.fs.copyTpl( this.templatePath('_src/_app/_index.vendor.js'), this.destinationPath('src/app/index.vendor.js'), this ); this.fs.copy( this.templatePath('_src/_app/_components/_footer/**/*'), this.destinationPath('src/app/components/footer') ); this.fs.copy( this.templatePath('_src/_app/_core/core.module.js'), this.destinationPath('src/app/core/core.module.js') ); this.fs.copy( this.templatePath('_src/_app/_core/_directives/**/*'), this.destinationPath('src/app/core/directives') ); this.fs.copyTpl( this.templatePath('_src/_app/_core/_services/**/*'), this.destinationPath('src/app/core/services'), this ); this.fs.copyTpl( this.templatePath('_src/_app/_pages/main/**/*'), this.destinationPath('src/app/pages/main'), this ); this.fs.copyTpl( this.templatePath('_e2e/**/*'), this.destinationPath('e2e'), this ); if (this.props.ocLazyLoad) { this.fs.copy( this.templatePath('_src/_app/_pages/async-page-example/**/*'), this.destinationPath('src/app/pages/async-page-example') ); } };
' window.define(\'' + name + '\', [], function () {', ' return ' + name + ';', ' });', '// CommonJS', '} else if (typeof module !== \'undefined\' && module.exports !== undefined) {', ' module.exports = ' + name + ';', '// Browser', '} else {', ' window.' + name + ' = ' + name + ';', '};' ].join('\n'); /** * Create directory */ mkdirp('./dist'); /** * Build task */ gulp.task('build', function() { mkdirp('./dist'); gulp.src('./index.js') .pipe(header(prefix, { 'pkg' : pkg })) .pipe(footer(postfix)) .pipe(replace('module.exports = ' + name + ';', umd)) .pipe(rename(pkg.name + '.js')) .pipe(gulp.dest('./dist/')); }); /**