Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
path.join(target, 'source/runtime.php'),
fs.readFileSync(path.join(target, 'source/runtime.php'))
.toString()
.replace('{{version}}', config.version)
);
} catch(err) {
return console.error(err);
}
// Delete .htaccess, database.php
del.sync(path.join(target, '.htaccess'));
del.sync(path.join(target, 'database.php'));
// Empty backups, content/cache, content/themes, content/uploads
del.sync(path.join(target, 'backups/*'));
del.sync(path.join(target, 'content/cache/*'));
del.sync([
path.join(target, 'content/themes/*'),
'!' + path.join(target, 'content/themes/range')
]);
del.sync([
path.join(target, 'content/uploads/*'),
'!' + path.join(target, 'content/uploads/2016')
]);
del.sync(path.join(target, 'content/plugins/*'));
// Prune source/images, source/scripts, and source/styles
del.sync(path.join(target, 'source/images/**'));
del.sync(path.join(target, 'source/scripts/**'));
del.sync(path.join(target, 'source/styles/**'));
// delete log folder
gulp.task('clean', (c) => {
del([
'./public/',
], {
force: true,
}).then(paths => {
// eslint-disable-next-line no-console
c();
console.log('Files and folders that would be deleted:\n', paths.join('\n'));
});
});
.pipe($.if('*.css', $.cleanCss({compatibility: '*'})))
.pipe($.if('*.js', $.sourcemaps.init()))
// .pipe($.if('*.js', $.uglify()))
.pipe($.if('*.js', $.sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('app/scripts.babel/**/*.js')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('app/scripts'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('watch', ['lint', 'babel'], () => {
$.livereload.listen();
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',
'app/images/**/*',
'app/styles/**/*',
'app/_locales/**/*.json'
]).on('change', $.livereload.reload);
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
gulp.watch('bower.json', ['wiredep']);
});
const fs = require("fs-extra");
const del = require("del");
// Delete .out directory
del.sync("./out");
// copy templates/*
fs.copySync("./src/templates", "./out/templates");
// copy test resources
fs.copySync("./src/test/resources", "./out/test/resources");
});
gulp.task('partials', ['styles'], function () {
var assets = $.useref.assets({searchPath: '{.tmp,themes/src}'});
return gulp.src('themes/src/layouts/**/*.html')
.pipe(assets)
.pipe($.if('*.js', $.uglify()))
.pipe($.if('*.css', $.csso()))
.pipe(assets.restore())
.pipe($.useref())
.pipe($.if('*.html', $.htmlclean()))
.pipe(gulp.dest(theme + 'layouts/'));
});
gulp.task('clean', require('del').bind(null, [theme + 'layouts', theme + 'static/assets/css/*.css', theme + 'static/assets/*.js']));
gulp.task('watch', function () {
// watch for changes
gulp.watch([
'*.html',
theme + 'static/css/**/*.css',
'scripts/**/*.js',
]).on('change', $.livereload.changed);
gulp.watch('themes/src/styles/**/*.styl', ['styles']);
gulp.watch('themes/src/scripts/**/*.js', ['scripts']);
gulp.watch('themes/src/**/*.html', ['html']);
gulp.watch('themes/src/**/*.html', ['partials']);
});
gulp.task('clearcache', function() {
'baseDir': [ '.tmp', 'app', '.tmp_examples' ]
},
'ports': {
'min': 9090,
'max': 9090
}
});
gulp.watch([srcFolder + '/**/*.html'], [ 'html:compile', reload ]);
gulp.watch([srcFolder + '/**/*.{css,scss}'], ['styles']);
gulp.watch(['.tmp/styles/**/*.css'], reload);
gulp.watch([srcFolder + '/**/*.js'], [ 'js:compile', reload ]);
// gulp.watch(['app/fonts/**/*'], ['fonts']);
});
gulp.task('clean', del.bind(null, [ '.tmp', 'test_out', distFolder ]));
gulp.task('dist', ['clean'], function (cb) {
runSequence('styles', [ 'html', 'fonts', 'images' ], cb);
});
gulp.task('default', [], function (cb) {
runSequence('dist', cb);
});
gulp.task('test', ['bower'], function () {
return gulp.src('./idontexist') // https://github.com/lazd/gulp-karma/issues/9
.pipe($.karma({
'configFile': './karma.conf.js',
'autoWatch': false
}))
var pkgs = (function() {
var pkgs = {};
var map = function(source) {
for (var key in source) {
pkgs[key.replace(/[^a-z0-9]/gi, '')] = source[key].substring(1);
}
};
map(require('./package.json').dependencies);
return pkgs;
}());
// The default task
gulp.task('default', ['serve']);
// Clean up
gulp.task('clean', del.bind(null, [DEST]));
// 3rd party libraries
gulp.task('vendor', function() {
src.vendor = [
'bower_components/todomvc-common/base.{js,css}',
'bower_components/todomvc-common/bg.png'
];
return merge(
gulp.src(src.vendor)
.pipe(gulp.dest(DEST + '/vendor')),
gulp.src('./node_modules/bootstrap/dist/fonts/**')
.pipe(gulp.dest(DEST + '/fonts'))
);
});
// Static files
function createBundle(context, profile) {
let bundleConfig = require('./webpack.bundle')(context, profile)
del.sync(join(serverFolder, bundleFolder))
if (Object.keys(bundleConfig.entry).length === 0) {
return
}
if (typeof context.beforeBundleCreate === 'function') {
bundleConfig = mergeConfig(
bundleConfig,
context.beforeBundleCreate(bundleConfig)
)
}
const bundleCompiler = webpack(bundleConfig)
function cb(err, stats) {
if (err) throw err
stats = stats.toJson()
stats.errors.forEach(err => console.error(err))
stats.warnings.forEach(err => console.warn(err))
const delPublish: DelPublish = (folder) => {
console.log(`delete publish folder: ${folder}`)
return del(folder)
}
})))
.pipe($.if('*.js', $.sourcemaps.init()))
.pipe($.if('*.js', $.uglify()))
.pipe($.if('*.js', $.sourcemaps.write('.')))
.pipe(gulp.dest('dist'));
});
gulp.task('babel', () => {
return gulp.src('app/scripts.babel/**/*.js')
.pipe($.babel({
presets: ['es2015']
}))
.pipe(gulp.dest('app/scripts'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
gulp.task('watch', ['lint', 'babel'], () => {
$.livereload.listen();
gulp.watch([
'app/*.html',
'app/scripts/**/*.js',
'app/images/**/*',
'app/styles/**/*',
'app/_locales/**/*.json'
]).on('change', $.livereload.reload);
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
gulp.watch('bower.json', ['wiredep']);
});