How to use cachedir - 3 common examples

To help you get started, we’ve selected a few cachedir 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 commitizen / cz-cli / src / commitizen / commit.js View on Github external
function commit (sh, inquirer, repoPath, prompter, options, done) {
  var cacheDirectory = cacheDir('commitizen');
  var cachePath = path.join(cacheDirectory, 'commitizen.json');

  ensureDir(cacheDirectory, function (error) {
    if (error) {
      console.error("Couldn't create commitizen cache directory: ", error);
      // TODO: properly handle error?
    } else {
      if (options.retryLastCommit) {

        console.log('Retrying last commit attempt.');

        // We want to use the last commit instead of the current commit,
        // so lets override some options using the values from cache.
        let {
          options: retryOptions,
          overrideOptions: retryOverrideOptions,
github sysgears / larix / packages / larix / src / index.ts View on Github external
(async () => {
  try {
    const argv = parser(process.argv.slice(2), yarnYargsOpts);
    const cacheDir = cachedir('larix');

    const registryUrl = await runYarnAndGetLastLine(['config', 'get', 'registry']);
    const projectRoot = path.resolve('.');
    await checkNewVersion(registryUrl, cacheDir);
    if (argv.v) {
      console.log(require('../package.json').version);
    } else {
      if (argv._.length >= 1 && argv._[0] === 'remove') {
        const packageNames = argv._.slice(1);
        await removePrefabs({ projectRoot, packageNames, registryUrl, cacheDir });
      }
      await runYarn(process.argv.slice(2));

      if (argv._.length === 0 || (argv._.length >= 1 && ['add', 'install'].indexOf(argv._[0]) >= 0 && !argv.v)) {
        await addPrefabs({ projectRoot, registryUrl, cacheDir });
      }
github rstacruz / open-in-atom / lib / port-file.js View on Github external
export async function write ({ port }) {
  const dir = cachedir('open-in-atom')
  const filepath = require('path').resolve(dir, 'port')
  const data = `${port}\n`

  await thenify(mkdirp)(dir)
  await thenify(writeFile)(filepath, data, 'utf-8')

  return filepath
}

cachedir

Provides a directory where the OS wants you to store cached files.

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Popular cachedir functions