How to use the tempy.directory function in tempy

To help you get started, we’ve selected a few tempy 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 expo / expo-cli / packages / expo-cli / src / commands / eject / Eject.ts View on Github external
appJson.expo.entryPoint = EXPO_APP_ENTRY;
  }

  log('Writing app.json...');
  await fse.writeFile(path.resolve('app.json'), JSON.stringify(appJson, null, 2));
  log(chalk.green('Wrote to app.json, please update it manually in the future.'));

  // This is validated later...
  let defaultDependencies: any = {};
  let defaultDevDependencies: any = {};

  /**
   * Extract the template and copy it over
   */
  try {
    const tempDir = temporary.directory();
    await Exp.extractTemplateAppAsync(templateSpec, tempDir, appJson);
    fse.copySync(path.join(tempDir, 'ios'), path.join(projectRoot, 'ios'));
    fse.copySync(path.join(tempDir, 'android'), path.join(projectRoot, 'android'));
    const { dependencies, devDependencies } = JsonFile.read(path.join(tempDir, 'package.json'));
    defaultDependencies = ensureDependenciesMap(dependencies);
    defaultDevDependencies = devDependencies;
    log('Successfully copied template native code.');
  } catch (e) {
    log(chalk.red(e.message));
    log(chalk.red(`Eject failed, see above output for any issues.`));
    log(chalk.yellow('You may want to delete the `ios` and/or `android` directories.'));
    process.exit(1);
  }

  log(`Updating your package.json...`);
  if (!pkg.scripts) {
github typicode / husky / src / __tests__ / getConf.ts View on Github external
it('should support .huskyrc', (): void => {
    const tempDir = tempy.directory()
    fs.writeFileSync(
      path.join(tempDir, '.huskyrc'),
      JSON.stringify(testConf.husky)
    )

    expect(getConf(tempDir)).toEqual({ skipCI: true, foo: 'bar' })
  })
})
github GoogleChrome / workbox / test / workbox-build / node / generate-sw.js View on Github external
it(`should use defaults when all the required parameters are present, with 'globFollow' and  symlinks`, async function() {
      const outputDir = tempy.directory();
      const swDest = upath.join(outputDir, 'sw.js');
      const globDirectory = tempy.directory();

      await fse.ensureSymlink(GLOB_DIR, upath.join(globDirectory, 'link'));

      const options = Object.assign({}, BASE_OPTIONS, {
        globDirectory,
        globFollow: false,
        swDest,
      });

      const {count, filePaths, size, warnings} = await generateSW(options);
      expect(warnings).to.be.empty;
      expect(count).to.eql(4);
      expect(size).to.eql(2535);

      confirmDirectoryContains(outputDir, filePaths);
github sindresorhus / make-dir / test / sync.js View on Github external
test('dir exists', t => {
	const dir = makeDir.sync(tempy.directory());
	t.true(dir.length > 0);
	assertDirectory(t, dir);
});
github pfrazee / diff-file-tree / test / util.js View on Github external
module.exports.mockCyclical = function mockCyclical () {
  var sfs = new ScopedFS(tempy.directory())
  fs.mkdirSync(path.join(sfs.base, 'subdir'))
  fs.writeFileSync(path.join(sfs.base, 'subdir', 'foo.txt'), 'more content', 'utf8')
  fs.symlinkSync(sfs.base, path.join(sfs.base, 'subdir', 'symlink'))
  return sfs
}
github beakerbrowser / webdb / test / query-mutators.js View on Github external
async function def (fn) {
    const a = await DatArchive.create({localPath: tempy.directory()})
    await a.mkdir('/multi')
    const write = (path, record) => a.writeFile(path, JSON.stringify(record))
    await fn(write, a)
    return a
  }
  for (let i = 0; i < 10; i++) {
github lukeed / mk-dirs / bench / index.js View on Github external
const getDir = _ => join(tempy.directory(), 'foo/bar/baz');
github wulkano / kap / main / convert.js View on Github external
const convertTo = (opts, format) => {
  const outputPath = path.join(tempy.directory(), opts.defaultFileName);
  const converter = converters.get(format);

  if (!converter) {
    throw new Error(`Unsupported file format: ${format}`);
  }

  opts.onProgress(0);
  track(`file/export/format/${format}`);

  return converter({outputPath, ...opts});
};
github viddo / atom-textual-velocity / lib / uiDev.js View on Github external
export default function uiDev(panel: Panel) {
  const initialState: any = {
    dir: tempy.directory(),
    listHeight: 150
  };
  const store = createStore(rootReducer, initialState);
  render(
    
      
    ,
    panel.getItem()
  );

  const hiddenColumns = atom.config.get("textual-velocity.hiddenColumns");
  store.dispatch(A.changeHiddenColumns(hiddenColumns));
  const rawFiles = generateRawFiles(20000);
  store.dispatch(A.readDirDone(rawFiles));
}

tempy

Get a random temporary file or directory path

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis