How to use recursive-copy - 10 common examples

To help you get started, we’ve selected a few recursive-copy 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 abraham / nutmeg / packages / create / src / generator.ts View on Github external
public execute(data: data) {
    this.data = data;
    return copy(this.templateDir, this.destinationDir, this.copyOptions)
      .on(copy.events.COPY_FILE_START, (_copyOperation: any) => {
        // console.info('Copying file ' + this.trimFilename(copyOperation.dest));
      })
      .on(copy.events.ERROR, (_error: object, copyOperation: any) => {
        console.error('Unable to copy ' + this.trimFilename(copyOperation.dest));
      })
      .then((results: object[]) => {
        console.info(`🖨️  Generating component with ${results.length} files`);
      })
  }
github Benaiah / netlify-cms-presentations-example / build.js View on Github external
const copyStatic = () =>
  copy("./static", "./dist", copyOptions)
    // Notifications of copy progress
    .on(copy.events.COPY_FILE_START, copyOperation =>
      console.info(`Copying file ${copyOperation.src} ...`)
    )
    .on(copy.events.COPY_FILE_COMPLETE, copyOperation =>
      console.info(`Copied to ${copyOperation.dest}`)
    )
    .on(copy.events.ERROR, (error, copyOperation) =>
      console.error(`Unable to copy to ${copyOperation.dest}`)
    )
    // Notification of success or failure
    .then(results => console.info(`${results.length} file(s) copied`))
    .catch(err => console.error(`Copy failed: ${err}`));
github rhiokim / flybook / libs / main.js View on Github external
/* mkdir output dir */
      mkdirp.sync(outputDir)

      /* gen new files */
      writeFileSync(outputFile, html, { encoding: 'utf8' })

      // log
      if (!silent) {
        console.log('>', key, '-', title, '\n', outputFile)
      }
    }
  })

  /* copy static assets */
  copy(join(__dirname, '..', '..', 'static'), join(outDir, 'static')).then(result => {
    console.log(`> FlyBook was generated at ${outDir}`)
  })

  /* copy assets which is used in docs */
  const files: string[] = glob.sync(
    join(docDir, '**', '!(*.md|*.markdown|*.mdown|*.mkdn|*.mkd|*.mdwn|*.mkdown|toc.yml)'),
    {
      ignore: [join(docDir, 'node_modules', '**')],
      nodir: true
    }
  )
  files.map(file => normalize(file)).forEach(file => {
    copySync(file, file.replace(docDir, outDir))
  })
}
github zeit / next.js / packages / next / export / index.js View on Github external
await mkdirp(join(outDir, '_next', buildId))

  // Copy static directory
  if (existsSync(join(dir, 'static'))) {
    log('  copying "static" directory')
    await cp(
      join(dir, 'static'),
      join(outDir, 'static'),
      { expand: true }
    )
  }

  // Copy .next/static directory
  if (existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))) {
    log('  copying "static build" directory')
    await cp(
      join(distDir, CLIENT_STATIC_FILES_PATH),
      join(outDir, '_next', CLIENT_STATIC_FILES_PATH)
    )
  }

  // Get the exportPathMap from the config file
  if (typeof nextConfig.exportPathMap !== 'function') {
    console.log(`> No "exportPathMap" found in "${CONFIG_FILE}". Generating map from "./pages"`)
    nextConfig.exportPathMap = async (defaultMap) => {
      return defaultMap
    }
  }

  // Start the rendering process
  const renderOpts = {
    dir,
github lnlfps / symph-joy / export / index.js View on Github external
defaultPathMap['/404'] = { page }
      continue
    }

    defaultPathMap[page] = { page }
  }

  // Initialize the output directory
  const outDir = options.outdir
  await del(join(outDir, '*'))
  // await mkdirp(join(outDir, '_joy', buildId))

  // Copy static directory
  if (existsSync(join(dir, 'static'))) {
    log('  copying "static" directory')
    await cp(
      join(dir, 'static'),
      join(outDir, 'static'),
      { expand: true }
    )
  }

  // Copy .joy/static directory
  if (existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))) {
    log('  copying "static build" directory')
    await cp(
      join(distDir, CLIENT_STATIC_FILES_PATH),
      join(outDir, '_joy', CLIENT_STATIC_FILES_PATH)
    )
  }

  // Get the exportPathMap from the config file
github Microtome / microtome / scripts / copy_shaders.js View on Github external
expand: false,
    dot: false,
    junk: false,
    filter: [
        '**/*.glsl',
    ]
};

copy('./src/lib', './build/lib/microtome', options)
    .on(copy.events.COPY_FILE_START, function (copyOperation) {
        console.info('Copying file ' + copyOperation.src + '...');
    })
    .on(copy.events.COPY_FILE_COMPLETE, function (copyOperation) {
        console.info('Copied to ' + copyOperation.dest);
    })
    .on(copy.events.ERROR, function (error, copyOperation) {
        console.error('Unable to copy ' + copyOperation.dest);
    })
    .then(function (results) {
        console.info(results.length + ' file(s) copied');
    })
    .catch(function (error) {
        return console.error('Copy failed: ' + error);
    });
github Microtome / microtome / scripts / copy_shaders.js View on Github external
var copy = require('recursive-copy');
var path = require('path');

var options = {
    overwrite: true,
    expand: false,
    dot: false,
    junk: false,
    filter: [
        '**/*.glsl',
    ]
};

copy('./src/lib', './build/lib/microtome', options)
    .on(copy.events.COPY_FILE_START, function (copyOperation) {
        console.info('Copying file ' + copyOperation.src + '...');
    })
    .on(copy.events.COPY_FILE_COMPLETE, function (copyOperation) {
        console.info('Copied to ' + copyOperation.dest);
    })
    .on(copy.events.ERROR, function (error, copyOperation) {
        console.error('Unable to copy ' + copyOperation.dest);
    })
    .then(function (results) {
        console.info(results.length + ' file(s) copied');
    })
    .catch(function (error) {
        return console.error('Copy failed: ' + error);
    });
github Microtome / microtome / scripts / copy_definitions.js View on Github external
expand: false,
    dot: false,
    junk: false,
    filter: [
        '**/*.d.ts',
    ]
};

copy('./build/lib/microtome', './dist/lib/microtome', options)
    .on(copy.events.COPY_FILE_START, function (copyOperation) {
        console.info('Copying file ' + copyOperation.src + '...');
    })
    .on(copy.events.COPY_FILE_COMPLETE, function (copyOperation) {
        console.info('Copied to ' + copyOperation.dest);
    })
    .on(copy.events.ERROR, function (error, copyOperation) {
        console.error('Unable to copy ' + copyOperation.dest);
    })
    .then(function (results) {
        console.info(results.length + ' file(s) copied');
    })
    .catch(function (error) {
        return console.error('Copy failed: ' + error);
    });
github dtysky / paradise / createNewEffect / index.js View on Github external
.replace(/\{AUTHOR_EMAIL\}/g, email);

  const options = {
    overwrite: true,
    dot: true,
    transform: (src, dest, stats) => {
      return through((chunk, enc, done) =>  {
        const output = renderTemplate(chunk.toString());
        done(null, output);
      });
    }
  };

  try {
    await copy(templatesPath, dirPath, options)
      .on(copy.events.COPY_FILE_START, copyOperation => {
        console.log(`Generate ${copyOperation.dest}...`);
      });
  } catch (error) {
    showError(`Generate failed: ${error}\nPlease clean current directory and retry !`);
  }

  PImage.encodeJPEGToStream(
    createCover(name),
    fs.createWriteStream(path.resolve(dirPath, 'cover.jpg'))
  );
}
github pattern-lab / patternlab-node / packages / core / core / lib / copyFile.js View on Github external
const copyFile = (p, dest, options) => {
  return copy(p, dest, options)
    .on(copy.events.ERROR, function(error, copyOperation) {
      logger.error('Unable to copy ' + copyOperation.dest);
    })
    .on(copy.events.COPY_FILE_ERROR, error => {
      logger.error(error);
    })
    .on(copy.events.COPY_FILE_COMPLETE, () => {
      logger.debug(`Moved ${p} to ${dest}`);
      options.emitter.emit(events.PATTERNLAB_PATTERN_ASSET_CHANGE, {
        file: p,
        dest: dest,
      });
    });
};

recursive-copy

Simple, flexible file copy utility

ISC
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis

Popular recursive-copy functions