Skip to content

Commit

Permalink
Merge branch '1.0' of github.com:gatsbyjs/gatsby into 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed May 3, 2017
2 parents 7b45d92 + 69d607b commit f66abd3
Show file tree
Hide file tree
Showing 48 changed files with 446 additions and 433 deletions.
11 changes: 10 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"sourceMaps": true,
// "env": {
// "development": {
// "sourceMaps": "inline"
// },
// "production": {
// "sourceMaps": false
// }
// },
"presets": [
[
"env",
Expand All @@ -17,4 +26,4 @@
"transform-async-to-generator",
"transform-flow-strip-types"
]
}
}
4 changes: 2 additions & 2 deletions examples/gatsbygram/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
graphql(
`
{
allPosts(limit: 1000) {
allPostsJson(limit: 1000) {
edges {
node {
id
Expand All @@ -45,7 +45,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
// Instagram post. Since the scrapped Instagram data
// already includes an ID field, we just use that for
// each page's path.
_.each(result.data.allPosts.edges, edge => {
_.each(result.data.allPostsJson.edges, edge => {
// Gatsby uses Redux to manage its internal state.
// Plugins and sites can use functions like "upsertPage"
// to interact with Gatsby.
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsbygram/src/components/post-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PostDetail extends React.Component {
text,
avatar,
} = this.props.post
const { big } = image.children[0]
const { big } = image.childImageSharp

const UserBar = () => (
<div
Expand Down
2 changes: 1 addition & 1 deletion examples/gatsbygram/src/components/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Post extends React.Component {

render() {
const { image, likes, id } = this.props.post
const { small } = image.children[0]
const { small } = image.childImageSharp
return (
<Link
to={`/${id}/`}
Expand Down
32 changes: 15 additions & 17 deletions examples/gatsbygram/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Index extends React.Component {

render() {
console.log(this.props)
this.context.setEdges(this.props.data.allPosts.edges)
this.context.setEdges(this.props.data.allPostsJson.edges)
return (
<div
css={{
Expand Down Expand Up @@ -122,17 +122,17 @@ class Index extends React.Component {
fontWeight: `normal`,
}}
>
{this.props.data.allPosts.edges[0].node.username}
{this.props.data.allPostsJson.edges[0].node.username}
</h3>
<p>
<strong>{this.props.data.allPosts.edges.length}</strong> posts
<strong>{this.props.data.allPostsJson.edges.length}</strong> posts
<strong css={{ marginLeft: rhythm(1) }}>192k</strong> followers
</p>
</div>
</div>
{/* posts */}
{chunk(
this.props.data.allPosts.edges.slice(0, this.state.postsToShow),
this.props.data.allPostsJson.edges.slice(0, this.state.postsToShow),
3
).map(chunk => {
return (
Expand All @@ -152,7 +152,7 @@ class Index extends React.Component {
<Post
key={edge.node.id}
post={edge.node}
edges={this.props.data.allPosts.edges}
edges={this.props.data.allPostsJson.edges}
location={this.props.location}
onClick={post => this.setState({ activePost: post })}
/>
Expand Down Expand Up @@ -211,25 +211,23 @@ export default Index

export const pageQuery = `
query allImages {
user: allPosts(limit: 1) { edges { node { avatar, username }}}
allPosts {
user: allPostsJson(limit: 1) { edges { node { avatar, username }}}
allPostsJson {
edges {
node {
likes
id
text
weeksAgo: time(difference: "weeks")
image {
children {
... on ImageSharp {
small: responsiveSizes(maxWidth: 292, maxHeight: 292) {
src
srcSet
}
big: responsiveSizes(maxWidth: 640, maxHeight: 640) {
src
srcSet
}
childImageSharp {
small: responsiveSizes(maxWidth: 292, maxHeight: 292) {
src
srcSet
}
big: responsiveSizes(maxWidth: 640, maxHeight: 640) {
src
srcSet
}
}
}
Expand Down
26 changes: 12 additions & 14 deletions examples/gatsbygram/src/templates/post-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PostTemplate extends React.Component {
return (
// PostDetail is used for this detail page and
// also in the modal.
<PostDetail post={this.props.data.posts} />
<PostDetail post={this.props.data.postsJson} />
)
}
}
Expand All @@ -20,9 +20,9 @@ export default PostTemplate
// All GraphQL queries in Gatsby are run at build-time and
// loaded as plain JSON files so have minimal client cost.
export const pageQuery = `
query PostPage($id: String!) {
query PostPageJson($id: String!) {
# Select the post which equals this id.
posts(id: { eq: $id }) {
postsJson(id: { eq: $id }) {
# Specify the fields from the post we need.
username
avatar
Expand All @@ -36,17 +36,15 @@ export const pageQuery = `
# for the client.
weeksAgo: time(difference: "weeks")
image {
children {
... on ImageSharp {
# Here we query for *multiple* image thumbnails to be
# created. So with no effort on our part, 100s of
# thumbnails are created. This makes iterating on
# designs effortless as we simply change the args
# for the query and we get new thumbnails.
big: responsiveSizes(maxWidth: 640) {
src
srcSet
}
childImageSharp {
# Here we query for *multiple* image thumbnails to be
# created. So with no effort on our part, 100s of
# thumbnails are created. This makes iterating on
# designs effortless as we simply change the args
# for the query and we get new thumbnails.
big: responsiveSizes(maxWidth: 640) {
src
srcSet
}
}
}
Expand Down
31 changes: 30 additions & 1 deletion packages/gatsby-dev-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
/index.js
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

decls
dist
32 changes: 0 additions & 32 deletions packages/gatsby-dev-cli/.npmignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,2 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
*.un~
yarn.lock
src
flow-typed
coverage
decls
examples
59 changes: 0 additions & 59 deletions packages/gatsby-dev-cli/bin/gatsby-dev

This file was deleted.

8 changes: 4 additions & 4 deletions packages/gatsby-dev-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"babel-cli": "^6.24.1"
},
"bin": {
"gatsby-dev": "./bin/gatsby-dev"
"gatsby-dev": "dist/index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src --out-dir .",
"watch": "babel -w src --out-dir ."
"build": "babel src --out-dir dist --presets es2015",
"watch": "babel -w src --out-dir dist --presets es2015"
},
"keywords": [
"gatsby"
],
"author": "Kyle Mathews <[email protected]>",
"license": "MIT"
}
}
Loading

0 comments on commit f66abd3

Please sign in to comment.