How to use the tmp.dirAsync function in tmp

To help you get started, we’ve selected a few tmp 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 Rush / publish-to-git / index.js View on Github external
async function publish({tag, version, push, packOptions}, pack = packWithNpm) {
  if (!tag) {
    tag = `v${version}`;
  }

  const tmpRepoDir = await tmp.dirAsync();
  let temporaryRemote = path.basename(tmpRepoDir);

  const git = (...args) => execFileAsync('git', args);
  const gitInTmpRepo = (...args) => execFileAsync('git', args, {
    cwd: tmpRepoDir
  });

  try {
    const gitInitPromise = gitInTmpRepo('init');

    await pack(Object.assign({
      sourceDir: process.cwd(),
      targetDir: tmpRepoDir,
    }, packOptions));

    await gitInitPromise;