How to use the 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 machawk1 / wail / tools / prepairBuild.js View on Github external
import ncp from 'ncp'

const buildPath = path.join(path.resolve('../'), 'electron/build')
const basePath = path.join(path.resolve('../'), 'electron/src')
const actions = path.join(basePath, 'js/actions')
const components = path.join(basePath, 'js/components')
const constants = path.join(basePath, 'js/constants')
const dispatchers = path.join(basePath, 'js/dispatchers')
const stores = path.join(basePath, 'js/stores')
const pub = path.join(basePath, 'public')
const app = path.join(buildPath, 'app')

console.log(basePath)
fs.ensureDir(app, err => console.log(err))

ncp(basePath, app, err => console.log(err))

// dirs.forEach(dir => fs.ensureDir(dir, err => console.log(dir)))
github leo / cory / bin / build.js View on Github external
builder.build().then(results => {
    const dir = typeof results === 'string' ? results : results.directory
    let buildTime = results.totalTime

    // Copy files from tmp folder to the destination directory
    // And make sure to follow symlinks while doing so
    ncp(dir, config.outputDir + '/assets', {dereference: true}, err => {
      if (err) {
        throw err
      }

      if (buildTime) {
        // The original built time is in nanoseconds, so we need to convert it to milliseconds
        buildTime += initialBuild
        console.log(chalk.green(`Finished building after ${Math.floor(buildTime / 1e6)}ms.`))
      } else {
        console.log(chalk.green('Finished building.'))
      }

      if (!options.watch) {
        builder.cleanup().catch(err => console.error(err))
      }
    })
github mozilla / hubs / scripts / deploy.js View on Github external
await new Promise(res => {
    ncp("./admin/dist", "./dist", err => {
      if (err) {
        console.error(err);
        process.exit(1);
      }

      res();
    });
  });
  step.text = "Preparing Deploy.";
github havardh / workflow / packages / workflow-cmd / src / platform.js View on Github external
write(file, { source, destination }, cb) {
    const ext = extname(file);
    const name = basename(file).replace(ext, '');

    const from = join(source, '.' + file, `${name}.${platform}-${wm}${ext}`);
    const to = join(destination, file);

    console.log(`Write platform file: ${to}`);
    console.log(`- Copy ${from} -> ${to}`);

    ncp(from, to, { clobber: true }, cb);

    return this;
  }
}
github zendesk / linksf / tools / lib / copy.js View on Github external
export default (source, dest) => new Promise((resolve, reject) => {
  ncp(source, dest, err => err ? reject(err) : resolve())
})
github nodkz / relay-northwind-app / tools / build.js View on Github external
async function build() {
  await run(clean);
  await ncp(
    path.resolve(__dirname, '../public'),
    path.resolve(__dirname, `../build/${process.env.NODE_ENV}`)
  );
  await run(bundle);
}
github cogolabs / cyto / src / postInstall.js View on Github external
mkdirp(outputPath, (templatePathErr) => {
      if (templatePathErr) {
        throw templatePathErr;
      }

      ncp(templatePath, outputPath, (copyErr) => {
        if (copyErr) {
          throw copyErr;
        }
      });
    });
  });
github pavjacko / renative / packages / rnv / src / systemTools / fileutils.js View on Github external
export const copyFolderContentsRecursive = (source, target, convertSvg = true, skipPaths) => new Promise((resolve, reject) => {
    logDebug('copyFolderContentsRecursive', source, target, skipPaths);
    if (!fs.existsSync(source)) return;
    const targetFolder = path.resolve(target);
    if (!fs.existsSync(targetFolder)) {
        mkdirSync(targetFolder);
    }
    ncp(source, targetFolder, (err) => {
        if (err) {
            return reject(err);
        }
        return resolve();
    });
});
github expo / expo-cli / dev / xdl / src / Utils.js View on Github external
return new Promise((resolve, reject) => {
    ncp(source, dest, options, err => {
      if (err) {
        reject(err);
      } else {
        resolve();
      }
    });
  });
}
github CloudBreadProject / CloudBread-Admin-Web / tools / tasks / copy.js View on Github external
return new Promise((resolve, reject) => {
    ncp(origin, carry, (err) => (err ? reject(err) : resolve()));
  });
}

ncp

Asynchronous recursive file copy utility.

MIT
Latest version published 9 years ago

Package Health Score

72 / 100
Full package analysis