gatsby develop
๋ ๋๊ท๋ชจ WordPress ์ค์น(~9000๊ฐ์ ๊ฒ์๋ฌผ, ~35ํ์ด์ง)๋ฅผ ์ฟผ๋ฆฌํ ํ source and transform nodes
์์ ๋ฉ์ถฅ๋๋ค.
์ด์ ๊ด๋ จํ์ฌ Gatsby๊ฐ ์ฒ๋ฆฌํ๊ธฐ์ ๋๋ฌด ํฐ ๊ฒ์ ๋ํ ์ง์นจ์ด ์์ต๋๊น?
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - ~/n/bin/node
Yarn: 1.5.1 - ~/n/bin/yarn
npm: 5.6.0 - ~/n/bin/npm
Browsers:
Chrome: 67.0.3396.99
Safari: 11.1.2
npmPackages:
gatsby: ^1.9.273 => 1.9.273
gatsby-image: ^1.0.54 => 1.0.54
gatsby-link: ^1.6.45 => 1.6.45
gatsby-plugin-google-analytics: ^1.0.27 => 1.0.31
gatsby-plugin-postcss-sass: ^1.0.22 => 1.0.22
gatsby-plugin-react-helmet: ^2.0.10 => 2.0.11
gatsby-plugin-react-next: ^1.0.11 => 1.0.11
gatsby-plugin-resolve-src: 1.1.3 => 1.1.3
gatsby-plugin-sharp: ^1.6.48 => 1.6.48
gatsby-plugin-svgr: ^1.0.1 => 1.0.1
gatsby-source-filesystem: ^1.5.39 => 1.5.39
gatsby-source-wordpress: ^2.0.93 => 2.0.93
gatsby-transformer-sharp: ^1.6.27 => 1.6.27
npmGlobalPackages:
gatsby-cli: 1.1.58
ํธ์ง : ๊ทธ๋ฅ์ด ๋ฐ๋ณต-์ดํ๊ธฐ ์ฝ๊ฒ ๊ณ ์น ์์๋ ๊ฒ์ด ์๋๋๋ค ์ํ๋ ์ญ์ .cache/
, .node_modules
, ๊ทธ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์์ ๋ฑ.
์ฌ์์ฐ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ค๋นํ ์ ์์ต๋๊น? ๊ฒ์๋ฌผ ์๋ ๋ฌธ์ ๊ฐ ๋์ง ์์์ผ ํฉ๋๋ค(์ ์ด๋ ์ด ๋จ๊ณ์์๋) - v1์์ ๋ฉ๋ชจ๋ฆฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ง๋ง ์ด๋ ์ดํ ๋น๋ ๋จ๊ณ์ ์์ผ๋ฉฐ ์ค๋จ๋์ด์๋ ์ ๋ฉ๋๋ค.
Local by Flywheel ์ ๋ฌธ์ ์ธ์ง, MAMP Pro ๋ฅผ ํตํด WordPress๋ฅผ ์ ๊ณตํ ๋ ์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ ์ ์๋์ง ๊ถ๊ธํ์ต๋๋ค.
๊ทธ๋ฌ๋ ๋๋ ์์ง ํฌ์คํธ ํ์ด์ง๋ฅผ ๊ตฌ์ถํ์ง๋ ์์๊ณ (ํ์ด์ง๋ฅผ ๊ตฌ์ถ ์ค), ๋ฌธ์ ๊ฐ ๋๋ ๋จ๊ณ์ ์คํ ์๊ฐ์ 636.41์ด(11๋ถ ๋จ์ง)์ ๋๋ค.
const path = require('path')
exports.createPages = ({ boundActionCreators, graphql }) => {
const { createPage } = boundActionCreators
const postTemplate = path.resolve('./src/templates/Post/Post.js')
graphql(
`
{
allWordpressPost {
edges {
node {
id
slug
}
}
}
}
`
)
.then((result) => {
console.log('posts')
// const { data, errors } = result
// if (errors) console.log(errors)
// if (!data) return
//data.allWordpressPost.edges.forEach(({ node }) => {
// const { id, slug } = node
// createPage({
// component: postTemplate,
// context: {
// id,
// },
// path: slug,
// })
//})
})
ํธ์ง: ๊ฒ์๋ฌผ์ ๋ํด createPage
๋ฅผ ํ์ฑํํ๋ฉด ํด๋น ํญ๋ชฉ์ ์คํ์ด 14๋ถ์ผ๋ก ๋์ด๋ฌ์ต๋๋ค. ์์ธํ์ง๋ง ~9000๊ฐ์ ์ถ๊ฐ ํญ๋ชฉ์ ๋ํด ๋จ 3๋ถ ๋ ์ค๋ ๊ฑธ๋ฆฐ๋ค๋ ์ ๋ ํฅ๋ฏธ๋กญ์ต๋๋ค. ํ์ฌ ์ค๋ซ๋์ โ run graphql queries
์ ๋จธ๋ฌผ๊ณ ์์ต๋๋ค.
ํธ์ง: 419.470์ด ๋๋ 7๋ถ ๋์ ์คํ๋์์ต๋๋ค.
@pieh ์์ค, ๋ด๊ฐ ๋ณด๊ธฐ ์ ์ ๊ฒ์ํ์ต๋๋ค. ๋ด์ผ ์๊ฒฉ์ผ๋ก ์ด ์ฌ์ดํธ๋ฅผ ๊ฐ๋ํ ์ ์์ต๋๋ค.
๊ทธ๋ฆฌ๊ณ ์ด ๋ง์ง๋ง ์ค์ Local์ ํตํด ์ค๋จ๋๊ณ MAMP๋ฅผ ํตํด ์์ํ ๊ฑธ๋ฆฝ๋๋ค.
$ gatsby develop
success delete html and css files from previous builds โ 0.017 s
success open and validate gatsby-config โ 0.226 s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's not any stale
data
success copy gatsby files โ 0.013 s
success onPreBootstrap โ 0.159 s
โ source and transform nodes -> wordpress__acf_posts fetched : 100
โ source and transform nodes -> wordpress__acf_pages fetched : 34
โ source and transform nodes -> wordpress__acf_media fetched : 100
โ source and transform nodes -> wordpress__acf_categories fetched : 13
โข source and transform nodes -> wordpress__acf_tags fetched : 0
โ source and transform nodes -> wordpress__acf_users fetched : 11
โข source and transform nodes -> wordpress__POST fetched : 9092
โข source and transform nodes -> wordpress__PAGE fetched : 34
โ source and transform nodes -> wordpress__wp_media fetched : 7483
โก source and transform nodes -> wordpress__wp_types fetched : 1
โ source and transform nodes -> wordpress__wp_statuses fetched : 1
โข source and transform nodes -> wordpress__wp_taxonomies fetched : 1
โ source and transform nodes -> wordpress__CATEGORY fetched : 14
โ source and transform nodes -> wordpress__TAG fetched : 19
โ source and transform nodes -> wordpress__wp_users fetched : 11
โก source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "You are not currently logged in."
โ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
โก source and transform nodesThe server response was "404 Not Found"
Inner exception message : "No route was found matching the URL and request method"
success source and transform nodes โ 636.410 s
@pieh ์ฑ๊ณต์ ์ผ๋ก ๋น๋ ์์๋จ ) ๋ฌธ์ ๊ฐ ํ์คํ ๋๋ฌ๋ฉ๋๋ค: https://github.com/dustinhorton/gatsby-issue
๋ณต์ ํ๊ณ ๋น๋ํ ์ ์์ด์ผ ํฉ๋๋ค.
ํ์ฅ ๋ง๋ฌด๋ฆฌ ๊ณต์ฌ ์์ด 10์๊ฐ ๋๊ฒ ๋ ๋ฒ๋ง ๋ฐ์๋ค. ๋๋ฒ๊น ์ ๋์์ด ๋๋๋ก ์ ๊ฐ ์ ๊ณตํ ์ ์๋ ๋ค๋ฅธ ์ฌํญ์ ์๋ ค์ฃผ์ธ์.
v2๋ก ์ ๊ทธ๋ ์ด๋ํด ์ฃผ์๊ฒ ์ต๋๊น? ์ฐ๋ฆฌ๋ ์ด์ ๊ฐ์ ๋๊ท๋ชจ ์ฌ์ดํธ์ ์๋๋ฅผ ๊ทน์ ์ผ๋ก ๋์ฌ์ผ ํ๋ ๋ค์ํ gatsby ํ์ ์์คํ ์ ์๋๋ฅผ ์์ฒญ๋๊ฒ ๊ฐ์ ํ์ต๋๋ค.
@KyleAMathews ์ค๋ ๋ฐค์ ํ ๋ฒ
@KyleAMathews v2 ๋ฒ์ @ https://github.com/dustinhorton/gatsby-v2-issue. ์ด ์์ ์์ ์ฝ 50๋ถ ๋์ ๊ตฌ์ถํ์ต๋๋ค.
์ง๊ธ ์ฃฝ์ฌ. ์ฌ์ดํธ๊ฐ ์์ง ๊ตฌ์ถ๋์ง ์์์ต๋๋ค.
์๋ํ ์ ์๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ https://next.gatsbyjs.org/docs/performance-tracing/ ์ถ์ ์ ํ์ฑํํ๋ ๊ฒ์ ๋๋ค.
์ฐ๋ฆฌ๋ ์์ง gatsby-source-wordpress์ ์ถ์ ์ง์์ ์ถ๊ฐํ์ง ์์์ง๋ง ์ถ์ ๋ณด๊ณ ์๋ ์ค๋จ๋๋ ์์น๋ฅผ ํ์ ํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค.
๋ค๋ฅธ ์ฌ๋์ด ์ด๊ฒ์ ์กฐ์ฌํ๋ ๋ฐ ๊ด์ฌ์ด ์๋ค๋ฉด ์ข์ PR์ gatsby-source-wordpress์ ์ถ์ ์ง์์ ์ถ๊ฐํ๋ ๊ฒ์ ๋๋ค. ๊ด์ฌ์ด ์๋ค๋ฉด ์์๋์ธ์!
๋ถํํ๋ ์ด๊ฒ์ ๊ตฌ์ ํด์ผ ํ ํ์๊ฐ ์์ต๋๋ค. ๋๋ ์ ํต์ ์ธ ํ ๋ง๋ก ์ด์ํ๋ ๋ฐ ๋ชจ๋ ์๊ฐ์ ํ ์ ํด์ผ ํ๊ธฐ ๋๋ฌธ์ Gatsby๋ฅผ ์ฌ์ฉํ ์ ์๋ค๋ ๊ฒ์ ์๋๋์ด ์์ต๋๋ค. ๋ค๋ฅธ ๋ชจ๋ ๊ฒ์ด ๋๋ฌด ๋ค๋ก ๋๊ปด์ง๋๋ค.
์ด์ ๋ํด ์กฐ์ฌํ ๊ธฐํ๊ฐ ์์ด์ ์ฃ์กํฉ๋๋ค :-( v2๋ฅผ ์ถ์ํ๊ธฐ ์ํด ์ง๊ธ ์ ๋ ฅ์ง์ฃผํ๊ณ ์์ต๋๋ค.
WP ์ฌ์ดํธ๋ฅผ ๊ณ์ ์คํํ ์ ์๋ ๊ธฐํ๊ฐ ์์ต๋๊น? ํ์คํ ์์ ํด์ผ ํ ๋ฒ๊ทธ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋์์ ์์ฒญํ๋ ํธ์์ ๋จ๊ฒผ์ผ๋ ๊ณง ๋๊ตฐ๊ฐ ์ด ๋ฌธ์ ์ ๋ฐ์ด๋ค๊ธฐ๋ฅผ ๋ฐ๋๋๋ค :-)
์์ฐ, ์ ๋ง ๊ฐ์ฌํฉ๋๋ค. ์ฌ์ดํธ๋ ๋น๋ถ๊ฐ ์๋ฌด๋ฐ๋ ๊ฐ์ง ์์ต๋๋ค(ํ์ํ ๊ฒฝ์ฐ ์ฌ๋ณธ์ ๋ง์ด๊ทธ๋ ์ด์ ํ๊ณ repo repo๋ฅผ ์ ๋ฐ์ดํธํ๊ฒ ์ต๋๋ค).
๊ฐ์น๊ฐ ์๋ @dustinhorton ๋ํ ์์ CDN์ด ์๋ ํ๋ก๋์ ํ๊ฒฝ๊ณผ ๋น๊ตํ์ฌ Local by Flywheel์์ ๋ ํฐ(์ต๋ 1,000๊ฐ ๊ฒ์๋ฌผ) ํ๋ก์ ํธ๋ฅผ ๋น๋ํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์์ ๋ฐ๊ฒฌํ์ต๋๋ค.
Gatsby์ ๋ํ REST ์๋ต์ ํ๋ก๋์ ๋ณด๋ค ๋ก์ปฌ์์ 10~20๋ฐฐ ๋ ๊ธธ๊ธฐ ๋๋ฌธ์ ์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ๋ ๋ฐ ์๊ฐ์ด ์ค๋ ๊ฑธ๋ฆฝ๋๋ค. ์์ง ๋ก์ปฌ์์ ๋ฌธ์ ๋ฅผ ๋๋ฒ๊น ํ๋ ๋ฐ ์๊ฐ์ ๋ณด๋ด์ง ์์์ง๋ง ํ ์ผ ๋ชฉ๋ก์ ์์ต๋๋ค. :)
@KyleAMathews source-wordpress์ ์ถ์ ์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณผ ์ ์์ต๋๋ค.
@Khristopho ๊ต์ฅํ๊ตฐ์ !
@dustinhorton ๋น๋๋ฅผ ๋ถํ๋ฆด ์ ์๋ ์ํ ์ฌ์ดํธ(https://dustinhorton.com/gatsby-wp/wp-content/uploads/2018/07/IMG_9906.jpg ๋ฑ)์ ์ด๋ฏธ์ง์ ๋ํด 404๋ฅผ ๋ณด๊ณ ์์ต๋๋ค. ์๊ฐ. ๊ทธ ๊ฒฝ๋ก๋ฅผ ์กฐ์ฌํ ์ ์๋ ๊ธฐํ๊ฐ ์์ต๋๊น?
WP_MEDIA ์์ฒญ์ ๊ฒฐ๊ณผ์ ํจ๊ป ์๋นํ ๋น ๋ฅด๊ฒ ์คํ๋๋ฏ๋ก
๋ช
ํํ์ง๋ง ์๊ฐํ๋ค๋ฉด ์ด๋ฒ ์ฃผ ํ๋ฐ์ ์ดํด๋ณผ ์ ์์ต๋๋ค.
๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค.
2018๋
8์ 8์ผ ์์์ผ ์คํ 5:45 Chris Wiseman [email protected]
์ผ๋ค:
@dustinhorton https://github.com/dustinhorton
์ํ ์ฌ์ดํธ์ ์ด๋ฏธ์ง(
https://dustinhorton.com/gatsby-wp/wp-content/uploads/2018/07/IMG_9906.jpg,
์๋ฅผ ๋ค์ด) ๋น๋ ์๊ฐ์ ๋ถํ๋ฆด ์ ์์ต๋๋ค. ๋น์ ์ด ํ ์์๋ ๋ชจ๋ ๊ธฐํ
๊ทธ๊ฒ๋ค์ ์ํ ๊ฒฝ๋ก๋ฅผ ์ดํด๋ณผ๊น์?โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/gatsbyjs/gatsby/issues/6654#issuecomment-411562589 ,
๋๋ ์ค๋ ๋ ์์๊ฑฐ
https://github.com/notifications/unsubscribe-auth/AAXFNRHTA-vqIwCTtioejUL-Ei3nM0Lbks5uO1vygaJpZM4VZ57n
.
์ฌ์ค์ด์ง๋ง ์์ค ๋ฐ ๋ณํ ๋จ๊ณ์ ์ผ๋ถ๋ REST ์๋ต์์ ์ฐพ์ ๋ชจ๋ ๋ฏธ๋์ด ํญ๋ชฉ์ ๋ค์ด๋ก๋ํ๋ ๊ฒ์
๋๋ค.
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/src/normalize.js#L434
7504 ์ด๋ฏธ์ง์์ 404๋ฅผ ์ป์ผ๋ฉด ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ;)
๋ด๊ฐ ๋ชจ๋ 404๋ฅผ ์ฒญ์ํ๋ค๊ณ ๋ฏฟ์ผ์ญ์์ค. ์ค๋ ๋ฐค ๋น๋๋ฅผ ์๋ํฉ๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
๊ฒ๋ณด๊ธฐ์ ๋ณํ๊ฐ ์์:
~/Sites/gatsby-issue-v2 (master)
โyarn build
yarn run v1.5.1
$ gatsby build
success open and validate gatsby-config โ 0.009 s
success load plugins โ 0.277 s
success onPreInit โ 0.257 s
success delete html and css files from previous builds โ 0.008 s
success initialize cache โ 0.245 s
success copy gatsby files โ 0.079 s
success onPreBootstrap โ 0.001 s
โ
=START PLUGIN=====================================
Site URL: http://dustinhorton.com/gatsby-wp
Site hosted on Wordpress.com: false
Using ACF: true
Using Auth: undefined undefined
Verbose output: true
Mama Route URL: http://dustinhorton.com/gatsby-wp/wp-json
โ source and transform nodesRoute discovered : /
Invalid route.
Route discovered : /oembed/1.0
Invalid route.
Route discovered : /oembed/1.0/embed
Invalid route.
Route discovered : /oembed/1.0/proxy
Invalid route.
Route discovered : /yoast/v1
Valid route found. Will try to fetch.
Route discovered : /yoast/v1/configurator
Valid route found. Will try to fetch.
Route discovered : /yoast/v1/reindex_posts
Valid route found. Will try to fetch.
Route discovered : /yoast/v1/ryte
Valid route found. Will try to fetch.
Route discovered : /yoast/v1/indexables/(?P<object_type>.*)/(?P<object_id>\d+)
Invalid route.
Route discovered : /yoast/v1/statistics
Valid route found. Will try to fetch.
Route discovered : /acf/v3
Invalid route.
Route discovered : /acf/v3/posts/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/posts
Valid route found. Will try to fetch.
Route discovered : /acf/v3/pages/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/pages
Valid route found. Will try to fetch.
Route discovered : /acf/v3/media/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/media
Valid route found. Will try to fetch.
Route discovered : /acf/v3/categories/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/categories
Valid route found. Will try to fetch.
Route discovered : /acf/v3/tags/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/tags
Valid route found. Will try to fetch.
Route discovered : /acf/v3/comments/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/comments
Valid route found. Will try to fetch.
Route discovered : /acf/v3/options/(?P<id>[\w\-\_]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/users/(?P<id>[\d]+)/?(?P<field>[\w\-\_]+)?
Invalid route.
Route discovered : /acf/v3/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2
Invalid route.
Route discovered : /wp/v2/posts
Valid route found. Will try to fetch.
Route discovered : /wp/v2/posts/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions
Invalid route.
Route discovered : /wp/v2/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/pages
Valid route found. Will try to fetch.
Route discovered : /wp/v2/pages/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions
Invalid route.
Route discovered : /wp/v2/pages/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/media
Valid route found. Will try to fetch.
Route discovered : /wp/v2/media/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/types
Valid route found. Will try to fetch.
Route discovered : /wp/v2/types/(?P<type>[\w-]+)
Invalid route.
Route discovered : /wp/v2/statuses
Valid route found. Will try to fetch.
Route discovered : /wp/v2/statuses/(?P<status>[\w-]+)
Invalid route.
Route discovered : /wp/v2/taxonomies
Valid route found. Will try to fetch.
Route discovered : /wp/v2/taxonomies/(?P<taxonomy>[\w-]+)
Invalid route.
Route discovered : /wp/v2/categories
Valid route found. Will try to fetch.
Route discovered : /wp/v2/categories/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/tags
Valid route found. Will try to fetch.
Route discovered : /wp/v2/tags/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/users
Valid route found. Will try to fetch.
Route discovered : /wp/v2/users/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/users/me
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments
Valid route found. Will try to fetch.
Route discovered : /wp/v2/comments/(?P<id>[\d]+)
Invalid route.
Route discovered : /wp/v2/settings
Valid route found. Will try to fetch.
Added ACF Options route.
Fetching the JSON data from 25 valid API Routes...
=== [ Fetching wordpress__yoast_v1 ] === https://dustinhorton.com/gatsby-wp/wp-json/yoast/v1
โ source and transform nodes -> wordpress__yoast_v1 fetched : 1
Fetching the wordpress__yoast_v1 took: 936.166ms
=== [ Fetching wordpress__yoast_configurator ] === https://dustinhorton.com/gatsby-wp/wp-json/yoast/v1/configurator
โข source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__yoast_configurator took: 846.014ms
=== [ Fetching wordpress__yoast_reindex_posts ] === https://dustinhorton.com/gatsby-wp/wp-json/yoast/v1/reindex_posts
โข source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__yoast_reindex_posts took: 1010.589ms
=== [ Fetching wordpress__yoast_ryte ] === https://dustinhorton.com/gatsby-wp/wp-json/yoast/v1/ryte
โ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__yoast_ryte took: 1022.977ms
=== [ Fetching wordpress__yoast_statistics ] === https://dustinhorton.com/gatsby-wp/wp-json/yoast/v1/statistics
โ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__yoast_statistics took: 820.827ms
=== [ Fetching wordpress__acf_posts ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/posts
โ source and transform nodes -> wordpress__acf_posts fetched : 100
Fetching the wordpress__acf_posts took: 6352.670ms
=== [ Fetching wordpress__acf_pages ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/pages
โก source and transform nodes -> wordpress__acf_pages fetched : 34
Fetching the wordpress__acf_pages took: 2760.048ms
=== [ Fetching wordpress__acf_media ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/media
โ source and transform nodes -> wordpress__acf_media fetched : 100
Fetching the wordpress__acf_media took: 4273.250ms
=== [ Fetching wordpress__acf_categories ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/categories
โ source and transform nodes -> wordpress__acf_categories fetched : 13
Fetching the wordpress__acf_categories took: 1029.029ms
=== [ Fetching wordpress__acf_tags ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/tags
โ source and transform nodes -> wordpress__acf_tags fetched : 0
Fetching the wordpress__acf_tags took: 941.066ms
=== [ Fetching wordpress__acf_comments ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/comments
โข source and transform nodes -> wordpress__acf_comments fetched : 9
Fetching the wordpress__acf_comments took: 2868.036ms
=== [ Fetching wordpress__acf_users ] === https://dustinhorton.com/gatsby-wp/wp-json/acf/v3/users
โ source and transform nodes -> wordpress__acf_users fetched : 11
Fetching the wordpress__acf_users took: 2049.181ms
=== [ Fetching wordpress__POST ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/posts
โ source and transform nodes
Total entities : 9094
Pages to be requested : 91
โ source and transform nodes -> wordpress__POST fetched : 9094
Fetching the wordpress__POST took: 152767.807ms
=== [ Fetching wordpress__PAGE ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/pages
โข source and transform nodes -> wordpress__PAGE fetched : 34
Fetching the wordpress__PAGE took: 2194.895ms
=== [ Fetching wordpress__wp_media ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media
โข source and transform nodes
Total entities : 7504
Pages to be requested : 76
โข source and transform nodes -> wordpress__wp_media fetched : 7485
Fetching the wordpress__wp_media took: 132029.996ms
=== [ Fetching wordpress__wp_types ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/types
โข source and transform nodes -> wordpress__wp_types fetched : 1
Fetching the wordpress__wp_types took: 956.603ms
=== [ Fetching wordpress__wp_statuses ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/statuses
โข source and transform nodes -> wordpress__wp_statuses fetched : 1
Fetching the wordpress__wp_statuses took: 1017.845ms
=== [ Fetching wordpress__wp_taxonomies ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/taxonomies
โ source and transform nodes -> wordpress__wp_taxonomies fetched : 1
Fetching the wordpress__wp_taxonomies took: 1029.885ms
=== [ Fetching wordpress__CATEGORY ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/categories
โข source and transform nodes -> wordpress__CATEGORY fetched : 14
Fetching the wordpress__CATEGORY took: 943.710ms
=== [ Fetching wordpress__TAG ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/tags
โ source and transform nodes -> wordpress__TAG fetched : 19
Fetching the wordpress__TAG took: 1104.454ms
=== [ Fetching wordpress__wp_users ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/users
โก source and transform nodes -> wordpress__wp_users fetched : 11
Fetching the wordpress__wp_users took: 1325.604ms
=== [ Fetching wordpress__wp_me ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/users/me
โ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "You are not currently logged in."
Fetching the wordpress__wp_me took: 926.146ms
=== [ Fetching wordpress__wp_comments ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/comments
โ source and transform nodes
Total entities : 9410
Pages to be requested : 95
โก source and transform nodes -> wordpress__wp_comments fetched : 9397
Fetching the wordpress__wp_comments took: 85370.673ms
=== [ Fetching wordpress__wp_settings ] === https://dustinhorton.com/gatsby-wp/wp-json/wp/v2/settings
โ source and transform nodesThe server response was "401 Unauthorized"
Inner exception message : "Sorry, you are not allowed to do that."
Fetching the wordpress__wp_settings took: 808.396ms
=== [ Fetching wordpress__acf_options ] === http://dustinhorton.com/gatsby-wp/wp-json/acf/v2/options
โ source and transform nodesThe server response was "404 Not Found"
Inner exception message : "No route was found matching the URL and request method"
Fetching the wordpress__acf_options took: 1059.276ms
=END PLUGIN=====================================: 412457.896ms
โ source and transform nodes
๊ทธ๋ฆฌ๊ณ ๊ทธ๊ฒ์ ์ฝ 8์๊ฐ ๋์ ๊ฑฐ๊ธฐ์ ์์ ์์์ต๋๋ค.
@dustinhorton ์ด๋ค ํธ์คํ ์ ์ฌ์ฉํ๊ณ ๊ณ์ ๊ฐ์? ๋๋ ๊ทธ๊ฒ์ด ์์ฒญ์ ์์ผ๋ก ๋น์ ์ ์์ฐ ์์๋ฅผ ์ฃฝ์ด๊ณ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. ๋๋ ๋์ ์ฐ๊ฒฐ์ 1 ๋๋ 2์ ๊ฐ์ด ๋ฎ์ ๊ฒ์ผ๋ก ์ค์ ํ๋ ๊ฒ์ ์๋ฃํ๋ค๊ณ ๋ฏฟ์ต๋๋ค(8์๊ฐ์ด ์๋ ๊ฝค ์ค๋ ์๊ฐ์ด ์ง๋ ํ์).
Linode์์ ๊ด์ฐฎ์ VPS์ ๋๋ค. ๋์์ด ๋๋ค๋ฉด ์ค์ ์ ์กฐ์ ํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฌธ์ ๋ ๋ก์ปฌ์์๋ ๋ฐ์ํฉ๋๋ค.
https://github.com/gatsbyjs/gatsby/blob/46290c2b0e7894fca036bdcc658a5d1936c4221f/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L133 -L159 ์ด ๋ ํด ๋ ๋๋๋ก ์ ๋๋ก ์๋ํ์ง ์์ต๋๋ค. ํ์ผ ์ - ๋คํธ์ํฌ ์์ฒญ์ด ํด๊ฒฐ๋์ง๋ง ํ์ผ ์ฐ๊ธฐ ์คํธ๋ฆผ์ด ์๋ฃ๋์ง ์๊ฑฐ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋๋ ํ ์๊ฐ ์ ํ์ ์ผ์ข
์ถ๊ฐ ์ข์ ๊ฒ์ด๋ผ๊ณ ์๊ฐ responseStream
๊ธฐ๋ค๋ฆด ๋ง๋ฌด๋ฆฌ fsWriteStream
๋ง๋ฌด๋ฆฌํ๊ณ , ๊ทธ๋ ์ง ์์ต๋๋ค ์๋ง๋ (๋ชจ๋ ์์์ ํ๊ดดํ๊ณ ๋ค์ ์ฐ๊ธฐ ํ์ผ์ ์๋ํ๋ ๊ฒฝ์ฐ ๋ช ๋ฒ๋ง ๋ค์ ์๋) ์ค์ ๋ก ๊ทธ๋ ๊ฒ ํ ์ ์์ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
@pieh ์ด ํ์ผ์ ๋ํ ์ ๋ฐ์ดํธ๋ ์ฝ๋๋ฅผ ๋ณด๋ด์ฃผ์๊ฒ ์ต๋๊น?
/packages/gatsby-source-filesystem/src/create-remote-file-node.js
@aman-developer ์์ง ์ด์ ๋ํ ์์ ์ฌํญ์ด ์์ต๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ๊ฒ์๋ฉ๋๋ค. ์ด ๋ฌธ์ ์ ๋ฌธ์ ๋ ์ด๋ฅผ ์ฌํํ ์ ์๋ ์ ๋ขฐํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์ผ๋ฏ๋ก ๋ชจ๋ ์์ ์ฌํญ์ ์ถ์ธก์
๋๋ค. ๋ฌธ์ (ํ๋์จ์ด ๋ฐ / ๋๋ OS์ ํน์ ์ ์์ต๋๋ค) ์ด๋ค ๊ฒฝ์ฐ์ ํ์ผ ์์คํ
writeStream ์๋ฃ๋์ง ์์ต๋๋ค ๋ฐ ์์ ์ด ์ ๋ง๋ก ์ฌ๊ธฐ์์ ํด๊ฒฐ ๋ฌธ์ ์ ๋
ธ๋ ฅํ๊ณ ์์ผ๋ฏ๋ก ์ค๋ฅ๋ฅผ ๋์ง๊ณ ์์ด ๋ถ์ด ์ ์ fs
ํจํค์ง / ํ๋์จ์ด / OS ์ ๋ขฐํ ์ ์์ :/
๋ด ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฐ ์ฌ์ดํธ์ ๋ฌธ์ ๊ฐ ์์์ต๋๊น? ๊ทธ๊ฒ์ ๋์๊ฒ ์ผ๊ด์ฑ์ด ์์ต๋๋ค.
createRemoteFileNode๋ฅผ ์ฌ์ฉํ์ฌ ์๊ฒฉ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ค๋๋ฐ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ค์ด๋ก๋๊ฐ ์ฝ 680/780ish์์ ๋ฉ์ถฅ๋๋ค.
createRemoteFileNode์๋ https://github.com/sindresorhus/got/releases/tag/v8.0.0 ์ ์ถ๊ฐ๋ downloadProgress
์ด๋ฒคํธ์ ๋ํ ๋ฆฌ์ค๋๊ฐ ์์ง๋ง gatsby-source-filesystem์ 7.1.0์ ์ฌ์ฉํฉ๋๋ค.
์ต์ ๋ฒ์ 9.2.2๋ก ์ ๊ทธ๋ ์ด๋๋ฅผ ์๋ํ๊ณ ์ด์ ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ์ฑ๊ณต์ ์ผ๋ก ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค.
package.json์ ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
"resolutions": {
"got": "^9.2.2"
}
๋ํ 7.1.0 ์ดํ์๋ ์คํธ๋ฆผ ์ค๋ฅ๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฌ๋์ง ์๋ ๋ฑ์ ์ค์ํ ์์ ์ฌํญ์ด ์๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. (https://github.com/sindresorhus/got/releases/tag/v8.0.1)
got
์
๋ฐ์ดํธ๋ฅผ ์๋ํ์ง๋ง ์ฌ์ ํ ๊ฐ๋ ์ค๋จ๋์ง๋ง ์ด์จ๋ ํ ๊ฐ์น๊ฐ ์์ต๋๋ค. downloadProgress
์ ๋นํ์ฑํํ๊ฑฐ๋ ๋ ๋์ ์ถ๋ ฅ์ด ํ์ํฉ๋๋ค. ํฐ๋ฏธ๋/์ฝ์์ ์ฌ์ฉํ ๋ ์งํ ์ํฉ์ด ์คํธ์ผ๋ก ์ ์ก๋๊ธฐ ๋๋ฌธ์
๋๋ค.
~25๋ถ ํ์ gatsby develop
๋ฅผ ์คํํ ์ ์์์ง๋ง create-remote-file-node.js์ ๋์์ฑ์ 200์์ 20์ผ๋ก ์ค์ฌ์ผ ํ์ต๋๋ค. 22๊ฐ์ TimeoutErrors๊ฐ ๋ฐ์ํ์ต๋๋ค(๊ทธ๋ฌ๋ gatsby ๊ฐ๋ฐ์ ์คํํ ๋ ๋ค์ ๋ค์ด๋ก๋๋์์ต๋๋ค. ๋ค์) processRemoteNode์ ๋น ์บ์น์ ๋ก๊ทธ๋ฅผ ๋ฃ์ ํ.
get ๋๋ฌธ์ธ์ง ํ์คํ์ง ์์ง๋ง ๋ค๋ฅธ http ํด๋ผ์ด์ธํธ๋ก ์คํ ํ ์ ์์ต๋๋ค ...
...
success source and transform nodes โ 1407.531 s
success building schema โ 3.315 s
success createPages โ 0.571 s
success createPagesStatefully โ 2.797 s
success onPreExtractQueries โ 0.012 s
success update schema โ 3.268 s
warning There are conflicting field types in your data. GraphQL schema will omit those fields.
wordpress__wp_media.media_details.width:
- type: number
value: 916
- type: string
value: '224'
wordpress__wp_media.media_details.height:
- type: number
value: 916
- type: string
value: '225'
wordpress__wp_media.media_details.sizes.thumbnail.width:
- type: number
value: 150
- type: string
value: '150'
wordpress__wp_media.media_details.sizes.thumbnail.height:
- type: number
value: 150
- type: string
value: '150'
wordpress__wp_media.media_details.sizes.medium.width:
- type: number
value: 300
- type: string
value: '300'
wordpress__wp_media.media_details.sizes.medium.height:
- type: number
value: 300
- type: string
value: '200'
wordpress__wp_media.media_details.sizes.large.width:
- type: number
value: 768
- type: string
value: '1024'
wordpress__wp_media.media_details.sizes.large.height:
- type: number
value: 1024
- type: string
value: '682'
wordpress__wp_media.media_details.image_meta.aperture:
- type: number
value: 2.2
- type: string
value: '0'
wordpress__wp_media.media_details.image_meta.created_timestamp:
- type: boolean
value: false
- type: number
value: 1433226914
- type: string
value: '0'
wordpress__wp_media.media_details.image_meta.focal_length:
- type: number
value: 0
- type: string
value: '0'
wordpress__wp_media.media_details.image_meta.iso:
- type: number
value: 0
- type: string
value: '0'
wordpress__wp_media.media_details.image_meta.shutter_speed:
- type: number
value: 0
- type: string
value: '0'
wordpress__wp_media.media_details.image_meta.orientation:
- type: number
value: 1
- type: string
value: '1'
warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
Import it instead like: import { graphql } from 'gatsby' in file:
/Users/tandingan.wlb/Projects/gatsby/gatsby-issue/src/templates/Post/Post.js
success extract queries from components โ 0.120 s
success run graphql queries โ 223.335 s โ 9121/9121 40.84 queries/second
success write out page data โ 0.119 s
success write out redirect data โ 0.001 s
success onPostBootstrap โ 0.027 s
info bootstrap finished - 1643.854 s
{ TimeoutError: Timeout awaiting 'request' for 30000ms
at Immediate.timeoutHandler [as _onImmediate] (/Users/tandingan.wlb/Projects/gatsby/gatsby-issue/node_modules/got/source/timed-out.js:39:25)
at runCallback (timers.js:694:11)
at tryOnImmediate (timers.js:664:5)
at processImmediate (timers.js:646:5)
name: 'TimeoutError',
code: 'ETIMEDOUT',
host: 'dustinhorton.com',
hostname: 'dustinhorton.com',
method: 'GET',
path: '/gatsby-wp/wp-content/uploads/2015/05/20150302_061259.jpg',
socketPath: undefined,
protocol: 'https:',
url:
'https://dustinhorton.com/gatsby-wp/wp-content/uploads/2015/05/20150302_061259.jpg',
event: 'request' }
ํ๋ฆฌ์ฆ๊ณผ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
"got": "^9.2.2"๋ก ์ ๊ทธ๋ ์ด๋ํ์ต๋๋ค. ์ด์ ์์ ์๊ฐ์ ๋๋ค!
got
๋ฒ์ ์ ์
๊ทธ๋ ์ด๋ํ๋ ค๋ฉด ํ์คํ ์ดํด๋ด์ผ ํฉ๋๋ค. ์ด๊ฒ์ ๊ฐํ์ ์ธ ๋ฌธ์ ์ด๋ฏ๋ก ์๋ํ๋ ์ฐ์ฐ์ ์ผ์น ์ผ ์ ์์ต๋๋ค. @RobinHerzog got
์ ์
๊ทธ๋ ์ด๋ ๋ฒ์ ์์ ์ ์ฌํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด ์๋ ค์ฃผ์ญ์์ค.
got
์
๋ฐ์ดํธํ๋ฉด repo repo์ ๋น๋ ์๊ฐ์ด ํฌ๊ฒ ๋จ์ถ๋์์ง๋ง ์ฌ์ ํ ๋ง์ง๋ง์ผ๋ก ์๋ํ ์๊ฐ์ ๊ฑฐ์ 1์๊ฐ์ด ๊ฑธ๋ ธ์ต๋๋ค.
@dustinhorton ๋น๋์ ์ด๋ค ๋ถ๋ถ์ด ์ด๋ฏธ์ง๋ฅผ source and transform data
)?
1GB ์ธํฐ๋ท ์ฐ๊ฒฐ์ 150MB ์ด๋ฏธ์ง๊ฐ ์์ต๋๋ค. ์ด์ ์๋ ์ค์ ๋๋ค. ๋ค์ด๋ก๋ํ๊ณ ๋น๋๋ฅผ ๊ณ์ํ๋ ค๋ฉด 30์ด๊ฐ ํ์ํฉ๋๋ค.
๋๋ ๋ํ์ด ๋ฌธ์ ๋ฅผ ์ง์์ ์ผ๋ก ๊ฒช๊ณ ์์ต๋๋ค. got
์
๊ทธ๋ ์ด๋ํด๋ ์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค. ๋ฌธ์ ๊ฐ ๋ฌด์์ธ์ง ๋๋ฒ๊น
ํ ์ ์๋๋ก source-wordpress์ ์ถ๊ฐ ์ถ์ ์ ์ถ๊ฐํ๋ ๋ฐ ์ฑ๊ณตํ์ต๋๊น?
concurrentRequests
๋ฐ perPage
๋ณ๊ฒฝ์ ์๋ํ๊ณ concurrentRequests
got
๋ฅผ ์ต์ ๋ฒ์ ์ผ๋ก ์
๊ทธ๋ ์ด๋ํ์ง๋ง ์๋ฌด ๊ฒ๋ ์๋ํ์ง ์์์ต๋๋ค. ์ง๊ธ์ categories
, posts
, pages
๋ฐ tags
๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ง๋ง users
๋๋ media
, =END PLUGIN===
๋ฐ๋ก ๋ค์ ํ๋ฌ๊ทธ์ธ์ด TypeError: Cannot read property 'id' of undefined
์ค๋ฅ์ ํจ๊ป ๋ฐํ๋ฉ๋๋ค.
๋ชจ๋ ๊ฒฝ๋ก๋ฅผ ํฌํจํ๊ณ ๋ด๊ฐ ์ก์ธ์คํ ์ ์๋ ๊ฒฝ๋ก๋ฅผ ๋ธ๋๋ฆฌ์คํธ์ ์ถ๊ฐํ๋ฉด =END PLUGIN===
๋ฐ์ง๋ง ์๋ฃ๋์ง ์์ต๋๋ค... ์ด๊ฒ์ ๋ด๊ฐ ํ
์คํธํ ์๋ง์ ์น ์ฌ์ดํธ์ ์ ์ฉ๋๋ฏ๋ก ์ด๋ป๊ฒ๋ ๋ด ์์คํ
์ผ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. . ๋๊ตฌ๋ ์ง ์ด๊ฒ์ ํ
์คํธํ๋ ค๋ ๊ฒฝ์ฐ ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
{
resolve: 'gatsby-source-wordpress',
options: {
// Other URLs I tried:
// https://clubedovalor.com.br
// http://rivainvestimentos.com.br
// http://queroinvestiragora.com/
// https://www.clubedospoupadores.com/
baseUrl: "aprenda.guiainvest.com.br",
protocol: "https",
hostingWPCOM: false,
useACF: false,
concurrentRequests: 10,
perPage: 50,
// Going with the excluded routes path
// excludedRoutes: [
// '/*/*/plugins',
// '/rock-convert/**',
// '/yoast/**',
// '/wp-super-cache/**',
// '/*/*/users/me',
// '/*/*/settings',
// ],
verboseOutput: true,
includedRoutes: [
"/*/*/categories",
"/*/*/posts",
"/*/*/pages",
"/*/*/tags",
// You can toggle between media and users (or both)
// All 3 scenarios will fail with the `'id' of undefined`
// problem
// "/*/*/media",
"/*/*/users",
],
},
์ถ์ : ๋ด๊ฐ ๊ฐ์ ธ์ค๊ธฐ _did_ ๊ด๋ฆฌํ URL ์ค ํ๋๋ https://wesbos.com/
HAPPY ์
๋ฐ์ดํธ : ๋๋ ๊ทธ๊ฒ์ด๋ก (์์ sites_ _For) ์๋ํ๋๋ก ๊ด๋ฆฌ includedRoutes
๋ ํจ๊ป users
๋ฐ / ๋๋ media
์ ํฌํจํ์ฌ taxonomies
์ฟผ๋ฆฌ . ์ด์ 'id' of undefined
์ค๋ฅ๊ฐ ๋ฐ์ํ์ง ์์ต๋๋ค :D
@pieh users
๋ฐ media
์ ํ์ taxonomies
์ข
์๋๋ฏ๋ก ๊ตฌ์ฑ์ ์ด๋ฌํ ์ ํ ์ค ํ๋๊ฐ ํฌํจ๋ ๋๋ง๋ค ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๊ณต๋์ด์ผ ํฉ๋๋ค. ์ถ๊ฐ ๋ฌธ์ ํด๊ฒฐ์ ๋์์ด ๋ ์ ์๋์ง ์๋ ค์ฃผ์ธ์! ๋ง์ง๋ง์ผ๋ก ์ด taxonomies
๋ฒ๊ทธ๋ ๋ฌดํ ๋น๋ ํ๋ก์ธ์ค์ ๊ด๋ จ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. 500๊ฐ ์ด์์ ๋ฏธ๋์ด ํ์ผ๋ณด๋ค ํฐ ์ฌ์ดํธ์์๋ ์ฌ์ ํ ๋น๋ ํ๋ก์ธ์ค๋ฅผ ์๋ฃํ ์ ์์ต๋๋ค!
์
๋ฐ์ดํธ ๋ฒํธ 2 : ๊ทธ๋์ queroinvestiragora.com
๋ํด ์๋ํ๋๋ก ๋ง๋ค์์ต๋๋ค. =END PLUGIN===
์ดํ์๋ ๋๋ต 15์ด๊ฐ ๊ฑธ๋ฆฌ์ง๋ง ์๋ํฉ๋๋ค. ๊ทธ๋ฌ๋ www.clubedospoupadores.com
์๋ 702๊ฐ์ ๋ฏธ๋์ด ํ์ผ๊ณผ 336๊ฐ์ ๊ฒ์๋ฌผ์ด ์์ผ๋ฉฐ ์ปดํ์ผ๋์ง ์์ต๋๋ค.
์ถ์ : ์ด ์คํ์์ ๋ด ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
{
resolve: 'gatsby-source-wordpress',
options: {
baseUrl: "queroinvestiragora.com",
protocol: "http",
hostingWPCOM: false,
useACF: false,
concurrentRequests: 10, // I've also tried removing it and going with the default, it's the same result
verboseOutput: true,
includedRoutes: [
"/*/*/categories",
"/*/*/posts",
"/*/*/pages",
"/*/*/tags",
"/*/*/media",
"/*/*/users",
"/*/*/taxonomies",
],
},
},
์๋ ํ์ธ์,
https://www.gatsbyjs.org/docs/performance-tracing/์ ์ค๋ช ๋ ๋จ๊ณ๋ฅผ ์ฌ์ฉํ์ฌ ์ถ์ ์ ์ถ๊ฐํ ์ ์์์ต๋๋ค. ๋ถํํ๋ ๋จ์ํ ์์ค ๋ฐ ๋ณํ ๋ ธ๋๊ฐ ๊ฝค ์ค๋ ๊ฑธ๋ฆฐ๋ค๊ณ ๋งํ๊ธฐ ๋๋ฌธ์ ๋ง์ ์ ๋ณด๋ฅผ ์ ๊ณตํ์ง ์์์ต๋๋ค.
๊ทธ๋ฌ๋ ์ด๋ฏธ์ง์ ๊ด๋ จ๋ ์ผ๋ถ ๋น๊ฒฐ์ ์ ๋์์ ํ ํ ๋ฌธ์ ์ ๋ํ ์์ฒด ๋๋ฒ๊น ์ ์ํํ์ต๋๋ค. ๊ฐ๋ฐ ๋๋ ๋น๋ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ ๋ ๋ชจ๋ ์ด๋ฏธ์ง๊ฐ ๋ค์ด๋ก๋๋์ง ์๊ณ localFile ๋ ธ๋๊ฐ ์๋ฃ๋์ง ์๋ ๊ฒฝ์ฐ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ฝ๋๋ฅผ ํํค์น ํ ์ฌ๊ธฐ์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ์ผ๋ก ํ์ธ๋์์ต๋๋ค.
๋๋ฅผ ์ํด createRemoteFile ๋ ธ๋๋ ์๋ฒ ์๊ฐ ์ด๊ณผ ์ค๋ฅ๋ก ์ธํด ์คํจํ์ผ๋ฉฐ ๊ธฐ๋ณธ๊ฐ์ null์ ๋ฐํํฉ๋๋ค. ์ด๋ฅผ ํ์ธํ๊ณ ์ค์ ์๋ฒ ์๋ต์ ์ป๊ธฐ ์ํด createRemoteFile ๋ ธ๋์๋ ์ผ๋ถ ๋ก๊น ์ ์ถ๊ฐํด์ผ ํ์ต๋๋ค. ์ด๋ฌํ ๋ ธ๋๋ ์๋ฃ๋์ง ์๊ณ ID๊ฐ ์๊ธฐ ๋๋ฌธ์ ์บ์์ ๋ฑ๋ก๋์ง ์์ต๋๋ค. tmp ํ์ผ์ด ์ญ์ ๋๊ณ gatsby-source-filesystem์ด ๋ถ์์ ํฉ๋๋ค. ์ด๋ค ์ด์ ์์๋ (๋๋ ์์ง ๋ฉ๋ฆฌ ๋ณด์ง ์์์) ๋น๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ค์ ์คํํ ๋ ์์ค ํ์ผ ์์คํ ์ด ์ญ์ ๋์์ต๋๋ค. ์๋ง๋ ์คํฌ๋ฆฝํธ๊ฐ ํ์ผ ์์คํ ์ด ์ ํจํ์ง ์๊ฑฐ๋ ๋ถ์์ ํ๋ค๋ ๊ฒ์ ๊ฐ์งํ๊ธฐ ๋๋ฌธ์ผ ๊ฒ์ ๋๋ค. ๋ฃจํ๋ฅผ ๋ง๋ค๊ณ ํ์ผ ์์คํ ์ด ์ ๋ ์๋ฃ๋์ง ์๊ธฐ ๋๋ฌธ์ ํฅํ ๋น๋์์ ์ค๋ฅ๋ฅผ ์ผ์ผํค๋ ๊ฒ์ ์ด ํ๋ก์ธ์ค์์ต๋๋ค.
์ ๋ ์ ์ด๋ ๋ง์ ์์ ์ด๋ฏธ์ง์ ๊ด๋ จ๋ ๋ฌธ์ ๋ฅผ ์ํํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ ์์ ์์ ์ ํ๊ณ ์์ต๋๋ค. ๊ฐ๋ฐ ๋๋ ๋น๋ ์คํฌ๋ฆฝํธ๊ฐ ์ฒ์์ผ๋ก ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ์ฑ๊ณต์ ์ผ๋ก ๋ค์ด๋ก๋ํ๋ฉด ์ดํ์ ์ญ์ ๋์ง ์๊ณ ์ด๋ฏธ์ง๊ฐ gatsby-source-filesystem์ ์ํด ์ ์ ํ๊ฒ ์บ์๋๊ธฐ ๋๋ฌธ์ ๋น๋ ํ๋ก์ธ์ค๊ฐ ๋งค์ฐ ๋น ๋ฅด๊ฒ ์งํ๋ฉ๋๋ค! ๋ด ๋น๋๋ 15๋ถ์์ 1๋ถ์ผ๋ก ์ค์์ต๋๋ค.
์ด๊ฒ์ด ๊ฒ์๋ฌผ์ด ๋ง์ ๋น๋์ ๊ด๋ จ์ด ์๋์ง ํ์คํ์ง ์์ต๋๋ค. ๋ด ๋ฌธ์ ๋ 1.6GB์ ์ด๋ฏธ์ง ๋ฐ์ดํฐ ๋ค์ด๋ก๋์ ์ง์ ์ ์ธ ๊ด๋ จ์ด ์์ต๋๋ค.
gatsby์ฉ ์์ค ํ๋ฌ๊ทธ์ธ์ผ๋ก ์์ ํ๋ ๊ฒ์ ์ด๋ฒ์ด ์ฒ์์ด๋ฏ๋ก ๋๊ตฌ๋ ์ง ์ด์ ๋ํด ์๊ฐ์ด๋ ์กฐ์ธ์ด ์์ผ๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค! ์ค๋ ๋์ค์ ๋ด ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๊ฒ์ํ ์ ์์ด์ผ ํฉ๋๋ค. ๋ด ๋ก์ปฌ ๋ฒ์ ์ gatsby-source-filesystem์ ๋ฌธ์ ์์ด ์ฌ์ฉํ ์ ์๋๋ก ํ๊ธฐ ์ํด ๋ ธ๋ ฅํ๊ณ ์์ต๋๋ค.
์๋ ํ์ธ์,
๋ฉฐ์น ์ ์ ๋๊ธ์ ๋ํ ํ์ ์กฐ์น์ ๋๋ค. ์ฌ๊ธฐ ๋ด ์ ์ฅ์๊ฐ ์์ต๋๋ค.
https://github.com/njmyers/byalejandradesign.com.git
์ ๋ ์ด ํ๋ก์ ํธ์์ monorepo๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฏ๋ก ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋ก์ปฌ์์ ์คํํ๋ ค๋ ๊ฒฝ์ฐ ๋ช ๊ฐ์ง ๋จ๊ณ๊ฐ ์์ต๋๋ค.
git clone https://github.com/njmyers/byalejandradesign.com.git -b wordpress-plugin
yarn && yarn bootstrap
cd packages/web
ํด๋ yarn develop
๋๋ yarn build-web
ํฉ๋๋ค. ์ฒ์์๋ ์ฑ๊ณต์ ์ผ๋ก ์๋ฃ๋์ด์ผ ํ๋ฉฐ ์ดํ์ ๋์ผํ ๋ช
๋ น์ ์คํํ๋ฉด ๋น๋๊ฐ ํจ์ฌ ๋นจ๋ผ์ง๋๋ค! ์์ค ๋ฐ ๋ณํ ๋
ธ๋๋ ์ด์ ๋ณด๋ค 3๋ฐฐ๋ ๊ฑธ๋ฆฌ๊ฑฐ๋ ์๋ฃ๋์ง ์์๊ธฐ ๋๋ฌธ์ 222๊ฐ ๊ฑธ๋ฆฝ๋๋ค./packages/web/.cache/gatsby-source-filesystem
์์ ํ์ผ ๋ธ๋ผ์ฐ์ ๋ฅผ ๋ณด๋ฉด ํ์ผ์ด ์์ฑ๋๊ณ ์์์ ์ ์ ์์ต๋๋ค.๋๋ downloadMediaFiles ๊ธฐ๋ฅ์ ์์ ํ ๋ค์ ์์ฑํ์ต๋๋ค. ์ด ๋งํฌ์์ ํด๋น ํ์ผ์ ๋ณผ ์ ์์ต๋๋ค. https://github.com/njmyers/byalejandradesign.com/blob/wordpress-plugin/packages/gatsby-source-wordpress/src/download-media-files.js
์๋ง๋ ํ์ํ ๊ฒ๋ณด๋ค ๋ ์ฅํฉํ์ง๋ง ์ผ์ด๋๊ณ ์๋ ๋ชจ๋ ๊ฒ์ ํ์ ํ๊ธฐ ์ํด ์ด ์์ ์ ์ํํด์ผ ํ์ต๋๋ค. ๋ด๊ฐ ๋ณ๊ฒฝํ ๊ธฐ๋ฅ์ createRemoteFileNode๊ฐ null์ ๋ฐํํ ๋ ์ฝ์ ๊ฑฐ๋ถ๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋๋ ํจ์ downloadRunner๋ฅผ ์ฌ์ฉํ์ฌ ์์ฒญ์ ์ ํํ์ฌ ๋ชจ๋ ์์ฒญ์ด ํ ๋ฒ์ ์๋ฒ์ ๋๋ฌํ์ง ์๊ณ ์ฝ์ ๊ฑฐ๋ถ ์ ์ฌ์๋ํ์ง ์๋๋ก ํฉ๋๋ค. ๊ฐ createRemoteFileNode ์์ฒญ ์ฌ์ด์ 200ms ์ค๋กํ์ ์ถ๊ฐํ์ต๋๋ค. ์ด ๊ฐ์ ์กฐ์ ํ ์ ์์ผ๋ฉฐ ์ด ์ค ์ผ๋ถ๋ createRemoteFileNode์ ์ง์ ์ถ๊ฐํ๋ ๋ฐ ๋ ์ ํฉํ ์ ์์ต๋๋ค.
๋๊ตฌ๋ ์ง WP ์ค์น๋ EC2 ๋ง์ดํฌ๋ก ์ธ์คํด์ค์ด๊ณ ์ด๋ฏธ์ง๋ CloudFront ๋ฐฐํฌ ๋ค์ ์์ต๋๋ค. ๊ฐ์ธ์ ์ผ๋ก ๋๋ ๊ฒ์๋ฌผ์ ์ป๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค. ๋ด ๋ฌธ์ ๋ ์ด๋ฏธ์ง๋ฅผ ์ป๋ ๊ฒ์ด์์ผ๋ฉฐ ์ฌ๋๋ค์ด ๊ฒช๊ณ ์๋ ๋๋ถ๋ถ์ ๋ฌธ์ ๋ ์ด๊ฒ ๋๋ฌธ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
๋ํ ๋๊ตฐ๊ฐ ์์ ์ ์ฌ์ดํธ๋ฅผ ์ถ์ ํ๊ฑฐ๋ ๋๋ฒ๊ทธํ๋ ค๋ ๊ฒฝ์ฐ ์ฌ๊ธฐ์์ ์์ํ๋ ๊ฒ์ด ์ข์ต๋๋ค...
catch ์ ์ ๋ก๊น ์ ์ถ๊ฐํ๊ณ ์๊ฐ ์ด๊ณผ ์ค๋ฅ๊ฐ ๋ฐ์ํ ๋ค์ null์ ๋ฐํํ๋ฏ๋ก ์ด๋ฏธ์ง ๋ ธ๋๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์ฒ๋ฆฌ๋์ง ์๊ณ ์์์ ํ์ธํ ์ ์์์ต๋๋ค.
@njmyers ๋๋ createRemoteFileNode
์์ ์ ์ฌํ ์ ๊ทผ ๋ฐฉ์์ ์ง์ ์ฌ์ฉํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ฐ๋ฆฌ๋ ๊ฑฐ๊ธฐ์์ queue
ํ๊ณ ์์ผ๋ฏ๋ก ์ด ํจ์์ ์๋น์(์ด ๊ฒฝ์ฐ gatsby-source-wordpress
)๋ ์ด์ ๋ํด ๊ฑฑ์ ํ ํ์๊ฐ ์์ต๋๋ค. ์ ์ฌ์ ์ผ๋ก ๋ฌธ์ ๊ฐ ๋ ์ ์๋ ํ ๊ฐ์ง๋ 200ms ์ค๋กํ์
๋๋ค. ์ด ์ค๋กํ ์์ด ์์ํ ์ ์์ผ๋ฉฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ธฐ ์์ํ๋ฉด ์๋์ผ๋ก ์ค๋กํ(ํธ์คํธ ์ด๋ฆ๋น)์ด ์ ์ฉ๋ฉ๋๋ค.
@pieh ์, ์๋ง๋ ์ด ๋
ผ๋ฆฌ๋ฅผ ์ ์ฉํ ์ฅ์์ผ ๊ฒ์
๋๋ค. ์ ์๊ฒ ์กฐ์ ์ ์ด ๋ฌธ์ ์ ์ ๊ทผํ๊ณ ๋ฌธ์ ๋ฅผ ์ง๋จํ๋ ๋ฐฉ๋ฒ์ด์๊ธฐ ๋๋ฌธ์ createRemoteFileNode
์์ฒด์ ์ผ๋ก ์ด ๋ฌธ์ ๋ฅผ ์ฒ๋ฆฌํ ์ ์์ด์ผ ํ๋ค๋ ๋ฐ ๋์ํฉ๋๋ค.
๊ทธ๋ฌ๋ ํนํ ๋ฌธ์ ๋ ์ค๋ฅ์ ์๋์ผ๋ก ์คํจํ๊ณ null์ ๋ฐํํ๋ ํ์ฌ ๋์์
๋๋ค. ์ ์๊ฐ์๋ ์์
์ ์คํจ ๋๋ ์ฑ๊ณต์ ๋ํด ์ฝ๊ฐ์ ์์ฌ ์ํต์ด ์์ด์ผ ํฉ๋๋ค. createRemoteFileNode
๋ ๋ค์ ๊ธฐ๋ฅ์ผ๋ก ๋์ฑ ๊ฐ๋ ฅํด์ง ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
1) ์ธ๋งฅ์ ๋นจ๋ฆฌ ํ์ฑํ๋ผ
2) ์๋ฒ์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด ์กฐ์ ์ ์์ํ๊ฑฐ๋ ํ์ํ ๊ฒฝ์ฐ ์ฌ์๋ํฉ๋๋ค.
3) ์กฐ์ /์ฌ์๋์ ๋ํ ์ ์์ ์ธ ๊ธฐ๋ณธ๊ฐ ์ค์
4) ์กฐ์ /์ฌ์๋ ์กฐ์ ์ ์ํ ์ง์
์ ์์ฑ
4) ์ด๋ค ์ด์ ๋ก ๋
ธ๋๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ ๊ฒฝ์ฐ ์ฝ์์ ๊ฑฐ๋ถํฉ๋๋ค.
๋๋ ๋ํ https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L135 ์์ ์๊ฐ ์ด๊ณผ ๊ฐ์ ๊ฐ์ง๊ณ ๋์๋ค๊ณ ๋งํ ์ ์์ต๋๋ค. L141. ๊ทธ๊ฒ์ด ์ฑ๊ณต์ ์ธ ์๋ต์ ํ๋ฅ ์ ๋์์ง๋ง ์ฑ๊ณต์ ์ธ ์๋ต์ ๋ณด์ฅ ํ๊ธฐ ์ํด ์ฒ๋ฆฌ๋ฅผ ์ถ๊ฐ
์ด ๋ ผ๋ฆฌ์ ๋ํ ์ฌ๋ฐ๋ฅธ ์ง์ ์ ์ด ์ฌ๊ธฐ์ ์์ ๊ฐ๋ฅ์ฑ์ด ํฝ๋๋ค.
ํ์คํฌ๊ฐ ์คํจํ๋ฉด ์ฌ์๋ ๋ฐ/๋๋ ์คํจํ ํ ์ต์ข ์ ์ผ๋ก ๊ฑฐ๋ถ๋ฉ๋๋ค.
๋ํ queue
๋ฌธ์๋ฅผ ๊ฐ๋จํ ์ฝ์ผ์ญ์์ค. queue
์์ฒด์ ์ผ๋ก ์ด๊ฒ์ ๊ด๋ฆฌํ ์ ์๋ค๋ ๊ฒ์ ๋ํด ๋ง์ํ์๋ ๊ฒ์ ์ ์ ์์ต๋๋ค.
@njmyers ๋ฉ์ง ์กฐ์ฌ ์์ ! ํ์ผ ๋ค์ด๋ก๋๊ฐ ํจ์ฌ ๋ ์ค๋งํธํด์ผ ํ๋ค๋ ๋ฐ ๋์ํฉ๋๋ค!
์๊ฒฉ ํ์ผ์ ๋ค์ด๋ก๋ํ๊ณ ์บ์ฑํ๋ ์ด ๋ฌธ์ ์ ์ด์ ์ ๋ง์ถ ์์ฒด ํจํค์ง๋ก ํ์ผ ๋ค์ด๋ก๋ ์กฐ๊ฐ์ ์ถ์ถํ๋ ๊ฒ์ด ์ค์ ๋ก ์ข์ ์ ์์ต๋๋ค.
Gatsby์ ๋ฏธ๋์ ์ฌ๋ฌ ์์น์์ ๊ธฐ๋ฅ์ ์ฌ์ฉํด์ผ ํ ๊ฐ๋ฅ์ฑ์ด ๋์ผ๋ฉฐ ์ธํฐ๋ท์ ๋ค๋ฅธ ์ฌ๋๋ค๋ ์ฌ์ฉํ๊ธฐ๋ฅผ ์ํ ๊ฒ์ ๋๋ค.
@KyleAMathews createRemoteFileNode
๋ฅผ ๋ณ๋์ ํจํค์ง๋ก ์ถ์ถํ๋ ๊ฒ์ ์๋ฏธํฉ๋๊น?
ํ์ผ ๋ค์ด๋ก๋ ๋ฐ ์บ์ฑ ๋ถ๋ถ๋ง์ด ์๋๋๋ค. ๊ทธ๋ฐ ๋ค์ createRemoteFileNode๋ ์ด ํจํค์ง๋ฅผ ํธ์ถํ๊ณ ํ์ผ์ด ๋ค์ด๋ก๋๋ ๋(๋๋ ์บ์์์ ๋ฐํ๋ ๋) ํด๊ฒฐ๋ ์ฝ์์ ๋ค์ ๊ฐ์ ธ์ต๋๋ค.
๋ด ์์ ์ ์กฐ์ข ์ ์์ค ํ๋ฌ๊ทธ์ธ์๋ ์ด ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์ฝ๋์ ์ด๋ฌํ ๋ถ๋ถ์ ๋ณ๋์ ํจํค์ง๋ก ์ถ์ถํ๋ ๊ฒ๊ณผ ๋ ๋น์ทํ ๊ฒ ๊ฐ์ต๋๋ค...
์ด๊ฒ์ ํนํ ๋ค์ด๋ก๋ ๋ฐ ์บ์ฑ์ ๋ค๋ฃจ๋ ์ฝ๋์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๋ง์ฝ ์ ๊ฐ ํ๋ ธ๋ค๋ฉด ์ ๋ฅผ ์์ ํด ์ฃผ์ญ์์ค. ์ด ์์ ์ ํ๊ฒ ๋์ด ๊ธฐ์ฉ๋๋ค! ๋ ํฐ ์ํ๊ณ์์ ์ด๋ป๊ฒ ์๋ํ๋์ง ์์ ๋ด๋ ค๊ณ ๋ ธ๋ ฅํ์ญ์์ค.
gatsby-source-wordpress๋ง ์์ ํ๋ PR์ด ํ์ฉ๋๊ณ ๋์ค์ ์์ ์ฌํญ์ ์ถ์ถํฉ๋๊น? @njmyers fork ํ๋ฌ๊ทธ์ธ์ ์๋ ๊ทธ๋๋ก ์ฌ์ฉํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์ผ๋ฉฐ ์์ฒญ๋ ๊ฐ์ ์ด ๋ ๊ฒ ๊ฐ์ต๋๋ค.
@dustinhorton ์ ์ด๊ฒ์ด ๋์์ด ๋๋์ง ํ์คํ์ง ์์ง๋ง ๋ก์ปฌ ํ๋ฌ๊ทธ์ธ์ ์ฌ์ฉํ๋ ค๋ฉด gatsby๊ฐ package.json ํ์ผ์ ์ง์ ๊ฐ๋ฆฌํค๋๋ก ํ๋ ๊ฒ์ด ๊ฐ์ฅ ์ข์ต๋๋ค. ๋ช ์์ ์ผ๋ก ์ง์ ํ๊ธฐ ์์ํ ๋๊น์ง gatsby์์ ๋ก์ปฌ ํ๋ฌ๊ทธ์ธ์ ์ฐพ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค.
๋๋ ์ฌ์ ํ ์ด ๋ฌธ์ ์ ๋ ผ์๋ ์ ํ๋ฌ๊ทธ์ธ์ ๋ํด ์์ ํ๊ฒ ๋์ด ๊ธฐ์ฉ๋๋ค. ๋ด๊ฐ ์์ง ๋ชปํ๋ ๋ค๋ฅธ ๋ง์ ๊ฒ๋ค์ ์ํฅ์ ๋ฏธ์น ์ ์๋ ํ๊ดด์ ์ธ ๋ณํ์ฒ๋ผ ๋ณด์ด๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ํตํฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์ฝ๊ฐ์ ์ง์นจ์ ์ฐพ๊ณ ์์ต๋๋ค. @KyleAMathew ์๊ฐ์ด ์์ผ์ ๊ฐ์? ๋๋ ์ฌ์ ํ ์ฝ๋๊ฐ ์ฌ๊ธฐ ์๋ ๊ฒ์ฒ๋ผ ๋๋๋ค.
์์ฒด ํจํค์ง๋ก ์ถ์ถํด์ผ ํ๋ ๋ถ๋ถ์
๋๋ค. ์ฆ, createRemoteFileNode
์ ํต์ฌ ๊ธฐ๋ฅ ์ค ํ๋์ด๋ฉฐ ์ํ๊ณ์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ค์ ํตํฉ๋ ์ ์๋๋ก ์ฌ๋ฐ๋ฅด๊ฒ ์งํํ๊ณ ์ถ์ต๋๋ค.
@njmyers ๋น์ ์ ๋น์ ์ ์ฝ๋ ์ ํ์ด ๋๋ถ๋ถ ์ ํํฉ๋๋ค - ์ฐ๋ฆฌ๋ ๋ํ ์ฐ๋ฆฌ์ ํ์ฌ ๋๊ธฐ์ด(200๊ฐ์ ๋์ ์์ฒญ์ผ๋ก ATM ์ ํ, ๋ก์ปฌ ๊ฐ๋ฐ ๋ฐ ์๋ํ๋ ์ค์ ์ ํฉํ์ง ์์ ๊ฒ์ผ๋ก ๋ณด์)์ด ์ด๋๋๊ณ ์๋ง๋ ๋ณ๊ฒฝ๋๊ธฐ๋ฅผ ์ํ ๊ฒ์ ๋๋ค.
@dustinhorton ์ ๋ ์ด๊ฒ์ wordpress ํ๋ฌ๊ทธ์ธ์์ ๋จผ์ ์ฌ์ฉํ๋ ๊ฒ์ด ํฉ๋ฆฌ์ ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค(๋๋ถ๋ถ ์ค์ ๋ก ์๋ฃ๋์๊ธฐ ๋๋ฌธ์).
@pieh ์ค๋ช ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ์๋ก์ด ํ๋ฌ๊ทธ์ธ ์์ ์ ์์ํ๊ฒ ์ต๋๋ค.
์์ wordpress-source ์์ ๊ณผ ๊ด๋ จํ์ฌ ๋ด ์ ์ผํ ๋ค๋ฅธ ์ง๋ฌธ์ ์ฌ๊ธฐ์ ์ํํ ์์ ์ ๋๋ค.
ํ์ฌ๋ก์๋ ์ฌ์ ํ ๋คํธ์ํฌ ์ค๋ฅ๊ฐ ์์ ์ ์์ผ๋ฉฐ ์ ์ฒด downloadMediaFiles ๊ธฐ๋ฅ์ ๋ํ catch ์ ์ด ํ์ํฉ๋๋ค. gatsby์ ์ค๋ฅ๋ฅผ ์ ๋ฌํ๋ ์ผ๋ฐ์ ์ธ ๋์์ ๋ฌด์์ ๋๊น? ๋คํธ์ํฌ ์ค๋ฅ๋ฅผ ์ฌ๋ฐ๋ฅธ ํธ๋ค๋ฌ์ ์ ์ ํ๊ฒ ์ ๋ฌํ๊ธฐ ์ํด ํด๋น ์ฝ๋๋ฅผ wordpress ํ๋ฌ๊ทธ์ธ์ ์ถ๊ฐํ๊ฒ ๋์ด ๊ธฐ์ฉ๋๋ค. ์ค๋ฅ ๋ฉ์์ง์ ์ด ๋ฌธ์ ์ ๋ํ ์ฐธ์กฐ๋ฅผ ํ์ํ ์ ์์ต๋๊น? ๋์์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค!
@njmyers ๊ฐ์ฌํฉ๋๋ค. ์, ๋ชจ๋
ธ๋ ํฌ( package.json
์ฐธ์กฐ ํฌํจ)๋ฅผ ์ ์ธํ๊ณ ์ต๋ํ ๊ฐ๊น๊ฒ ์ค์ ์ ๋ณต์ ํ์ต๋๋ค. develop
์คํํ๋ฉด ๋ง์น gatsby-source-wordpress
๊ฐ ์๋ ๊ฒ์ฒ๋ผ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์ฌ๊ธฐ์์ ์ ์ ํ์ ๋ค์ ํ๋๋ก ํ๊ฒ ์ต๋๋ค.
๋ชจ๋
ธ๋ ํฌ๋ฅผ ๋ ์ถฉ์คํ๊ฒ ์ฌํํ๊ณ ์ด์ํ๊ฒ๋ source and transform nodes
์์ ์์ต๋๋ค.
@pieh @ https://github.com/gatsbyjs/gatsby/issues/6654#issuecomment -442536931 ?
@dustinhorton ๋ค, ์ด๋ฏธ์ง๊ฐ ๋ง์ผ๋ฉด ๊ฝค ์ค๋ ์์ ์์ด์ผ ํฉ๋๋ค. ์๊ฒฉ ํ์ผ ๋ค์ด๋ก๋์ ์คํจํ๋ฉด ๋ด ํฌํฌ์์ unhandled promise rejection
๊ฐ ๋ฐ์ํฉ๋๋ค. ๊ทธ๋ ๊ธฐ ๋๋ฌธ์ ์ด ์๋๋ฆฌ์ค๋ฅผ ์ ์ ํ๊ฒ ์ฒ๋ฆฌํ ์ ์๋ ๋ฉ์ปค๋์ฆ์ ๊ฐ๊ณ ์ถ์ต๋๋ค.
ํ๋ฌ๊ทธ์ธ ์ํ์ ๋ํ ํผ๋๋ฐฑ์ ์ ๊ณตํ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ ์ผ์ข ์ ์งํ ๊ด๋ฆฌ์ ํตํฉ์ ๋ํ ์ด์ผ๊ธฐ๋ ๋ค๋ฅธ ์ค๋ ๋์์ ์ฝ์ ๊ฒ ๊ฐ์ต๋๋ค.
project-root/.cache/gatsby-source-filesystem ์๋์ OS ํ์ผ ์์คํ ์ ๋ณด๋ฉด ๋ค์ด๋ก๋ ์ค์ธ ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ๋ณผ ์ ์์ด์ผ ํฉ๋๋ค. ์ ๊ฒฝ์ฐ์๋ ์ด์ ๊ฑฐ์ 400๊ฐ์ ์ด๋ฏธ์ง๊ฐ ์์ผ๋ฏ๋ก ์๊ฐ์ด ๊ฝค ๊ฑธ๋ฆฝ๋๋ค. ๊ทธ๋ฌ๋ ๋ถ๊ธฐ๋ ๋ฒ์ ์ ์ฌ์ฉํ๊ธฐ ์ ์ ํ๋ฌ๊ทธ์ธ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด ์๋์ผ๋ก ์คํจํ๊ณ ์งํ๋์ง ์์ ์์ค ๋ฐ ๋ณํ์ ๋ช ์๊ฐ์ด ๊ฑธ๋ฆฌ๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค...
๋ ํฌ๊ฐ ์๋์? ์ง๊ธ๊น์ง ๋ด ์ฌ์ดํธ์ ์ค์ ์ํฉ์์๋ง ํ ์คํธํ๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ์ฌ์ดํธ์์ ์๋ํด ๋ณผ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
@njmyers ๊ทธ๊ฒ ์์น์ ๋๋ค. ๊ด์ฐฎ์ผ์๋ค๋ฉด [email protected] ์ผ๋ก ์ด๋ฉ์ผ์ ๋ณด๋ด ๊ธฐ๋ค๋ฆฌ์ธ์ . ์ค๋ ์ ๋ ์ ์ค๋นํ ๊ฒ์ด ์์ต๋๋ค.
got
์
๋ฐ์ดํธํ๋ฉด ์ ์๊ฒ๋ ๋ชจ๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
got@9
์ ๋ฌธ์ ๋ Node 8(https://github.com/sindresorhus/got/releases/tag/v9.0.0)์ด ํ์ํ๋ฏ๋ก ATM์ ์
๊ทธ๋ ์ด๋ํ ์ ์๋ค๋ ๊ฒ์
๋๋ค.
์ต์ํ got@8
๋ก ์
๊ทธ๋ ์ด๋ํ ์ ์์ด์ผ ํ์ง๋ง ์ด๊ฒ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ง ํ์ ํ ์ ์์ต๋๋ค.
got@8
๋ RFC 7234 ํธํ HTTP ์บ์ฑ์ ๊ตฌํํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ฏ๋ก gatsby-source-filesystem์ ์์ฒด ํ์ผ ์์คํ
์บ์ ์ด๋ํฐ๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค. ๋ฆฌ์์ค๊ฐ ์บ์ ๊ฐ๋ฅํ๋ค๋ ์ ์ ๊ฐ์ํ ๋ ๋ ๋ฒ์งธ๋ก ์์ค ๋ฐ ๋ณํ ๋
ธ๋์์ ์์๋๋ ์๊ฐ์ ์ต์ํ ์ค์ฌ์ผ ํฉ๋๋ค.
ํ์ผ!
์ด ๋ฌธ์ ๋ ์ ์ ํด์ก์ต๋๋ค. ์ผ์ค์คํ ์กฐ์ฉํจ. ๐ป
๋ง์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ ํ์ฌ 30์ผ ๋์ ํ๋์ด ์์ผ๋ฉด ๋ฌธ์ ๋ฅผ ์ข ๋ฃํฉ๋๋ค. ๋ง์ง๋ง ์ ๋ฐ์ดํธ ์ดํ๋ก ์ต์ 20์ผ์ด ์ง๋ฌ์ต๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ๋์ณค๊ฑฐ๋ ๊ณ์ ๊ณต๊ฐํ๊ณ ์ถ๋ค๋ฉด ์ฌ๊ธฐ์์ ํ์ ํด ์ฃผ์ธ์. ์ด ๋ฌธ์ ๋ฅผ ๊ณ์ ๊ณต๊ฐํ๊ธฐ ์ํด "not stale" ๋ ์ด๋ธ์ ์ถ๊ฐํ ์๋ ์์ต๋๋ค!
Gatsby ์ปค๋ฎค๋ํฐ์ ์ผ์์ด ๋์ด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๐ช๐
@gatsbot ์ฌ์ ํ ๋ฌธ์ ์ ๋๋ค.
์ฌ๋ฌ๋ถ์ ์ํด ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ๊ธฐ๊ณ ํด ๋ฌ๋ผ๋ ์์ฒญ์ ๋ฐ์์ต๋๋ค. ์์ค ๋ฐ ๋ณํ ๋ ธ๋์ ๋ถ์ด ์์ผ๋ฏ๋ก ํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ๋ฌธ์ ๋ฅผ ๋ณด์์ง๋ง ์ด ๋ฌธ์ ์ ๋ํ ์์ ์ฌํญ์ด ์๋ ๊ณณ์ด ๋ณด์ด์ง ์์ต๋๋ค. ์ต์ ์ ์คํธ๋ฆผ์ธ gatsbyjs์ ํฌํฌ์ ๋๋ค. ํ ๋ฒ๋ง ์คํํ๋๋ก ํ์ต๋๋ค. ๋ ธ๋๋ฅผ ๋ณํํ๋ ๋ฐ ํญ์ ๋ถ์ด ์์ต๋๋ค.
๋น๋ํ๋ ๋์ ๋ช๋ช ์ฌ์ดํธ์์ ์คํฌ๋ฆฐ์ท์ ์บก์ฒํ๋ ๋ฐ ์คํจํ์ต๋๋ค. ์์นจ์ ๋ฌธ์ ๊ฐ ๋๋ ์ฌ์ดํธ๋ฅผ ์ถ๊ฐํ๊ฒ ์ต๋๋ค.
@ twhite96 ๋ฐฉ๊ธ ๋ฌธ์ ์ ๋ถ๋ช์ณค๊ณ ๋๋ฅผ ์ํด ์ผํ ๊ฒ์ (emacs์์) ์ด๋ ค ์๋ ์์ ํ์ผ์ ์ ๊ฑฐํ๋ ๊ฒ์ด ์์ต๋๋ค. ์ด๊ฒ์ด ๋์์ด ๋ ์ง ์ฌ๋ถ๋ ํ์คํ์ง ์์ง๋ง ๋น๋๋ฅผ ๊ณ์ ์งํํ ์ ์์ต๋๋ค.
๊ทธ๋์ ์ด๊ฒ ์์ง ๋ฌธ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค...
gatsby-source-s3๋ฅผ ์ฌ์ฉํ์ฌ 100์ฅ์ ์ฌ์ง์ ๊ฐ์ ธ์ ์ ๋ช ํ๊ฒ ๋ณํํ ๋๋ ๋์ผํ ๋ฌธ์ ์ ์ง๋ฉดํฉ๋๋ค. ๋๊ตฌ๋ ์ง ์์ ์ฌํญ์ ์์ ๋์ต๋๊น?
์ด๋ป๊ฒ ๋ ๋ด ๋ฌธ์ ๊ฐ ์์ ๋์์ต๋๋ค (๋ฌด์์๋ก?). ์ด๊ฒ์ ๋ด๊ฐ ์ทจํ ๋จ๊ณ์ ๋๋ค. ํ ์คํธ๋ฅผ ์ํด ๋ ์ ์ ์์ ์ฌ์ง์ผ๋ก ์ s3 ๋ฒํท์ ๋ง๋ ๋ค์ ๋น๋๋ฅผ ์๋ํ๋๋ฐ ๋งค์ฐ ๋น ๋ฅด๊ฒ ์ฑ๊ณต์ ์ผ๋ก ๋น๋๋์์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ๋์๊ฐ์ ์๋ ๋ฒํท์์ ๊ฐ์ ธ์ค๊ธฐ๋ก ๊ฒฐ์ ํ๋๋ฐ ์๋๋ ๋ช ์๊ฐ ๋์ ๊ณ์๋๋ 49์ด์ ๊ฐ์๊ธฐ ์ฑ๊ณต์ ์ผ๋ก ๊ตฌ์ถ๋์์ต๋๋ค. ๋ฒํท ๋งํฌ์ ๋จ์ํ ์ค์์น๊ฐ ์ด๋ป๊ฒ ์คํจ์ ๊ณ ์ณค๋์ง ๋ชจ๋ฅด์ง๋ง ์ด๊ฒ์ด ๋๊ตฐ๊ฐ๊ฐ ๊ทธ๊ฒ์ ์์๋ด๋ ๋ฐ ๋์์ด๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ์๋ง๋ ์บ์์ ๊ด๋ จ์ด ์์ต๋๊น?
์๋ ๋ชจ๋. ์ด ๋ฌธ์ ๊ฐ ์๋ ์ฌ์ดํธ์ ์ฌ์ฉํ๋ ๋ก์ปฌ ํ๋ฌ๊ทธ์ธ ๋ฒ์ ์ ์ ๋ฐ์ดํธํ์ต๋๋ค. 'createRemoteNode' ์ ์ 'better-queue'๋ฅผ ์ฌ์ฉํ๊ณ 'concurrentRequests' ๋งค๊ฐ๋ณ์๋ฅผ ์ ๋ฌํ๋ฏ๋ก ๊ตฌํ์ด ๋ ๋์ ๊ฒ ๊ฐ์์. 'createRemoteNode'๊ฐ ์ด๋ฏธ ๋๊ธฐ์ด์ ์ฌ์ฉํ๊ณ ์๊ธฐ ๋๋ฌธ์ ์ฝ๊ฐ ์ค๋ณต๋์ง๋ง ์ด ๋ฒ์ ๊ณผ ์๊ด์์ด ์ต๊ทผ ๊ฐ์ธ ๋น ์ ๊ทธ๋ ์ด๋์ ์ ์๋ํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ฉฐ ํ์ผ ์งํ ์ํฉ์ ๋ํ ํผ๋๋ฐฑ์ ์ ๊ณตํฉ๋๋ค. ์ด๋ฅผ ์ํด ํจ๊ป PR์ ํ๋ ค๊ณ ํฉ๋๋ค. ๋ฆ์ด์ ์ฃ์กํฉ๋๋ค. ๋ ์ผ์ฐ ์์ ํ๊ฒ ๋ค๊ณ ๋งํ์ง๋ง ๊ฝค ๋ฐ๋นด์ต๋๋ค!
@njmyers
์ ๋ง ๊ณ ๋ง์. ๊ทํ์ ๋ฒ์ ์ ๋ด๊ฐ ๊ฒช๊ณ ์๋ ๋ช ๊ฐ์ง ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค. 25GB์ mp3 ๋ค์ด๋ก๋๋ฅผ ํํฐ๋งํ๊ธฐ ์ํด ํ๋ ์ค๋ก ๊ฒฐํฉํ์ผ๋ฉฐ ์ด์ ์ค์ ๋์์ต๋๋ค!
ํ์คํ ์ฌ์ ํ ๋ฌธ์ ์
๋๋ค.
์ง๋ 24์๊ฐ ๋์ ํ๋ก์ ํธ๋ฅผ ์ปดํ์ผํ๋ ค๊ณ ํ์ต๋๋ค. ์ฝ 12๋ฒ์ ์๋ ์ค 3๋ฒ์ ์ถ๋ ฅ๊ณผ ์ค์ WP ์ฐ๊ฒฐ์ ์ฑ๊ณตํ์ต๋๋ค. ์ด์ ๋ํ ์์ ์ฌํญ์ด ์์ต๋๊น?
BTW, ํ๋ฌ๊ทธ์ธ์ @njmyers ๋ฒ์ ์ ์ฌ์ฉํ๋ ค๊ณ ์๋ํ์ง๋ง(์ค์ ๋ก ๋ฉ์ง ์์
์ด์์ต๋๋ค!) ๊ฒฐ๊ณผ๊ฐ ํผํฉ๋์์ต๋๋ค. ๋๋ก๋ wordpress_parent ๋๋ Date์ ๋ํด ๋ถํํ๊ณ ๊ฒฐ๊ตญ ์ถฉ๋ํ์ง๋ง ์ด๋ฌํ ์ค๋ฅ๋ก ์ธํด ์ค์ ๋ก ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ํ์
ํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ๋น๋์์๋ ๋ค๋ฅธ ์ค๋ฅ(ํ์ง๋ง ์ปดํ์ผ์ ์ํํ๋ฏ๋ก ํฅ๋ฏธ๋กญ์ต๋๋ค)๊ฐ ์ค์ ๋ก GraphQL์ ๋ฌธ์ ๋ฅผ ์ผ์ผํต๋๋ค.
@lucassilvagc ์ผ๋ถ ์ถ๋ ฅ์ ๊ฒ์ํ ์ ์์ต๋๊น? ์ฌ๋๋ค์ด ์ง์ ์ ์๋ํ๊ณ ํ ์คํธํ๊ณ ์์ด ๊ธฐ์ฉ๋๋ค. PR์ ์ด ์ ์๋๋ก ๋ ์ ์๋ํ๋๋ก ํฉ์๋ค!
@njmyers ๋ฌผ๋ก ์ ๋๋ค!
์งํ ์ํฉ์ ๋ํ ๊ฐ๋ตํ ๊ฐ์:
๋ด ์น ์ฌ์ดํธ๋ ํ์ฌ ~1940๊ฐ์ ์ด๋ฏธ์ง ํ์ผ๋ก ์คํ๋๋ฉฐ, ์ฌ๋ฌ ์ด๋ฏธ์ง ํ์ผ์ ์ฌ๋ฌ ๋ฒ ์์ฑํ WordPress์ ์๋ชป์ผ ์ ์์ต๋๋ค. ๋ด๊ฐ ๋ฐ๋๋ผ _gatsby-source-wordpress_๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฌธ์ ๊ฐ ์๋ํ ๋๋ก ๋ํ๋ฉ๋๋ค(์ด์ ์ ๋ ๋ค๋ฅธ ๋น๋ ํ๊ฒฝ์์ ๋ง๋ "๋ฐ๋๋ผ" ๋น๋๊ฐ ์์ต๋๋ค. ์ด ๋น๋๋ ์ด ๋ฌธ์ ์ ๋ํด ๋ ผ์ํ๊ณ ์๋ ๊ฒ๊ณผ ๋์ผํ ๋ฌธ์ ๋ฅผ ๋ฐํํฉ๋๋ค. ๋ชจ๋ ์ด๋ฏธ์ง ํ์ผ์ด ๋ฐํ๋๋ฉด ๋น๋๊ฐ ์๋ํ๊ณ ์ปดํ์ผ๋ฉ๋๋ค). ํ๋ฌ๊ทธ์ธ์ ์ฌ์ฉํ๋ฉด(node_modules/gatsby-source-wordpress ๋ด๋ถ์ ๋ชจ๋ ํ์ผ์ ๊ต์ฒดํฉ๋๋ค(์๋ชป๋ ๊ฒฝ์ฐ ์์ )), _gatsby development_๋ ๋ค์์ ๋ฐํํฉ๋๋ค.
TypeError: Cannot read property 'wordpress_parent' of undefined
- normalize.js:287 entities.map.e
[amazingtec]/[gatsby-source-wordpress]/normalize.js:287:11
- Array.map
- normalize.js:286 Object.exports.mapElementsToParent.entities [as mapElementsToParent]
[amazingtec]/[gatsby-source-wordpress]/normalize.js:286:12
- gatsby-node.js:134 Object.exports.sourceNodes
[amazingtec]/[gatsby-source-wordpress]/gatsby-node.js:134:24
warning The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes โ 299.757 s
success building schema โ 10.192 s
์ ์ ํ ๋ค์๊ณผ ๊ฐ์ด ์ถ๋ ฅ๋ฉ๋๋ค.
'Cannot query field "allWordpressPage" on type "Query". Did you mean "allSitePage"?',
locations: [ [Object] ] } ]
error UNHANDLED REJECTION
TypeError: Cannot read property 'allWordpressPage' of undefined
- gatsby-node.js:54 graphql.then.result
C:/Projects/amztec-gtby/amazingtec/gatsby-node.js:54:36
์ถ์ : ์ด๊ฒ์ ์์์ ๋งํ๋ฏ์ด ํ์ผ์ ๊ต์ฒดํ์ฌ _"๋ณํ๋"_ gatsby-source-wordpress์ ๋ฐ๋๋ผ ๋น๋์์ต๋๋ค. ๋ชจ๋ ํ์ด์ง๋ฅผ ์ฟผ๋ฆฌํ ์ ์๋ค๋ ์ฌ์ค์ ์์ฑ๋๋ ๋ ธ๋๊ฐ ์๋ ๊ฒ๊ณผ ๊ด๋ จ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค. ๋ํ ์ด ๋น๋๊ฐ ์ด ๋ฌธ์ ๊ฐ ๋ํ๋์ง ์์ ๋ ์๋ํ๋ ๋ฐ๋๋ผ ๋น๋์ ๋์ผํ๋ค๋ ์ ์ ์๊ณ ์ถ์ต๋๋ค.
๋ํ ๊ฒฝ๋ก๋ฅผ ์ถ๊ฐํ๋ฉด ๋์ผํ ์ด๊ธฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค(WordPress์ ๋ํ ์ฌ๋ฌ ๋ณดํธ ๊ณ์ธต์ผ๋ก ์ธํด ๊ด๋ จ์ด ์๊ฑฐ๋ ์ค๋ฅ๋ฅผ ๋ฐํํ๋ ๋ค๋ฅธ ํ์ด์ง๋ฅผ ํผํ๊ณ ์ถ์๊ธฐ ๋๋ฌธ์). ๋ด๊ฐ ๋์ดํ ๊ฒฝ๋ก๊ฐ ์ฌ๋ฐ๋ฅธ์ง ๋๋ ์ดํ์ ๋๋ฝ๋ ๊ฒ์ด ์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๊ทํ์ ํ์ ์ ๋งค์ฐ ๋ง์กฑํฉ๋๋ค. ์ด ๋ฌธ์ ๋ ํ์ฌ ์ ํ๋ก์ ํธ์ ํฐ ์ฐจ์ง์ ๋น๊ณ ์์ผ๋ฉฐ ์ฌ์ ํ ์ด ๋ฌธ์ ์ ๋ํด ๊ด์ฌ์ ๊ฐ๊ณ ๊ณ์๋ค๋ ์ฌ์ค์ ๊ธฐ์ฉ๋๋ค. ์ ๋ง ๊ฐ์ฌํฉ๋๋ค!
acf ํ๋์ 4000๊ฐ์ ์ด๋ฏธ์ง๊ฐ ์๋ 400๊ฐ ์ด์์ ์ฌ์ฉ์ ์ ์ ๊ฒ์๋ฌผ์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋๋ ์ ๋ฐ์ดํธํ๊ณ 35 ๋ถ์ผ๋ก ๋น๋ ํ ์์์์ต๋๋ค.
got
์
๋ฐ์ดํธํ ํ ๋ค์ ๋น๋ํ ์ ์์ต๋๋ค.
์์๋๋ก ์ด ๋ฒ๊ทธ๋ ์ฌ์ ํ gatsby-wordpress์ ์กด์ฌํฉ๋๋ค. ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ๊ณ ์ฒ๋ฆฌํ๋ ๋ฐ 35๋ถ์ ๋ชจ๋ ์์(ํ๊ท ์ธํฐ๋ท ์๋, ์ฒ๋ฆฌ ๋ฅ๋ ฅ, ์ด ํ์ผ ์ ๋ฑ)๋ฅผ ๊ณ ๋ คํ ๋ ๋งค์ฐ ๊ธด ์๊ฐ์
๋๋ค.
@njmyers ๋ฒ์ ์ ํน์ ์ฉ๋์ ์ ์ฉํ ์ ์์ต๋๋ค. ๊ฐ์ง๊ณ ์๋ ๋ชจ๋ ์ด๋ฏธ์ง ํ์ผ์ ๋ค์ด๋ก๋ํ ๋ ๋งค๋ ฅ์ฒ๋ผ ์๋ํฉ๋๋ค.
์์๋๋ก ์ด ๋ฒ๊ทธ๋ ์ฌ์ ํ gatsby-wordpress์ ์กด์ฌํฉ๋๋ค. ๋ชจ๋ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ๊ณ ์ฒ๋ฆฌํ๋ ๋ฐ 35๋ถ์ ๋ชจ๋ ์์(ํ๊ท ์ธํฐ๋ท ์๋, ์ฒ๋ฆฌ ๋ฅ๋ ฅ, ์ด ํ์ผ ์ ๋ฑ)๋ฅผ ๊ณ ๋ คํ ๋ ๋งค์ฐ ๊ธด ์๊ฐ์ ๋๋ค.
@njmyers ๋ฒ์ ์ ํน์ ์ฉ๋์ ์ ์ฉํ ์ ์์ต๋๋ค. ๊ฐ์ง๊ณ ์๋ ๋ชจ๋ ์ด๋ฏธ์ง ํ์ผ์ ๋ค์ด๋ก๋ํ ๋ ๋งค๋ ฅ์ฒ๋ผ ์๋ํฉ๋๋ค.
๋ด ์ฌ์ดํธ๋ ์ด๋ฏธ์ง ์๊ฐ ์ ์์ ๋ ์ ๋๋ก ์๋ํ์ง๋ง ๋ ์ถ๊ฐํ๊ธฐ ์์ํ๋ฉด ์ด๋ฐ ์ผ์ด ๋ฐ์ํฉ๋๋ค.
@MWalid got
์
๋ฐ์ดํธํ๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผ ํฉ๋๊น? ๊ฐ์ฌ ํด์.
ํ๋ฃจ ์ข ์ผ ์ฑ๊ณตํ์ง ์์ผ๋ ค๊ณ ๋ ธ๋ ฅํ์ต๋๋ค. ์ฝ 1450๊ฐ์ ์ด๋ฏธ์ง๊ฐ ์์ต๋๋ค.
์ง๊ธ 2์ผ ๋์ ๋ฐฐํฌํ ์ ์์ต๋๋ค. ๋๊ตฐ๊ฐ๊ฐ ์ฝ๋์์ ์ด๊ฒ์ด ๋ฐ์ํ๋ ์์น์ ๋ํด ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํ์ฌ ์๋ฃจ์ ์ ์ฐพ์ ์ ์๋๋ก ๋์์ค ์ ์์ต๋๊น?
์ง๊ธ 2์ผ ๋์ ๋ฐฐํฌํ ์ ์์ต๋๋ค. ๋๊ตฐ๊ฐ๊ฐ ์ฝ๋์์ ์ด๊ฒ์ด ๋ฐ์ํ๋ ์์น์ ๋ํด ์ฌ๋ฐ๋ฅธ ๋ฐฉํฅ์ผ๋ก ์๋ดํ์ฌ ์๋ฃจ์ ์ ์ฐพ์ ์ ์๋๋ก ๋์์ค ์ ์์ต๋๊น?
๋น์ ์ ๋น์ ์ ์
๊ทธ๋ ์ด๋ got
์ ์ค์ฒฉ ๋ ์์กด์ฑ gatsby-source-filesystem
์ด์ ๋ฒ์ ์ ์ฌ์ฉํ๋ 9.4.0
?
๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ๋ค์์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
"resolutions": {
"gatsby-source-filesystem/got": "9.4.0"
}
Gatsby ํ๋ก์ ํธ์ package.json
. ๊ทธ๋ฐ ๋ค์ node_modules
๋ฐ yarn.lock
ํ์ผ์ ์ ๊ฑฐํ๊ณ ๋ค์ ์ค์นํ์ญ์์ค.
์ฐธ๊ณ : ์ด resolutions
๊ธฐ๋ฅ์ yarn
์์๋ง ์๋ํฉ๋๋ค. npm
๋ ์์ง ๊ตฌํํ์ง ์์์ต๋๋ค.
@anagstef ํ์ ์ฃผ์ ์ ๋๋จํ ๊ฐ์ฌํฉ๋๋ค! ๋๋ ์ด๊ฒ์ ์๋ํ๊ณ ๋ค์๋ณด๊ณ ํ ๊ฒ์ ๋๋ค.
gatsby develop
์คํํ ๋ ๋ช
๋ น์ด ์คํ๋ ๋๋ง๋ค ์๊ฒฉ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๋์ ๋ก์ปฌ ์บ์๋ฅผ ์ ์งํ๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
@anagstef ๊ฐ ํจ์ฌ ๋ ์ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค! ํ ๊ณ ๋ง์!
์ด ๋ฒ์ ์ got์ผ๋ก ๋น๋ํ ๋ ์ถ๋ ฅ์ด ๋งค์ฐ ์ฅํฉํฉ๋๋ค. ์ด๊ฑฐ ์์ ๋ ๋ฐฉ๋ฒ์ด ์๋์ง ์์ธ์?
@nratter ๋์์ด ๋์ จ ๋ค๋ ๋คํ์ ๋๋ค!
์, ๋งค์ฐ ์ฅํฉํ๋ฉฐ ๋ ์ ์๋ค๋ ๊ฒ์ ์๋๋ค. ๋ชจ๋ ์ ์ฉํ ์ฝ์ ์ถ๋ ฅ์ ๋ง์นฉ๋๋ค.
๋ด๊ฐ ํ ๋ช ๊ฐ์ง ์กฐ์ฌ ํ์, ๋๋ ๊ทธ๊ฒ์ด ์ฌ๊ธฐ์์ ๋ฐ์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
https://github.com/gatsbyjs/gatsby/blob/80c7023a8bc23886939205fe52e305277294e6af/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L155
๋ณด์๋ค์ํผ ์ด๋น ๋๋ฌด ๋ง์ด ๋ฐ์ํ๋ downloadProgress
์ด๋ฒคํธ๊ฐ ๋ฐ์ํ ๋๋ง๋ค ๊ฐ ํ์ผ์ ๋ค์ด๋ก๋ ์งํ๋ฅ ๊ณผ ํจ๊ป console.log
๋ฅผ ํธ์ถํฉ๋๋ค. ์ด์ got
๋ฒ์ ์์๋ downloadProgress
์ด๋ฒคํธ๋ฅผ ๊ตฌํํ์ง ์์๊ธฐ ๋๋ฌธ์ ์ด์ ์๋ ๋ฌธ์ ๊ฐ ๋์ง ์์์ต๋๋ค.
PR๋ก ํด๊ฒฐํ ์ ์์๊น์? ๋จ์ ์ฝ๋๋ฅผ ๋๋ฒ๊น ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค.
๋๋ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"์ ๋ถ์ด ๊ฐ์ ๋ฌธ์ ๊ฐ์์์ต๋๋ค. ๋ง์ console.logs ํ์ ๋ด ๋ฌธ์ ๋ wordpress์์ ๋ฏธ๋์ด ํ์ผ์ ๊ฒ์ํ๋ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฌธ์ ๊ฐ ๋์์ต๋๋ค. ๋ฌธ์ ๋ ์๋ฒ๊ฐ ์ด๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ค๋ ๊ฒ์ด ์๋๋ผ ์ฝ 350๊ฐ ์์ฒญ ํ Cloudflare ์๋ ์ ํ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฐ์์ด์์ต๋๋ค.
Cloudflare๋ฅผ ์ฐํํ๊ณ vps๋ก ๋ฐ๋ก ์ด๋ํ๋๋ฐ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"๊ฐ ๋ ์ด์ ํ์๋์ง ์๊ณ ๋น๋๊ฐ ์๋ฃ๋ฉ๋๋ค.
๋ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ ํ ์คํธ๋ฅผ ์ํด ๋ก์ปฌ ์๋ํ๋ ์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด์์ผ๋ฉฐ ๋ผ์ด๋ธ ์ฌ์ดํธ๋ netlify์ ์์ง๋ง ๋ฐฐํฌํด๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์์์ต๋๋ค.
์ฌ๋ฌ๋ถ, ๋ณ๋ ฌ ๋์ ์ง๋ ฌ๋ก createRemoteFileNode
์์ฒญ์ ์คํํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
๋ด๊ฐ ์ฌ์ฉํ๋ ๊ธฐ๋ฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
/**
* Map over items array using the fn function but wait for each step to finish before moving to the next one
*/
exports.serialMap = async (items, fn) => {
const results = []
for (const item of items) {
const result = await fn(item)
results.push(result)
}
return results
}
๋ด๊ฐ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
const imageNodes = await serialMap(node.___originalImages, imgUrl => {
return createRemoteFileNode({
url: imgUrl,
parentNodeId: node.id,
store,
cache,
createNode,
createNodeId,
})
})
์ด๋ฏธ์ง๊ฐ ๋ค์ด๋ก๋๋ ํ ์์ค ๋ฐ ๋ณํ ๋จ๊ณ๊ฐ ์ด๋ป๊ฒ ๋ณด์ด๋์ง ๋ณด์ฌ์ค๋๋ค.
Downloading remote files [==============================] 1063/1063 156.1 secs 100%
Downloading remote files [==============================] 1064/1064 157.2 secs 100%
Downloading remote files [==============================] 1065/1065 158.4 secs 100%
Downloading remote files [==============================] 1066/1066 159.5 secs 100%
Downloading remote files [==============================] 1067/1067 160.5 secs 100%
Downloading remote files [==============================] 1068/1068 161.5 secs 100%
Downloading remote files [==============================] 1069/1069 162.6 secs 100%
Downloading remote files [==============================] 1070/1070 163.7 secs 100%
Downloading remote files [==============================] 1071/1071 164.9 secs 100%
Downloading remote files [==============================] 1072/1072 166.0 secs 100%
Downloading remote files [==============================] 1073/1073 167.5 secs 100%
Downloading remote files [==============================] 1074/1074 169.2 secs 100%
Downloading remote files [==============================] 1075/1075 171.0 secs 100%
success source and transform nodes โ 175.271 s
๊ทํ์ ๋ฌธ์ ๋ ํด๊ฒฐ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
๊ฑด๋ฐฐ
@ancashoria ์ด ์ฝ๋๋ฅผ ์ด๋์ ๋ฃ์ด์ผ ํ๋์?
@ancashoria ์, ์ด ์ฝ๋๋ฅผ ์ด๋์
์ด๊ฒ์ gatsby-source-wordpress
ํ๋ฌ๊ทธ์ธ๊ณผ ๋ค์ ๊ด๋ จ์ด ์์ต๋๋ค. ๋ด gatsby-node.js
์์ ์ฝ๋๊ฐ ์์ต๋๋ค. ์ด๋ฌํ ๋ชจ๋ ์์ฒญ์ ๋ณ๋ ฌ๋ก ์คํํ๋ฉด ์์ฒญ์ด ์คํจํ๊ฒ ๋์๊ธฐ ๋๋ฌธ์ ํด๋น ์์ฒญ์ ์ฐจ๋ก๋ก ์คํํ๋ ๋์ฐ๋ฏธ ํจ์๋ฅผ ์์ฑํ์ต๋๋ค.
gatsby-source-wordpress
์๋ ๋น์ทํ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ ๊ฐ์๋ฐ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๋ ๋ง์ ๋์์ ๋๋ฆฌ์ง ๋ชปํด ์ฃ์กํฉ๋๋ค.
๋ฐฉ๋ํ ์ด๋ฏธ์ง์ ๋๋ฆฐ ์ธํฐ๋ท ์ฐ๊ฒฐ๊ณผ ๊ด๋ จ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. Netlify๋ ์ฌ์ดํธ๋ฅผ ๊ตฌ์ถํ ์ ์์์ง๋ง ๋ด ๋ก์ปฌ ์ฐ๊ฒฐ์ 1MB/s ๋ค์ด๋ก๋์ ๋ถ๊ณผํ์ฌ 30์ด ํ์ ์๊ฐ ์ด๊ณผ๋๊ณ ํฐ ์ด๋ฏธ์ง์์ ์คํจํ๊ฒ ๋์๊ธฐ ๋๋ฌธ์ ๊ทธ๋ ์ง ์์์ต๋๋ค.
๋๋ 1GB์ ๊ด์ฌ์ ๋ฅผ ๊ฐ์ง๊ณ ์๊ณ '๋๊ท๋ชจ' ์ด๋ฏธ์ง๋ ์์ต๋๋ค.
์๋ํ๋ ์ค๋ฅผ ๋ค์ด๋ก๋ํ ํ ๋ธ๋ก๊ทธ ์ด๋ฏธ์ง๋ฅผ ๋ก์ปฌ๋ก ๋ณํํ์ง ์๊ณ ๋จ์ํ URL์ ์ฌ์ฉํฉ๋๋ค. ์ด ๊ฒฝ์ฐ ์ด๋ฌํ ์ด๋ฏธ์ง์ ๋ค์ด๋ก๋๋ฅผ ๋นํ์ฑํํ๋ ์ค์ ์ด ์์ผ๋ฉด ์ข์ ๊ฒ์ ๋๋ค.
์ฌ๋ฌ๋ถ, createRemoteFileNode ์์ฒญ์ ๋ณ๋ ฌ ๋์ ์ง๋ ฌ๋ก ์คํํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
๋ค, ๋ฌธ์ ๋ ์ค์ ๋ก createRemoteFileNode
๊ฐ ๋๋ถ๋ถ์ WP ์๋ฒ์ ๋๋ฌด ๋ง์ 200์ ๋์์ฑ์ ์ฌ์ฉํ๋ค๋ ์ฌ์ค์ ๊ธฐ๋ฐํฉ๋๋ค. CloudFront์ ๋ด ์ด๋ฏธ์ง๊ฐ ์๊ณ ๊ฑฐ๊ธฐ์์ ์ผ๋ถ ์๋ ์ ํ์ ๋๋ฌํ์ต๋๋ค.
๋๋ ์ ์ ๋์ ์์ค ํ๋ฌ๊ทธ์ธ์ ๋ถ๊ธฐ ๋ฒ์ ์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๊ณ ์๋ํ์ง๋ง ๋ฌธ์ ๋ ์ค์ ๋ก gatsby-source-wordpress
์์ง ์๊ณ gatsby-source-filesystem
์์ต๋๋ค. ์ด์์ ์ผ๋ก createRemoteFileNode
ํจ์์ ์๋น์๋ ๊ฑฐ๊ธฐ์์ ๋์์ฑ์ ์ ๋ฌํ ์ ์์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ํ๋ฌ๊ทธ์ธ์ ๊ตฌ์ฑ์์ ๋์์ฑ ์ต์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋๋ ์ฌ์ ํ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด PR์ ํ๊ณ ์ถ์ต๋๋ค!
๋ด๊ฐ ์ฌ์ฉํ ์๋ฃจ์
์ node_modules
๋ด๋ถ์ ์ฝ๋๋ฅผ ์์ ํ๋ ๊ฐ๋จํ ์คํฌ๋ฆฝํธ์
๋๋ค. ์ค์ ๋ก ๋งค์ฐ ์ทจ์ฝํ๊ณ ์ด์์ ์ด์ง๋ ์์ง๋ง ๋์์ฑ์ ์ง์ ์์ ํ๋ ๊ฐ๋จํ ํดํน์
๋๋ค. shelljs
ํ๋ฏ๋ก Windows ์ฌ์ฉ์์๊ฒ๋ ์๋ํ๋๋ก ๋์ด ์์ต๋๋ค(์๋ํ์ง ์์).
#!/usr/bin/env node
const path = require('path');
const shell = require('shelljs');
const FILE_PATH = path.resolve(
__dirname,
// add path to your root dir here,
'node_modules',
'gatsby-source-filesystem/create-remote-file-node.js'
);
shell.sed('-i', 'concurrent: 200', 'concurrent: 20', FILE_PATH);
๋๋ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"์ ๋ถ์ด ๊ฐ์ ๋ฌธ์ ๊ฐ์์์ต๋๋ค. ๋ง์ console.logs ํ์ ๋ด ๋ฌธ์ ๋ wordpress์์ ๋ฏธ๋์ด ํ์ผ์ ๊ฒ์ํ๋ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฌธ์ ๊ฐ ๋์์ต๋๋ค. ๋ฌธ์ ๋ ์๋ฒ๊ฐ ์ด๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ค๋ ๊ฒ์ด ์๋๋ผ ์ฝ 350๊ฐ ์์ฒญ ํ Cloudflare ์๋ ์ ํ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฐ์์ด์์ต๋๋ค.
Cloudflare๋ฅผ ์ฐํํ๊ณ vps๋ก ๋ฐ๋ก ์ด๋ํ๋๋ฐ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"๊ฐ ๋ ์ด์ ํ์๋์ง ์๊ณ ๋น๋๊ฐ ์๋ฃ๋ฉ๋๋ค.
์ด๊ฒ์ ์ ํํ ๋ด ๋ฌธ์ ์์ต๋๋ค. Netlify๋ 2๋ถ ๋ฏธ๋ง์ผ๋ก ๋งค์ฐ ๋น ๋ฅด๊ฒ ๊ตฌ์ถ๋์์ต๋๋ค. ์ฝ 500๊ฐ์ ์์ค ์ด๋ฏธ์ง์ ํจ๊ป ์ฝ 30๊ฐ์ ๊ฒ์๋ฌผ๋ง ์์ต๋๋ค. ๋ก์ปฌ์์ ๋ชจ๋ ์์ ์ด ์๋ฃ๋๋ ๊ฒ์ ์๋์๊ณ CloudFlare ์ํ๋ฅผ DNS๋ก ์ ํ ํด์ ํ๊ธฐ๋ง ํ๋ฉด ์ฆ์ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋๋ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"์ ๋ถ์ด ๊ฐ์ ๋ฌธ์ ๊ฐ์์์ต๋๋ค. ๋ง์ console.logs ํ์ ๋ด ๋ฌธ์ ๋ wordpress์์ ๋ฏธ๋์ด ํ์ผ์ ๊ฒ์ํ๋ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฌธ์ ๊ฐ ๋์์ต๋๋ค. ๋ฌธ์ ๋ ์๋ฒ๊ฐ ์ด๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ค๋ ๊ฒ์ด ์๋๋ผ ์ฝ 350๊ฐ ์์ฒญ ํ Cloudflare ์๋ ์ ํ ๋ฐ ์๊ฐ ์ด๊ณผ ๋ฐ์์ด์์ต๋๋ค.
Cloudflare๋ฅผ ์ฐํํ๊ณ vps๋ก ๋ฐ๋ก ์ด๋ํ๋๋ฐ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"๊ฐ ๋ ์ด์ ํ์๋์ง ์๊ณ ๋น๋๊ฐ ์๋ฃ๋ฉ๋๋ค.์ด๊ฒ์ ์ ํํ ๋ด ๋ฌธ์ ์์ต๋๋ค. Netlify๋ 2๋ถ ๋ฏธ๋ง์ผ๋ก ๋งค์ฐ ๋น ๋ฅด๊ฒ ๊ตฌ์ถ๋์์ต๋๋ค. ์ฝ 500๊ฐ์ ์์ค ์ด๋ฏธ์ง์ ํจ๊ป ์ฝ 30๊ฐ์ ๊ฒ์๋ฌผ๋ง ์์ต๋๋ค. ๋ก์ปฌ์์ ๋ชจ๋ ์์ ์ด ์๋ฃ๋๋ ๊ฒ์ ์๋์๊ณ CloudFlare ์ํ๋ฅผ DNS๋ก ์ ํ ํด์ ํ๊ธฐ๋ง ํ๋ฉด ์ฆ์ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋๋ ๋ํ ์ด๊ฒ์ด ์ฌ์ค์์ ์์๋ค. ์ด์ ์ ๋น๋ ์คํจ์ ์์ธ์ด ๋๋ ํ๋์ ์ด๋ฏธ์ง๊ฐ ์์๊ณ Cloudflare๊ฐ ๋ฌธ์ ๋ผ๊ณ ๋ฌด์ํ์ต๋๋ค. ๊ทธ ์ดํ๋ก ๋ฌธ์ ๊ฐ ์ต๊ทผ์ ๋ค์ ๋ฐ์ํ์ผ๋ฉฐ @amcc๊ฐ Cloudflare๋ฅผ ํตํด A ๋ ์ฝ๋๋ฅผ ๋ผ์ฐํ ํ์ง ๋ฐ๋ผ ๋ก์ปฌ์์๋ ์ฆ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
์ด๊ฒ์ ๋จ์ง WP ์์ค ๋ฌธ์ ๊ฐ ์๋๋ผ๋ ๊ฒ์ ๋ํ์ดํ๊ณ ์ถ์์ต๋๋ค. gatsby-source-prismic
์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. @njmyers ํดํน์ผ๋ก soure-filesystem์ ๋์์ฑ์ ์ค์ด๋ฉด ์ ๋ฅผ ์ํด ํด๊ฒฐ๋์์ผ๋ฏ๋ก ์๋๋ผ๊ณ ์ถ์ธกํ์ต๋๋ค. ์ ํ/๊ณผ๋ถํ ๋ฌธ์ .
์์ค ํ์ผ ์์คํ ์ ๋์์ฑ์ ๊ตฌ์ฑํ ์ ์๋ ๊ฒฝ์ฐ์๋ ๋์ํฉ๋๋ค.
@njmyers ์ด๋ฐ ์ง๋ฌธ์ ํด์ ์ฃ์กํ์ง๋ง ์ด ์์ ์ฌํญ์ด ์ ํํ ์ด๋ป๊ฒ ์คํ๋๊ณ
@alexanderwe ์ด์จ๋ ์ด๋ฆฌ์์ ํดํน node_modules
์ค์น ํ ์คํํ ์ ์์ต๋๋ค. ๋๋ 100 % ํ์ ํ์ง๋ง ์ ๋ ๋ฏฟ์ต๋๋ค postinstall
ํ๋ก์ ํธ์ package.json
ํ์ผ์ด ์๋ํฉ๋๋ค.
์ ์๊ฒ Gatsby๋ 500๊ฐ ์ด์์ ์ด๋ฏธ์ง๊ฐ ํฌํจ๋ json์ ์ฌ์ฉํ ๋ "์์ค ๋ฐ ๋ณํ ๋ ธ๋"์์ ์๊ฐ์ 50%๋ฅผ ๋ฉ์ถฅ๋๋ค. gatsby-source-custom-api๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
์ด๋ฏธ์ง๋ ๋น ๋ฅด๊ณ ์์ ์ ์ธ ์๋ฒ์์ ํธ์คํ
๋ฉ๋๋ค.
๋ด ์ธํฐ๋ท ์ฐ๊ฒฐ๋ ๋น ๋ฅด๊ณ ์์ ์ ์
๋๋ค.
"gatsby": "^2.9.4",
"gatsby-image": "^2.1.4",
"gatsby-plugin-emotion": "^4.0.7",
"gatsby-plugin-sharp": "^2.1.5",
"gatsby-plugin-typography": "^2.2.13",
"gatsby-source-custom-api": "^2.0.4",
"gatsby-transformer-remark": "^2.4.0",
"gatsby-transformer-sharp": "^2.1.21",
๋๋ฒ๊น ํ๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผ ํฉ๋๊น?
์ด ๋ฌธ์ ๋ gatsby-source-custom-api ๋๋ source-wordpress์์๋ง ๋ฐ์ํฉ๋๊น?
๊ทธ๊ฒ์ ๋์๊ฒ๋ ์ผ์ด๋๋ค. ์ ์๋ ๋ชจ๋ ์์ ์ฌํญ์ ์๋ํ์ง๋ง ์๋ฌด ๊ฒ๋ ์๋ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ฌ๋๋ค์ด ๋ค๋ฅธ ์๋น์ค์์๋ ๋น์ทํ ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์๋ค๊ณ ๋ค์์ง๋ง ๋ถ๋ช ํ Gatsby์ ๋ฐฑ์๋๋ก Wordpress๋ฅผ ๋ค์ ์ฌ์ฉํ์ง ์์ ๊ฒ์ ๋๋ค.
@alexanderwe ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ์ ์ ํ ๋ฐฉ๋ฒ์ @njmyers๊ฐ ์ ์ํ ํจ์น๋ฅผ ๊ตฌํํ๋ ๊ฒ์
๋๋ค.
๊ทธ๋ฐ ๋ค์ gatsby-source-wordpress
๋ฐ gatsby-config.js
์ ์ฐธ์กฐ์์ ์ค์ ๋ก ๊ตฌ์ฑํ ์ ์๋๋ก ๋ค๋ฅธ PR์ ์๊ฐํฉ๋๋ค.
@sebastienfi ๋ ๊ทธ๋ฅ์ด ๋นํ ๊ฑฐ๋ ธ๋ค https://github.com/gatsbyjs/gatsby/issues/14819#event -2418874313 ๋ฐ ํด๋น ์ปค๋ฐ https://github.com/gatsbyjs/gatsby/commit/90aa24787b32ef9613b6becbfadab6029ec39ce9#diff -1864dd21828754bdbc63f22b895bee8eํ๋ ๋์์ฑ ๋น์จ์ ๊ตฌ์ฑํ๋ ํ๊ฒฝ ๋ณ์๋ฅผ ์ถ๊ฐํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค. ํ๊ฒฝ ๋ณ์์ ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์์ ๋ํ ์ง์์ ์ธ ํ ๋ก ๋ ์์ต๋๋ค. https://github.com/gatsbyjs/gatsby/issues/14636
GATSBY_CONCURRENT_DOWNLOAD
๋ฅผ ๋ ๋ฎ์ ์ซ์๋ก ์ค์ ํด ๋ณด์
จ์ต๋๊น? ๊ธฐ๋ณธ์ ์ผ๋ก 200์ผ๋ก ์ค์ ๋์ด ์์ต๋๋ค.
๋ฆฌ๋
์ค/๋งฅ:
GATSBY_CONCURRENT_DOWNLOAD=5 gatsby build
์๋์ฐ:
setx GATSBY_CONCURRENT_DOWNLOAD 5; gatsby build
@wardpeet
๋๋ ๋
ธ๋ ฅํ๋ค, ์๋ฌด๊ฒ๋ ๋ฐ๋์ง ์์๋ค
๋ก๊ทธ์ ์ด๋ฏธ์ง๊ฐ ์ฑ๊ณต์ ์ผ๋ก ๊ฒ์๋์์์ ๋ณด์ฌ์ฃผ๊ธฐ ๋๋ฌธ์ ์์ค ํ์ผ ์์คํ ๊ณผ ํ์คํ ๊ด๋ จ์ด ์์ต๋๋ค. ๋ฌธ์ ๋ ์ฌ์ ํ ํฝ๋๋ค... ์ฐ๋ฆฌ๋ ๋ง๊ฐ ์๊ฐ์ ๋ฆ๊ฒ ์คํ๋๊ณ ์์ผ๋ฉฐ ์ ๋ง๋ก ์ฐพ๊ณ ์์ต๋๋ค. ์ด์ ๋ํ ํด๊ฒฐ์ฑ ...
wordpress ์์ค ํ๋ฌ๊ทธ์ธ์ ๋๋ฒ๊ทธ๋ก ์ค์ ํ ํ ๋๋ ์ด๊ฒ์ ๋ด
๋๋ค.
ํญ์ 470-480 ์ฌ์ด์ ์ ํ๋ฅผ ๋์ต๋๋ค ... ์ผ๋ฐ์ ์ผ๋ก ๊ฐ์ ์ฅ์์ ์์ง๋ ์์ต๋๋ค.
์ฝ๋์์ ์ด๊ฒ์ด ์คํ๋๋ ์์น๋ฅผ ์๋ ์ฌ๋์ด ์์ต๋๊น?
VPN์ ์ค๊ฐ์ ํ ๊ธํ์ฌ ์๋ํ๊ฒ ํ์ต๋๋ค.
๋๊ตฌ๋ ์ง ์์ ์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ๋์ ์๊ฒฉ ์ฆ๋ช ๊ณผ ๊ณต์ ํ์ฌ ๋ด๊ฐ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ณ ๋ฌธ์ ๋ฅผ ์ฐพ์ ์ ์๋๋ก ํ์๊ฒ ์ต๋๊น?
[email protected] ์ผ๋ก ๊ฐ์ธ ๋ฉ์ผ์ ๋ณด๋ด์ฃผ์ญ์์ค.
๋ด repo๋ ์ด ์์ ์์ ์ฝ๊ฒ ๋ค์ ์์ฑ๋์ง ์์ต๋๋ค. ์ด๋๊ฐ์ ์๋ db์ ๋ฐฑ์ ์ด ์์ง๋ง ์ฌ์ดํธ ๊ตฌ์ถ์ ์ํด ๋ช ๋ ๋์ ์ฝํ ์ธ ์ ๋ํด ๋งค์ ๋ถ๋์ ๊ฒ์๋ฌผ์ ๋จ์ผ ๊ฒ์๋ฌผ๋ก ์ค์ฌ์ผ ํ์ต๋๋ค.
@wardpeet ์ด ๋ด repo Ward([email protected])๋ฅผ ์ด๋ฉ์ผ๋ก ๋ณด๋์ต๋๋ค. ์ด๋ป๊ฒ ๋๋์ง ์๋ ค์ฃผ์ธ์.
์ฐ๋ฆฌ ํ์ฌ๋ Wi-Fi๋ฅผ ๋ณ๊ฒฝํ๊ณ ๋์ญํญ์ ๋๋ ธ์ต๋๋ค. ์ค๋์ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค.... ํ์ง๋ง ์ฌ์ ํ ์ดํด๊ฐ ๋์ง ์์ต๋๋ค. ๋คํธ์ํฌ ๋๋ ๋์์ฑ์ ๋๊น?
๊ทธ๋ฌ๋ Netlify์ ๋ชจ๋ ๋น๋๋ ์คํจํฉ๋๋ค...
์คํ 5:13:43: === [ wordpress__wp_media ๊ฐ์ ธ์ค๊ธฐ ] === https://wildkiwi.com/wp-json/wp/v2/media
์คํ 5:13:43: ์ด ๊ฐ์ฒด ์: 1717
์คํ 5:13:43: ์์ฒญ ํ์ด์ง ์: 344
์คํ 5:13:45: "์ ์๋์ง ์์" ์ค๋ฅ ์ฝ๋๋ก ์์ฒญ์ด ์คํจํ์ต๋๋ค.
์ค๋ฅ ์ฝ๋๊ฐ ์ ์๋์ง ์์์ผ๋ฏ๋ก ๋ฌด์จ ์ผ์ด ์ผ์ด๋๊ณ ์๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค...
๋์ ์์ฒญ์ 5๋ก ๋ณ๊ฒฝํ๋ฉด Netlify์์ ์๋ํฉ๋๋ค.
๋ค๋ฅธ ํ๋ฌ๊ทธ์ธ(https://github.com/angeloashmore/gatsby-source-prismic)์์ ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ผ๋ฉฐ GATSBY_CONCURRENT_DOWNLOAD=50
์ค์ ์ด ํธ๋ฆญ์ ์ํํ์ต๋๋ค.
์ด๊ฒ์ ๊ฐ์๊ธฐ ์ผ์ด๋ ์ผ์ด๋ฉฐ(์ด๋ ๋ ๋ด ์ฌ์ดํธ๊ฐ ๊ตฌ์ถ๋๊ณ ๋ค์ ๋ ์ ๋ณ๊ฒฝ ์์ด) ์ด๋ค ์ข ๋ฅ์ ์ค๋ฅ ๋ฉ์์ง๋ ์์ด ํด๋ผ์ด์ธํธ๋ฅผ ์ํด ์น์ฌ์ดํธ๋ฅผ ๋ฐฐํฌํ๋ ๊ฒ์ด ์ฝ๊ฐ ๋นํฉ์ค๋ฝ์ต๋๋ค. ๋ค์๋ ์ผ์ด๋์ง ์์ ๊ฒ์ ๋๋ค.
๊ธฐ๋ณธ์ ์ผ๋ก ํ ๋ฒ์ 200๊ฐ์ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ์ง๋ง ์ผ๋ถ ์ปดํจํฐ/์ธํฐ๋ท ์ฐ๊ฒฐ์์๋ ๋ฌธ์ ๊ฐ ๋ ์ ์์ต๋๋ค. ์ข์ ํด๊ฒฐ์ฑ ์ ๋ช ๊ฐ์ง ์ฌ์๋ ๋ฉ์ปค๋์ฆ์ ๊ตฝ๋ ๊ฒ์ ๋๋ค.
์ด๋ฌํ ๋ฌธ์ ๊ฐ ์์์ง๋ง ๋ฌด๋ฃ ๋ฒ์ ์ https://๋ฅผ ์ฌ์ฉํ์ฌ setx GATSBY_CONCURRENT_DOWNLOAD 5; gatsby build
๋ฐ ๋ชจ๋ ์ด๋ฏธ์ง(์ผ๋ถ๋ ์น์์ ํ์ผ ํฌ๊ธฐ๊ฐ ๊ณผ๋ํ๊ฒ ํผ)๋ฅผ ์กฐํฉํ์ฌ ๋น๋๊ฐ ์ ๋๋ก ์๋ํ๋๋ก ํ์ต๋๋ค . en-gb.wordpress.org/plugins/wp-smushit/.
์ฌ๋ณด์ธ์! ๋ด๊ฐ ๋ง๋ค๊ณ ์๋ ์์ค ํ๋ฌ๊ทธ์ธ(WordPress์ ๊ด๋ จ ์์)์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ณ API์์ 1000๊ฐ ์ด์์ ์ด๋ฏธ์ง๋ฅผ ๋ค์ด๋ก๋ํ ๋ ๋ฐ์ํฉ๋๋ค. ๊ฑฐ์ ํญ์ ํ๋ก์ธ์ค๊ฐ ๋๋ ๋ ๋ฉ์ถฅ๋๋ค.
GATSBY_CONCURRENT_DOWNLOAD
์ค์ ํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค. 50
, 20
, 5
, ์ด์ด ์์์ต๋๋ค.
API์์ ํฌ๊ธฐ ๋ชจ์์ ๊ฐ์ ธ์ค๊ณ ๊ฐ์ฅ ํฐ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํ์ง๋ง ๊ฐ์ฅ ์์ ์ด๋ฏธ์ง๋ก ๋ณ๊ฒฝํ๋๋ฐ๋ ์์ ๋์ง ์์ต๋๋ค.
์ด ์์ ์์ ์คํจํ๋ ์ด์ ๋ฅผ ์๋ณํ๊ธฐ๋ ์ด๋ ต์ต๋๋ค. ๋ด๊ฐ ์ป๋ ์ ์ผํ ๊ฒ์ source and transform nodes
์ด๊ณ ์์ํ ์นจ๋ฌตํฉ๋๋ค.
์ด๋ฅผ ์ํ ๋๋ฒ๊น ๋ฉ์ปค๋์ฆ์ด ์์ผ๋ฉด ๊ต์ฅํ ๊ฒ์ ๋๋ค.
gatsby+wordress ํตํฉ์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค. createRemoteFileNode๋ฅผ ์ฌ์ฉํ๋ onCreateNode API์์ ๋น๋๊ฐ ์์ํ ์ค์ง๋ฉ๋๋ค.
์๋ฃจ์ : gatsby-source-filesystem์ 2.0.4์์ 2.1.8๋ก ์ ๋ฐ์ดํธํ๊ณ GATSBY_CONCURRENT_DOWNLOAD=50์ ํ๊ฒฝ ๋ณ์์ ์ถ๊ฐํ์ต๋๋ค.
์๋ ํ์ธ์ ๐
๋ด ํ๋ก์ ํธ์ ๋น์ทํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.17.3 - ~/.yarn/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
Browsers:
Chrome: 76.0.3809.100
Firefox: 68.0.1
Safari: 12.1.2
npmPackages:
gatsby: ^2.13.42 => 2.13.42
gatsby-cli: ^2.7.34 => 2.7.34
gatsby-image: ^2.2.14 => 2.2.14
gatsby-plugin-glamor: ^2.1.3 => 2.1.3
gatsby-plugin-manifest: ^2.2.4 => 2.2.4
gatsby-plugin-offline: ^2.2.4 => 2.2.4
gatsby-plugin-react-helmet: ^3.1.5 => 3.1.5
gatsby-plugin-sass: ^2.1.10 => 2.1.10
gatsby-plugin-sharp: ^2.2.9 => 2.2.9
gatsby-plugin-svg-sprite: ^2.0.1 => 2.0.1
gatsby-source-filesystem: ^2.1.18 => 2.1.18
gatsby-source-wordpress: ^3.1.12 => 3.1.12
gatsby-transformer-sharp: ^2.2.5 => 2.2.5
๋ด WP ์ฌ์ดํธ์ 80000๊ฐ ์ด์์ ๋ฏธ๋์ด๊ฐ ์์ต๋๋ค. npx gatsby develop
์คํํ ๋ "END PLUGIN" ์ดํ์ ๋ฉ์ถฅ๋๋ค.
...
=== [ Fetching wordpress__TAG ] === https://[WP_REST_API]/wp-json/wp/v2/tags
Total entities : 8805
Pages to be requested : 89
-> wordpress__TAG fetched : 8805
Fetching the wordpress__TAG took: 12408.827ms
โ
=== [ Fetching wordpress__wp_partners ] === https://[WP_REST_API]/wp-json/wp/v2/partners
-> wordpress__wp_partners fetched : 22
Fetching the wordpress__wp_partners took: 1268.292ms
โ
=END PLUGIN=====================================: 377120.512ms
โ ผ source and transform nodes
GATSBY_CONCURRENT_DOWNLOAD ๊ฐ์ ์์ ํ๋ ค๊ณ ํ์ง๋ง ์๋ฌด ๊ฒ๋ ๋ณ๊ฒฝ๋์ง ์์์ต๋๋ค.
๋ฏธ๋์ด ์๋ ๊ฐ์ ธ์ค๊ธฐ๋ฅผ ์ ํํ๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? ์๋ฅผ ๋ค์ด :
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images/uploads`,
limit: 50,
},
},
์ฌ๊ธฐ์๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์์ฒด ํธ์คํ WP์๋ 1690๊ฐ์ ๋ฏธ๋์ด๊ฐ ์์ต๋๋ค. ํญ์ ์๊ฒฉ ํ์ผ ๋ค์ด๋ก๋ ๋จ๊ณ๊ฐ ๋๋ ๋ ๋ฉ์ถฅ๋๋ค. ๋๋ก๋ ํ๋์ ๋ฏธ๋์ด๋ง ๋๋ฝ๋๋ ๊ฒฝ์ฐ๋ ์์ต๋๋ค...
ํธ์ง: ์ด๋ฒ์๋ GATSBY_CONCURRENT_DOWNLOAD=5 yarn build
๋น๋๊ฐ ์ฑ๊ณตํ์ต๋๋ค ...
@kvalium ๊ทํ์ ์๊ฒฌ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. GATSBY_CONCURRENT_DOWNLOAD=5 yarn build
๊ฐ) ์ ์๊ฒ ๋์์ด ๋์์ต๋๋ค.
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ ํฐ๋ฏธ๋ ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ต๋๋ค.
#4666์ ๋ํ ๋ง์ง๋ง ์๊ฒฌ์ ์ฐธ์กฐํ์ญ์์ค.
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๋ค. ๋๋ ๊ทธ๊ฒ์ ํด๊ฒฐํ๋ค :
rm -r node_modules/
rm -r .cache
sudo chown -R login:login .
fuser -k 8000/tcp
yarn
gatsby build
gatsby develop
๋์์ด ๋ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
์ด๊ฒ์ ๊ธฐ๋ฐํ ๋ฌธ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ์ด์ ๋ํ ๋ด ๊ฒฝํ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
GATSBY_CONCURRENT_DOWNLOAD=50 gatsby develop
์ฌ์ฉํ๊ธฐ ์์ํ๊ณ ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค(๋ช ์ฃผ ๋์ ๊ทธ๋ฌ์ต๋๋ค)2.7.47
์
๊ทธ๋ ์ด๋ํ ๋ค์ ๋ค์ ๋ฌธ์ ๋ฅผ ๋ณด๊ธฐ ์์ํ์ต๋๋ค(iTerm ์ฌ์ฉ)GATSBY_CONCURRENT_DOWNLOAD
๋ฅผ 5๋ก ๋ณ๊ฒฝํด ๋ณด์์ต๋๋ค..cache
๋ฐ node_modules
๋ ๋ ค๋ณด๋์ต๋๋ค.gatsby develop
๋ฅผ ์คํํ๋ ๋์ iTerm ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๋ ค๊ณ ํ์ต๋๋ค(50 ๋ฐ 5 ๋ชจ๋ ์ฌ์ฉ).GATSBY_CONCURRENT_DOWNLOAD=50 gatsby develop
ํ์ต๋๋ค.GATSBY_CONCURRENT_DOWNLOAD=50 gatsby develop
๋ฅผ ์ฌ์ฉํด ๋ณด์๊ณ ๊ทธ ๊ณผ์ ์์ ์ฐฝ ํฌ๊ธฐ๋ฅผ ๋ช ๋ฒ ์กฐ์ ํ๋๋ฐ ํจ๊ณผ๊ฐ ์์์ต๋๋ค.์ฑ๊ธํ๊ฒ ๋ด๊ฐ ๋ง์ง๋ง์ผ๋ก ์คํํ๊ณ ์๋ค๊ณ ์๊ฐํ์ง๋ง ์ค๋จ๋์์ต๋๋ค. ์ด๊ฒ์ด ๋ค๋ฅธ ์ฌ๋๋ค์๊ฒ ๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ์์ง ์ด๊ฒ์ด ์์ ํ ๊ณ ์ ๋์ง ์์ ๊ฒ ๊ฐ์ง๋ง ์ฐ๋ฆฌ๋ ์ฒ์ฒํ ๊ทธ๋ฌ๋ ํ์คํ๊ฒ ๊ฑฐ๊ธฐ์ ๋๋ฌํ๊ณ ์์ต๋๋ค.
์ ๋ฐ์ดํธ: ์ค๋ ์ด๊ฒ์ ๋๋ฅผ ์ํด ์ผํ์ต๋๋ค. ํ๋ก์ธ์ค์ ์ฌ๋ฐ๋ฅธ ์ง์ ์์ iTerm ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๊ธฐ ๋๋ฌธ์ธ์ง ์๋๋ฉด 93%์์ 100%๋ก ๊ฐ๋ ๊ฒ์ ๋ณด์์ง๋ง ์ด๋ฒ์๋ ๋ญ๊ฐ ๋ฌ๋์ต๋๋ค.
GATSBY_CONCURRENT_DOWNLOAD = 5๋ฅผ ์ถ๊ฐ๋ก ์ฌ์ฉํ๋ ค๋ฉด ๋ค์ ์ฝ๋๋ฅผ gatsby-node.js ํ์ผ์ ์ถ๊ฐํ์ธ์.
// ๊ตญ์ ํ
export.onPostBuild = () => {
ChildProcess.execSync("ps aux | grep jest | grep -v grep | awk '{print $2}' | xargs kill")
console.log('๋ก์ผ์ผ โโ๋ณต์ฌ')
fs.copySync(๊ฒฝ๋ก.join(__dirname, '/src/locales'), path.join(__dirname, '/public/locales))
}
์ฌ๋ฐ๋ฅธ ์ง์ ์์ iTerm ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๊ธฐ ๋๋ฌธ์ธ์ง ํ์คํ์ง ์์ต๋๋ค.
๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๋์ iTerm ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๊ณ bam - ๊ฐ์๊ธฐ ๊ณ์๋์์ต๋๋ค. ์ด๊ฒ์ด ์ฐ์ฐ์ ์ผ์น์ธ์ง, ์๋๋ฉด...
@bradydowling @davegregg ์์ฐ ๊ธฐ์ดํ ์ผ์ ๋๋ค. ๋ด iTerm ์ฐฝ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํ๋ ๊ฒ์ด ํธ๋ฆญ์ด์์ต๋๋ค.
@TylerBarnes ์ด๊ฒ์ด ๋ฌด์์ด๋ , ๋๋ ๊ทธ๊ฒ์ด Wordpress์ ๊ด๋ จ์ด ์๋ค๊ณ ์ ์ํฉ๋๋ค. Wordpress์ ๊ด๋ จ๋ ๊ฒ์ ์ ํ ์ฌ์ฉํ์ง ์์ต๋๋ค.
@beauhankins ์ด๋์?
@davegregg @beauhankins @bradydowling ์ด๋ฐ ์ผ์ด ์ผ์ด๋๋ ๊ณณ์์
@TylerBarnes ๋์ค์ ๋ด๊ฐ ๋ณด์๋ ์ ์ฅ์ ๊ฐ ์์ต๋๋ค. ๋๋ ๊ทธ๊ฒ์ ์กฐ๊ธ ๋ง์ง์ง ์์์ต๋๋ค.
์ฐธ๊ณ ์ฌํญ: ํ์ฌ CLI์์ ์ค์นํ ๊ฒ๋ณด๋ค ์ด์ ๋ฒ์ ์ Gatsby๋ก Gatsby ์ฌ์ดํธ๋ฅผ ๋ณต์ ํ๋ ์ํฉ์ ์ด๋ป๊ฒ ์ฒ๋ฆฌํฉ๋๊น?
๋๋ VS ์ฝ๋ ํฐ๋ฏธ๋์์ commends๋ฅผ ์คํํ๊ณ ์์์ต๋๋ค (๋๋ bash๋ฅผ ์ฌ์ฉํฉ๋๋ค). ๊ทธ๊ฒ์ ์์ํ ๊ฑธ๋ฆฌ๊ณ ์์์ ์ ์ํ๋๋ก ์ ์ฒด ํ๋ฉด ๋ชจ๋๋ฅผ ์ข ๋ฃํ๊ณ ์๋ํ์ต๋๋ค.
@bradydowling ๋ฆฌํฌ์งํ ๋ฆฌ ๋ฅผ ๊ณต์ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! cli๋ณด๋ค ์ด์ ๋ฒ์ ์ Gatsby๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๊ฐ๋ฐ ๋ฐ ๋น๋์ฉ npm ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
{
"scripts": {
"develop": "gatsby develop",
"build": "gatsby build"
}
}
๊ทธ๋ฐ ๋ค์ npm run develop
๋๋ yarn develop
ํ๋ฉด ํ๋ก์ ํธ์ ๋ก์ปฌ ๋ฒ์ ์ด ์ฌ์ฉ๋ฉ๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ์กฐ์ฌํ๊ณ ์์ง๋ง ๊ทธ ๋์์๋ ๋ฌธ์ ๊ฐ ์๋ ๋ชจ๋ ์ฌ๋์ด CI=1 yarn build
๋ฅผ ์คํํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ต๋๋ค. ์ด๋ ๋ฐฐํ์์ ๋ค๋ฅธ ๋ฆฌํฌํฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํด์ผ ํ๊ธฐ ๋๋ฌธ์
๋๋ค. ๋น์ ์ด ๊ทธ๊ฒ์ ์๋ํ๊ณ ์๋ํ๋ค๋ฉด ์ ํฌ์๊ฒ ์๋ ค์ฃผ์ญ์์ค!
@dustinhorton :
v2 ๋ฒ์ @ https://github.com/dustinhorton/gatsby-v2-issue. ์ด ์์ ์์ ์ฝ 50๋ถ ๋์ ๊ตฌ์ถํ์ต๋๋ค.
ํ์ฐ. ๋๋ ๊ทธ๊ฒ์ด ์ฝ 1 ๋
์ ์ ๊ฒ์๋์๋ค๋ ๊ฒ์ ์๊ณ ์์ผ๋ฉฐ ๊ทธ ์ดํ๋ก Gatsby๊ฐ ๋ง์ด ๋ณํ์ต๋๋ค. ๋ด ์ปดํจํฐ์์ ์คํํ ๋(๊ทธ๋ฆฌ๊ณ package.json์์ gatsby ๋ฒ์ ์ *๋ก ์ค์ ) ๋น๋๋ ์ฝ 2000์ด(~33๋ถ) ์์ ์๋ฃ๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ํ cli๋ฅผ ์
๊ทธ๋ ์ด๋ํ ๋ ๋ ๊ตฌ์ฒด์ ์ธ ํผ๋๋ฐฑ ๋ฃจํ๋ฅผ ์ป์ ์ ์๊ธฐ ๋๋ฌธ์ "๋๋"์ด ์ผ๋ง๋ ์ค๋ ๊ฑธ๋ฆฌ๋ ๋ฉด์์ ํฐ ์ฐจ์ด๋ฅผ ๋ง๋๋ ์งํ๋ฅ ํ์์ค์ด ์์ต๋๋ค.
์์ฑ ๋จ๊ณ๋ ๊ฑฐ์ ๋ชจ๋ ์๊ฐ(1968/1975์ด)์ด ๊ฑธ๋ฆฝ๋๋ค. ์๊ฒฉ ํ์ผ ๋ค์ด๋ก๋๋ ๊ทธ ์ค ๊ฐ์ฅ ๋ง์ ์๊ฐ(1845์ด)์ ๋๋ค.
์ด ์๋ฒ์ ๋ํ ๋จ์ผ ์๋ณต ์ฌํ์ ๋ณผ ๋ ์ด๊ฒ์ ๋๋ฅผ ๋๋ผ๊ฒ ํ์ง ์์ต๋๋ค.
# Starting requestInQueue, _concurrentRequests= 10
@ requestInQueue for 75 tasks { concurrent: 10 } { id: 'url' }
@ Fetch http://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media?per_page=100&page=4: 2587.339ms
@ Fetch http://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media?per_page=100&page=10: 2661.584ms
@ Fetch http://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media?per_page=100&page=8: 2695.937ms
@ Fetch http://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media?per_page=100&page=2: 2738.339ms
@ Fetch http://dustinhorton.com/gatsby-wp/wp-json/wp/v2/media?per_page=100&page=6: 2853.199ms
๊ฐ ์์ฒญ์๋ ์ฝ 2~4์ด๊ฐ ์์๋ฉ๋๋ค. ํ์ ์ค ์ฒ์์ ๊ฐ์ ธ์ค๋ 75ํ์ด์ง๋ ์ด 18์ด(!)๊ฐ ๊ฑธ๋ฆฝ๋๋ค. ๋๋ ๋น ๋ฅธ ์ฐ๊ฒฐ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ ์ผ๋ฐ wget์ผ๋ก ๊ทธ ํ์ด๋ฐ์ ์ฌํํฉ๋๋ค.
๋ฐ๋ผ์ ๊ฐ์ฅ ๊ธด ๋จ๊ณ๋ ์ฝ 7500๊ฐ์ ๋ฆฌ์์ค๋ฅผ ๋ค์ด๋ก๋ํ๋ ค๊ณ ํฉ๋๋ค. ๋จ์ผ ์์ฒญ์ 2~4์ด๊ฐ ๊ฑธ๋ฆฐ๋ค๋ ์ ์ ๊ณ ๋ คํ๋ฉด ๊ทธ๋ ๊ฒ ์ค๋ ๊ฑธ๋ฆฌ๋ ๊ฒ์ด ๋๋์ง ์์ต๋๋ค.
๊ทธ๋ผ์๋ ๋ถ๊ตฌํ๊ณ 1845์ด์ ๊ธฐ๋ณธ ๋ค์ด๋ก๋ ์คํธ๋ ์น ๋์ ์ฝ๊ฐ์ ์ผ์ ์ค์ง๊ฐ ๋ฐ์ํ์ต๋๋ค. ์ด๊ฒ์ด ๋ฐ์ดํฐ๋ฅผ ์กฐ์ ํ๋ ์๋ฒ์ธ์ง ์ฌ๋ถ๋ ํ์คํ์ง ์์ต๋๋ค(๋์์ฑ์ 5๋ก ์ค์ ํ์ต๋๋ค).
๋๋ ํฐ๋ฏธ๋์ ๋๋น๋ฅผ ํ๋ค๋ ค๊ณ ๋ ธ๋ ฅํ๊ณ (์ ๋ xfce linux, fwiw๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค) ๋๋๋ก ์งํ ์ํฉ๊ณผ ์ผ์นํ์ง๋ง, ์ง๊ธ์ ๊ทธ๊ฒ์ด ์ธ๊ณผ ๊ด๊ณ๋ณด๋ค ์ฐ์ฐ์ ์ผ์น์ ๊ฐ๊น๋ค๊ณ ํ์ ํฉ๋๋ค.
๊ฒฐ๋ก : ๋๋ฆฐ ๋ค์ด๋ก๋์ ๊ฒ๋ณด๊ธฐ์ "๋ฉ์ถค" ์งํ ์ํฉ์ ์ฌํํ ์ ์์ง๋ง ํ์ฌ ๋ชจ๋ ์งํ๋ ์๋ฒ ์๋ต์ ๊ธฐ๋ค๋ฆฌ๋ ๋ฐ์ ๊ธฐ์ธํ๋ค๋ ๊ฒ์ ๊ฐ๋ฆฌํต๋๋ค. ๋ํ ํฐ๋ฏธ๋ ๋๋น๋ ์ด๊ฒ์ ์ํฅ์ ๋ฏธ์น์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฆ, ๋งค์ฐ ํน์ ํ ๋๋น์์ ์งํ๋ฅ ํ์์ค์ ์ ๋ฐ์ดํธํ๋ ๋์ ํฐ๋ฏธ๋ ์ถ๋ ฅ์ด ์ด๋ป๊ฒ๋ ์ค๋จ๋ ๊ฐ๋ฅ์ฑ์ด ์์ต๋๋ค. ๊ฐ๋ฅ์ฑ์ ๋ฎ์ง๋ง ๋ถ๊ฐ๋ฅํ ๊ฒ์ ์๋๋๋ค. ๋ฐ๋ผ์ ์ฐ๋ฆฌ๋ ์ค์ค๋ก ์คํํ ์ ์๋ ์ฌํ์ด ํ์ํฉ๋๋ค(์ธ์ฆ ์์). ๊ทธ๋ฆฌ๊ณ ์๋ฒ๋ฅผ ๋ง์น๊ณ ์ถ์ง ์๊ธฐ ๋๋ฌธ์ ์๊ฒฉ ์๋ฒ์ ์์กดํ์ง _์์_ ๊ฒ์ด ๋ฐ๋์งํฉ๋๋ค.
์ด์ ๋ฐ๋ผ ์ด ๋ฌธ์ ์ ๋ํ ๋ ์ด๋ธ์ ์ ๋ฐ์ดํธํ๊ฒ ์ต๋๋ค.
@njmyers ๊ฐ https://github.com/gatsbyjs/gatsby/issues/6654#issuecomment -438667221์ ๊ฒ์ํ ๋ ํ๋ก ๋ ๋ ์ด์ ์กด์ฌํ์ง ์์ต๋๋ค.
@bradydowling ์ด https://github.com/gatsbyjs/gatsby/issues/6654#issuecomment -562607399์ ๊ฒ์ํ ๋ฆฌํฌ์งํ ๋ฆฌ ์๋
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=7: 25025.257ms
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=4: 27791.269ms
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=2: 37817.874ms
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=5: 38056.989ms
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=3: 38446.504ms
@ Fetch http://topazandsapphire.com/wp-json/wp/v2/media?per_page=100&page=6: 43799.842ms
์ด ์์ฑ ๋จ๊ณ๋ ์คํผ๋์ ๋๋๋ก ๋จ๊ณ๊ฐ ๊ธฐ๋ก๋๋ ๊ฒ์ ์ ์ธํ๊ณ ๋ ์งํ ํ์๊ธฐ๋ฅผ ์ค์ ๋ก ํ์ํ์ง ์์ผ๋ฉฐ ์ฌ์ ํ ๋ช ๋ถ์ด ๊ฑธ๋ฆฌ๋ฏ๋ก ์๋ฏธ๊ฐ ์๋ ๊ฒฝ์ฐ ์ต์ํ ์ผ์ข ์ ์งํ ํ์๊ธฐ๋ฅผ ํ์ํ ์ ์์ต๋๋ค.
๋ํ ๋ฆฌ์์ค๋ฅผ ๊ฐ์ ธ์ค๋ ํ๊ท ์๊ฐ์ ์ง์ ํ๋ ๊ฒ์ด ๋์์ด ๋ ์ ์์ต๋๋ค. ์ด๋ ์ค์ ๋ก ์๋ณต ์ฌํ์ผ๋ก ์ธํด "Gatsby"๊ฐ ๋๋ฆฐ ์ด์ ๋ฅผ ๋ํ๋ด๊ธฐ ๋๋ฌธ์ ๋๋ค.
์ด ๋ฆฌํฌ์งํ ๋ฆฌ์์๋ 589๊ฐ์ ์๊ฒฉ ํ์ผ์ ๋ค์ด๋ก๋ํ๋ ๋ฐ์๋ ์ฝ 5๋ถ์ด ๊ฑธ๋ ธ์ผ๋ฉฐ ์งํ๋ฅ ํ์์ค์ด ๋๋ ทํ ์ด์ ์์ด ๋ฉ์ถ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์์ต๋๋ค.
๋ถํธ์คํธ๋ฉ ํ ํ์ผ์ด ์๊ธฐ ๋๋ฌธ์ ๋น๋๊ฐ ์คํจํฉ๋๋ค.
@pvdz ๋๋ ์ด๊ฒ์ ๋ค์ ํ๋ ์ดํด์ผ ํ ๊ฒ์ ๋๋ค(์ ์ ํฌ๊ธฐํ์ต๋๋ค). ๊ทธ๋ฌ๋ ์ฑ๊ณต์ ์ผ๋ก ๋น๋๋๋๋ผ๋ ๊ถํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ํน์ ํ์ผ์ด ์์ผ๋ฏ๋ก ๋ฌด์ํ ์ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
ํ์ง๋ง ๊ฒ์๋ฌผ์ ์์ฝํ์๋ฉด ํน์ (๋ค์ด๋ก๋) ๋จ๊ณ๊ฐ ์ ๋ง ์ค๋ ๊ฑธ๋ฆฌ๊ณ ์๋ฃ๋ ๋๊น์ง ๋ ์ค๋ ๊ธฐ๋ค๋ ค์ผ ํ๋ค๋ ๋ง์์ด์ ๊ฐ์?
@bradydowling ๊ธ์์, ๊ทธ๋ ์ต๋๋ค. :)
FTR: ์์ ์์ง์ ์กฐ๊ธ ์ถ์ ํ์ต๋๋ค. ํ์ด๋ฐ์ ์ฝ๊ฐ์ ๋น์ ๋น์ถ๊ธฐ ์ํด;
Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6084.jpg: 15605.630ms
Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6036.jpg
Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6051.jpg: 6447.272ms
Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6034.jpg
Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6045.jpg: 6944.355ms
Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6029.jpg
Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6036.jpg: 6401.541ms
Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/01/IMG_6027.jpg
์ด๊ฒ๋ค์ 6MB ํ์ผ์ ๋๋ค. ๋๋ 250Mbs ์ฐ๊ฒฐ์ ์ฌ์ฉํ๊ณ ์๋๋ฐ 1mbs๋ณด๋ค ๋น ๋ฅธ ๊ฒ์ ์ ์ฒ๋ฆฌํ์ง๋ง ๋ค์ด๋ก๋ ์๊ฐ์ด ๋์ด๋๋ ๊ฒ์ ๋๋ผ์ด ์ผ์ด ์๋๋๋ค. cli ํฌ๊ธฐ ์กฐ์ ์ ์๋ฌด๋ฆฌ ๋ง์ด ํด๋ ์๋๊ฐ ๋นจ๋ผ์ง์ง๋ ์์ต๋๋ค. ;)
ํฅ๋ฏธ๋ก์ด. ์ด๊ฒ์ EC2์์ ํธ์คํ ๋๋ ํ์ค WordPress ๊ฐ์ธ ๋ธ๋ก๊ทธ์ด๋ฏ๋ก ๊ฑฐ๋ํ ์ค์น๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์๋ง๋ ์ด๊ฒ์ ์ด๋ฌํ ๋ชจ๋ ์์ฒญ์ด ํธ์คํธ์ ๊ณผ๋ถํ๋ฅผ ์ฃผ๊ธฐ ๋๋ฌธ์ผ ๊ฒ์ ๋๋ค. ๋๋ ์ ๋ WordPress ์ ๋ฌธ๊ฐ๊ฐ ์๋์ง๋ง ๋ฐ์ํ ์ ์๋ REST API ํธ์ถ์ ์ผ์ข ์ ํ์ค WP ์๋ ์ ํ์ด ์์ต๋๊น? ๋๋ ๋ํ ์ด ๋์์ด ์ด ์ฌ์ดํธ์์๋ง ๋ฐ์ํ๋ ๊ฒ์ด ์๋๋ผ๋ ๊ฐ์ ํ์ ์งํํฉ๋๋ค.
์๋ง๋ ์ด๊ฒ์ ์ด๋ฌํ ๋ชจ๋ ์์ฒญ์ด ํธ์คํธ์ ๊ณผ๋ถํ๋ฅผ ์ฃผ๊ธฐ ๋๋ฌธ์ผ ๊ฒ์ ๋๋ค.
์ด๊ฒ์ ๋ด ์ถ์ธก(๋๋ ์ด ์ผ๊ตฌ์ฅ์ ์๋ ๊ฒ)์ ๋๋ค. ํ์ง๋ง ์ถ์ํ๋ฅผ ํตํด ํจ์จ์ฑ์ด ๋จ์ด์ง๊ณ ์๋์ง ํ์ธํ๊ธฐ ์ํด ์์ฒด ์ํคํ ์ฒ๋ฅผ ์ฝ๊ฐ ํ์ํ๊ณ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ผ๋ฐ wgets/curls๋ก ๋ณด๊ณ ๋ ๋๋ถ๋ถ์ ์๊ฐ์ ๋ชจ๋ฐฉํ ์ ์๋ค๋ ๊ฒ์ ๊ณ ๋ คํ๋ฉด ๊ฑฐ๊ธฐ์ ๋ง์ ๊ฒ์ด ์๋์ง ์์ฌ๋ฉ๋๋ค.
๊ทธ๋์ fwiw got.stream()
๋นํธ๋ฅผ ๋ฉ์ฒญํ ์์ ๋ค์ด๋ก๋๋ก ๋ฐ๊ฟจ์ต๋๋ค.
let r = ""
require("http").get(url, res =>
res
.on("data", m => (r += m))
.on("end", () => {
console.timeEnd("$$ Fetch time for " + url)
resolve(r)
})
)
$ Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/05/IMG_5260.jpg
$$ Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/09/TRAVEL-LEISURE-2-copy.png: 1003.535ms
$ Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/05/International-Travel-Topaz-Sapphire.png
$$ Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/09/IMG_4606.jpg: 3174.126ms
$ Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/05/Brunch-Topaz-Sapphire-2.png
$$ Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/09/IMG_4647.jpg: 9521.157ms
$ Started actually fetching http://topazandsapphire.com/wp-content/uploads/2016/05/IMG_6978.jpg
$$ Fetch time for http://topazandsapphire.com/wp-content/uploads/2016/05/International-Travel-Topaz-Sapphire.png: 3611.910ms
์, ๊ธด ์ง์ฐ(์ ์ด๋ ์ด ๊ฒฝ์ฐ์๋)์ด ๋ค์ด๋ก๋๋ก ์ธํด ๋ฐ์ํ๋ค๊ณ ํ์ ํฉ๋๋ค. ๋ฐ๋ผ์ ์๋ง๋ ์ฐ๋ฆฌ์ ์ต์ ์ ๋ฐฉ๋ฒ์ ๋ค์ด๋ก๋๋ฅผ ๊ธฐ๋ค๋ฆฌ๋ ๋์ ํผ๋๋ฐฑ์ ๊ฐ์ ํ๋ ๊ฒ์ ๋๋ค. :)
๋ง์ ์ฌ๋๋ค์ด ํฐ๋ฏธ๋ ์ฐฝ ํฌ๊ธฐ ์กฐ์ (์ด์ํ ์ด์ ๊ฐ ๋ฌด์์ด๋ )์ด '์์ค ๋ฐ ๋ณํ ๋ ธ๋'์ ๊ฐํ ๊ฐ๋ฐ ํ๋ก์ธ์ค๋ฅผ ํด๊ฒฐํ๋ค๊ณ ๋งํฉ๋๋ค.
์ฌํ๊ฒ๋ WSL์ ์ฌ์ฉํ ๋ ์ด๊ฒ์ ์๋ฃจ์ ์ด ์๋๋๋ค. ๋น๋ ๋ฐ ๊ฐ๋ฐ์์ ๋ก์ปฌ๋ก '์์ค ๋ฐ ๋ณํ ๋ ธ๋'๊ฐ ๋ฉ์ถฅ๋๋ค. Netlify ๋น๋๋ ์๋ํ์ง๋ง ๋ก์ปฌ ๊ฐ๋ฐ์ด ๋ถ๊ฐ๋ฅํด์ก์ต๋๋ค.
@Vacilando ์์ฑ ์ค์ ์ฌ์ดํธ์ ๋ค์ด๋ก๋๋๋ ์ผ๋ถ ๋งํฌ๋ฅผ ๋๋ฒ๊น ํ๊ณ ๋ค์ด๋ก๋๊ฐ ๋น ๋ฅธ์ง ์๋์ผ๋ก ํ ์คํธํ ์ ์์ต๋๊น? ์์์ ์ธ๊ธํ๋ฏ์ด ๋ด๊ฐ ๋ณด๊ณ ์๋ ํ ๊ฐ์ง ํฐ ๋ฌธ์ ๋ ํน์ wp ํธ์คํธ๊ฐ ๋จ์ํ ์์ฒญ๋๊ฒ ๋๋ฆฌ๋ค๋ ๊ฒ์ ๋๋ค.
๋ฐ๋ผ์ ํธ์คํธ๊ฐ ๋๋ฆฌ๊ณ ๋ค์ด๋ก๋ํ ์ฝํ ์ธ ๊ฐ ๋ง์ ๊ฒฝ์ฐ ์ด ๋จ๊ณ์์ ์ํํด์ผ ํ๋ ์์ ์ ์ ๋ถ์ด๋ฏ๋ก ์ด ๋จ๊ณ์ ๋ง์ ์๊ฐ์ด ์์๋ฉ๋๋ค. ์ฝํ ์ธ ๋ฅผ ๋ฐ๊ฒฌํ๊ณ ๋ค์ด๋ก๋ํ์ธ์ :)
์ ์ฒด ๋จ๊ณ์ ์ผ๋ถ๋ง ์ฝํ ์ธ ์์ฒด๊ฐ ๋ค์ด๋ก๋๋์์์ ํ์ธํ ๊ฒฝ์ฐ ์ฌ๊ธฐ๋ก ๋ค์ ๋๊ทธ๋ผ๋ฏธ๋ฅผ ์น์ญ์์ค. ์ด ๊ฒฝ์ฐ repro๋ ์์ฒญ๋๊ฒ ๋์์ด ๋ ๊ฒ์ ๋๋ค :)
์๋ง๋ ์ด์์ ์ธ ์ธ๊ณ์์๋ ์บ์ํ ํ๋๊ทธ๋ฅผ gatsby์ ์ ๋ฌํ ์ ์์ต๋๋ค.
๋ฐ๋ณต์ ์ผ๋ก ์ํํ ํ์๊ฐ ์๋๋ก ์ฌ์ดํธ ์์ฐ ๋ค์ด๋ก๋.
๋ ๋ค๋ฅธ ์ต์ ์ ์๋ฃจ์
์ ์ผ์ข
์ ํ๋๊ทธ๋ฅผ ์ค์ ํ๋ ๊ฒ์
๋๋ค.
์์ฐ ๋ค์ด๋ก๋ ์ ์๋ ์ ํ ๋๋ ์ค๋กํ๋ง์ ํตํด ์ค๋จ๋์ง ์์
์ฃผ์ธ.
์ด ๋ ๊ฐ์ง ์์ด๋์ด์ ๋ํ ์๊ฐ์ด ์์ต๋๊น?
2019๋
12์ 19์ผ ๋ชฉ์์ผ ์คํ 6:09 Peter van der Zee [email protected]
์ผ๋ค:
@Vacilando https://github.com/Vacilando ์ผ๋ถ ๋งํฌ๋ฅผ ๋๋ฒ๊น ํ ์ ์์ต๋๊น?
์์ฑ ๋ฐ ํ ์คํธ ์ค์ ์ฌ์ดํธ์ ๋ํด ์๋์ผ๋ก ๋ค์ด๋ก๋ ์ค์ ๋๋ค.
๊ทธ๋ค์ด ๋นจ๋ฆฌ ๋ค์ด๋ก๋ํ๋์ง ์ฌ๋ถ? ์์์ ์ธ๊ธํ๋ฏ์ด ํ ๊ฐ์ง ํฐ ๋ฌธ์ ๋
ํน์ wp ํธ์คํธ๊ฐ ๋จ์ํ ์์ฒญ๋๊ฒ ๋๋ฆฌ๋ค๋ ๊ฒ์ ์ ์ ์์ต๋๋ค.๋ฐ๋ผ์ ํธ์คํธ๊ฐ ๋๋ฆฌ๊ณ ๋ค์ด๋ก๋ํ ์ฝํ ์ธ ๊ฐ ๋ง๋ค๋ฉด ์
์ด ๋จ๊ณ๋ ์ํํด์ผ ํ๋ ๋ชจ๋ ์์ ์ด๋ฏ๋ก ์๊ฐ์ด ๋ง์ด ๊ฑธ๋ฆฝ๋๋ค.
์ด ๋จ๊ณ; ์ฝํ ์ธ ๋ฅผ ๋ฐ๊ฒฌํ๊ณ ๋ค์ด๋ก๋ํ์ธ์ :)์ฝํ ์ธ ์์ฒด๊ฐ
์ฌ๊ธฐ๋ก ๋ค์ ์์ ๊ทธ๋ฆฌ์ญ์์ค. ์ด ๊ฒฝ์ฐ ์ฌํ์
์์ฒญ๋๊ฒ ๋์์ด ๋ฉ๋๋ค :)โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/gatsbyjs/gatsby/issues/6654?email_source=notifications&email_token=ABS4AU62367MTEWP7LJXWTLQZP5L5A5CNFSM4FLHT3T2YY3PNVWWK3TUL52HS4DFWEXG43VMV
๋๋ ๊ตฌ๋ ์ทจ์
https://github.com/notifications/unsubscribe-auth/ABS4AU7GCV4YMZQH6R37BSDQZP5L5ANCNFSM4FLHT3TQ
.
@bradydowling ๋ถ๋ถ์ ์ด๋ฏธ ์ค์ ๋ก ์กด์ฌํฉ๋๋ค. ํ๊ฒฝ ๋ณ์ GATSBY_CONCURRENT_DOWNLOAD
๋ฅผ ์ค์ ํ์ฌ ๋์ ์์ฒญ์ ๋ํ ์ ํ์ ๊ตฌ์ฑํ ์ ์์ต๋๋ค. gatsby-source-wordpress
https://github.com/gatsbyjs/gatsby/issues/19292 ์ ๋ค์ ์ฃผ์ ๋ฒ์ ์ ๋ฏธ๋์ด ํ์ผ ๋ค์ด๋ก๋ ๋ฐฉ๋ฒ์ ๋ ์ ์ ์ดํ ๊ฒ์
๋๋ค. ์บ์ฑ์ ๊ฒฝ์ฐ ํ์ฌ ๋ค์ด๋ก๋๋ ํ์ผ์ด ์บ์ฑ๋์ด ์์ง๋ง gatsby-*.js ํ์ผ์ ๋ณ๊ฒฝํ๋ฉด ํ์ฌ ์บ์ฌ๋ฅผ ์ง์์ stale ์บ์ฌ๋ก ์ธํด ์์์น ๋ชปํ ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค. ๋ฐ๋ผ์ gatsby-source-wordpress
๊ตญํ๋์ง ์๊ณ ํต์ฌ ๋ฌธ์ ์ด์ง๋ง Gatsby์ ์บ์๋ฅผ ๊ฐ์ ํ๊ธฐ ์ํ ์์
์ด ํญ์ ์ํ๋๊ณ ์์ต๋๋ค.
๋ถ๋ถ์ ์ผ๋ก Jobs Api(#19831)๊ฐ ์ด ์บ์ฑ ๋ฌธ์ ๋ฅผ ์์ ํด์ผ ํฉ๋๋ค.
์, ์๋จ์ GATSBY_CONCURRENT_DOWNLOAD
๊ฐ๊น์ด ์๋ ๊ฒ์ ๋ณด์์ต๋๋ค. ๋ด ๊ฒฝํ์ผ๋ก๋ ๋์์ด ๋์ง ์์์ผ๋ฏ๋ก ๋ด ์ ์์ mb/s/m/h ๋๋ ์ด์ ์ ์ฌํ ๊ฒ๊ณผ ๊ฐ์ด ๋ณด๋ค ์ธ๋ถํ๋ ์ ์ด๋ฅผ ์ํ ๊ฒ์ด์์ต๋๋ค. ๊ทธ๋ฅ ๋ง๋ ์๋๋ ์๋ฆฌ๋ฅผ ํ๊ณ ์๋์ง๋ ๋ชจ๋ฆ
๋๋ค.
@bradydowling ์ง์ ๋ฐฑ์คํ๋ฅผ ์ฌ์ฉํ์ฌ ์์ฒญ ์ฌ์๋๋ฅผ ์ถ๊ฐํ๊ณ ์ ๋๋ก ์๋ํ์ง ์๋ ๊ฒฝ์ฐ ์ด๋น ์ต๋ ์์ฒญ์ ๋ํ ์ ํ์ ์ค์ ์ ์ถ๊ฐํ๋ ค๊ณ ํฉ๋๋ค.
ํ์ผ!
์ด ๋ฌธ์ ๋ ์ ์ ํด์ก์ต๋๋ค. ์ผ์ค์คํ ์กฐ์ฉํจ. ๐ป
๋ง์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ ํ์ฌ 30์ผ ๋์ ํ๋์ด ์์ผ๋ฉด ๋ฌธ์ ๋ฅผ ์ข
๋ฃํฉ๋๋ค. ๋ง์ง๋ง ์
๋ฐ์ดํธ ์ดํ๋ก ์ต์ 20์ผ์ด ์ง๋ฌ์ต๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ๋์ณค๊ฑฐ๋ ๊ณ์ ๊ณต๊ฐํ๊ณ ์ถ๋ค๋ฉด ์ฌ๊ธฐ์์ ํ์ ํด ์ฃผ์ธ์. ์ด ๋ฌธ์ ๋ฅผ ๊ณ์ ๊ณต๊ฐํ๊ธฐ ์ํด "not stale" ๋ ์ด๋ธ์ ์ถ๊ฐํ ์๋ ์์ต๋๋ค!
์น์ ํ ์๋ฆผ์ผ๋ก ์ด ๋ฌธ์ ๋๋ ํด๊ฒฐ๋ ๋ค๋ฅธ ๋ฌธ์ ๋ฅผ ํ์ธํ๋ ๊ฐ์ฅ ์ข์ ๋ฐฉ๋ฒ์ ๋์ด์ค๊ธฐ ์์ฒญ์ ์ฌ๋ ๊ฒ์
๋๋ค. PR ์์, ๋ฌธ์ ๋ถ๋ฅ ๋ฐ ๊ธฐ์ฌ์ ๋ํ ์์ธํ ๋ด์ฉ์ gatsby.dev/contribute ๋ฅผ ํ์ธํ์ญ์์ค!
Gatsby ์ปค๋ฎค๋ํฐ์ ์ผ์์ด ๋์ด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๐ช๐
๋๋ ์ง๊ธ ์ด๊ฒ์ ๋ซ์ ๊ฒ์ด๋ค.
์๋ํ๋ ์ค ์์ฑ ๋ฌธ์ ๊ฐ ์๋ค๊ณ ์๊ฐ๋์๋ฉด ๋จผ์ ์๋ํ๋ ์ค ์๋ฒ๊ฐ ๋๋ ค์ ์ง์ฐ์ด ๋ฐ์ํ์ง ์๋์ง ํ์ธํ์๊ธฐ ๋ฐ๋๋๋ค. ๊ทธ๋ฐ ๋ค์ _new_ ๋ฌธ์ ๋ฅผ ์ฌ์ญ์์ค(๋จ, ์ด ๋ฌธ์ ์ ๋ํด ๋ค์ ์ธ๊ธํด ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค).
๋๊ธ ์๊ฐ ๋ง์ผ๋ฉด ํ ๋ก ์ ์ถ์ ํ๊ธฐ๊ฐ ๋งค์ฐ ์ด๋ ต์ต๋๋ค. ๋ฐ๋ผ์ ์ ๋ฌธ์ ๋ฅผ ์ด๋ฉด ํน์ ๋ฌธ์ ๊ฐ ๋ต์ ์ป์ ๊ฐ๋ฅ์ฑ์ด ๋ ๋์์ง๋๋ค.
๋์ ๋ค๋ฅธ ์ฌ๋๋ค์ ์ง๋ 1๋ ๋ฐ ๋์ ๊ทธ๊ฒ์ ํ์ธํ๋ค. ๋ด ์๋ ๋ฌธ์ ๋ ์ ์กฐ์ ๋ vps์ ์์์ต๋๋ค. @njmyers ๋ ์์ ๋๋ ์ต์ํ ๊ฐ์ ์ฌํญ์ด ์์์ง๋ง ์ ์ง ๊ด๋ฆฌ์๋ก๋ถํฐ ์ํ๋ ๋ฐฉ์์ ๋ํ ๋ต๋ณ์ ์ป์ ์ ์์์ต๋๋ค.
๋๋ ๋ ์์ ์ ๋ซ๋ ๊ฒ์ ๋ํด ์๊ฐํ์ง๋ง ์ ๋นํ ํฐ WordPress ์ฌ์ดํธ๋ ์์ง gatsby์ ์ ํฉํ์ง ์๋ค๋ ๊ฒฝ๊ณ ๋ก ๊ฑฐ๊ธฐ์ ์์ด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
@dustinhorton ์ดํดํฉ๋๋ค. ์ด ๋ฌธ์ ๋ 1๋ ๋ฐ์ด ๋์์ผ๋ฉฐ ์ํฉ์ด ๋น ๋ฅด๊ฒ ๋ณํฉ๋๋ค. ์ด๋งํผ ๋ง์ ๋๊ธ์ด ๋ฌ๋ฆฐ ๋ฌธ์ ๋ก ์ธํด ๋ ์ด์ ์ค์ ๋ฌธ์ ๋ฅผ ํ์ ํ๊ธฐ๊ฐ ์ด๋ ต์ต๋๋ค.
์์์ ์ธ๊ธํ๋ฏ์ด Fwiw๋ ๋ง์ง๋ง์ผ๋ก๋ณด๊ณ ๋ ์ฌํ์ ํ์ธํ๊ณ ์ต์ํ ๋๋ฆฐ ์๊ฒฉ์ผ๋ก ์ธํ ๊ฒ์ด๋ผ๊ณ ๊ฒฐ์ ํ์ต๋๋ค. ๋น ๋ฅธ ๋ฆฌ๋ชจ์ปจ์ ํ์ฌ Gatsby ๋ฆด๋ฆฌ์ค์ ๋ํ ์ฌํ์ด ์๋ ๊ฒฝ์ฐ ์ด ์ค๋ ๋์ ์ด๋ฏธ ๊ฒ์๋์ด ์๋๋ผ๋ ์๋ ค์ฃผ์ธ์. ๋๋ ๊ทธ๊ฒ์ ๋ํ ์๋ก์ด ๋ฌธ์ ๋ฅผ ์ด๊ณ (๋์๊ฒ ํ๊ทธ๋ฅผ ์ง์ ) ๋ ์ง์คํ๊ณ ์ถ๋ค๋ฉด ๋น์ ์๊ฒ ๋งก๊ธฐ๊ฒ ์ต๋๋ค. :)
(_๋ถ๋ช ํ ํ์๋ฉด, ๋๋ฌด ๋ง์ ์ฃผ์ ์์ ๋ฒ์ด๋ ๋ฉ์์ง๋ก ์ธํด ๋ฌธ์ ๊ฐ ์กฐ๊ธ ์ง๋ถํด์ ธ์ ์ด ๋ฌธ์ ๋ฅผ ๋ซ์์ต๋๋ค. ์ฐ๋ฆฌ๊ฐ ํ ๋ก ์ ๋ถ์๊ณ ์๋ค๊ณ ์๊ฐํ์ง ๋ง์ญ์์ค. ์ด๋ ์๋๊ฐ ์๋๋ฉฐ ์ฐ๋ฆฌ ์์ ์ด ์ฌ๊ธฐ์ ๋๋์ง ์์์์ ์ธ์ํฉ๋๋ค. !_)
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋ค, ๋ฌธ์ ๋ ์ค์ ๋ก
createRemoteFileNode
๊ฐ ๋๋ถ๋ถ์ WP ์๋ฒ์ ๋๋ฌด ๋ง์ 200์ ๋์์ฑ์ ์ฌ์ฉํ๋ค๋ ์ฌ์ค์ ๊ธฐ๋ฐํฉ๋๋ค. CloudFront์ ๋ด ์ด๋ฏธ์ง๊ฐ ์๊ณ ๊ฑฐ๊ธฐ์์ ์ผ๋ถ ์๋ ์ ํ์ ๋๋ฌํ์ต๋๋ค.๋๋ ์ ์ ๋์ ์์ค ํ๋ฌ๊ทธ์ธ์ ๋ถ๊ธฐ ๋ฒ์ ์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๊ณ ์๋ํ์ง๋ง ๋ฌธ์ ๋ ์ค์ ๋ก
gatsby-source-wordpress
์์ง ์๊ณgatsby-source-filesystem
์์ต๋๋ค. ์ด์์ ์ผ๋กcreateRemoteFileNode
ํจ์์ ์๋น์๋ ๊ฑฐ๊ธฐ์์ ๋์์ฑ์ ์ ๋ฌํ ์ ์์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ํ๋ฌ๊ทธ์ธ์ ๊ตฌ์ฑ์์ ๋์์ฑ ์ต์ ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋๋ ์ฌ์ ํ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด PR์ ํ๊ณ ์ถ์ต๋๋ค!๋ด๊ฐ ์ฌ์ฉํ ์๋ฃจ์ ์
node_modules
๋ด๋ถ์ ์ฝ๋๋ฅผ ์์ ํ๋ ๊ฐ๋จํ ์คํฌ๋ฆฝํธ์ ๋๋ค. ์ค์ ๋ก ๋งค์ฐ ์ทจ์ฝํ๊ณ ์ด์์ ์ด์ง๋ ์์ง๋ง ๋์์ฑ์ ์ง์ ์์ ํ๋ ๊ฐ๋จํ ํดํน์ ๋๋ค.shelljs
ํ๋ฏ๋ก Windows ์ฌ์ฉ์์๊ฒ๋ ์๋ํ๋๋ก ๋์ด ์์ต๋๋ค(์๋ํ์ง ์์).