Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function configureEnvironment() {
let env = CLIOptions.getEnvironment();
return gulp.src(`aurelia_project/environments/${env}${project.transpiler.fileExtension}`)
.pipe(rename(`environment${project.transpiler.fileExtension}`))
.pipe(through.obj(function (file, _, cb) {
// https://github.com/aurelia/cli/issues/1031
fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
}))
.pipe(gulp.dest(project.paths.root))
.pipe(through.obj(function(file, enc, cb) {
// https://github.com/webpack/watchpack/issues/25#issuecomment-287789288
const now = Date.now() / 1000;
const then = now - 10;
fs.utimes(file.path, then, then, function(err) { if (err) throw err; });
cb(null, file);
}));
}
langs.forEach(lang => {
return gulp.src(`./dist/index-en.html`)
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
}))
.pipe(rename({
basename: 'index',
}))
// .pipe(gulpif(lang !== 'en', gulp.dest(`${dirs.dest}/${lang}`), gulp.dest(`${dirs.dest}`)))
.pipe(gulp.dest(`${dirs.dest}`));
});
});
function buildBundle(options, extname, minify) {
let stream = browserify(options)
.transform('babelify')
.bundle()
.pipe(source('GitHub.js'))
.pipe(buffer())
.pipe(sourcemaps.init({
loadMaps: true,
}));
if (minify) {
stream = stream.pipe(uglify());
}
return stream.pipe(rename({extname}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
;
}
export const styles = () => src('src/timeline.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle:'compressed'}))
.pipe(autoprefixer())
.pipe(rename('jquery.timeline.min.css'))
.pipe(sourcemaps.write('.'))
.pipe(dest('dist'))
return [
...conf,
outputs[output],
];
}, []);
fileSystem.push(new File({
path: resolve(`packages/css-values/index.js`),
contents: new Buffer(generator.property(validatorConfig)),
}), new File({
path: resolve(`packages/css-values/test.js`),
contents: new Buffer(generator.test(validatorConfig)),
}));
const stream = vfs.src(['./src/util/**/*.js', './src/validators/**/*.js'], {base: process.cwd()})
.pipe(rename(renamer))
.pipe(map((file, cb) => {
fileSystem.push(file);
cb(null, file);
}));
stream.on('close', () => {
return writeBundle({
entry: './packages/css-values/index.js',
dest: './packages/css-values/index.js',
files: fileSystem,
}).then(writeBundle({
entry: './packages/css-values/test.js',
dest: './packages/css-values/test.js',
files: fileSystem,
external: [
resolve('./packages/css-values/index.js'),
export function buildImages() {
return gulp.src(sourcePaths.images)
.pipe(gulp.dest(targetDirs.images))
.pipe(rename(p => {
p.dirname = path.join(targetDirs.images, p.dirname);
}))
.pipe(browserSync.stream());
}
gulp.task('default', () => {
setVersion();
return gulp.src('skeleton.js')
.pipe(babel())
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('.'));
});
.pipe(replace(/INCLUDE_ALL_MODULES\(\[(.*)\]/, function(match) {
if (match.match(/\[\]/)) {
return match.replace(']', `${name}Component]`);
} else {
return match.replace(']', `, ${name}Component]`);
}
}))
.pipe(clean({force: true}))
.pipe(gulp.dest(resolveToCommon()));
let createNewCommonComponentBasedOnComponentTemplate = gulp.src(paths.blankTemplates)
.pipe(template({
name: name,
upCaseName: cap(name)
}))
.pipe(rename((path) => {
path.basename = path.basename.replace('temp', name);
}))
.pipe(gulp.dest(destPath));
return merge(
merge(addNewImportAndDependanciesToComponentsJS, createNewCommonComponentBasedOnComponentTemplate),
includeAdditionallSCSSFileInGlobalIndex
);
});
.pipe(postcss([
atImport(),
sprites({
spritePath: targetDirs.images,
stylesheetPath: targetDirs.styles,
spritesmith: {
padding: 2,
},
}),
colorHexAlpha(),
autoprefixer(),
discardComments(),
]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(targetDirs.styles))
.pipe(rename(p => {
p.dirname = path.join(targetDirs.styles, p.dirname);
}))
.pipe(browserSync.stream());
}
const exportsJS = (fs.readFileSync('src/components/index.js').toString())
const replaceExportsJS = exportsJS
.replace('module.exports', `module.exports = ${JSON.stringify(requireComponents)}`)
.replace(/"(require[^"]+)"/g, '$1')
fs.writeFileSync('src/components/index.js', replaceExportsJS)
exec('NODE_ENV=temp npm run pack.client')
exec('NODE_ENV=build npm run pack.client -- --display-modules')
rm(['npm/dist/*.css'])
gu.src('npm/dist/*.js', { base: 'npm' })
.pipe(uglify())
.pipe(rename({
suffix: '.min',
}))
.pipe(gu.dest('npm'))
.on('finish', ()=> {
const pkg = require('../package.json')
const { scripts, devDependencies, jest, ...packageJSON } = pkg
fs.writeFile('npm/package.json', JSON.stringify(packageJSON, null, 2))
gu.src('README.md')
.pipe(gu.dest('npm'))
.on('finish', ()=> {
log(`outputs to: ${c.cyan('npm/')}`)
gu.src('npm/**')
.pipe(size({