-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(deployment): Added automatic version release process and editorc…
…onfig
- Loading branch information
Showing
5 changed files
with
141 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
; EditorConfig helps developers define and maintain consistent | ||
; coding styles between different editors and IDEs. | ||
|
||
; For more visit http://editorconfig.org. | ||
root = true | ||
|
||
; Choose between lf or rf on "end_of_line" property | ||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{js,css,scss}] | ||
indent_size = 2 | ||
|
||
[*.html] | ||
indent_style = space | ||
|
||
[*.{py,html,md}] | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = true |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,103 @@ | ||
var gulp = require('gulp'); | ||
var sass = require('gulp-sass'); | ||
var gulpStylelint = require('gulp-stylelint'); | ||
const gulp = require('gulp'); | ||
const sass = require('gulp-sass'); | ||
const gulpStylelint = require('gulp-stylelint'); | ||
const runSequence = require('run-sequence'); | ||
const conventionalChangelog = require('gulp-conventional-changelog'); | ||
const conventionalGitHubReleaser = require('conventional-github-releaser'); | ||
const bump = require('gulp-bump'); | ||
const argv = require('yargs').argv; | ||
const validBumpTypes = 'major|minor|patch|prerelease'.split('|'); | ||
const bumpType = (argv.bump || 'patch').toLowerCase(); | ||
|
||
if (validBumpTypes.indexOf(bumpType) === -1) { | ||
throw new Error('Unrecognized bump "' + bumpType + '".'); | ||
} | ||
|
||
const args = { | ||
bump: bumpType, | ||
depth: parseInt(argv.depth || '0', 10), | ||
token: argv.token, | ||
branch: argv.branch | ||
}; | ||
|
||
const changelogOpts = { | ||
preset: 'angular', | ||
releaseCount: 1, | ||
targetCommitish: args.branch | ||
}; | ||
|
||
// utilizes the bump plugin to bump the | ||
// semver for the repo | ||
gulp.task('bump-version', () => | ||
gulp.src(['./package.json']) | ||
.pipe(bump({type: args.bump})) | ||
.pipe(gulp.dest('./')) | ||
); | ||
|
||
// generates the CHANGELOG.md file based on commit | ||
// from git commit messages | ||
gulp.task('changelog', () => | ||
gulp.src(`./CHANGELOG.md`) | ||
.pipe(conventionalChangelog(changelogOpts)) | ||
.pipe(gulp.dest('./')) | ||
); | ||
|
||
// calls the listed sequence of tasks in order | ||
gulp.task('prepare-release', callback => | ||
runSequence( | ||
'build', | ||
'lint', | ||
'bump-version', | ||
'changelog', | ||
callback | ||
) | ||
); | ||
|
||
gulp.task('release', callback => { | ||
conventionalGitHubReleaser({ | ||
type: 'oauth', | ||
token: args.token || process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN | ||
}, changelogOpts, {}, {}, {}, {}, (err, data) => { | ||
if (err) { | ||
console.error(err.toString()); | ||
return callback(); | ||
} | ||
|
||
if (!data.length) { | ||
console.log('No GitHub releases created because no git tags available to work with.'); | ||
return callback(); | ||
} | ||
|
||
let allRejected = true; | ||
for (let i = data.length - 1; i >= 0; i--) { | ||
if (data[i].state === 'fulfilled') { | ||
allRejected = false; | ||
break; | ||
} | ||
} | ||
|
||
if (allRejected) { | ||
console.error(data); | ||
} else { | ||
console.log(data); | ||
} | ||
return callback(); | ||
}); | ||
}); | ||
|
||
gulp.task('lint-sass', function() { | ||
return gulp.src(['./*.scss', './custom/*.scss', './components/*.scss', './components/**/*.scss']) | ||
.pipe(gulpStylelint({ | ||
reporters: [ | ||
{formatter: 'string', console: true} | ||
] | ||
})); | ||
return gulp.src(['./*.scss', './custom/*.scss', './components/*.scss', './components/**/*.scss']) | ||
.pipe(gulpStylelint({ | ||
reporters: [ | ||
{formatter: 'string', console: true} | ||
] | ||
})); | ||
}); | ||
|
||
// This is only used to validate the code is able to compile | ||
gulp.task('sass', function () { | ||
return gulp.src('./index.scss') | ||
.pipe(sass().on('error', sass.logError)); | ||
}); | ||
gulp.task('sass', () => | ||
gulp.src('./index.scss') | ||
.pipe(sass().on('error', sass.logError)) | ||
); | ||
|
||
gulp.task('default', function() { | ||
return gulp.parallel('sass', 'lint-sass') | ||
}); | ||
gulp.task('default', () => gulp.parallel('sass', 'lint-sass')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters