Skip to content

Commit

Permalink
Travis: Fail when changed files are detected (#1819)
Browse files Browse the repository at this point in the history
This adds a new check to the Travis CI config which will cause the build to fail if any files change (This usually indicates that the committer forgot to rebuild Prism.). To implement this, we also add the `package-lock.json` file.
  • Loading branch information
RunDevelopment authored Mar 24, 2019
1 parent c3e74ea commit 66b44e3
Show file tree
Hide file tree
Showing 7 changed files with 5,482 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ branches:
only:
- gh-pages
- /.*/
before_install:
- npm i -g npm@latest
install:
- npm ci
before_script:
- npm install -g gulp
- gulp
- gulp premerge
script: npm test
deploy:
provider: npm
Expand Down
2 changes: 1 addition & 1 deletion components/prism-markdown.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const concat = require('gulp-concat');
const replace = require('gulp-replace');
const pump = require('pump');
const fs = require('fs');
const simpleGit = require('simple-git');

const paths = {
componentsFile: 'components.json',
Expand Down Expand Up @@ -202,7 +203,24 @@ function changelog(cb) {
const components = minifyComponents;
const plugins = series(languagePlugins, minifyPlugins);

function gitChanges(cb) {
const git = simpleGit(__dirname);

git.status((err, res) => {
if (err) {
cb(new Error(`Something went wrong!\n${err}`));
} else if (res.files.length > 0) {
console.log(res);
cb(new Error('There are changes in the file system. Did you forget to run gulp?'));
} else {
cb();
}
});
}


exports.watch = watchComponentsAndPlugins;
exports.default = parallel(components, plugins, componentsJsonToJs, build);
exports.changelog = changelog;

exports.premerge = gitChanges;
Loading

0 comments on commit 66b44e3

Please sign in to comment.