Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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`);
})
}
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}`));
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);
});
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);
});
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);
});
.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'))
);
}
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,
});
});
};
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)
}
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}`
);
});
});
});
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)
}