How to use the recursive-copy.events function in recursive-copy

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 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,
      });
    });
};
github iamturns / create-exposed-app / src / core / copy.ts View on Github external
destPath: string,
  viewData: ViewData,
): CopyOperation[] => {
  const recuriveCopyOptions = {
    overwrite: true,
    dot: true,
    rename: (filePath: string) => {
      const destinationPath = toDestinationPath(filePath, viewData)
      logDebug("Copy %s to %s", filePath, destinationPath)
      return destinationPath
    },
  }

  return recursiveCopy(sourcePath, destPath, recuriveCopyOptions)
    .on(recursiveCopy.events.COPY_FILE_COMPLETE, onCopyComplete)
    .on(recursiveCopy.events.ERROR, onCopyError)
}
github pattern-lab / patternlab-node / packages / core / src / lib / buildPatterns.js View on Github external
return map(patternlab.uikits, uikit => {
                        return copy(
                          src,
                          path.resolve(process.cwd(), uikit.outputDir, dest),
                          {
                            overwrite: true,
                            filter: ['*.js'],
                            rename: () => {
                              return `${patternPartial}.js`;
                            },
                          }
                        ).on(copy.events.COPY_FILE_COMPLETE, () => {
                          logger.debug(
                            `Copied JavaScript files from ${src} to ${dest}`
                          );
                        });
                      });
                    });
github iamturns / create-exposed-app / src / core / copy.ts View on Github external
sourcePath: string,
  destPath: string,
  viewData: ViewData,
): CopyOperation[] => {
  const recuriveCopyOptions = {
    overwrite: true,
    dot: true,
    rename: (filePath: string) => {
      const destinationPath = toDestinationPath(filePath, viewData)
      logDebug("Copy %s to %s", filePath, destinationPath)
      return destinationPath
    },
  }

  return recursiveCopy(sourcePath, destPath, recuriveCopyOptions)
    .on(recursiveCopy.events.COPY_FILE_COMPLETE, onCopyComplete)
    .on(recursiveCopy.events.ERROR, onCopyError)
}

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