Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return tap(function(file) {
var filename = path.basename(file.relative);
if (filename === 'index.html') {
var adScriptLib = file.contents.toString().replace('', getAdScript('lib'));
file.contents = new Buffer(adScriptLib);
}
if (filename === 'script.js') {
var adScriptInit = file.contents.toString().replace('timeline.init();', getAdScript('init'));
file.contents = new Buffer(adScriptInit);
if (platform === 'sizmek') { // move init file into folder
fs.copy(supportFiles.cwd() + '/EBLoader.js', path.parse(file.path).dir + '/EBLoader.js', { overwrite: true });
}
}
});
};
bannerList.forEach(function(item) {
var banner = './review/banners/' + item;
fs.copy('./banners/' + item, banner);
// remove unnecessary files/folders within the `assets` folder
fs.remove(banner + '/assets/css/source.css');
fs.remove(banner + '/assets/img/keyframes');
// remove the fonts folder, if empty
var dirFonts = fs.inspectTree(banner + '/assets/css/fonts/');
if (!dirFonts.size) { fs.remove(banner + '/assets/css/fonts/'); }
});
export let createTemplateFile = function(title, content, dirPath, callback) {
var tempDirName = 'safe_uploader_template';
dirPath = path.resolve(__dirname, dirPath);
try {
var tempDirPath = temp.mkdirSync(tempDirName);
jetpack.copy(dirPath, tempDirPath, { overwrite: true });
var htmlFilePath = path.resolve(tempDirPath, 'index.html');
var templateString = fs.readFileSync(htmlFilePath).toString();
// var tempFilePath = path.resolve(tempDirPath, 'index.html');
fs.writeFileSync(htmlFilePath,
util.format(templateString, title, title, content));
return callback(null, tempDirPath);
} catch (e) {
return callback(e);
}
};
gulp.task('release', ['createDirs'], () => {
fsJ.file(path.join(releaseVersionDir, 'run.sh'), {mode: '775'});
fsJ.file(path.join(releaseVersionDir, 'setup.sh'), {mode: '775'});
fsJ.copy(resDir, releaseVersionDir, {overwrite: true});
fsJ.copy(buildDir, releaseBuildDir, {overwrite: true});
fsJ.copy(packageJsonPath, packageJsonReleasePath, {overwrite: true});
});
function copy_task ( )
{
jetpack.copy ( 'app/styles',
'build/styles' );
copy_app_to_build ( 'moment' );
copy_app_to_build ( 'sqlite3' );
copy_app_to_build ( 'debug-menu' );
copy_app_to_build ( 'minimatch' );
copy_app_to_build ( 'mkdirp' );
copy_app_to_build ( 'bluebird' );
copy_app_to_build ( 'rimraf' );
function copyFile(path) {
gutil.log(`Copy file ${path.substr(srcDir.path().length)}`);
const destPath = path.replace(srcDir.path(), destDir.path());
jetpack.copy(path, destPath, {overwrite: true});
}
async function createFolder() {
const tmpfolder = path.join(os.tmpdir(), 'glightbox-master');
await updateIndexVersion(args[0]);
await updatePackageVersion(args[0]);
jetpack.copy(folder, tmpfolder, {
matching: ['!node_modules', '!node_modules/**/*', '!.git', '!.git/**/*', '!.github', '!.github/**/*', '!.vscode', '!.vscode/**/*', '!*.psd', '!.DS_Store']
});
notify('Created folder', `Created folder correctly`);
const zip = await createZip(tmpfolder).catch(error => {
jetpack.remove(tmpfolder);
});
const folderName = path.basename(folder);
jetpack.remove(tmpfolder);
jetpack.move(zip, path.join(folder, folderName +'-master.zip'));
notify('Done', `Packaging process ended correctly`);
}
createFolder();
gulp.task('manifest', function () {
jetpack.copy('manifest.json', path.join(conf.paths.dist, '/manifest.json'), {overwrite: true});
});