Skip to content

New config mechanism, improved context API, perf improvements

Compare
Choose a tag to compare
@ZauberNerd ZauberNerd released this 08 Feb 12:29
· 2234 commits to master since this release
8f10cc7

10.0.0 (2018-02-07)

With this major release we replaced the npm based config mechanism with cosmiconfig (which is what is being used by lint-staged and others).

BREAKING CHANGES

  • config: new and improved config mechanism
    hops-config no longer supports the previous, npm based config mechanism.

    Hops now needs to be configured using a hops field in package.json instead of config.hops.

       "version": "9.8.0",
       "main": "src/app.js",
    -  "config": {
    -    "hops": {
    -      "browsers": "last 1 Chrome versions",
    -      "locations": ["/", "/counter"]
    -    }
    +  "hops": {
    +    "browsers": "last 1 Chrome versions",
    +    "locations": ["/", "/counter"]
       },

    You can also configure Hops via dedicated files .hopsrc or hops.config.js etc. Read more in the updated config readme.

    Local config overrides (using npm config set, .npmrc files or npm environment variables) are no longer supported. Instead we have adopted an environment variables based approach, similar to what Babel is doing.

       "version": "9.8.0",
       "main": "src/app.js",
       "hops": {
         "port": 8080,
    -    "locations": ["/", "/counter"]
    +    "locations": ["/", "/counter"],
    +    "env": {
    +      "my-environment": {
    +        "port": 1337
    +      }
    +    }
       },

    Then run: HOPS_ENV=my-environment yarn start to start your server on port 1337.

    Hops uses HOPS_ENV and falls back to NODE_ENV if the first one is unset.

  • config: function config values are no longer treated as getters, but returned directly

  • graphql: server side rendering (fetching) of GraphQL data is disabled in static builds
    In static mode, during server side rendering, GraphQL data is no longer being prefetched.
    That appears to be the sane default. The old behaviour can be restored by extending GraphQLContext and overriding its prefetchData method.

Features

  • build-config: hide config keys starting with _ from browsers (e087a49)
  • config: add support for config keys starting with '_' (42272e5)
  • config: add env support (404d262)
  • config: deeply merge configs (b9519cd)
  • config: improve config "inheritance" (7ba54ae)
  • config: introduce cosmiconfig (d9f8c15)
  • config: support <configkey> placeholders (f5ccc11)
  • config: use cosmiconfig for inheritance (db2d39d)
  • config: apply placeholders to plain objects, too (b84b60c)
  • config: support placeholders everywhere (d0e47a0)
  • graphql: disable data fetching in static ssr (4e5e28a), closes #324
  • react: render variant hiding contexts from users (610381d)
  • redux: making redux configration scoped (7813213)

Bug Fixes

  • config: fix extends overriding previous values instead of extending (93b8945)
  • config: deep-merge config without array concatenation (3a464e8)
  • config: fix config extension mechanism (fcc1a74)
  • redux: missing options no longer crash (6ba75a7)

Performance Improvements

  • build-config: enable caching and parallelism in uglify plugin (0530c24)