Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(build): use react-static for prerender #2925

Merged
merged 82 commits into from
Jul 24, 2018
Merged

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jun 19, 2018

Fixes #2826.

Oleksandr Fediashov added 11 commits June 19, 2018 15:51
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Oleksandr Fediashov added 18 commits June 20, 2018 10:01
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Oleksandr Fediashov added 3 commits July 5, 2018 19:25
Oleksandr Fediashov added 2 commits July 6, 2018 14:08
…React into chore/react-static

Signed-off-by: Oleksandr Fediashov <[email protected]>

# Conflicts:
#	docs/src/views/Introduction.js
#	docs/src/views/Layouts.js
#	docs/src/views/PageNotFound.js
#	docs/src/views/Theming.js
#	docs/src/views/Usage.js
#	gulp/tasks/docs.js
Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter layershifter changed the title [WIP] docs(build): use react-static for prerender docs(build): use react-static for prerender Jul 6, 2018
Oleksandr Fediashov added 3 commits July 6, 2018 14:34
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter
Copy link
Member Author

It's finally ready! ✌️

Testing

Develop build

yarn start

Staging build
  1. Update docs.js
-build().then(cb)
+build({ staging: true }).then(cb)
  1. yarn build
  2. yarn serve docs/dist

@layershifter
Copy link
Member Author

/cc @levithomason

@levithomason
Copy link
Member

👍 pushed a fix to .gitignore for the /tmp directory
👍 The development workflow with yarn start works OK

⛔️ Changing docs.js to build({ staging: true }) and running yarn build produces this error:

[12:43:17] Starting 'build:docs:static:build'...

ReferenceError: regeneratorRuntime is not defined
    at Object.<anonymous> (static.routes.js:28:1)
    at Module._compile (module.js:652:30)
    at Module._compile (node_modules/pirates/lib/index.js:91:24)
    at Module._extensions..js (module.js:663:10)
    at Object.newLoader [as .js] (node_modules/pirates/lib/index.js:96:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

(node:31600) UnhandledPromiseRejectionWarning:
    TypeError: Cannot read property 'DIST' of undefined
    at _callee$ (node_modules/react-static/lib/commands/build.js:73:58)
    at tryCatch (node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next]
        (node_modules/regenerator-runtime/runtime.js:117:21)
    at step (node_modules/react-static/lib/commands/build.js:31:191)
    at node_modules/react-static/lib/commands/build.js:31:437
    at new Promise (<anonymous>)
    at node_modules/react-static/lib/commands/build.js:31:99
    at build (node_modules/react-static/lib/commands/build.js:165:17)
    at gulp/tasks/docs.js:60:3

(node:31600) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
             This error originated either by throwing inside of an async function
             without a catch block, or by rejecting a promise which was not handled
             with .catch(). (rejection id: 2)

(node:31600) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
             In the future, promise rejections that are not handled will terminate the
             Node.js process with a non-zero exit code.

[12:43:17] The following tasks did not complete:
           build, <parallel>, build:docs, build:docs:static:build

[12:43:17] Did you forget to signal async completion?

I debugged this for a bit but could not get anywhere.

@layershifter
Copy link
Member Author

@levithomason React-Static forces the usage regeneratorRuntime. However, I think we don't need it for our builds. So this configured with NODE_ENV, ref.

It seems that I've forgotten to update package.json, because I've tested with yarn prerelease.
Pushed a small commit with an update, my fault 😼

Signed-off-by: Oleksandr Fediashov <[email protected]>
Oleksandr Fediashov added 3 commits July 23, 2018 17:43
…React into chore/react-static

Signed-off-by: Oleksandr Fediashov <[email protected]>

# Conflicts:
#	docs/src/components/ComponentDoc/ComponentDoc.js
#	docs/src/layouts/index.js
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter
Copy link
Member Author

@levithomason resolved merge conflicts 👍

@levithomason levithomason merged commit a2cc3a7 into master Jul 24, 2018
@levithomason levithomason deleted the chore/react-static branch July 24, 2018 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants