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

Extract the Hapi Server to expose it for testing #277

Closed
wants to merge 3 commits into from

Commits on May 7, 2016

  1. Extract the Hapi Server to expose it for testing

    * The Hapi Server has been extracted so that it can be
    tested using the built in #inject() method.
    * Test support has been moved to /helpers. This is the default location
    that is ignored by `ava`.
    * Added a test to ensure that the user can override the default html.js
    in both the develop and build stages.
    
    After some research I think using Hapi's inject is going to provide the
    best testing experience. The only code change was that the server is now
    started in `lib/utils/develop` and constructed in `lib/utils/dev-server`
    benstepp committed May 7, 2016
    Configuration menu
    Copy the full SHA
    1399814 View commit details
    Browse the repository at this point in the history
  2. Use require.resolve for babel plugins

    Moves the htmlCompilerConfig to webpack.config where it belongs in
    webpack.config.js
    
    Drops babel-plugin-transform-object-rest-spread because we already use
    babel-stage-0 in our .babelrc and this plugin is included in it. It
    doesn't make sense to call it out twice.
    
    Switched the `develop` stage babel-loader config to use stage-0 over
    stage-1 because that is what we have specified in our package.json
    benstepp committed May 7, 2016
    Configuration menu
    Copy the full SHA
    17df421 View commit details
    Browse the repository at this point in the history
  3. Use babel-presets by default

    This change makes it so the user doesn't need to specify their plugins.
    If they want to override it they would need to modify the js loader
    config using the modifyWebpackConfig API. Ideally we would support a
    user provided .babelrc as well.
    
    ```
    exports.modifyWebpackConfig = function(config, env) {
      config.removeLader('js')
      config.loader('js', {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel',
        query: {
          presets: [
            'babel-preset-react',
            'babel-preset-es2015',
            'babel-preset-stage-0',
          ].map(require.resolve),
          plugins: [
            'babel-plugin-add-module-exports',
            'babel-plugin-transform-decorators-legacy',
          ].map(require.resolve),
        },
      })
      return config;
    }
    ```
    
    Fixes gatsbyjs#235. Requires less user package.json dependencies unless the user
    wants to add babel plugins (Users no longer need to provide
    babel-plugins of any kind in their project as gatsby provides them)
    benstepp committed May 7, 2016
    Configuration menu
    Copy the full SHA
    17e36fd View commit details
    Browse the repository at this point in the history