How to use the mkdir function from shelljs
Find comprehensive JavaScript shelljs.mkdir code examples handpicked from public code repositorys.
shelljs.mkdir creates a new directory.
74 75 76 77 78 79 80 81 82 83
if (!isProgrammingLanguageExtension) { continue } shelljs.mkdir('-p', path.join(pathToExtensionBundles, extensionName)) shelljs.exec( `cp ${path.join(bundlePath, 'package.json')} ${path.join(pathToExtensionBundles, extensionName, 'package.json')}` ) shelljs.exec(
107 108 109 110 111 112 113 114 115
]; sh.rm('-rf', '~/.config/yarn/link/@tagspaces'); if (!sh.test('-d', extensionDir)) { sh.mkdir(extensionDir); } sh.cd(extensionDir);
How does shelljs.mkdir work?
shelljs.mkdir() is a function in the ShellJS library that creates a new directory (folder) with the specified name and optional permissions. It returns a ShellString object representing the standard output of the command. The function takes one or more arguments, with the first argument being the name of the directory to create and the second being the permissions mode. If the permissions argument is not provided, the new directory will be created with the default permissions for the current environment. The mkdir() function can also create multiple directories at once by passing in an array of directory names as the first argument. If any of the directories already exist, the function will continue to create the remaining directories in the array.
GitHub: o1-labs/zkapp-cli
51 52 53 54 55 56 57 58 59 60
} ui = res.ui; } sh.mkdir('-p', name); // Create path/to/dir with their desired name sh.cd(name); // Set dir for shell commands. Doesn't change user's dir in their CLI. // If user wants a UI framework installed alongside their smart contract, // we'll create this dir structure:
+ 74 other calls in file
155 156 157 158 159 160 161 162 163 164 165
function createLocale(done) { var fileExt = '.js'; var localePath = './Scripts'; if (!fs.existsSync(localePath)) { shelljs.mkdir('-p', localePath); } var localeJson = glob.sync('./Views/**/locale.json', { silent: true });
+ 24 other calls in file
Ai Example
1 2 3 4
const shell = require("shelljs"); // create a new directory shell.mkdir("myDirectory");
This will create a new directory named myDirectory in the current working directory. If the directory already exists, shelljs.mkdir() will not do anything.
568 569 570 571 572 573 574 575 576 577
shell.exit(1); } try { shell.mkdir('-p', databaseRootPath); shell.mkdir('-p', path.join(databaseRootPath, 'examples')); await Promise.all( allExamples.map((example) => fs.writeFile(
+ 2 other calls in file
GitHub: mark-szabo/carwash
97 98 99 100 101 102 103 104 105 106
* @param {Object} destinations An object that contains destination * paths for www files. */ function updateWww(cordovaProject, destinations) { shell.rm('-rf', destinations.www); shell.mkdir('-p', destinations.www); // Copy source files from project's www directory shell.cp('-rf', path.join(cordovaProject.locations.www, '*'), destinations.www); // Override www sources by files in 'platform_www' directory shell.cp('-rf', path.join(destinations.platformWww, '*'), destinations.www);
+ 18 other calls in file
GitHub: mendix/widgets-tools
59 60 61 62 63 64 65 66 67 68
if (!workDir) { workDir = join( index === 0 ? join(tempdir(), "spaced folder") : tempdir(), `pwt_test_${Math.round(Math.random() * 10000)}` ); mkdir("-p", workDir); } await runTest(workDir, ...config); return undefined; } catch (e) {
+ 4 other calls in file
GitHub: b1f6c1c4/draw.io-export
40 41 42 43 44 45 46 47 48 49
return; } const response = await axios.get(f, { responseType: 'stream', }); shelljs.mkdir('-p', path.join(cachePath, path.dirname(t))); response.data.pipe(fs.createWriteStream(path.join(cachePath, t))); return new Promise((resolve, reject) => { response.data.on('end', () => { resolve();
+ 50 other calls in file
GitHub: ec0lint/ec0lint
94 95 96 97 98 99 100 101 102 103
* extremely slow filesystem operations, during which copying fixtures * exceeds the default test timeout, so raise it just for this hook. * Mocha uses `this` to set timeouts on an individual hook level. */ this.timeout(60 * 1000); shell.mkdir("-p", fixtureDir); shell.cp("-r", "./tests/fixtures/.", fixtureDir); }); beforeEach(() => {
+ 34 other calls in file
GitHub: pritamprasd/therapyApp
203 204 205 206 207 208 209 210 211 212
} 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) {
163 164 165 166 167 168 169 170 171 172
fs.writeFileSync(wwwDest, scriptContent, 'utf-8'); if (options && options.usePlatformWww) { // CB-11022 copy file to both directories if usePlatformWww is specified var platformWwwDest = path.resolve(project.platformWww, 'plugins', plugin.id, obj.src); shell.mkdir('-p', path.dirname(platformWwwDest)); fs.writeFileSync(platformWwwDest, scriptContent, 'utf-8'); } }, uninstall: function (obj, plugin, project, options) {
+ 5 other calls in file
GitHub: TomMalbran/Runner
134 135 136 137 138 139 140 141 142 143 144
* Create the directory if it doesnt exists * @param {String} dir * @returns {Void} */ function mkdir(dir) { Shell.mkdir("-p", dir); } /** * Moves a File
GitHub: lbear9090/wediapp_ionic
65 66 67 68 69 70 71 72 73 74
// Delete only the src, since eclipse can't handle its .project file being deleted. shell.rm('-rf', path.join(nestedCordovaLibPath, 'src')); } }); if (!shared) { shell.mkdir('-p', nestedCordovaLibPath); shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath); shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath); shell.cp('-f', path.join(ROOT, 'framework', 'build.gradle'), nestedCordovaLibPath); shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath);
+ 29 other calls in file
GitHub: dhis2/deploy-build
255 256 257 258 259 260 261 262 263 264
core.info(`build repo path: ${artifact_repo_path}`) const res_rm = shell.rm('-rf', artifact_repo_path) core.info(`rm: ${res_rm.code}`) const res_mkd = shell.mkdir('-p', artifact_repo_path) core.info(`mkdir: ${res_mkd.code}`) await git.init({ ...config,
+ 157 other calls in file
GitHub: eldoy/extras
382 383 384 385 386 387 388 389 390 391 392 393
return sh.exec(command, options) } // Make directory extras.mkdir = function (...dirs) { return sh.mkdir('-p', ...dirs) } // Remove directory extras.rmdir = function (...dirs) {
+ 56 other calls in file
49 50 51 52 53 54 55 56 57 58 59 60
const answers = await inquirer.prompt(questions); return answers; }; const createProjectFolder = function (projectName) { return shell.mkdir('-p', path.resolve(process.cwd()), projectName); } const copyTemplateFiles = async function(templateType, projectName){ const currentFileUrl = __filename;
+ 9 other calls in file
GitHub: cenfun/starfall-cli
107 108 109 110 111 112 113 114 115 116
// init temp output const tempPath = Util.getConfig('tempPath'); Util.tempRoot = Util.formatPath(path.resolve(Util.root, tempPath)); if (!fs.existsSync(Util.tempRoot)) { shelljs.mkdir('-p', Util.tempRoot); } return Util.tempRoot; },
+ 15 other calls in file
GitHub: briancabbott/ChatNow
84 85 86 87 88 89 90 91 92 93 94 95 96
} async function packageRust() { shell.echo("PACKAGING RUST..."); shell.mkdir("./bin-package"); shell.cp("./native/index.node", "./bin-package"); shell.exec("npm run package");
GitHub: boomerang-io/worker.cicd
72 73 74 75 76 77 78 79 80 81
let buildTool = taskParams["buildTool"]; log.debug("Build Tool: ", buildTool); // log.debug("Copy source code from shared drive to container"); // shell.mkdir("-p", workdir); // shell.cp("-R", dir + "/repository/*", testdir); const testTypes = typeof taskParams["testType"] === "string" ? taskParams["testType"].split(",") : []; const version = parseVersion(taskParams["version"], taskParams["appendBuildNumber"]);
+ 107 other calls in file
GitHub: UliiseesGC/UWorldBook
471 472 473 474 475 476 477 478 479 480 481 482
final_contents += '// TOP OF METADATA\n'; final_contents += JSON.stringify(this._platformJson.root.plugin_metadata || {}, null, ' ') + '\n'; final_contents += '// BOTTOM OF METADATA\n'; final_contents += '});'; // Close cordova.define. shell.mkdir('-p', targetDir); fs.writeFileSync(path.join(targetDir, 'cordova_plugins.js'), final_contents, 'utf-8'); }; /**
shelljs.exec is the most popular function in shelljs (4615 examples)