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

Broken doc site builds should break CI #880

Open
kale-stew opened this issue Apr 15, 2020 · 2 comments
Open

Broken doc site builds should break CI #880

kale-stew opened this issue Apr 15, 2020 · 2 comments

Comments

@kale-stew
Copy link
Contributor

Currently, react-static can build an empty or broken public dir and CI will still pass as if it successfully deployed that broken build.

@ryan-roemer
Copy link
Member

ryan-roemer commented Apr 20, 2020

Some quick research. Probably should wrap up more concisely in a PR or issue upstream.

Starting point:

// static.config.js
throw new Error("HI");

This produces an error but doesn't exit non-zero. Inspecting things, the init() call (see below) exits successfully without hitting the try/catch.

Then directly in source edit node_modules/react-static/bin/react-static:

Take this section at the top: https://github.com/react-static/react-static/blob/master/packages/react-static/bin/react-static#L5-L10

try {
  init()
} catch (e) {
  console.trace(e)
  process.exit(1)
}

cut it out, move it to the bottom of the file like this:

(async () => {
  try {
    await init()
    console.log("TODO RS INIT SUCCESSFUL");
  } catch (e) {
    console.log("TODO RS CAUGHT");
    console.trace(e)
    process.exit(1)
  }
  console.log("TODO RS INIT DONE");
})();

And change init's definition to async function init() { /* ... */ }

Now, the debugging statements show that we don't get to TODO RS INIT SUCCESSFUL and do trip TODO RS CAUGHT and we exit non-zero as expected.

@ryan-roemer
Copy link
Member

It looks like react-static may have fixed this here: react-static/react-static#1451

AFAICT it’s presently only in master https://github.com/react-static/react-static/blob/master/CHANGELOG.md but as soon as that releases we should definitely update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants