How to use the fs-extra.copySync function in fs-extra

To help you get started, we’ve selected a few fs-extra 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 FortAwesome / angular-fontawesome / tasks / build.js View on Github external
.then(() => {
    copySync('README.md', join(process.cwd(), 'dist/README.md'));
  })
  .then(() => console.log('success'));
github naugtur / secure-dependencies / index.js View on Github external
//npm --prefix requires package.json to be in the location given
fs.copySync('package.json', path.resolve(dir, './package.json'));

//now npm has the package-lock
if(fs.existsSync('package-lock.json')) {
    fs.copySync('package-lock.json', path.resolve(dir, './package-lock.json'));
}
//Shrinkwrap is important, we don't want to silently skip it
if (fs.existsSync('npm-shrinkwrap.json')) {
    fs.copySync('npm-shrinkwrap.json', path.resolve(dir, './npm-shrinkwrap.json'));
}
//but shrinkwrap is uncomfortable for daily development, so you can store it in a file that only this bundler will use.
//TODO: make this configurable with commandline argument
if (fs.existsSync('npm-shrinkwrap-production.json')) {
    fs.copySync('npm-shrinkwrap-production.json', path.resolve(dir, './npm-shrinkwrap.json'));
}
//shrinkwrap is old news, package-lock has to be there too!
if (fs.existsSync('package-lock.json')) {
    fs.copySync('package-lock.json', path.resolve(dir, './package-lock.json'));
}
//support audit resolutions
if (fs.existsSync('audit-resolv.json')) {
    fs.copySync('audit-resolv.json', path.resolve(dir, './audit-resolv.json'));
}
const tarball = path.resolve(process.cwd(), common.getTarballName(dir))
    //Get rid of the previous tarball, because I'm afraid tar could merge instead of overwriting
fs.removeSync(tarball)

//The main purpose of this is to reject the promise based on exit code
function promiseCommand(command) {
    const opts = {
github neo4j-apps / graph-app-kit / scripts / build.js View on Github external
function copyPublicFolder() {
  fs.copySync(paths.appPublic, paths.appBuild, {
    dereference: true,
    filter: file => file !== paths.appHtml
  });
}
github GDJiaMi / jm-cli / src / cmds / create / genGitignore.ts View on Github external
function createGitIgnore(appPath: string, ownPath: string) {
  const dotIgnorePath = path.join(appPath, '.gitignore')
  const ignorePath = path.join(appPath, 'gitignore')

  if (fs.existsSync(dotIgnorePath)) {
    return
  }

  if (fs.existsSync(ignorePath)) {
    fs.moveSync(ignorePath, dotIgnorePath)
    return
  }

  const defaultIgnorePath = path.join(ownPath, 'lib/gitignore')
  fs.copySync(defaultIgnorePath, dotIgnorePath)
  message.info('created .gitignore')
}
github mozilla / webmaker-android / gulp / clean.js View on Github external
module.exports = function (done) {
  fs.removeSync('./build');
  fs.mkdirsSync('build');
  fs.copySync('./static/.', './build/');
  fs.copySync('./node_modules/webmaker-app-icons/fonts/.', './build/fonts');
  done();
};
github reactioncommerce / reaction-cli / src / utils / asset-provisioner.js View on Github external
function copyAssets(appRoot, assetDirs) {
  for (const { dir, name } of assetDirs) {
    for (const folder of ['private', 'public']) {
      const sourceDir = dir + '/' + folder;
      const targetDir = path.join(appRoot, folder, 'plugins', name);
      if (exists(sourceDir)) {
        try {
          fs.copySync(sourceDir, targetDir);
        } catch (error) {
          Log.error(`Can't copy files from ${sourceDir} to ${targetDir}: ${error.message}`);
        }
      }
    }
  }
}
github electron-userland / electron-builder / lib / win.js View on Github external
function copyAssetsToTmpFolder( iconPath ) {
  var tmpDir = os.tmpDir();

  fs.copySync(
    path.join( __dirname, '..', 'assets', 'win', 'nsProcess.nsh' ),
    path.join( tmpDir, 'nsProcess.nsh' )
  );

  fs.copySync(
    path.join( __dirname, '..', 'assets', 'win', 'FileAssociation.nsh' ),
    path.join( tmpDir, 'FileAssociation.nsh' )
  );

  fs.copySync(
    path.join( __dirname, '..', 'assets', 'win', 'nsProcess.dll' ),
    path.join( tmpDir, 'nsProcess.dll' )
  );

  fs.copySync(
    path.resolve( iconPath ),
    path.join( tmpDir, 'icon.ico' )
  );
}
github eclipsesource / tabris-js / grunt / grunt-copy-examples.js View on Github external
function copyExample(srcDir, targetDir) {
  let manifest = readJsonSync(join(srcDir, 'package.json'));
  if ('title' in manifest) {
    copySync(srcDir, targetDir, path => !path.includes('/node_modules'));
    copySync('build/tabris', join(targetDir, 'node_modules/tabris'));
    installDependencies(targetDir, manifest);
    return {
      category: manifest.category || '',
      title: manifest.title,
      description: manifest.description || '',
      path: basename(srcDir)
    };
  }
}
github microsoft / PowerBI-visuals-tools / lib / VisualGenerator.js View on Github external
function copyVisualTemplate(targetPath, templateName) {
    fs.copySync(path.join(VISUAL_TEMPLATES_PATH, '_global'), targetPath);
    fs.copySync(path.join(VISUAL_TEMPLATES_PATH, templateName), targetPath);
}
/**
github joefitzgerald / go-plus / spec / highlight / highlight-provider-spec.js View on Github external
beforeEach(async () => {
      gopath = fs.realpathSync(lifecycle.temp.mkdirSync('gopath-'))
      process.env.GOPATH = gopath

      source = path.join(__dirname, '..', 'fixtures')
      target = path.join(gopath, 'src', 'what')
      fs.copySync(source, target)

      atom.config.set('go-plus.guru.highlightIdentifiers', true)

      editor = await atom.workspace.open(path.join(target || '.', 'doc.go'))
    })