Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
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
}
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);
}
}
filteredData.forEach(({ filename, doc }, i) => {
fs.writeFileSync(
`./${name}/premapped/${filename}`,
JSON.stringify(doc, null, 2)
);
});
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})
})
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));
}
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);
};
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);
});
}
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));
}