Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function inc(importance, cake_mustnt_be_a_lie) {
var process = gulp.src(paths.versionToBump) // get all the files to bump version in
.pipe(prompt.confirm('Have you commited all the changes to be included by this version?'));
if (cake_mustnt_be_a_lie === true) {
/* never ever do a big release without proper celebration, it's a company Hoshin thing */
process.pipe(prompt.confirm('Has cake been served to celebrate the release?'));
}
process.pipe(bump({type: importance})) // bump the version number in those files
.pipe(gulp.dest(paths.dest)) // save it back to filesystem
.pipe(git.commit('bumps package version')) // commit the changed version number
.pipe(filter(paths.versionToCheck)) // read only one file to get the version number
.pipe(tag_version()) // tag it in the repository
//.pipe(git.push('origin', 'master', { args: '--tags' })) // push the tags to master
}
indexRootPath: true,
};
return gulp.src('./dist/**/*')
.pipe(gulpIf(() => {
// As a dumb check against syncing the entire bucket
// we check to make sure you're putting your project at
// least 2 directories deep.
const depth = awsDirectory.replace(/\/$/, '').split('/').length;
return depth < 2;
}, fail(`Can't publish to ${awsDirectory}. Check meta.json and your publishPath setting.`)))
.on('end', () => {
gutil.log(
gutil.colors.cyan(`You're about to publish this project to AWS under directory ${gutil.colors.bold.black.bgYellow(awsDirectory)}. This will sync this directory with your local dist folder and may cause files to be deleted.`));
})
.pipe(prompt.confirm('Are you sure?'))
.pipe(rename((pubPath) => {
// eslint-disable-next-line no-param-reassign
pubPath.dirname = path.join(awsDirectory, pubPath.dirname.replace('.\\', ''));
}))
.pipe(revAll.revision({
dontRenameFile: versionIgnore,
dontUpdateReference: versionIgnore,
}))
.pipe(awspublish.gzip())
.pipe(publisher.publish(headers, { force: false }))
.pipe(publisher.sync(awsDirectory))
// eslint-disable-next-line no-extra-boolean-cast
.pipe(!!gutil.env.invalidate ? invalidate(cloudFrontConfig) : gutil.noop())
.pipe(publisher.cache())
.pipe(awspublish.reporter())
.on('end', () => {
gulp.task('confirmAndBump', function () {
var process = gulp.src(config.paths.package) // get all the files to bump version in
.pipe(prompt.confirm({
message: 'Have you commited all the changes to be included by this version?',
default: true
}));
if (cake_mustnt_be_a_lie === true) {
/* never ever do a big release without proper celebration, it's a company Hoshin thing */
process.pipe(prompt.confirm('Has cake been served to celebrate the release?'));
}
process.pipe(bump({type: importance})) // bump the version number in those files
.pipe(gulp.dest('./')); // save it back to filesystem
return process;
});
if (argv.production) {
rsyncConf.hostname = deploy.hostname; // hostname
rsyncConf.username = deploy.username; // ssh username
rsyncConf.destination = deploy.destination; // path where uploaded files go
rsyncConf.root = 'dist/';
// Missing/Invalid Target
} else {
throwError('deploy', gutil.colors.red('Missing or invalid target'));
}
// Use gulp-rsync to sync the files
return gulp.src(config.dist + '/**/*')
.pipe(gulpif(
argv.production,
prompt.confirm({
message: 'Heads Up! Are you SURE you want to push to PRODUCTION?',
default: false
})
))
.pipe(rsync(rsyncConf));
});
// **tag it in the repository**
.pipe(tag_version({prefix: ''}))
// push tag
.pipe(prompt.confirm({
message: 'Push tag ' + version + ' to github?',
default: false
}))
.pipe(cb(function() {
git.push('origin','master', {args: ' --tags --force'}, function (err) {
if (err) throw err;
});
}))
// npm publish
.pipe(prompt.confirm({
message: 'publish ' + version + ' to npm?',
default: false
}))
.pipe(shell([
'npm publish --tag ' + (tag ? tag : 'latest')
]));
}
// **tag it in the repository**
.pipe(tag_version({prefix: ''}))
// push tag
.pipe(prompt.confirm({
message: 'Push tag ' + version + ' to github?',
default: false
}))
.pipe(cb(function() {
git.push('origin','master', {args: ' --tags'}, function (err) {
if (err) throw err;
});
}))
// npm publish
.pipe(prompt.confirm({
message: 'publish ' + version + ' to npm?',
default: false
}))
.pipe(shell([
'npm publish --tag ' + (tag ? tag : 'latest')
]));
}
// **tag it in the repository**
.pipe(tag_version({prefix: ''}))
// push tag
.pipe(prompt.confirm({
message: 'Push tag ' + version + ' to github?',
default: false
}))
.pipe(cb(function() {
git.push('origin','master', {args: ' --tags'}, function (err) {
if (err) throw err;
});
}))
// npm publish
.pipe(prompt.confirm({
message: 'publish ' + version + ' to npm?',
default: false
}))
.pipe(shell([
'npm publish --tag ' + (tag ? tag : 'latest')
]));
}
// **tag it in the repository**
.pipe(tag_version({prefix: ''}))
// push tag
.pipe(prompt.confirm({
message: 'Push tag ' + version + ' to github?',
default: false
}))
.pipe(cb(function() {
git.push('origin','master', {args: ' --tags'}, function (err) {
if (err) throw err;
});
}))
// npm publish
.pipe(prompt.confirm({
message: 'publish ' + version + ' to npm?',
default: false
}))
.pipe(shell([
'npm publish --tag ' + (tag ? tag : 'latest')
]));
}
gulp.task('deploy', function() {
gulp.src(config.deploy.src + '/**/*')
.pipe(prompt.confirm({
message: 'Are you sure you want to replace the contents of ' + config.deploy.dest +
' with the current contents of ' + config.deploy.src + '?',
default: false
}))
.pipe(gulp.dest(config.deploy.dest));
});
gulp.task('confver', ['version'], function(){
return gulp.src('.')
.pipe( prompt.confirm({ message: 'Are you sure version `' + version + '` is OK to publish?' }) )
;
});