Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const checkIsCycle = async () => {
const dir = path.join(xdg.cache, 'flipper');
const filePath = path.join(dir, 'last-launcher-run');
// This isn't monotonically increasing, so there's a change we get time drift
// between the checks, but the worst case here is that we do two roundtrips
// before this check works.
const rightNow = Date.now();
let backThen;
try {
backThen = parseInt(await promisify(fs.readFile)(filePath), 10);
} catch (e) {
backThen = 0;
}
const delta = rightNow - backThen;
await promisify(mkdirp)(dir);
await promisify(fs.writeFile)(filePath, rightNow);
symfonyBase: function () {
const source = 'https://github.com/symfony/symfony-standard/archive/v' + this.props.commit + '.zip';
const dest = this.destinationRoot();
const cache = path.join(xdgBasedir.cache, 'generator-sf');
// Will be generated from the zip
const dirname = 'symfony-standard-' + this.props.commit;
const log = this.log.write();
// Check cache first
return fs.statAsync(path.join(cache, dirname))
.catch(() => {
log.info('Fetching %s ...', source)
.info(chalk.yellow('This might take a few moments'));
return download(source, cache, {extract: true});
})
.then(() => {
return fs.copyAsync(path.join(cache, dirname) + '/', dest + '/.');
});
},
remote.cacheRoot = function cacheRoot() {
return path.join(xdgBasedir.cache, 'node-yeoman-remote-cache');
};
cache.path = function () {
var basePath = basedir.cache || os.tempdir();
var cachePath = path.join(basePath, C.CACHE_DIR_NAME, C.CACHE_FILE_NAME);
return cachePath;
};