How to use copy-dir - 10 common examples

To help you get started, we’ve selected a few copy-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 nexssp / cli / nexss-project / commands / new.js View on Github external
if (!fs.existsSync(`${templatePath}/_nexss.yml`)) {
        //We clone the default template
        try {
          require("child_process").execSync(
            `git clone https://github.com/nexssp/template_default.git ${templatePath}`,
            {
              stdio: "inherit"
            }
          );
          success(`Default template cloned.`);
        } catch (er) {
          console.error(er);
          process.exit(1);
        }
      }
      copydir.sync(templatePath, projectPath, options);
    } else {
      console.log("This is already nexss project.");
    }
  }

  const { loadConfigContent, saveConfigContent } = require("../../lib/config");
  const newProjectConfigPath = path.join(projectPath, "_nexss.yml");
  let configContent = loadConfigContent(newProjectConfigPath);
  configContent.name = paramName;

  // console.log(configContent);

  saveConfigContent(configContent, newProjectConfigPath);

  if (dotDir) {
    //current folder new project
github Jeremboo / scribble-lab / scripts / createScribble.js View on Github external
groupPath = 'scribbles/';
  groupPath += `${askWitchChildDir(groupPath, 'group')}/`;
}

// WITCH TYPE
// Get all app name
const templatePath = 'templates/';
const templateFiles = fs.readdirSync(templatePath);
const types = templateFiles.filter(fileName => (fileName.indexOf('app.') !== -1));

// CREATE DIR
const { path, name } = askToCreateDir(groupPath, 'Sketch');

// CLONE TEMPLATE AND KEEP THE GOOD APP
const typeFileName = askWitchChoice(types, 'template');
copyDir.sync(templatePath, path, (stat, filepath, filename) => {
  if (filename.indexOf('app.') !== -1) {
    return (filename === typeFileName);
  }
  return true;
});
fs.renameSync(`${path}/${typeFileName}`, `${path}/app.js`);

// CREATE DATA.json
createDataJSON(name, path);

// NPM START
process.env.GROUP_PATH = groupPath;
process.env.SKETCH_PATH = path;
process.env.NAME = name;
require('./startWebpack')();
github jscad / OpenJSCAD.org / packages / web / postInstall.js View on Github external
// this copies the examples folder from the @jscad/examples repository locally
const path = require('path')
const examplesPath = path.resolve('./node_modules/@jscad/examples')
const copydir = require('copy-dir')
const fs = require('fs')
if (fs.existsSync(examplesPath)) copydir.sync(examplesPath, 'examples')
github TypeStrong / fork-ts-checker-webpack-plugin / test / integration / helpers / createCompiler.ts View on Github external
function prepareDirectory({ context }: { context: string }) {
  if (!fs.existsSync(tmpDirParent)) {
    fs.mkdirSync(tmpDirParent);
  }
  const tmpDir = fs.mkdtempSync(path.join(tmpDirParent, 'test'));
  const contextDir = path.resolve(tmpDir, context);
  const outDir = path.resolve(tmpDir, 'out');
  fs.mkdirSync(contextDir);
  fs.mkdirSync(outDir);
  copyDir.sync(path.resolve(__dirname, '../../fixtures/', context), contextDir);
  return { contextDir, outDir, tmpDir };
}
github jozsefsallai / insomnia-documenter / bin / generate.js View on Github external
mkdirp(outputPath, err => {
  if (err) {
    console.error(err);
    process.exit(127);
  }

  copydir.sync(PACKAGE_DIST_PATH, outputPath, {
    utimes: false,
    mode: false,
    cover: true
  });

  console.log('Adding Insomnia JSON...');

  fs.copyFileSync(configPath, path.join(outputPath, 'insomnia.json'));

  if (logoPath) {
    console.log('Adding custom logo...');
    fs.copyFileSync(logoPath, path.join(outputPath, 'logo.png'));
  }

  console.log('\n * * * Done! * * *\nYour documentation has been created and it\'s ready to be deployed!');
github ashblue / fluid-behavior-tree / create-dist.js View on Github external
async function init () {
    await del([OUTPUT]);

    copyDir.sync(SOURCE, OUTPUT, {});
    crossPopulatePackages();
    fs.copyFileSync(`${SOURCE}/package.json`, `${OUTPUT}/package.json`);
    copyFiles();
    await zip(OUTPUT, `${OUTPUT}.zip`);
    
    console.log(`Copied files from ${SOURCE} to ${OUTPUT}`);
}
github yusangeng / ypackr / lib / cp.js View on Github external
function cp(src, dst) {
	try {
		if (isFile(src)) {
			cpFile(src, dst);
		} else if (isDir(src)) {
			cpDir(src, dst);
		}
	} catch (e) {
		console.log('cp error', e);
		return e;
	}
}
github skylarkjs / skylark / runtime / build / gulp / tasks / clean.js View on Github external
module.exports = function() {
    del.sync([util.dest + '/**/*', '!' + util.dest + "/"], {
        force: true
    });

    copydir.sync(util.lib_langx, util.dest + "included/skylark-langx");

    copydir.sync(util.lib_router, util.dest + "included/skylark-router");

    copydir.sync(util.lib_spa, util.dest + "included/skylark-spa");

    copydir.sync(util.lib_utils, util.dest + "included/skylark-utils");

    console.log('Clean folder:\n and recopy included libraries', util.dest);

};
github orchoban / react.cordova / node_modules / .cache / esm / f1f70fc214a5a573.js View on Github external
else files.forEach(file => {
                                if (fs.existsSync(dir + "/react-js/src/" + file))
                                    fs.unlink(dir + "/react-js/src/" + file, (err) => {
                                        if (err) console.log("ERROR: reco can't copy template files.(unlink) :" + err);
                                    });
                                copydir.sync(reco.state.args[1].substring(0, reco.state.args[1].lastIndexOf(".bin")) + "templates\\" + template + "\\" + file, dir + "/react-js/src/" + file, {}, () => {
                                    if (err) console.log("ERROR: reco can't copy template files :" + err);
                                });
                            });
                        });
github orchoban / react.cordova / node_modules / .cache / esm / f1f70fc2ecb73815.js View on Github external
else files.forEach(file => {
                                if (fs.existsSync(dir + "/react-js/src/" + file))
                                    fs.unlink(dir + "/react-js/src/" + file, (err) => {
                                        if (err) console.log("ERROR: reco can't copy template files.(unlink) :" + err);
                                    });
                                copydir.sync(reco.state.args[1].substring(0, reco.state.args[1].lastIndexOf(".bin")) + "templates\\" + template + "\\" + file, dir + "/react-js/src/" + file, {}, () => {
                                    if (err) console.log("ERROR: reco can't copy template files :" + err);
                                });
                            });
                        });

copy-dir

copy-dir

MIT
Latest version published 4 years ago

Package Health Score

47 / 100
Full package analysis

Popular copy-dir functions