Releases: gatsbyjs/gatsby
React Router V4 upgrade, static directory, bug fixes, tests, etc.
Added
- Update version of React Router to v4 #940
- API proxy for use during development #957
- "static" directory for files to be copied directly into the "public"
directory #956 - Add
toFormat
argument to the ImageSharp GraphQL type so can change
format of image e.g. frompng
tojpg
. - React Docgen transformer plugin for parsing propType info from React
components #928
Changed
- Change node format to hide most node-specific fields under an "internal"
key. Any code referencingnode.type
and others will need changed to
node.internal.type
#960 - Changed the id for the root
<div>
used by Gatsby to mount React to___gatsby
- The default layout component should be at
layouts/index.js
notlayouts/default.js
#940 (comment) this.props.children
in layout components is now a function #940 (comment)- Change the default port for serve-build to 9000
- Change the path to GraphiQL to
/___graphql
Chore
- Upgrade Jest to v20 #935
New GraphQL compiler!
Added
- Use the Relay Modern compiler for extracting GraphQL queries from components.
This allows us to now support components being added to all components. This
means you can now write queries next to the views that use them. #912 - Hook for modifying pages #863
- New Drupal source plugin and example site #890
- Detect if a site's plugins have changed and when they do, delete the site
cache as it might now be invalid #927 - New way to make connections between nodes e.g. article --> author #902
Changed
- Combine transformer and typegen plugins. The distinction between the two
types of plugins has proved somewhat artificial so they were combined. Any
typegen plugins in yourpackage.json
andgatsby-config.js
need to be
removed. #918 - Gatsby now garbage collects old nodes. Source plugins should now "touch"
- nodes that haven't changed #861
- Due to adopting the Relay compiler, GraphQL query template strings need
named "graphql" plus must be named. So if previously you wrote:
export const pageQuery = `
{
allMarkdownMark {
edges {
node {
id
}
}
}
}
`
You must now write:
export const pageQuery = graphql`
query IndexQuery {
allMarkdownMark {
edges {
node {
id
}
}
}
}
`
Smarter faster data processing (oh and data hot reloading!)
Gatsby v1's data layer is starting to feel quite solid.
For this latest alpha, I did a almost complete refactor of the data layer adding in Redux and ideas from event sourcing and modern build tools like Buck and Bazel from Facebook and Google respectively.
Now all data processing is incremental and completely cached. On booting, Gatsby looks at your data contents to decide if new processing is needed and only processes data that's actually changed. One large site built on 1.0 saw it's bootstrap time drop from nearly a minute to under 5 seconds!
And as part of this work, Gatsby's data system now automatically watches all your data sources for changes and reprocesses data on the fly. Remote or local data, if you change it, the change will be automatically pushed to the development version of your site. This is handy for editing a local markdown file but also a gatsby plugin can be monitoring a remote API for changes and automatically pull down data and update your site when something is updated.
Imagine a small team working on a site with a developer and two people working on content hosted on a CMS. Every time content is updated, the developer sees the changes in near real-time on the development site.
This was the last big piece blocking 1.0.0 from being released. There are a number of smaller tasks to complete but these should be more predictable in scope. There's plenty of smaller tasks to do! Please come help out!
Breaking changes
Add support to JS frontmatter for named exports
@NMinhNguyen added this very nice PR adding support for named exports to JS frontmatter #838
So this is now supported:
export const data = {
titles: ['My title', 'My other title'],
}
Fix sourcemaps, templating logic, and updates for React 0.15.5
- @0x80 noticed that source maps weren't working in Chrome in development and asked about it. That, combined with a serendipitous tweet by @gaearon, led to #812 where we swapped out using the
eval
source-maps technique forcheap-module-source-maps
. - @donysukardi got us React 16 ready by removing our uses of React.createClass and the built-in proptypes #809
- @danperkins fixed a logic bug in our router generation where nested templates weren't being tied to their parent templates correctly #808
- @KyleAMathews replaced the old default starter with a much simpler one to make it simpler to understand Gatsby when new plus easier to use the starter as a base for building new sites #806
Use the default PostCSS browserlist config for autoprefixing
@kennethormandy fixed a problem with our PostCSS webpack config where because of how it was setup, you couldn't override the browserlist using a custom .browserslist
file in your site. And by removing our custom option, we can now rely on the PostCSS default browserlist which is preferable as Gatsby doesn't have unique needs here so better to rely on the community maintaining a standard than us. #787
Use Yarn by default and add support for array values in JS frontmatter
Our 40th patch release on the 0.12 minor series! Woot!
Two nice feature additions from two new Gatsby contributors.
- @donysukardi added support for using Yarn over NPM when creating a new Gatsby site using
gatsby new
#782 - @Tom-Bonnike extended our JavaScript frontmatter code to support array values. #784 So now the parsing code can extract values in this form:
exports.data = {
titles: ['My title', 'My other title'],
}
Do shallow clone when creating new Gatsby sites
- @ahonn noticed we were doing a full clone of Gatsby starters when running
gatsby new
which is wasteful as we just throw away the git repo. So in #730 he fixed that to just do a shallow clone. - @dbismut fixed the default markdown loader to add in a site's prefix/basename to links within markdown. #710
Correct wording to 'listening'
Add gatsby-ssr.js for lifecycle APIs during server rendering
- #695 @mtt87 needed to support rendering translations correctly for his site during the static HTML build so added support for SSR APIs through a new
gatsby-ssr.js
file which can be added to your site similar togatsby-browser.js
andgatsby-node.js
. He added awrapRootComponent
API similar to what was recently added to the browser but the method is now available if we need to add additional SSR APIs. - @mjesuele added support for extracting data from JS frontmatter when using template literal strings in additional to normal strings in #656
Thanks everyone!