How to use the ncp.ncp function in ncp

To help you get started, we’ve selected a few ncp 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 thatcort / git-gallery / bin / main.js View on Github external
function init() {
	// create the .gitGallery directory
	fs.mkdirSync(galleryRoot);

	// copy in the views directory
	let sourceViews = path.join(__dirname, '../views');
	let destViews = path.join(galleryRoot, 'views');
	ncp(sourceViews, destViews, { "clobber": false }, error => { if (error) console.error(error); });

	// add a gallery.json file
	let gjFile = path.join(galleryRoot, 'gallery.json');
	fsUtils.writeJson({ 'title': '', 'comment': '', 'showCanvas': false }, gjFile, { 'flag': 'wx' }, error => { if (error) console.log(error); });

	// create/edit .gitignore file
	let gitignore = path.join(galleryRoot, '../.gitignore');
	fs.ensureFileSync(gitignore);
	var rd = readline.createInterface({
		input: fs.createReadStream(gitignore),
		output: process.stdout,
		terminal: false
	});
	let alreadyIgnored = false;
	rd.on('line', function(line) {
		if (line.indexOf('.gitGallery') >= 0)
github Nishkalkashyap / Quark-electron / copyicons.js View on Github external
function copyFiles() {
                var mkdirp = require('mkdirp');
                mkdirp('./definitions/' + val, function (e) {
                    if (e) {
                        console.log(e);
                    }
                });
                ncp.ncp("./node_modules/" + val, './definitions/' + val, {
                    filter: function (file) {
                        return (((fs.statSync(file).isDirectory() || file.includes('.d.ts') || file.endsWith('package.json'))
                            && (!file.replace('node_modules', '').includes('node_modules')))
                            // && (file.search(/api[\\/]umd/) == -1)
                            && (file.search('.git') == -1));
                    },
                    dereference: true
                }, function (e) {
                    if (e) {
                        console.log(e, 'failed');
                    }
                });
            }
        });
github orchoban / react.cordova / node_modules / .cache / esm / f1f70fc214a5a573.js View on Github external
? "./" : dirPath1.substring(0, dirPath1.indexOf("/cordova")) + "/"

                    ncp(parentDir + "react-js/build", parentDir + "cordova/www", function (err) {
                        if (err) {
                            reco.setState({ error: true });
                            return console.error("ERROR ncp1, copy react-js/build tocordova/www :   " + err);
                        }
                        reco.state.callBack_replaceWwwRootDir(); // callBack();
                    });
                }

            }
            rmWwwRootDir(dirPath1);
        } else {
            let parentDir = dirPath1.startsWith("./cordova") ? "./" : dirPath1.substring(0, dirPath1.indexOf("/cordova")) + "/";
            ncp(parentDir + "react-js/build", parentDir + "cordova/www", function (err) {
                if (err) {
                    reco.setState({ error: true });
                    return console.error("ERROR ncp2, copy react-js/build tocordova/www :   " + err);
                }
                reco.state.callBack_replaceWwwRootDir(); // callBack();
            });
        }

    },
github abhinavsingh / proxy.py / dashboard / src / core / devtools.ts View on Github external
function setUpDevTools () {
  const destinationFolderPath = path.join(path.dirname(__dirname), 'public', 'dashboard', 'devtools')

  const destinationFolderExists = fs.existsSync(destinationFolderPath)
  if (!destinationFolderExists) {
    console.error(destinationFolderPath + ' folder doesn\'t exist, make sure you are in the right directory.')
    process.exit(1)
  }

  const chromeDevTools = path.dirname(require.resolve('chrome-devtools-frontend/front_end/inspector.html'))

  console.log('Destination folder: ' + destinationFolderPath)
  ncp(chromeDevTools, destinationFolderPath, (err: any) => {
    if (err) {
      return console.error(err)
    }
    console.log('Done!!!')
  })
}
github iiyo / WebStory-Engine / build.js View on Github external
copy("./build", "./export/engine", function () {
        copy("./story", "./export", function () {
            console.log("Exported WebStory Engine skeleton to export folder.");
        });
    });
}
github arangodb / arangodb / js / node / node_modules / docco / node_modules / fs-extra / lib / move.js View on Github external
function startNcp() {
    ncp(source, dest, options, function(errList) {
      if (errList) return cb(errList[0]);
      rimraf(source, cb);
    });
  }
}
github symphonyoss / SymphonyElectron / spec / spectron / spectronSetup.js View on Github external
return new Promise((resolve) => {
            ncp('config', configPath, function (err) {
                if (err) {
                    throw new Error("Unable to copy config file to Electron dir " + err);
                }
                return resolve();
            });
        })
    }
github sharvit / mongoose-data-seed / src / e2e / utils / files-sandbox.js View on Github external
return new Promise((resolve, reject) =>
      ncp(source, this.sandboxPath, err => {
        if (err) return reject(err);
        resolve();
      })
    );
github RimWorld-zh / RimTrans / io / src / io.ts View on Github external
return new Promise((resolve, reject) => {
    ncp(source, target, error => {
      if (error) {
        return reject(error);
      }
      return resolve();
    });
  });
}
github logicalparadox / codex / lib / codex / cli / index.js View on Github external
cli.on('skeleton *', function (args) {
  header();
  var dir = args._[1];
  if (!_.isPathAbsolute(dir)){
    dir = path.resolve(args.cwd, dir);
  }

  if (exists(dir)) {
    log.error('Skeleton folder already exists.');
    log.error(dir);
    footerNotOk();
  }

  ncp(join(__dirname, '..', '..', '..', 'skeleton'), dir, function (err) {
    if (err && err.length > 0) {
      log.error(err[0].message);
      footerNotOk();
    }

    log.info('Skeleton successfully created'.blue);
    log.info(dir);
    footerOk();
  });
});

ncp

Asynchronous recursive file copy utility.

MIT
Latest version published 10 years ago

Package Health Score

72 / 100
Full package analysis