How to use mkpath - 10 common examples

To help you get started, we’ve selected a few mkpath 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 nordnet / cordova-universal-links-plugin / hooks / lib / ios / projectEntitlements.js View on Github external
function saveContentToEntitlementsFile(content) {
  var plistContent = plist.build(content);
  var filePath = pathToEntitlementsFile();

  // ensure that file exists
  mkpath.sync(path.dirname(filePath));

  // save it's content
  fs.writeFileSync(filePath, plistContent, 'utf8');
}
github ionic-team / ionic-plugin-deeplinks / hooks / lib / ios / projectEntitlements.js View on Github external
function saveContentToEntitlementsFile(content) {
  var plistContent = plist.build(content);
  var filePath = pathToEntitlementsFile();

  // ensure that file exists
  mkpath.sync(path.dirname(filePath));

  // save it's content
  fs.writeFileSync(filePath, plistContent, 'utf8');
}
github BranchMetrics / cordova-ionic-phonegap-branch-deep-linking-attribution / hooks / lib / ios / projectEntitlements.js View on Github external
function saveContentToEntitlementsFile(content) {
    var plistContent = plist.build(content),
        filePath = pathToEntitlementsFile();

    // ensure that file exists
    mkpath.sync(path.dirname(filePath));

    // save it's content
    fs.writeFileSync(filePath, plistContent, 'utf8');
  }
github auth0-blog / angular2-authentication-sample / gulpfile.js View on Github external
gulp.task('css', function() {
  var file = path.resolve(PATHS.src.css.main);
  var source = path.relative(__dirname, file);
  mkpath.sync('dist');
  var output = fs.createWriteStream('dist/build.css');
  var contents = fs.readFileSync(file, {encoding: 'utf8'});

  // Initialize and pluginize `rework`
  var css = rework(contents);
  css.use(npmRework());

  // write result
  output.write(css.toString())
  output.end();
});
github capaj / proxy-recorder / index.js View on Github external
recorder.rec = function rec (opts) {
  const proxy = httpProxy.createProxyServer({
    changeOrigin: true
  }) // be default we changeOrigin, because

  // ssl enabled APIs like github throw Hostname/IP doesn't match certificate's altnames when this is not enabled
  const defaultPath = 'test/fixtures/' + utils.urlToFilename(opts.target)

  const mockPath = opts.mockPath || defaultPath
  mkpath.sync(mockPath)

  const bodies = {}
  proxy.on('proxyRes', function (proxyRes, req, res) {
    const body = bodies[req._header]
    if (body) {
      req.body = body
    }
    record(req, proxyRes, mockPath)
  })

  const app = connect()
    .use(morgan)
    .use(function (req, res) {
      let body = ''
      req.on('data', function (data) {
        body += data
github trek10inc / serverless-secrets / src / encryptors / providers / kmsfile.js View on Github external
kms.generateDataKey(params, function(err, data){
    if (err) return callback(err); // an error occurred
    else{

      mkpath.sync(path.join(project.getRootPath(), '_meta', 'secrets', 'kmsfile'));

      let aesCtr = new aesjs.ModeOfOperation.ctr(data.Plaintext);
      let encryptedBytes = aesCtr.encrypt(plaintext);

      fs.writeFileAsync(path.join(project.getRootPath(), '_meta', 'secrets', 'kmsfile', path.basename(evt.options.file)), encryptedBytes);
      return callback(null, `kmsfile::${kmskey}::${data.CiphertextBlob.toString('base64')}::${path.basename(evt.options.file)}`);
    }
  });
}
github rthor / cra-generate / generate.js View on Github external
function getComponentPath(componentName, directory, fileName) {
  const cwd = process.cwd()
  const root = path.join(cwd, 'src')
  mkdir.sync(root)

  const dir = path.join(root, directory)
  mkdir.sync(dir)
  const componentPath = path.join(dir, fileName)
  const exists = fs.existsSync(componentPath)

  if (exists) {
    console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
    return process.exit(1)
  }

  mkdir.sync(componentPath)
  return componentPath
}
github rthor / cra-generate / generate.js View on Github external
function getComponentPath(componentName, directory, fileName) {
  const cwd = process.cwd()
  const root = path.join(cwd, 'src')
  mkdir.sync(root)

  const dir = path.join(root, directory)
  mkdir.sync(dir)
  const componentPath = path.join(dir, fileName)
  const exists = fs.existsSync(componentPath)

  if (exists) {
    console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
    return process.exit(1)
  }

  mkdir.sync(componentPath)
  return componentPath
}
github rthor / cra-generate / generate.js View on Github external
function getComponentPath(componentName, directory, fileName) {
  const cwd = process.cwd()
  const root = path.join(cwd, 'src')
  mkdir.sync(root)

  const dir = path.join(root, directory)
  mkdir.sync(dir)
  const componentPath = path.join(dir, fileName)
  const exists = fs.existsSync(componentPath)

  if (exists) {
    console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
    return process.exit(1)
  }

  mkdir.sync(componentPath)
  return componentPath
}
github nordnet / cordova-universal-links-plugin / hooks / lib / ios / appleAppSiteAssociationFile.js View on Github external
function createDirectoriesIfNeeded(dirPath) {
  try {
    mkpath.sync(dirPath);
  } catch (err) {
    console.log(err);
  }
}

mkpath

Make all directories in a path, like mkdir -p

MIT
Latest version published 9 years ago

Package Health Score

50 / 100
Full package analysis

Popular mkpath functions