Create and build JS applications with managed configurations
Neutrino is a helper tool which lets you build web and Node.js applications with shared configurations. It intends to make the process of initializing and building projects much simpler by providing minimal development dependencies. Neutrino uses Webpack to build both web and Node.js projects by providing complete build presets which can be shared across targets and projects. You can use neutrino base presets to get started building a variety of projects, create your own presets by extending the neutrino code presets to be shared across your own projects or even by the community. Presets can even be manipulated on a project-by-project basis to handle almost any build situation your preset doesn't cover.
Neutrino projects require 2 development dependencies: neutrino itself and a build configuration preset. Neutrino provides core presets for building generic web applications, Node.js, or React applications. If these presets do not meet your needs, feel free to use a community-provided preset or extend one of these presets to meet your needs.
To get started using neutrino in your project, install neutrino and your preset as development dependencies. In this example, we want to build a React application:
npm install --save-dev neutrino neutrino-preset-react
With neutrino and your preset in place, modify the
npm scripts in your package.json to use
neutrino for building the project:
By default, neutrino preset look for source code in
src/, and tests in
test/. Use your npm
scripts to start building!
npm startnpm testnpm run build
If you plan to use the same preset across all your script targets, you can add a
config entry to
your package.json to specify this:
applications by providing configuration for Webpack, ESLint, Karma, and Mocha. If you need to modify
preset configuration, you can
require the preset in your project and specify a new preset to
neutrino with the changes.
For example, let's say you have a project using the neutrino
web preset, but now want to support
building LESS files. Let's create a new custom preset in your project to handle this, e.g.
// require the preset to changeconst preset = ;// also a using helper to deep-copy an objectconst clone = ;// Find the preset's CSS loaderconst cssLoader = presetmoduleloaders;// Make a copy of the loader so we can use it for LESS loading, while still keeping normal// CSS loadingconst lessLoader = ;// Change the files the loader uses to .less fileslessLoadertest = /\.less$/;// Add the less-loader to this loader which handles LESS compilationlessLoaderloaders;// Add the new LESS loader to the presetpresetmoduleloaders;// re-export the modified presetmoduleexports = preset;
Now use your new preset in your package.json scripts:
Creating neutrino presets uses the same premise as modifying a preset, but with the addition that these can be published to npm and used in numerous projects. See the neutrino core presets for examples on how this is accomplished for tips on creating your own presets.
If you are having issues, please let us know.
This project is licensed under the Mozilla Public License v2.0