How to use the make-dir function in make-dir

To help you get started, we’ve selected a few make-dir 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 prisma / photonjs / packages / photon / src / generation / generateClient.ts View on Github external
datamodel,
    datamodelPath,
    schemaDir,
    transpile,
    runtimePath,
    browser,
    outputDir,
    generator,
    version,
    dmmf,
    datasources,
    binaryPaths,
  })

  debug(`makeDir: ${outputDir}`)
  await makeDir(outputDir)
  await Promise.all(
    Object.entries(fileMap).map(async ([fileName, file]) => {
      const filePath = path.join(outputDir, fileName)
      // The deletion of the file is necessary, so VSCode
      // picks up the changes.
      if (await exists(filePath)) {
        await remove(filePath)
      }
      await writeFile(filePath, file)
    }),
  )
  const inputDir = testMode
    ? eval(`require('path').join(__dirname, '../../runtime')`) // tslint:disable-line
    : eval(`require('path').join(__dirname, '../runtime')`) // tslint:disable-line

  // if users use a custom output dir
github DevExpress / testcafe / src / utils / temp-directory / index.js View on Github external
async _createNewTmpDir () {
        this.path = tmp.tmpNameSync({ dir: TempDirectory.TEMP_DIRECTORIES_ROOT, prefix: this.namePrefix + '-' });

        await makeDir(this.path);

        this.lockFile = new LockFile(this.path);

        this.lockFile.init();
    }
github DevExpress / testcafe / src / runner / bootstrapper.js View on Github external
async _ensureOutStream (outStream) {
        if (typeof outStream !== 'string')
            return outStream;

        const fullReporterOutputPath = resolvePathRelativelyCwd(outStream);

        await makeDir(path.dirname(fullReporterOutputPath));

        return fs.createWriteStream(fullReporterOutputPath);
    }
github zeit / next.js / packages / create-next-app / create-app.ts View on Github external
if (example) {
    const found = await hasExample(example)
    if (!found) {
      console.error(
        `Could not locate an example named ${chalk.red(
          `"${example}"`
        )}. Please check your spelling and try again.`
      )
      process.exit(1)
    }
  }

  const root = path.resolve(appPath)
  const appName = path.basename(root)

  await makeDir(root)
  if (!isFolderEmpty(root, appName)) {
    process.exit(1)
  }

  const useYarn = useNpm ? false : shouldUseYarn()
  const isOnline = !useYarn || (await getOnline())
  const originalDirectory = process.cwd()

  const displayedCommand = useYarn ? 'yarn' : 'npm'
  console.log(`Creating a new Next.js app in ${chalk.green(root)}.`)
  console.log()

  await makeDir(root)
  process.chdir(root)

  if (example) {
github logux / logux.io / scripts / steps / copy-well-known.js View on Github external
async function copyWellKnown (assets) {
  await makeDir(join(DIST, '.well-known'))
  await Promise.all(FILES.map(async i => {
    if (i.endsWith('/')) {
      let from = join(SRC, 'well-known', i.slice(0, -1))
      let to = join(DIST, i.slice(0, -1))
      let files = await copyDir(from, to)
      for (let file of files) {
        if (file.dest !== to) {
          assets.add(file.dest)
        }
      }
    } else {
      let from = join(SRC, 'well-known', i)
      let to = join(DIST, i)
      if (i === 'security.txt') to = join(DIST, '.well-known', i)
      assets.add(to)
      await fs.copyFile(from, to)
github swashata / wp-webpack-script / packages / scripts / src / scripts / Pack.ts View on Github external
private async mkDirPackageSlug(): Promise {
		return makeDir(this.packageSlugPath);
	}
github tommy351 / kosko / packages / cli / src / commands / init.ts View on Github external
const logger = getLogger(args);
    const path = args.path ? resolve(args.cwd, args.path) : args.cwd;
    logger.info("Initialize in", path);

    const exist = await exists(path);

    if (exist && !args.force) {
      throw new CLIError("Already exists", {
        output: `Already exists. Use "--force" to overwrite existing files.`
      });
    }

    for (const name of ["components", "environments", "templates"]) {
      const dir = join(path, name);
      debug("Creating directory", dir);
      await makeDir(dir);
    }

    await updatePkg(join(path, "package.json"), {
      dependencies: {
        "@kosko/env": "^0.4.1",
        "kubernetes-models": "^0.5.0"
      }
    });

    const configPath = join(path, "kosko.toml");
    debug("Writing config", configPath);
    await writeFile(configPath, DEFAULT_CONFIG);

    logger.success(
      `We are almost there. Run "npm install" to finish the setup.`
    );
github namics / frontend-defaults / cli / src / write-files.ts View on Github external
const writeFile = async (pathName: string, data: string | object) => {
	await makeDir(path.join(pathName.replace(path.basename(pathName), '')));
	await fs.writeFile(pathName, typeof data === 'string' ? data : JSON.stringify(data, null, 2));
};
github jaylinski / remok / src / Repository.js View on Github external
async save(RequestResponse) {
    const Request = RequestResponse.request;
    Request._hash = this.hash.request(Request);

    const Response = RequestResponse.response;
    Response._hash = this.hash.response(Response);

    await makeDir(this.getFilePathByRequest(Request));

    const fileName = `${Request.method}.${Request._hash}.${Response._hash}.json`;
    const filePath = `${this.getFilePathByRequest(Request)}${path.sep}${fileName}`;
    const data = JSON.stringify(RequestResponse, null, 2);

    return new Promise((resolve, reject) => {
      fs.writeFile(filePath, data, (err) => {
        if (err) {
          reject(err);
        } else {
          const mock = new MockFile(path.relative(this.directory, filePath));
          this.addMock(mock);
          resolve(true);
        }
      });
    });
github sqren / backport / src / options / config / globalConfig.ts View on Github external
export async function maybeCreateGlobalConfigAndFolder() {
  const reposPath = getReposPath();
  const globalConfigPath = getGlobalConfigPath();
  const configTemplate = await getConfigTemplate();
  await makeDir(reposPath);
  const didCreate = await maybeCreateGlobalConfig(
    globalConfigPath,
    configTemplate
  );
  await ensureCorrectPermissions(globalConfigPath);
  return didCreate;
}

make-dir

Make a directory and its parents if needed - Think `mkdir -p`

MIT
Latest version published 22 days ago

Package Health Score

83 / 100
Full package analysis

Popular make-dir functions