How to use the mz/fs.writeFileSync function in mz

To help you get started, we’ve selected a few mz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flutter-view / flutter-view / src / watcher.ts View on Github external
})
		if(options.debug && options.debug.logDartPostAST) 
			console.debug(relativeFile, 'Dart Post-process AST:\n' + JSON.stringify(widgets, null, 3))
		
		// extract the imports to use from the ast
		const imports = extractImports(ast)

		// convert the widget tree with imports into dart source code
		const p = parseFileName(file)
		const dartFile = `${p.dir}/${p.name}.dart`
		const relativeDartFile = relative(process.cwd(), dartFile)
		const code = renderDartFile(relativeDartFile, widgets, imports, options)
		if(options.debug && options.debug.logCode) console.debug(relativeFile, 'Code:\n' + code)

		// save the code
		fs.writeFileSync(dartFile, code)
		return dartFile
	}
github cnpm / npminstall / lib / local_install.js View on Github external
const isToday = key === today;
      const label = isToday ? 'Today:' : key;
      const logToConsole = !options.onlyShowTodayUpdateToConsole || (options.onlyShowTodayUpdateToConsole && isToday);
      const text = `  ${label}`;
      recentlyUpdatesText += `${text}\n`;

      logToConsole && console.info(chalk.gray(text));
      const list = displays[key];
      for (const message of list) {
        const text = `    ${chalk.green('→')} ${message}`;
        recentlyUpdatesText += `${text}\n`;

        logToConsole && console.info(text);
      }
    }
    fs.writeFileSync(recentlyUpdatesTextFile, recentlyUpdatesText);
  }
}
github wellcometrust / wellcomecollection.org / prismic_remapper / remap.js View on Github external
filteredData.forEach(({ filename, doc }, i) => {
    fs.writeFileSync(
      `./${name}/premapped/${filename}`,
      JSON.stringify(doc, null, 2)
    );
  });
github heroku / cli / gulp / plugins.js View on Github external
gulp.task('build:coreplugins', ['build:workspace'], () => {
  fs.writeFileSync(workspace + '/lib/package.json', JSON.stringify(config.pjson, null, 2), 'utf8')
  return spawn('./bin/heroku', ['setup'], {cwd: workspace})
})
github cnpm / npminstall / lib / local_install.js View on Github external
function recordDependenciesTree(options) {
  if (!options.saveDependenciesTree) return;

  const tree = {};
  for (const key in options.cache.dependenciesTree) {
    tree[key] = omitPackage(options.cache.dependenciesTree[key]);
  }
  const installCacheFile = path.join(options.storeDir, '.dependencies_tree.json');
  fs.writeFileSync(installCacheFile, JSON.stringify(tree, null, 2));
}
github node-modules / utility / lib / json.js View on Github external
exports.writeJSONSync = function(filepath, str, options) {
  options = options || {};
  if (!('space' in options)) {
    options.space = 2;
  }

  mkdirp.sync(path.dirname(filepath));
  if (typeof str === 'object') {
    str = JSON.stringify(str, options.replacer, options.space) + '\n';
  }

  fs.writeFileSync(filepath, str);
};
github jgillich / hyper-proxy / index.js View on Github external
return Promise.join(services, config, (services, config) => {
    let newConfig = configTemplate({services: services});
    if(config != newConfig) {
      fs.writeFileSync(configPath, newConfig);
      return Promise.resolve(true);
    }
    return Promise.resolve(false);
  });
}
github cnpm / npminstall / lib / local_install.js View on Github external
function recordPackageVersions(options) {
  if (!options.installRoot) return;
  const versions = {};
  for (const pkg in options.packageVersions) {
    versions[pkg] = Array.from(options.packageVersions[pkg]);
  }
  const packageVersionsFile = path.join(options.storeDir, '.package_versions.json');
  fs.writeFileSync(packageVersionsFile, JSON.stringify(versions, null, 2));
}