Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'package.json',
'package-lock.json',
'app/manifest.json'
], {
base: './'
})
// bump the version number in those files
.pipe(bump({
type: importance
}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('bump package version'))
// read only one file to get the version number
.pipe(filter('package.json'))
// **tag it in the repository**
.pipe(tagVersion())
}
function compile() {
const filterBinFiles = gFilter(
`${tsProject.config.compilerOptions.outDir}/knapsack-pro-cypress.js`,
{ restore: true },
);
return (
tsProject
.src()
.pipe(tsProject())
.js // compile TypeScript to JavaScript
.pipe(filterBinFiles) // filter a subset of the files
// make them executable
.pipe(chmod(0o755))
// bring back the previously filtered out files
.pipe(filterBinFiles.restore)
.pipe(gulp.dest(paths.dest))
);
gulp.task("compile", () => {
const jsFilter = filter("**/*.js", {restore:true});
return gulp.src("src/**")
.pipe(jsFilter)
.pipe(babel())
.pipe(jsFilter.restore)
.pipe(gulp.dest("target"));
});
gulp.task('commit-release', function() {
return gulp.src([
'./bower.json',
'./package.json',
'./CHANGELOG.md',
'./dist'
])
.pipe(git.add({
args: '-A'
}))
.pipe(git.commit(`chore(release): new ${getImportance()} release`))
.pipe(filter('bower.json'))
.pipe(tag());
});
gulp.task('templates', () => (
gulp.src('app/**/*.jade')
.pipe(plumber({errorHandler: errorHandler(`Error in \'templates\' task`)}))
.pipe(cached('jade'))
.pipe(gulpIf(global.watch, inheritance({basedir: 'app'})))
.pipe(filter(file => /app[\\\/]pages/.test(file.path)))
.pipe(jade({basedir: 'app', data}))
.pipe(gulpIf(process.env.PRETTIFY !== false, prettify({
braceStyle: 'expand',
indentWithTabs: true,
indentInnerHtml: true,
preserveNewlines: true,
endWithNewline: true,
wrapLineLength: 120,
maxPreserveNewlines: 50,
wrapAttributesIndentSize: 1,
unformatted: ['use']
})))
.pipe(gulpIf(process.env.NODE_ENV === 'production', staticHash({
asset: 'dist',
exts: ['js', 'css']
})))
export function buildJS (manifest) {
const componentsFilter = gfilter(`**/${buildComponentsPath}/**/*.json`, {restore: true})
const routesFilter = gfilter(`**/${buildRoutesFilePath}`, {restore: true})
return new Promise((resolve, reject) => {
gulp.src(jsGlob)
.pipe(babel({
presets: [
path.resolve(nodeModulesPath, 'babel-preset-es2015'),
path.resolve(nodeModulesPath, 'babel-preset-stage-2'),
path.resolve(nodeModulesPath, 'babel-preset-react'),
],
plugins: [
[path.resolve(nodeModulesPath, 'babel-plugin-import-rename'), {'(.less|.sass|.scss)$': '.css'}],
path.resolve(nodeModulesPath, 'babel-plugin-vtex-render-route'),
path.resolve(nodeModulesPath, 'babel-plugin-transform-es2015-modules-systemjs'),
],
}))
.pipe(gulp.dest(buildAssetsPath))
.pipe(vtexRender({manifest: manifest}))
gulpTask() {
const jsFiles = filter(['**/*.js'], {restore: true});
return (
gulp
.src(this.src.path)
.pipe(this.webpack())
.on('error', this.onError())
.pipe(jsFiles)
.pipe(this.minify())
.on('error', this.onError())
.pipe(jsFiles.restore)
.pipe(this.saveAs(gulp))
.pipe(this.onSuccess())
);
}
gulp.task('update-license-headers', () => {
const commonFilter = filter(getLicenseFileFilter('js', 'go', 'scss'), {restore: true});
const htmlFilter = filter(getLicenseFileFilter('html'), {restore: true});
const matchRate = 0.9;
gulp.src(
[path.join(conf.paths.src, getLicenseFileFilter('js', 'go', 'scss', 'html'))],
{base: conf.paths.base})
.pipe(commonFilter)
.pipe(license(fs.readFileSync('build/assets/license/header.txt', 'utf8'), {}, matchRate))
.pipe(commonFilter.restore)
.pipe(htmlFilter)
.pipe(license(fs.readFileSync('build/assets/license/header_html.txt', 'utf8'), {}, matchRate))
.pipe(htmlFilter.restore)
.pipe(gulp.dest(conf.paths.base));
});
function build(config) {
const basename = path.basename(config.output.filename, path.extname(config.output.filename));
const jsOnly = filter(['**/*.js'], {restore: true});
const mapOnly = filter(['**/*.map']);
return () => webpackStream(config)
.pipe(jsOnly)
.pipe(header(BANNER))
.pipe(rename({basename: basename, extname: '.max.js'}))
.pipe(gulp.dest(DIST))
.pipe(stripDebug())
.pipe(rename({basename: basename, extname: '.js'}))
.pipe(gulp.dest(DIST))
.pipe(uglify({compress: {properties: false}, output: {'quote_keys': true}}))
.pipe(header(BANNER))
.pipe(rename({basename: basename, extname: '.min.js'}))
.pipe(gulp.dest(DIST))
.pipe(jsOnly.restore)
.pipe(mapOnly)
.pipe(gulp.dest(DIST));
appleStartup: true,
coast: true,
favicons: true,
firefox: true,
opengraph: false,
twitter: false,
windows: true,
yandex: false,
},
html: config.favicons.html,
replace: true,
})
)
.on('error', gutil.log)
.pipe(gulp.dest(`${config.favicons.build}`))
.pipe(filter('**/*.{xml,json,webapp}'))
.pipe(replace('{{root}}', '/'))
.pipe(gulp.dest(`${config.favicons.build}`))
.pipe(browser.stream())
.pipe(
notify({
title: config.notify.title,
message: 'Favicons task complete',
onLast: true,
})
);
});