How to use the shelljs.mkdir function in shelljs

To help you get started, we’ve selected a few shelljs 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 postmanlabs / uvm / npm / test-unit.js View on Github external
module.exports = function (exit) {
    // banner line
    console.log(chalk.yellow.bold('Running unit tests using mocha on node...'));

    sh.test('-d', COV_REPORT_PATH) && sh.rm('-rf', COV_REPORT_PATH);
    sh.mkdir('-p', COV_REPORT_PATH);

    var Mocha = require('mocha'),
        nyc = new NYC({
            hookRequire: true,
            reporter: ['text', 'lcov', 'text-summary', 'json'],
            reportDir: COV_REPORT_PATH,
            tempDirectory: COV_REPORT_PATH
        });

    nyc.wrap();
    // add all spec files to mocha
    recursive(SPEC_SOURCE_DIR, function (err, files) {
        if (err) { console.error(err); return exit(1); }

        var mocha = new Mocha({ timeout: 1000 * 60 });
github parse-community / parse-server / parse-init / init.js View on Github external
async function main({
  directory,
  interactive,
}) {
  let target_directory = await getInstallationsDir({ interactive, directory });
  target_directory = path.resolve(target_directory);
  if (fs.existsSync(target_directory)) {
    console.log(chalk.red(`${chalk.bold(target_directory)} already exists.\naborting...`));
    process.exit(1);
  }

  shell.mkdir(target_directory);

  const config = await getAppConfiguration({ interactive });
  const {
    masterKey,
    databaseURI
  } = config;

  // Cleanup sensitive info
  delete config.masterKey;
  delete config.databaseURI;

  shell.cd(target_directory);

  const packageContent = {
    scripts: {
      start: "node -r dotenv/config node_modules/.bin/parse-server config.js"
github apache / cordova-amazon-fireos / bin / lib / create.js View on Github external
var lib_path = path.join(global_config_path, 'lib');
    var awv_sdk_expected_path=path.join(lib_path, 'commonlibs');
    var awv_interface_jar_commonlib_path = path.join(awv_sdk_expected_path, awv_interface);
    console.log('Checking if awv sdk is installed at : ' + awv_sdk_expected_path);
    if (!fs.existsSync(awv_sdk_expected_path) || !fs.existsSync(awv_interface_jar_commonlib_path)) {
        shell.mkdir('-p',awv_sdk_expected_path);
        var msg = '\n*********************************\n\nAmazon WebView API Library Not Found.\n\nPlease download the AmazonWebView SDK from:\n\nhttps://developer.amazon.com/public/solutions/platforms/android-fireos/docs/building-and-testing-your-hybrid-app\n\nThen copy awv_interface.jar from the SDK into this folder:\n\n' + awv_sdk_expected_path + '\n\nRe-run \'cordova platform add amazon-fireos\' to finish adding Amazon Fire OS support to your project.\n\n*********************************\n';
        console.log(msg);
        return Q.resolve();

    } 
    //Copy awv_interface.jar to ~/.cordova/lib/amazon-fireos/cordova/[cordova_release]/framework/libs folder.
    var awv_interface_expected_path=path.join(ROOT, 'framework','libs');
    console.log('awv_path : ' + awv_interface_expected_path);
    if (!fs.existsSync(awv_interface_expected_path) || !fs.existsSync(path.join(awv_interface_expected_path, awv_interface))) {
        shell.mkdir('-p', awv_interface_expected_path);
        shell.cp(awv_interface_jar_commonlib_path, awv_interface_expected_path);
    } 

    //Make the package conform to Java package types
    return validatePackageName(package_name)
    .then(function() {
        validateProjectName(project_name);
    }).then(function() {
        // Log the given values for the project
        console.log('Creating Cordova project for the amazon-fireos platform:');
        console.log('\tPath: ' + project_path);
        console.log('\tPackage: ' + package_name);
        console.log('\tName: ' + project_name);
        console.log('\tAndroid target: ' + target_api);

        console.log('Copying template files...');
github codefeathers / up-serve / actions / killALL.js View on Github external
function killALL () {
	shell.rm('-Rf', npath.serversBakUp);
	shell.mv(npath.serversUp(), npath.serversBakUp());
	shell.rm('-Rf', npath() + "sites-available");
	shell.rm('-Rf', npath.confD());
	shell.rm('-Rf', npath.enabledSites());
	shell.rm('-Rf', npath.webRoot());
	shell.mkdir('-p', npath.confD());
	shell.mkdir('-p', npath.enabledSites());
	shell.mkdir('-p', npath.webRoot());
	shell.cp((path.join(__dirname, '/../build/defaultNginx.conf')),
		conf(npath.enabledSites()));
	// Create the default.conf file
	console.log("All servers were killed and reverted to default.");
	console.log(EOL + [
		"A backup of your old servers.up is " +
			"saved in /etc/up-serve/servers.bak.up.",
		"Check this if you need to."
	].join(EOL) + EOL);
	nginxReload();
}
github weexteam / pack-android-tools-for-Apache-Weex / bin / templates / cordova / lib / prepare.js View on Github external
.setTargetSdkVersion(platformConfig.getPreference('android-targetSdkVersion', 'android'))
        .write();

    var javaPattern = path.join(locations.root, 'src', orig_pkg.replace(/\./g, '/'), '*.java');
    var java_files = shell.ls(javaPattern).filter(function(f) {
        return shell.grep(/extends\s+CordovaActivity/g, f);
    });

    if (java_files.length === 0) {
        throw new CordovaError('No Java files found that extend CordovaActivity.');
    } else if(java_files.length > 1) {
        events.emit('log', 'Multiple candidate Java files that extend CordovaActivity found. Guessing at the first one, ' + java_files[0]);
    }

    var destFile = path.join(locations.root, 'src', pkg.replace(/\./g, '/'), path.basename(java_files[0]));
    shell.mkdir('-p', path.dirname(destFile));
    shell.sed(/package [\w\.]*;/, 'package ' + pkg + ';', java_files[0]).to(destFile);
    events.emit('verbose', 'Wrote out Android package name "' + pkg + '" to ' + destFile);

    if (orig_pkg !== pkg) {
        // If package was name changed we need to remove old java with main activity
        shell.rm('-Rf',java_files[0]);
        // remove any empty directories
        var currentDir = path.dirname(java_files[0]);
        var sourcesRoot = path.resolve(locations.root, 'src');
        while(currentDir !== sourcesRoot) {
            if(fs.existsSync(currentDir) && fs.readdirSync(currentDir).length === 0) {
                fs.rmdirSync(currentDir);
                currentDir = path.resolve(currentDir, '..');
            } else {
                break;
            }
github peoples-e / pe-epub / Peepub.js View on Github external
if(_.isUndefined(this.buffers[dir + Peepub.EPUB_META_DIR + 'container.xml'] && !add)){

      this.buffers[dir + Peepub.EPUB_META_DIR + 'container.xml'] = new Buffer(handlebars.templates[templatesBase + "container.xml"]({}));
      this.epubFiles.push(dir + Peepub.EPUB_META_DIR + 'container.xml');

      var ff = this.getJson().fixedFormat;
      if( !_.isUndefined(ff) ){
        this.epubFiles.push(dir + Peepub.EPUB_META_DIR + 'com.apple.ibooks.display-options.xml');
        this.buffers[dir + Peepub.EPUB_META_DIR + 'com.apple.ibooks.display-options.xml'] = new Buffer(handlebars.templates[templatesBase + "com.apple.ibooks.display-options.xml"]({}));
      }
    }
    return dir;
  }

  if(!fs.existsSync(dir)){
    shell.mkdir('-p', dir);

    // set up the whole structure
    if(!add){
      fs.mkdirSync(dir + Peepub.EPUB_META_DIR);
      fs.writeFileSync(dir + Peepub.EPUB_META_DIR + 'container.xml', handlebars.templates[templatesBase + "container.xml"]({}), "utf8");
      this.epubFiles.push(dir + Peepub.EPUB_META_DIR + 'container.xml');
      fs.mkdirSync(dir + Peepub.EPUB_CONTENT_DIR);
      // fs.writeFileSync(dir + 'mimetype', 'application/epub+zip');
      // this.epubFiles.push(dir + 'mimetype');

      var ff = this.getJson().fixedFormat;
      if( !_.isUndefined(ff) ){
        fs.writeFileSync(dir + Peepub.EPUB_META_DIR + 'com.apple.ibooks.display-options.xml', handlebars.templates[templatesBase + "com.apple.ibooks.display-options.xml"]({}), "utf8");
        this.epubFiles.push(dir + Peepub.EPUB_META_DIR + 'com.apple.ibooks.display-options.xml');
        this.buffers[dir + Peepub.EPUB_META_DIR + 'com.apple.ibooks.display-options.xml'] = new Buffer(handlebars.templates[templatesBase + "com.apple.ibooks.display-options.xml"]({}));
      }
github arboleya / electrify / lib / scaffold.js View on Github external
Scaffold.prototype.prepare = function() {

  this.log.info('ensuring basic structure');
  
  shell.mkdir('-p' , this.$.env.app.bin);
  shell.mkdir('-p' , this.$.env.core.tmp);
  shell.mkdir('-p',  this.$.env.core.root);

  var index        = path.join(this.$.env.app.root, 'index.js');
  var package      = path.join(this.$.env.app.root, 'package.json');
  var config       = path.join(this.$.env.app.root, 'electrify.json');
  var gitignore    = path.join(this.$.env.app.root, '.gitignore');

  var index_tmpl    = path.join(__dirname, 'templates', 'index.js');

  // in development mode we overwrite this file everytime
  if(!fs.existsSync(index) || this.$.env.in_development_mode) {
    fs.writeFileSync(index, fs.readFileSync(index_tmpl, 'utf8'));
  }

  if (!fs.existsSync(package)) {
    fs.writeFileSync(package, JSON.stringify({
github medialize / ally.js / build / web-tests / build.focusable.js View on Github external
const path = require('path');

const shelljs = require('shelljs');
const replace = require('replace');
const requirejs = require('requirejs');

const cwd = process.cwd();
const SOURCE = path.resolve(cwd, 'tests/focusable/');
const TARGET = path.resolve(cwd, 'web/tests/focusable/');

shelljs.mkdir('-p', TARGET);
shelljs.cp(path.resolve(SOURCE, '*.html'), TARGET);

replace({
  regex: '',
  replacement: '',
  paths: [path.resolve(TARGET, 'test.html')],
  recursive: false,
  silent: true,
});

const config = {
  name: 'focusable',
  out: path.resolve(TARGET, 'focusable.js'),
  mainConfigFile: path.resolve(SOURCE, 'focusable.js'),
  paths: {
    requireLib: path.resolve(cwd, 'node_modules/requirejs/require'),
github conventional-changelog / conventional-changelog / test / prepare.js View on Github external
shell.rm('-rf', 'tmp');
shell.mkdir('tmp');
shell.cd('tmp');

shell.mkdir('git-templates');
shell.mkdir('test');
shell.mkdir('angular');
shell.mkdir('jquery');
shell.mkdir('jshint');
shell.mkdir('eslint');
shell.mkdir('atom');
shell.mkdir('express');
shell.mkdir('jscs');
shell.mkdir('ember');
shell.mkdir('codemirror');
shell.mkdir('cli');
github apache / cordova-lib / spec-cordova / util.spec.js View on Github external
it('Test 012 : should not return ".svn" directories', function() {
            var plugins = path.join(temp, 'plugins');
            var android = path.join(plugins, 'android');
            var ios = path.join(plugins, 'ios');
            var svn = path.join(plugins, '.svn');
            shell.mkdir('-p', android);
            shell.mkdir('-p', ios);
            shell.mkdir('-p', svn);
            var res = util.findPlugins(plugins);
            expect(res.length).toEqual(2);
            expect(res.indexOf('.svn')).toEqual(-1);
        });
        it('Test 013 : should not return "CVS" directories', function() {