inputFiles.forEach(file => { const result = app.convert(app.expandInputFiles([file])); fs.writeFileSync(`${fixturesDir}/${path.basename(file)}.json`, JSON.stringify(result, replacer)); console.log(`[typedoc-plugin-markdown(task:fixtures)] writing ${path.basename(file)}.json fixture`); });
/** * @param {string} fileURL * @param {string} content * @param {string} encoding */ writeFile(fileURL, content, encoding) { if (encoding === 'base64') content = Buffer.from(content, 'base64'); fs.writeFileSync(new URL(fileURL), content, {encoding: encoding}); }
function writeCredentials(obj, pathname) { let stdlibPath = pathname ? path.join(pathname, FILENAME) : findPath(); if (!stdlibPath) { throw new Error(`Please initialize stdlib in directory tree`); } let str = Object.keys(obj).map(k => `${k}=${obj[k]}`).join('\n') + '\n'; fs.writeFileSync(stdlibPath, str); }
(function main() { const version = require('./package.json').version; let preload = fs.readFileSync('./lib/preload/ndb/preload.js', 'utf8'); preload = preload.replace(/process\.versions\['ndb'\] = '[\d+\.]+';/, `process.versions['ndb'] = '${version}';`); fs.writeFileSync('./lib/preload/ndb/preload.js', preload, 'utf8'); })();
function jsonOut (name, data) { fs.writeFileSync( path.resolve(__dirname, `../dist/${name}.json`), JSON.stringify(data)) }
getCurrentVersion().then(({ latest }) => { packageJson.version = PRE_RELEASE_VERSION packageJson.kafkajs = { sha: commitSha, compare: `https://github.com/tulios/kafkajs/compare/v${latest}...${commitSha}`, } console.log(packageJson.kafkajs) const filePath = path.resolve(__dirname, '../../package.json') fs.writeFileSync(filePath, JSON.stringify(packageJson, null, 2)) console.log(`Package.json updated with pre-release version ${PRE_RELEASE_VERSION}`) })
dumpTiming() { try { const json = this.timing.toJSON(); const rundir = this.config.rundir; const dumpFile = path.join(rundir, `${this.type}_timing_${process.pid}.json`); fs.writeFileSync(dumpFile, CircularJSON.stringify(json, null, 2)); this.timing.clear(); this.timing.disable(); } catch (err) { this.coreLogger.warn(`dumpTiming error: ${err.message}`); } }
// Let's also make a copy of caCert with the standarized .crt ending for better linux compat // See: https://github.com/lando/lando/issues/1550 lando.events.on('pre-engine-start', 3, data => { const caNormalizedCert = path.join(caDir, `${caDomain}.crt`); if (fs.existsSync(caCert) && !fs.existsSync(caNormalizedCert)) { // @NOTE: we need to use pre node 8.x-isms because pld roles with node 7.9 currently fs.writeFileSync(caNormalizedCert, fs.readFileSync(caCert)); } });
/** * Save tab handler --> Writes to filesystem of whichever path is being changed */ saveTab() { fs.writeFileSync(this.state.previousPaths[this.state.previousPaths.length - 1], this.state.openTabs[this.state.previousPaths[this.state.previousPaths.length - 1]].editorValue, { encoding: 'utf8' }); }
nodeVersionData((err, versions) => { if (err) { console.error('Aborting due to download error from node or iojs') console.error(err.stack) return process.exit(1) } fs.writeFileSync( path.join(__dirname, '..', 'source', 'versions.json') , JSON.stringify(versions, null, 2) ) })
function writeFile(file, data) { fs.writeFileSync(makePath(file), data, "utf8"); return new Promise((resolve, reject) => { // wait a bit for zero to be ready // TODO: When zero has an eventemitter feature, wait for 'ready' instead. setTimeout(() => { resolve(); }, process.env.HMRWAITTIME || 3000); }); }
mods.forEach(mod => { fs.writeFileSync( require.resolve(mod[0]), fs.readFileSync(path.join(__dirname, "mods", mod[1]), "utf8"), "utf8" ); });
function applyHelmetMod() { var files = ["lib/index.js", "lib/index.module.js"]; files.forEach(file => { var fullPath = resolve(`react-helmet-async/${file}`); var content = fs.readFileSync(fullPath, "utf8"); content = content.replace("r.warnOnInvalidChildren(e,i)", "false"); content = content.replace("r.warnOnInvalidChildren(t,i)", "false"); fs.writeFileSync(fullPath, content, "utf8"); }); }
mods.forEach(mod => { fs.writeFileSync( require.resolve(mod[0]), fs.readFileSync(path.join(__dirname, "mods", mod[1]), "utf8"), "utf8" ); });
function applyHelmetMod() { var files = ["lib/index.js", "lib/index.module.js"]; files.forEach(file => { var fullPath = resolve(`react-helmet-async/${file}`); var content = fs.readFileSync(fullPath, "utf8"); content = content.replace("r.warnOnInvalidChildren(e,i)", "false"); content = content.replace("r.warnOnInvalidChildren(t,i)", "false"); fs.writeFileSync(fullPath, content, "utf8"); }); }