Skip to content

Commit

Permalink
Generate RSS feeds during deployment (jestjs#2769)
Browse files Browse the repository at this point in the history
* Generate RSS feeds during deployment.
Remove redundant gitignore entries.
Updated autogenerated README

* Make sure blog directory exists before generating feeds
  • Loading branch information
hramos authored and cpojer committed Feb 1, 2017
1 parent b8cf678 commit ee1055f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ npm-debug.log
coverage
lerna-debug.log
npm-debug.log*
website/core/metadata*.js
website/src/jest/blog
website/src/jest/docs
/danger/node_modules/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Jest can be used in projects that use [webpack](https://webpack.github.io/) to m
To use TypeScript in your tests, install the `ts-jest` package:

```
npm install --save-dev test-jest
npm install --save-dev ts-jest
```

then modify your `package.json` so the `jest` section looks something like:
Expand Down
Binary file modified packages/jest-cli/src/assets/jest_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions website/server/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const glob = require('glob');
const fs = require('fs.extra');
const mkdirp = require('mkdirp');
const server = require('./server.js');
const feed = require('./feed');

// Sadly, our setup fatals when doing multiple concurrent requests
// I don't have the time to dig into why, it's easier to just serialize
Expand Down Expand Up @@ -31,6 +32,14 @@ const queue = (function() {
return {push};
})();

queue.push(cb => {
mkdirp.sync('build/jest/blog/');
fs.writeFileSync('build/jest/blog/feed.xml', feed('rss'));
fs.writeFileSync('build/jest/blog/atom.xml', feed('atom'));
console.log('Generated RSS feed');
cb();
});

glob('src/**/*.*', (er, files) => {
files.forEach(file => {
let targetFile = file.replace(/^src/, 'build');
Expand All @@ -53,6 +62,7 @@ glob('src/**/*.*', (er, files) => {
});

queue.push(cb => {
console.log('Generated website');
server.close();
cb();
});
Expand Down

0 comments on commit ee1055f

Please sign in to comment.