How to use the make-dir.sync 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 istanbuljs / istanbuljs / packages / istanbul-api / lib / run-instrument.js View on Github external
if (iOpts.completeCopy()) {
        includes = ['**/*'];
    } else {
        includes = iOpts.extensions().map(ext => '**/*' + ext);
    }

    if (!input) {
        return callback(new Error('No input specified'));
    }

    instrumenter = libInstrument.createInstrumenter(
        iOpts.getInstrumenterOpts()
    );

    if (needBaseline) {
        mkdirp.sync(path.dirname(baselineFile));
        instrumenter = new BaselineCollector(instrumenter);
        callback = function(err) {
            /* istanbul ignore else */
            if (!err) {
                console.error('Saving baseline coverage at ' + baselineFile);
                fs.writeFileSync(
                    baselineFile,
                    JSON.stringify(instrumenter.getCoverage()),
                    'utf8'
                );
            }
            return origCallback(err);
        };
    }

    const file = path.resolve(input);
github vmware / clarity / latest / prerender.ts View on Github external
].forEach(file => {
    const content = ``;
    if (!existsSync(file.from)) {
      makeDir.sync(file.from);
    }
    writeFileSync(join(file.from, 'index.html'), content);
  });
};
github babel / babel / packages / babel-cli / src / babel / dir.js View on Github external
return count;
    } else {
      const filename = filenameOrDir;
      const written = await handleFile(filename, path.dirname(filename));

      return written ? 1 : 0;
    }
  }

  if (!cliOptions.skipInitialBuild) {
    if (cliOptions.deleteDirOnStart) {
      util.deleteDir(cliOptions.outDir);
    }

    makeDirSync(cliOptions.outDir);

    let compiledFiles = 0;
    for (const filename of cliOptions.filenames) {
      compiledFiles += await handle(filename);
    }

    if (!cliOptions.quiet) {
      console.log(
        `Successfully compiled ${compiledFiles} ${
          compiledFiles !== 1 ? "files" : "file"
        } with Babel.`,
      );
    }
  }

  if (cliOptions.watch) {
github splunk / splunk-sdk-javascript / node_modules / nyc / index.js View on Github external
const visitor = relFile => {
      const inFile = path.resolve(inputDir, relFile)
      const inCode = fs.readFileSync(inFile, 'utf-8')
      const outCode = this._transform(inCode, inFile) || inCode

      if (output) {
        const mode = fs.statSync(inFile).mode
        const outFile = path.resolve(output, relFile)
        mkdirp.sync(path.dirname(outFile))
        fs.writeFileSync(outFile, outCode)
        fs.chmodSync(outFile, mode)
      } else {
        console.log(outCode)
      }
    }
github splunk / splunk-sdk-javascript / node_modules / nyc / index.js View on Github external
createTempDirectory () {
    mkdirp.sync(this.tempDirectory())
    if (this.cache) mkdirp.sync(this.cacheDirectory)

    mkdirp.sync(this.processInfoDirectory())
  }
github babel / babel / packages / babel-cli / src / babel / dir.js View on Github external
function outputFileSync(filePath: string, data: string | Buffer): void {
  makeDirSync(path.dirname(filePath));
  fs.writeFileSync(filePath, data);
}
github uschek / somafm / index.js View on Github external
.then(channel => new Promise(resolve => {
      const imageDir = path.join(tempDir, pkg.name);
      channel.imageFile = path.join(imageDir, channel.id);

      if (!fs.existsSync(channel.imageFile)) {
        makeDir.sync(imageDir);
        got.stream(channel.image).pipe(fs.createWriteStream(channel.imageFile));
      }

      resolve(channel);
    }));
}
github smollweide / node-mock-server / lib / cli / init-cli.js View on Github external
function writeDirectory(answers) {
	var _path = path.join(answers.path);
	var _pathData = path.join(_path, '/rest');
	makeDir.sync(_path);
	makeDir.sync(_pathData);
	log('Wrote directory "' + _path + '"');
	log('Wrore directory "' + _pathData + '"');
	return Boolean(utils.existDir(_path) && utils.existDir(_pathData)) ? _path : undefined;
}
github istanbuljs / istanbuljs / packages / istanbul-lib-source-maps / lib / source-store.js View on Github external
constructor(opts = {}) {
        super();

        const tmpDir = opts.tmpdir || os.tmpdir();
        this.counter = 0;
        this.mappings = [];
        this.basePath = path.resolve(tmpDir, '.istanbul', 'cache_');
        mkdirp.sync(path.dirname(this.basePath));
    }
github istanbuljs / istanbuljs / packages / istanbul-lib-report / lib / file-writer.js View on Github external
writeFile(file) {
        if (file === null || file === '-') {
            return new ConsoleWriter();
        }
        if (path.isAbsolute(file)) {
            throw new Error(`Cannot write to absolute path: ${file}`);
        }
        file = path.resolve(this.baseDir, file);
        mkdirp.sync(path.dirname(file));
        return new FileContentWriter(fs.openSync(file, 'w'));
    }
}

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