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

Fix jest noop, upgrade to Babel 7, use Yarn Workspaces, add create-razzle-app tests #519

Closed
wants to merge 23 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 20, 2018

Changes

  • Upgrade to Babel 7 (closes Start migrating to babel 7.x #462, closes Migrate to Babel 7.x #464) (9ad42ac, de27f1f, d12ced3)
    • While keeping and extending babel-preset-razzle instead of using babel-preset-react-app.
      • It now supports options to pass to preset-env and preset-react instead of having them opaque and incurring in a full-blown manual configuration for minor tweaks (e.g., disabling async transforms or using target.browsers) (not tested yet).
    • Add support for .babelrc.js (994cf40)


  • Add yarn init:bin requirement for examples that depend on locally-compiled binaries (e8bd5f1)
    • Such as BuckleScript, which was slowing down install time significantly (due to bs-platform devDependency within with-reason-react)
    • When a package that compiles locally is added directly to devDependencies, yarn install performs an unnecessary, expensive operation. npm/yarn run init:bin bootstraps these requirements in userland via create-razzle-app, which was updated to handle the change.
    • with-elm and with-reason-react were updated with custom "pkg.init:bin"
    • CONTRIBUTING.md was updated accordingly
  • Refactor create-razzle-app to allow testing with local examples (e8bd5f1)
    • It was hardcoded to retrieve examples from origin; this made it impossible to test it with local changes without merging.
  • Add create-razzle-app tests (to also cover yarn init:bin) (0b1c71e)
  • Use CRA-like config/polyfills in createJestConfig (as per Start migrating to babel 7.x #462 (comment)) (a45375d, c5e90c4)

Fixes

Yarn Workspaces Caveats

Caveats


  • All tests passing.
  • All commits referenced.
  • Document babel-preset-razzle preset-env and preset-react options.
  • Document usage with Yarn Workspaces and remove yarn bootstrap and yarn clean mentions.
  • Document all caveats for contributors.

William Esz added 23 commits February 19, 2018 03:29
Instead of inline options.
It wasn't running tests. `jest.config.json` was not being used. I have not been able to figure out why, but it works without `--config`.
babel-preset-razzle was adjusted to CRA and extended to accept options for both `@babel/preset-env` and `@babel/preset-react`, to exclude generator and async transforms accordingly.

`@babel/preset-env` options are divided in `envTest` and `envRest` to allow more control over the Node environment when testing.
Removes manual linking and direct bootstrapping with Lerna in favor of Yarn Workspaces. See facebook/create-react-app#3755.

Before using Yarn Workspaces, tests were not passing because of an error similar to babel/babel#7110; it seems it was related to conflicting babel-core (see babel/babel#7110 (comment)) since we are using Jest which depends on babel-core 6 and needs babel-core 7-bridge to work.

Issues disappear with Yarn Workspaces and tests are passing.
Some packages may require compilers. Some, like BuckleScript's, are compiled locally. When added directly to `devDependencies`, internal `yarn install` performs an unnecessary, expensive operation. Therefore,`npm/yarn run init` bootstraps these requirements in userland.

Moreover, Yarn Workspaces reinstalls all packages on `add` (yarnpkg/yarn#4980) and having these dependencies within `devDependencies` meant that binaries where redownloaded and recompiled every time.
Other than testing some of create-razzle-app's surface, we ensure that `yarn init:bin` is working correctly.
Due to `yarn format` failing on `yarn add razzle`.
@olehreznichenko
Copy link
Contributor

Waiting to razzle v2.1.0 😄

@jaredpalmer
Copy link
Owner

jaredpalmer commented May 30, 2018

Most of this is in 2.x

The init:bin, jestConfig, and Babel 7 are still on the to-do list

tgriesser added a commit to tgriesser/razzle that referenced this pull request Jun 11, 2018
@stale
Copy link

stale bot commented Aug 15, 2018

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

@stale stale bot added the stale label Aug 15, 2018
@stale
Copy link

stale bot commented Aug 22, 2018

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

@stale stale bot closed this Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to Babel 7.x Upgrade to Jest 22 Update eslint to latest version 4.11.0
2 participants