Neutrino: Releasing v8 🎉

Eli Perelman
Dec 14, 2017 · 5 min read
Neutrino v8 is released!

Creating new projects

In an effort to make it as simple as possible to get started using Neutrino, we introduced a new way to scaffold the bare minimum you need to create new projects! There is no need to install any packages globally; as long as you have the latest yarn or npm installed, you are ready to go!

yarn create @neutrinojs/project <directory-name>
npx @neutrinojs/create-project <directory-name>
  • Preact
  • Vue
  • Node.js
  • Web and Node.js libraries
  • Any generic web app
  • Standalone React components

Scoped packages

You may notice if you were a Neutrino user in the past that your old presets and middleware have new names under a new npm organization, @neutrinojs. We did this for two reasons. First, it wasn’t clear which packages were officially supported by Neutrino, and which ones weren’t, since all existed in npm with the similar names. Second, if Neutrino wanted to release a new package, and the name conflicted with one already in the community, we would have had to resort to weirder naming as a workaround. Moving our official presets and middleware to the @neutrinojs org helps us resolve both of these issues.

  • neutrino-preset-react@neutrinojs/react
  • neutrino-preset-node@neutrinojs/node
  • neutrino-preset-jest@neutrinojs/jest

New middleware types

Neutrino v8 also introduced a few new core middleware packages:

  • @neutrinojs/react-components: Create generic React components. Plays nicely with other Neutrino middleware, so you can build, test, and publish multiple React components from a single repository.
  • @neutrinojs/preact & @neutrinojs/vue: Create Preact and Vue-based projects with support for JSX and more.
  • @neutrinojs/standardjs: Use ESLint with StandardJS rules to lint your projects
  • @neutrinojs/fork: Fork the usage of middleware into separate processes. You can combine this with other middleware to configure and build multiple project types from a single project, such as React+Node for SSR, or build multiple variations of a library in parallel.

Better support for multi-page apps and multiple mains

When creating web apps that have multiple pages, or libraries and Node.js projects that have multiple main entry points, there can be several moving parts that need to be kept in sync in order for everything to work properly, such as hot module replacement and HTML template generation. Neutrino now keeps all these in sync by moving from a single entry option to now using a map of mains:

// .neutrinorc.jsmodule.exports = {
options: {
// Each key in `mains` maps to an entry point
// located in the source code directory, e.g. src/
mains: {
// The key is the file name that will be generated
// The value is the file in src/ to use as the entry point
index: 'index',
admin: 'admin',
login: 'sign-in'
}
}
};

Improved style middleware, CSS modules

The @neutrinojs/style-loader middleware, which is used by Neutrino’s core web-based presets, now supports better integration and extension with other types of preprocessors and tools. This means you can more easily tell your configuration in the future if you wish to use LESS, Sass, PostCSS, stylelint, and more, just by passing additional options to these middleware or presets.

Breaking changes

With every major release comes the potential for breaking changes when you try to update. We maintain a list of these in our migration guide for v7 to v8. Please give that a read if you are updating from a previous version.

What’s next?

We plan on adding even more interesting project types to Neutrino and the create-project scaffolder. Some of these include support for:

  • Electron
  • Elm

Getting involved!

We are always looking for new and engaged individuals to help with our project, and welcome anyone who wants to be mentored in these efforts! Here’s a few things we really want help with, so if you feel inclined, jump in and talk to us!

  • Video tutorials and courses. Being able to guide new users of Neutrino into starting new types of projects, and customizing them in the future is something that would really help us out!
  • Porting Create-React-App to be backed by Neutrino. We have an issue filed for this, and would really like someone from the community to be the hero on this effort.

Eli Perelman

JavaScript and Node.js Obsessionalist™, ❤️ open source and experimenting with electronic music production. Child of the ’90s web. Skeptic.

Eli Perelman

Written by

Software Engineer at Mozilla

Eli Perelman

JavaScript and Node.js Obsessionalist™, ❤️ open source and experimenting with electronic music production. Child of the ’90s web. Skeptic.