beforeAll(async function(state) { const DEVTOOLS_DIR = path.dirname( require.resolve('chrome-devtools-frontend/front_end/shell.json')); const frontendFolder = await fsMkdtemp(path.join(os.tmpdir(), 'ndb-test-frontend-')); await new ReleaseBuilder([ path.join(__dirname, '..', 'front_end'), DEVTOOLS_DIR, path.join(__dirname, '..'), path.join(__dirname, '..', '..', '..') ], frontendFolder).buildApp('integration_test_runner'); state.frontendFolder = frontendFolder; });
const mkdirsSync = function(dirname) { if (fs.existsSync(dirname)) { return true; } if (mkdirsSync(path.dirname(dirname))) { fs.mkdirSync(dirname); return true; } }
fs.readdirSync(keyboardsDir).forEach(kb => { if (!kb.endsWith(".json")) return; kb = kb.replace(".json", ""); if (kb === window.settings.keyboard) return; keyboards += `<option>${kb}</option>`; });
_(config.LANDO_METRICS_PLUGINS) .map(plugin => _.merge({}, plugin, {path: path.resolve(__dirname, 'plugins', `${plugin.name}.js`)})) .filter(plugin => fs.existsSync(plugin.path)) .map(plugin => _.merge({}, plugin, {Reporter: require(plugin.path)})) .value()
// Start listening Promise.fromNode(cb => { api.listen(config.LANDO_API_PORT, cb); }) // Load our routes .then(() => { fs.readdirSync(path.join(__dirname, 'routes')).map(file => { require(`./routes/${file}`)(api, handler, {config, slack}); log.info('Loaded route %s', file); }); log.info('Listening on port: %s', config.LANDO_API_PORT); });
fs.readFile(tempPath, 'utf-8', (err, source) => { if (err) throw err; const template = handlebars.compile(source); const exportCode = template(data); callback(exportCode); });
const sslConnectionOpts = () => Object.assign(connectionOpts(), { port: 9093, ssl: { servername: 'localhost', rejectUnauthorized: false, ca: [fs.readFileSync('./testHelpers/certs/cert-signed', 'utf-8')], }, })
tape("styleFiles", (test) => { test.plan(4); fs.readdir("./style", function readdir(err, files) { test.ifError(err); files.forEach(function forFile(file) { test.ok(require(path.join("../style", file)), "Unable to load/parse."); }); test.end(); }); });
/** * @param {string} fileURL * @param {string} encoding */ readFile(fileURL, encoding) { return fs.readFileSync(new URL(fileURL), encoding); }
const readFile = filePath => { return new Promise((resolve, reject) => { fs.readFile(filePath, 'utf8', (error, fileContent) => { if (error != null) { reject(error); return; } resolve(fileContent); }); }); }
function renderPost (results) { const templateStr = fs.readFileSync(path.resolve(__dirname, 'release.hbs')).toString('utf8') const template = Handlebars.compile(templateStr, { noEscape: true }) const view = Object.assign({ date: new Date().toISOString(), versionSlug: slugify(results.version) }, results) return Object.assign({ content: template(view) }, results) }
_(fs.readdirSync(baseDir, {withFileTypes: true})) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) .concat('.') .map(directory => path.resolve(baseDir, directory, '.platform.app.yaml')) .filter(file => fs.existsSync(file)) .map(file => ({data: yamlPlatform.load(fs.readFileSync(file)), file})) .map(data => ({name: data.data.name, file: data.file, dir: path.dirname(data.file)})) .value()
/* * Toggle the secret toggle */ clearTaskCaches() { if (fs.existsSync(process.landoTaskCacheFile)) fs.unlinkSync(process.landoTaskCacheFile); if (fs.existsSync(process.landoAppTaskCacheFile)) fs.unlinkSync(process.landoAppTaskCacheFile); }
constructor(id, config = {}) { // Move our config into the userconfroot if we have some // NOTE: we need to do this because on macOS and Windows not all host files // are shared into the docker vm if (fs.existsSync(config.confSrc)) utils.moveConfig(config.confSrc, config.confDest); this.id = id; this.config = { proxy: config.proxy, services: config.services, tooling: config.tooling, }; }
const writeFile = (filePath, fileContent) => { return new Promise((resolve, reject) => { fs.writeFile(filePath, fileContent, writeFileError => { if (writeFileError) { reject(writeFileError); return; } resolve(filePath); }); }); }