├── .auto-changelog
├── .eslintignore
├── .eslintrc.js
├── .github
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
├── SUPPORT.md
└── workflows
│ └── ci.yml
├── .gitignore
├── .huskyrc.js
├── .lintstagedrc.js
├── .neutrinorc.js
├── .prettierrc.js
├── CHANGELOG.md
├── LICENSE
├── README.md
├── docs
├── api.md
├── assets
│ └── logo.png
├── contributing
│ ├── code-of-conduct.md
│ ├── development.md
│ └── index.md
├── creating-presets.md
├── customization.md
├── faq.md
├── index.md
├── installation
│ ├── create-new-project.md
│ └── index.md
├── learning-resources.md
├── middleware.md
├── migrate.md
├── migration-guide.md
├── packages
│ ├── airbnb-base.md
│ ├── airbnb.md
│ ├── banner.md
│ ├── clean.md
│ ├── compile-loader.md
│ ├── copy.md
│ ├── dev-server.md
│ ├── eslint.md
│ ├── font-loader.md
│ ├── html-loader.md
│ ├── html-template.md
│ ├── image-loader.md
│ ├── jest.md
│ ├── karma.md
│ ├── library.md
│ ├── mocha.md
│ ├── node.md
│ ├── preact.md
│ ├── react-components.md
│ ├── react.md
│ ├── standardjs.md
│ ├── start-server.md
│ ├── style-loader.md
│ ├── style-minify.md
│ ├── vue.md
│ └── web.md
├── presets.md
├── project-layout.md
├── requirements.txt
├── runtime.txt
├── usage.md
└── webpack-chain.md
├── lerna.json
├── mkdocs.yml
├── netlify.toml
├── package.json
├── packages
├── airbnb-base
│ ├── .npmignore
│ ├── README.md
│ ├── eslintrc.js
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── airbnb_test.js
├── airbnb
│ ├── .npmignore
│ ├── README.md
│ ├── eslintrc.js
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── airbnb_test.js
├── banner
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── clean
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── compile-loader
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── copy
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── create-project
│ ├── .npmignore
│ ├── README.md
│ ├── bin
│ │ └── create-project.js
│ ├── commands
│ │ └── init
│ │ │ ├── constants.js
│ │ │ ├── index.js
│ │ │ ├── templates
│ │ │ ├── airbnb-base
│ │ │ │ └── .eslintrc.js
│ │ │ ├── airbnb
│ │ │ │ └── .eslintrc.js
│ │ │ ├── jest
│ │ │ │ ├── jest.config.js
│ │ │ │ └── test
│ │ │ │ │ └── simple_test.js
│ │ │ ├── karma
│ │ │ │ ├── karma.conf.js
│ │ │ │ └── test
│ │ │ │ │ └── simple_test.js
│ │ │ ├── library
│ │ │ │ ├── src
│ │ │ │ │ └── index.js
│ │ │ │ └── webpack.config.js
│ │ │ ├── mocha
│ │ │ │ ├── .mocharc.js
│ │ │ │ └── test
│ │ │ │ │ └── simple_test.js
│ │ │ ├── neutrino
│ │ │ │ └── .neutrinorc.js.ejs
│ │ │ ├── node
│ │ │ │ ├── src
│ │ │ │ │ ├── app.js
│ │ │ │ │ └── index.js
│ │ │ │ └── webpack.config.js
│ │ │ ├── preact
│ │ │ │ ├── src
│ │ │ │ │ ├── App.css
│ │ │ │ │ ├── App.jsx
│ │ │ │ │ └── index.jsx
│ │ │ │ └── webpack.config.js
│ │ │ ├── react-components
│ │ │ │ ├── src
│ │ │ │ │ ├── components
│ │ │ │ │ │ └── Example
│ │ │ │ │ │ │ └── index.jsx
│ │ │ │ │ └── index.jsx
│ │ │ │ └── webpack.config.js
│ │ │ ├── react
│ │ │ │ ├── src
│ │ │ │ │ ├── App.css
│ │ │ │ │ ├── App.jsx
│ │ │ │ │ └── index.jsx
│ │ │ │ └── webpack.config.js
│ │ │ ├── standardjs
│ │ │ │ └── .eslintrc.js
│ │ │ ├── vue
│ │ │ │ ├── src
│ │ │ │ │ ├── App.vue
│ │ │ │ │ └── index.js
│ │ │ │ └── webpack.config.js
│ │ │ └── web
│ │ │ │ ├── src
│ │ │ │ └── index.js
│ │ │ │ └── webpack.config.js
│ │ │ └── utils.js
│ ├── package.json
│ └── test
│ │ └── cli_test.js
├── dev-server
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── eslint
│ ├── .npmignore
│ ├── README.md
│ ├── eslintrc.js
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── font-loader
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── html-loader
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── html-template
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ ├── template.ejs
│ └── test
│ │ └── middleware_test.js
├── image-loader
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── jest
│ ├── .npmignore
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── file-mock.js
│ │ ├── index.js
│ │ ├── style-mock.js
│ │ └── transformer.js
│ └── test
│ │ └── jest_test.js
├── karma
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── karma_test.js
├── library
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── library_test.js
├── migrate
│ ├── .npmignore
│ ├── README.md
│ ├── bin
│ │ └── migrate.js
│ ├── package.json
│ ├── test
│ │ ├── fixtures
│ │ │ ├── .neutrinorc.js
│ │ │ └── .neutrinorc.js.txt
│ │ └── migrate_test.js
│ └── transforms
│ │ └── middleware.js
├── mocha
│ ├── .npmignore
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.js
│ │ └── register.js
│ └── test
│ │ └── mocha_test.js
├── neutrino
│ ├── .npmignore
│ ├── Neutrino.js
│ ├── README.md
│ ├── bin
│ │ └── neutrino.js
│ ├── errors.js
│ ├── extensions.js
│ ├── handlers.js
│ ├── index.js
│ ├── package.json
│ └── test
│ │ ├── api_test.js
│ │ ├── fixtures
│ │ ├── middleware.js
│ │ └── test-module
│ │ │ ├── errorMiddleware.js
│ │ │ ├── middleware.js
│ │ │ └── node_modules
│ │ │ └── alpha
│ │ │ └── index.js
│ │ └── package_test.js
├── node
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── node_test.js
├── preact
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── preact_test.js
├── react-components
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ ├── components_test.js
│ │ └── src
│ │ └── components
│ │ └── Empty.jsx
├── react
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── react_test.js
├── standardjs
│ ├── .npmignore
│ ├── README.md
│ ├── eslintrc.js
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── standardjs_test.js
├── start-server
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── style-loader
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── style-minify
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── middleware_test.js
├── vue
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ │ └── vue_test.js
└── web
│ ├── .npmignore
│ ├── README.md
│ ├── index.js
│ ├── package.json
│ └── test
│ └── web_test.js
├── renovate.json
├── scripts
├── build-docs.sh
└── test-create-project-ci.sh
├── verdaccio.npm.yml
├── verdaccio.yarn.yml
└── yarn.lock
/.auto-changelog:
--------------------------------------------------------------------------------
1 | {
2 | "commitLimit": false,
3 | "releaseSummary": true,
4 | "remote": "upstream"
5 | }
6 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | # ESLint only ignores the repo root node_modules by default.
2 | packages/**/node_modules/
3 |
4 | # This file intentionally contains invalid syntax so results in a parse error.
5 | packages/neutrino/test/fixtures/test-module/errorMiddleware.js
6 |
7 | # By using --no-eslintrc in yarn lint, eslint no longer lints the nested
8 | # RC files. We then negate this ignore so they are still linted, but no longer
9 | # used as configuration by our development lint command.
10 | !packages/create-project/bin/commands/init/templates/*/.eslintrc.js
11 |
12 | # Ignore directories that may potentially have JS we don't need linted
13 | coverage
14 | docs
15 | build
16 | .nyc_output
17 |
18 | # Lint dotfiles
19 | !.*.js
20 |
21 | # Do not use prettier to re-format the changelog
22 | CHANGELOG.md
23 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('./packages/neutrino');
2 |
3 | module.exports = neutrino().eslintrc();
4 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of
9 | experience, nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | - Using welcoming and inclusive language
18 | - Being respectful of differing viewpoints and experiences
19 | - Gracefully accepting constructive criticism
20 | - Focusing on what is best for the community
21 | - Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | - The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | - Trolling, insulting/derogatory comments, and personal or political attacks
28 | - Public or private harassment
29 | - Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | - Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or reject
41 | comments, commits, code, wiki edits, issues, and other contributions that are
42 | not aligned to this Code of Conduct, or to ban temporarily or permanently any
43 | contributor for other behaviors that they deem inappropriate, threatening,
44 | offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project lead at eli@mozilla.com. All complaints will
59 | be reviewed and investigated and will result in a response that is deemed
60 | necessary and appropriate to the circumstances. The project team is obligated to
61 | maintain confidentiality with regard to the reporter of an incident. Further
62 | details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71 | version 1.4, available at
72 | [https://www.contributor-covenant.org/version/1/4][version]
73 |
74 | [homepage]: https://www.contributor-covenant.org
75 | [version]: https://www.contributor-covenant.org/version/1/4/code-of-conduct
76 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Bug or issue?
2 |
3 | Please try to answer the following questions:
4 |
5 | - What version of Neutrino are you using?
6 | - Are you trying to use any presets? If so, which ones, and what versions?
7 | - Are you using the Yarn client or the npm client? What version?
8 | - What version of Node.js are you using?
9 | - What operating system are you using?
10 | - What did you do?
11 | - What did you expect to happen?
12 | - What actually happened, contrary to your expectations?
13 |
14 | ### Feature request or enhancement?
15 |
16 | Please describe your request in detail. Use the following questions as guidance:
17 |
18 | - What is the goal of the change?
19 | - What are the pros and cons of the change?
20 | - Could this dramatically improve the experience of our users?
21 |
--------------------------------------------------------------------------------
/.github/SUPPORT.md:
--------------------------------------------------------------------------------
1 | # Support
2 |
3 | Neutrino team members and contributors are here to help you! Should you need
4 | assistance or have questions in using Neutrino or its core presets, please
5 | consider asking on our Spectrum channel, Stack Overflow, or other channel rather
6 | than filing issues. We would prefer to keep our GitHub issues clear for bugs,
7 | feature requests, discussions, and relevant information related to its
8 | development.
9 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | lint:
7 | runs-on: ubuntu-latest
8 |
9 | steps:
10 | - name: Check out Git repository
11 | uses: actions/checkout@v2
12 |
13 | - name: Install Node.js, NPM and Yarn
14 | uses: actions/setup-node@v2
15 | with:
16 | node-version: 16
17 | cache: 'yarn'
18 |
19 | - name: Install modules
20 | run: yarn install --prefer-offline --frozen-lockfile
21 |
22 | - name: Run validate:eslintrc
23 | run: yarn validate:eslintrc
24 |
25 | - name: Run lint
26 | run: yarn lint
27 |
28 | - name: Run prettier:check
29 | run: yarn prettier:check
30 |
31 | test:
32 | runs-on: ubuntu-latest
33 |
34 | strategy:
35 | matrix:
36 | node: ['12', '14', '16']
37 |
38 | name: Test Node ${{ matrix.node }}
39 |
40 | steps:
41 | - name: Check out Git repository
42 | uses: actions/checkout@v2
43 |
44 | - name: Install Node.js, NPM and Yarn
45 | uses: actions/setup-node@v2
46 | with:
47 | node-version: ${{ matrix.node }}
48 | cache: 'yarn'
49 |
50 | - name: Install modules
51 | run: yarn install --prefer-offline --frozen-lockfile
52 |
53 | - name: Run unit tests
54 | run: yarn test
55 |
56 | - name: Create test project with yarn
57 | run: scripts/test-create-project-ci.sh
58 | env:
59 | CREATE_PROJECT_YARN: 'true'
60 |
61 | - name: Create test project with npm
62 | run: scripts/test-create-project-ci.sh
63 | env:
64 | CREATE_PROJECT_YARN: 'false'
65 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | lerna-debug.log
6 |
7 | # Build directories
8 | build
9 | lib
10 |
11 | # Runtime data
12 | pids
13 | *.pid
14 | *.seed
15 | *.pid.lock
16 |
17 | # Directory for instrumented libs generated by jscoverage/JSCover
18 | lib-cov
19 |
20 | # Coverage directory used by tools like istanbul
21 | coverage
22 | .nyc_output
23 |
24 | # node-waf configuration
25 | .lock-wscript
26 |
27 | # Dependency directories
28 | node_modules
29 |
30 | # But allow node_modules for test fixtures
31 | !packages/neutrino/test/fixtures/test-module/node_modules
32 |
33 | # Optional npm cache directory
34 | .npm
35 |
36 | # Optional REPL history
37 | .node_repl_history
38 |
39 | # Project metadata
40 | .idea
41 | /.vscode
42 |
43 | # ESlint CLI cache
44 | .eslintcache
45 |
--------------------------------------------------------------------------------
/.huskyrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | hooks: {
3 | 'pre-commit': 'lint-staged',
4 | },
5 | };
6 |
--------------------------------------------------------------------------------
/.lintstagedrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | '*.{js,jsx}': ['yarn lint'],
3 | '*.{css,html,js,jsx,json,md,yaml,yml}': ['yarn prettier:check'],
4 | };
5 |
--------------------------------------------------------------------------------
/.neutrinorc.js:
--------------------------------------------------------------------------------
1 | const airbnb = require('./packages/airbnb');
2 |
3 | module.exports = {
4 | options: {
5 | root: __dirname,
6 | },
7 | use: [
8 | airbnb({
9 | // See the package.json `lint` script for which files are linted.
10 | // Excludes are managed via `.eslintignore`.
11 | eslint: {
12 | baseConfig: {
13 | extends: ['plugin:prettier/recommended'],
14 | env: {
15 | browser: true,
16 | jest: true,
17 | mocha: true,
18 | node: true,
19 | },
20 | rules: {
21 | 'prettier/prettier': [
22 | 'error',
23 | {
24 | singleQuote: true,
25 | bracketSameLine: true,
26 | trailingComma: 'all',
27 | proseWrap: 'always',
28 | },
29 | ],
30 | // Allow using console since most of the code in this repo isn't run in a browser.
31 | 'no-console': 'off',
32 | // Allowing shadowing variable that share the same context as the outer scope
33 | 'no-shadow': 'off',
34 | },
35 | overrides: [
36 | {
37 | files: [
38 | 'packages/create-project/commands/init/templates/**',
39 | 'packages/create-project/commands/init/templates/*/.*.js',
40 | ],
41 | rules: {
42 | // The dependencies in create-project's templates are installed by
43 | // by create-project and so are expected to be missing from package.json.
44 | 'import/no-extraneous-dependencies': 'off',
45 | },
46 | },
47 | {
48 | files: [
49 | 'packages/create-project/commands/init/templates/preact/**',
50 | ],
51 | settings: {
52 | react: {
53 | pragma: 'h',
54 | },
55 | },
56 | rules: {
57 | // With Preact the use of `class` is recommended over `className`,
58 | // so we have to add `class` to the ignore list, to prevent:
59 | // `Unknown property 'class' found, use 'className' instead`
60 | 'react/no-unknown-property': ['error', { ignore: ['class'] }],
61 | },
62 | },
63 | {
64 | files: ['packages/*/test/*'],
65 | rules: {
66 | // The tests need to do non-global require() to test the presets.
67 | 'global-require': 'off',
68 | // This rule doesn't handle devDependencies being defined
69 | // in the monorepo root package.json.
70 | 'import/no-extraneous-dependencies': 'off',
71 | },
72 | },
73 | ],
74 | },
75 | },
76 | }),
77 | (neutrino) => {
78 | neutrino.register('prettierrc', (neutrino) => {
79 | const handler = neutrino.outputHandlers.get('eslintrc');
80 | const eslintConfig = handler(neutrino);
81 |
82 | return eslintConfig.rules['prettier/prettier'][1];
83 | });
84 | },
85 | ],
86 | };
87 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('./packages/neutrino');
2 |
3 | module.exports = neutrino().prettierrc();
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ### Create and build modern JavaScript applications with zero initial configuration
4 |
5 | #### Neutrino combines the power of webpack with the simplicity of presets.
6 |
7 | [![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url]
8 | [![CI Status][ci-image]][ci-url] [![Netlify Status][netlify-image]][netlify-url]
9 |
10 | [https://github.com/neutrinojs/neutrino](https://github.com/neutrinojs/neutrino)
11 |
12 | ---
13 |
14 | Neutrino is a companion tool which lets you build web and Node.js applications
15 | with shared presets or configurations. It intends to make the process of
16 | initializing and building projects much simpler by providing minimal development
17 | dependencies.
18 |
19 | Neutrino uses webpack to build both web and Node.js projects by providing
20 | complete build presets which can be shared across targets and projects. You can
21 | use Neutrino base presets to get started building a variety of projects, create
22 | your own presets by extending the Neutrino core ones to be shared across your
23 | own projects or even by the community. Presets can even be manipulated on a
24 | project-by-project basis to handle almost any build situation your preset
25 | doesn't cover.
26 |
27 | ## Documentation
28 |
29 | See the [Neutrino docs](https://neutrinojs.org/) for details on installation,
30 | getting started, usage, and customizing.
31 |
32 | ### Contributing
33 |
34 | Thank you for wanting to help out with Neutrino! We are very happy that you want
35 | to contribute, and have put together this guide to help you get started. We want
36 | to do our best to help you make successful contributions and be part of our
37 | community.
38 |
39 | - [Contributing to Neutrino](https://neutrinojs.org/contributing/)
40 | - [Participation Guidelines](https://neutrinojs.org/contributing/code-of-conduct/)
41 |
42 | [npm-image]: https://img.shields.io/npm/v/neutrino.svg
43 | [npm-downloads]: https://img.shields.io/npm/dt/neutrino.svg
44 | [npm-url]: https://www.npmjs.com/package/neutrino
45 | [ci-image]:
46 | https://github.com/neutrinojs/neutrino/actions/workflows/ci.yml/badge.svg
47 | [ci-url]: https://github.com/neutrinojs/neutrino/actions/workflows/ci.yml
48 | [netlify-image]:
49 | https://api.netlify.com/api/v1/badges/faef6419-2d67-488a-95a8-998e1ad3e40f/deploy-status
50 | [netlify-url]: https://app.netlify.com/sites/neutrinojs/deploys
51 |
--------------------------------------------------------------------------------
/docs/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/neutrinojs/neutrino/f9d476446983684225545159f58bbed2a93ca824/docs/assets/logo.png
--------------------------------------------------------------------------------
/docs/contributing/code-of-conduct.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of experience,
9 | nationality, personal appearance, race, religion, or sexual identity and
10 | orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project lead at eli@mozilla.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at [https://www.contributor-covenant.org/version/1/4][version]
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 | [version]: https://www.contributor-covenant.org/version/1/4/code-of-conduct
75 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Create and build modern JavaScript applications with zero initial configuration
4 |
Neutrino combines the power of webpack with the simplicity of presets.
5 |
6 | [![NPM version][npm-image]][npm-url]
7 | [![NPM downloads][npm-downloads]][npm-url]
8 | [![CI Status][ci-image]][ci-url]
9 | [![Netlify Status][netlify-image]][netlify-url]
10 |
11 | [https://github.com/neutrinojs/neutrino](https://github.com/neutrinojs/neutrino)
12 |
13 | ---
14 |
15 | Neutrino is a companion tool which lets you build web and Node.js applications with shared presets or configurations.
16 | It intends to make the process of initializing and building projects much simpler by providing minimal development
17 | dependencies.
18 |
19 | Neutrino uses webpack to build both web and Node.js projects by providing complete build presets which can be shared
20 | across targets and projects. You can use Neutrino base presets to get started building a variety of projects, create
21 | your own presets by extending the Neutrino core ones to be shared across your own projects or even by the community.
22 | Presets can even be manipulated on a project-by-project basis to handle almost any build situation your preset doesn't
23 | cover.
24 |
25 | [npm-image]: https://img.shields.io/npm/v/neutrino.svg
26 | [npm-downloads]: https://img.shields.io/npm/dt/neutrino.svg
27 | [npm-url]: https://www.npmjs.com/package/neutrino
28 | [ci-image]: https://github.com/neutrinojs/neutrino/actions/workflows/ci.yml/badge.svg
29 | [ci-url]: https://github.com/neutrinojs/neutrino/actions/workflows/ci.yml
30 | [netlify-image]: https://api.netlify.com/api/v1/badges/faef6419-2d67-488a-95a8-998e1ad3e40f/deploy-status
31 | [netlify-url]: https://app.netlify.com/sites/neutrinojs/deploys
32 |
--------------------------------------------------------------------------------
/docs/installation/create-new-project.md:
--------------------------------------------------------------------------------
1 | ../../packages/create-project/README.md
--------------------------------------------------------------------------------
/docs/installation/index.md:
--------------------------------------------------------------------------------
1 | # Installing Neutrino
2 |
3 | ## Requirements
4 |
5 | Installing Neutrino requires Node.js 10+, and either [Yarn](https://yarnpkg.com/en/docs/install) or
6 | npm. At a minimum, you will be installing Neutrino and Neutrino middleware, such as `@neutrinojs/react`.
7 |
8 | ## Create New Project
9 |
10 | The fastest way to get started is by using the [`@neutrinojs/create-project`](./create-new-project.md) scaffolding tool.
11 | If you don’t want to use the CLI helper, proceed below for manual installation instructions.
12 |
13 | ## Yarn Installation
14 |
15 | Run the following command inside your project directory. Substitute `MIDDLEWARE` with the name of the middleware
16 | you wish to install.
17 |
18 | ```bash
19 | yarn add --dev neutrino MIDDLEWARE
20 | ```
21 |
22 | For example, if you wanted to build your project using Neutrino's React preset:
23 |
24 | ```bash
25 | yarn add --dev neutrino @neutrinojs/react
26 | ```
27 |
28 | ## npm Installation
29 |
30 | Run the following command inside your project directory. Substitute `MIDDLEWARE` with the name of the middleware
31 | you wish to install.
32 |
33 | ```bash
34 | npm install --save-dev neutrino MIDDLEWARE
35 | ```
36 |
37 | For example, if you wanted to build your project using Neutrino's React preset:
38 |
39 | ```bash
40 | npm install --save-dev neutrino @neutrinojs/react
41 | ```
42 |
43 | ## Getting started
44 |
45 | Please continue through the documentation for instructions on Neutrino usage and default project layout.
46 |
--------------------------------------------------------------------------------
/docs/learning-resources.md:
--------------------------------------------------------------------------------
1 | # Learning Resources
2 |
3 | Here we keep a listing of external learning resources related to Neutrino and its presets, things like blog posts,
4 | tutorials, screencasts, videos, starter repos, and more. If you would like to submit a resource for the benefit of the
5 | community, file an issue or submit a pull request.
6 |
7 | ## Blog Posts & Tutorials
8 |
9 | #### v6, v7
10 |
11 | * [Neutrino - Create modern JavaScript applications with minimal configuration - Interview with Eli Perelman](https://survivejs.com/blog/neutrino-interview/) by [@survivejs](https://twitter.com/survivejs)
12 |
13 | #### v5
14 |
15 | * [Code Splitting for React Router with webpack and HMR](https://hackernoon.com/code-splitting-for-react-router-with-webpack-and-hmr-bb509968e86f) by [@hassanhelfi](https://twitter.com/hassanhelfi)
16 |
17 | #### v4
18 |
19 | * [Modern JavaScript Apps with Neutrino](https://davidwalsh.name/neutrino) by [@eliperelman](https://twitter.com/eliperelman)
20 | * [Using Neutrino to jump-start modern JavaScript development](https://hacks.mozilla.org/2017/02/using-neutrino-for-modern-javascript-development/) by [@eliperelman](https://twitter.com/eliperelman)
21 | * [Custom Neutrino Linting](https://davidwalsh.name/neutrino-linting) by [@davidwalshblog](https://twitter.com/davidwalshblog)
22 |
23 | ## Screencasts & Videos
24 |
25 | #### v5
26 |
27 | * [Bootstrap a Zero Configuration React App with Neutrino](https://egghead.io/lessons/react-bootstrap-a-zero-configuration-react-app-with-neutrino) by [@markshust](https://twitter.com/markshust)
28 | * [Empower and Simplify JavaScript Development](https://www.youtube.com/watch?v=fz5jMdmKmRI) by [@eliperelman](https://twitter.com/eliperelman) at [@nebraskajs](https://nebraskajs.com)
29 |
30 | ## Third Party Presets and Middleware
31 |
32 | Other presets and middleware that can be taken as examples to learn from:
33 |
34 | * [Preset for Zoho Sites Template development](https://gitlab.com/ringods/neutrino-preset-zoho-sites-template)
35 |
--------------------------------------------------------------------------------
/docs/migrate.md:
--------------------------------------------------------------------------------
1 | ../packages/migrate/README.md
--------------------------------------------------------------------------------
/docs/packages/airbnb-base.md:
--------------------------------------------------------------------------------
1 | ../../packages/airbnb-base/README.md
--------------------------------------------------------------------------------
/docs/packages/airbnb.md:
--------------------------------------------------------------------------------
1 | ../../packages/airbnb/README.md
--------------------------------------------------------------------------------
/docs/packages/banner.md:
--------------------------------------------------------------------------------
1 | ../../packages/banner/README.md
--------------------------------------------------------------------------------
/docs/packages/clean.md:
--------------------------------------------------------------------------------
1 | ../../packages/clean/README.md
--------------------------------------------------------------------------------
/docs/packages/compile-loader.md:
--------------------------------------------------------------------------------
1 | ../../packages/compile-loader/README.md
--------------------------------------------------------------------------------
/docs/packages/copy.md:
--------------------------------------------------------------------------------
1 | ../../packages/copy/README.md
--------------------------------------------------------------------------------
/docs/packages/dev-server.md:
--------------------------------------------------------------------------------
1 | ../../packages/dev-server/README.md
--------------------------------------------------------------------------------
/docs/packages/eslint.md:
--------------------------------------------------------------------------------
1 | ../../packages/eslint/README.md
--------------------------------------------------------------------------------
/docs/packages/font-loader.md:
--------------------------------------------------------------------------------
1 | ../../packages/font-loader/README.md
--------------------------------------------------------------------------------
/docs/packages/html-loader.md:
--------------------------------------------------------------------------------
1 | ../../packages/html-loader/README.md
--------------------------------------------------------------------------------
/docs/packages/html-template.md:
--------------------------------------------------------------------------------
1 | ../../packages/html-template/README.md
--------------------------------------------------------------------------------
/docs/packages/image-loader.md:
--------------------------------------------------------------------------------
1 | ../../packages/image-loader/README.md
--------------------------------------------------------------------------------
/docs/packages/jest.md:
--------------------------------------------------------------------------------
1 | ../../packages/jest/README.md
--------------------------------------------------------------------------------
/docs/packages/karma.md:
--------------------------------------------------------------------------------
1 | ../../packages/karma/README.md
--------------------------------------------------------------------------------
/docs/packages/library.md:
--------------------------------------------------------------------------------
1 | ../../packages/library/README.md
--------------------------------------------------------------------------------
/docs/packages/mocha.md:
--------------------------------------------------------------------------------
1 | ../../packages/mocha/README.md
--------------------------------------------------------------------------------
/docs/packages/node.md:
--------------------------------------------------------------------------------
1 | ../../packages/node/README.md
--------------------------------------------------------------------------------
/docs/packages/preact.md:
--------------------------------------------------------------------------------
1 | ../../packages/preact/README.md
--------------------------------------------------------------------------------
/docs/packages/react-components.md:
--------------------------------------------------------------------------------
1 | ../../packages/react-components/README.md
--------------------------------------------------------------------------------
/docs/packages/react.md:
--------------------------------------------------------------------------------
1 | ../../packages/react/README.md
--------------------------------------------------------------------------------
/docs/packages/standardjs.md:
--------------------------------------------------------------------------------
1 | ../../packages/standardjs/README.md
--------------------------------------------------------------------------------
/docs/packages/start-server.md:
--------------------------------------------------------------------------------
1 | ../../packages/start-server/README.md
--------------------------------------------------------------------------------
/docs/packages/style-loader.md:
--------------------------------------------------------------------------------
1 | ../../packages/style-loader/README.md
--------------------------------------------------------------------------------
/docs/packages/style-minify.md:
--------------------------------------------------------------------------------
1 | ../../packages/style-minify/README.md
--------------------------------------------------------------------------------
/docs/packages/vue.md:
--------------------------------------------------------------------------------
1 | ../../packages/vue/README.md
--------------------------------------------------------------------------------
/docs/packages/web.md:
--------------------------------------------------------------------------------
1 | ../../packages/web/README.md
--------------------------------------------------------------------------------
/docs/presets.md:
--------------------------------------------------------------------------------
1 | # What are presets?
2 |
3 | A preset is a Neutrino-compatible configuration capable of building, modifying
4 | the build process, or interacting with a project as a result of building.
5 | Neutrino provides a few core presets to quickly get started building some popular project
6 | types, but anyone can inherit, extend, and modify these presets and tailor them to their project,
7 | team, or company preferences. You can even create your own presets from scratch.
8 |
9 | If you are familiar with Babel presets, Neutrino presets work similarly. For example,
10 | given the Babel preset `@babel/preset-react`, you can compile React code with JSX
11 | to vanilla JavaScript calls. Neutrino adopts this same concept by adapting webpack into
12 | a tool that understands configurations-as-packages, i.e. presets. Many more aspects of
13 | development surround building a complete React project, for which webpack is commonly used.
14 | By encapsulating the common needs of a project type into a preset, Neutrino allows you to
15 | avoid the upfront cost of configuring and instead focus on project development.
16 |
17 | Not every project is the same, and oftentimes small tweaks need to be made to the build
18 | configuration in order to meet this need. Fortunately Neutrino presets can be modified and
19 | extended directly from the project you are building. No need to be locked in to a particular
20 | pattern, and no escape hatches that force you into maintaining the entire configuration should
21 | you need to make changes.
22 |
23 | Presets can be easily distributed by publishing them to npm or GitHub and installing them
24 | in your project. This also allows others to discover and build projects based on your own
25 | presets.
26 |
--------------------------------------------------------------------------------
/docs/project-layout.md:
--------------------------------------------------------------------------------
1 | # Project Layout
2 |
3 | Out of the box, Neutrino presets expect a project to have a particular structure to make the
4 | development process for new projects as quick as possible. This is broken up into four directories:
5 |
6 | - Source code
7 | - Static assets
8 | - Build assets
9 | - Testing
10 |
11 | Each of these directories is set up via convention by a Neutrino preset, but each can be customized as
12 | desired by overriding the preset's configuration or using a different preset. See
13 | [Custom Configuration](./customization.md) for detailed instructions.
14 |
15 | ## Source Code
16 |
17 | By default, Neutrino presets expect all project source code to live in a directory named `src` in the
18 | root of the project. This includes compiled and imported JavaScript files, CSS stylesheets, images, and any other assets
19 | that would be available to your compiled project.
20 |
21 | When running your project or creating a build bundle, a preset will look for this `src` directory for
22 | the main entry points of your application and use this as the relative location for finding other assets
23 | necessary for creating your builds.
24 |
25 | ## Build Assets
26 |
27 | When creating a build bundle, a preset will put the compiled assets, including any generated
28 | JavaScript files, into a directory named `build` by default.
29 |
30 | Normally most projects will exclude checking in this build directory to source control.
31 | Be sure to add this directory to your project's `.gitignore`, `.hgignore`, or similar file.
32 |
33 | ## Testing
34 |
35 | Neutrino presets by default expect all tests to be located in a directory named `test`. In order to make the
36 | separation between tests and test fixtures or harnesses easier to differentiate, Neutrino presets also
37 | usually look for test files ending in `_test.js` or `.test.js`. See your specific test preset for more
38 | detailed information about running tests and other conventions.
39 |
--------------------------------------------------------------------------------
/docs/requirements.txt:
--------------------------------------------------------------------------------
1 | mkdocs-material>=7,<8
2 |
--------------------------------------------------------------------------------
/docs/runtime.txt:
--------------------------------------------------------------------------------
1 | 3.8
2 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "9.5.0",
3 | "npmClient": "yarn",
4 | "registry": "https://registry.npmjs.org/",
5 | "useWorkspaces": true,
6 | "command": {
7 | "version": {
8 | "exact": true,
9 | "forcePublish": "*",
10 | "gitRemote": "upstream",
11 | "gitTagVersion": false,
12 | "push": false
13 | },
14 | "publish": {
15 | "exact": true,
16 | "forcePublish": "*",
17 | "gitRemote": "upstream",
18 | "gitTagVersion": false,
19 | "push": false
20 | }
21 | },
22 | "packages": ["packages/*"]
23 | }
24 |
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | docs_dir: 'docs'
2 | site_dir: 'build'
3 | strict: true
4 |
5 | site_name: 'Neutrino'
6 | site_description:
7 | 'Create and build modern JavaScript applications with zero initial
8 | configuration'
9 | repo_name: 'neutrinojs/neutrino'
10 | repo_url: 'https://github.com/neutrinojs/neutrino'
11 |
12 | # https://squidfunk.github.io/mkdocs-material/getting-started/#configuration
13 | theme:
14 | name: 'material'
15 | palette:
16 | primary: 'teal'
17 | accent: 'teal'
18 | icon:
19 | repo: 'fontawesome/brands/github'
20 |
21 | # http://www.mkdocs.org/user-guide/writing-your-docs/#configure-pages-and-navigation
22 | nav:
23 | - Introduction: './index.md'
24 | - Getting Started:
25 | - Installation: './installation/index.md'
26 | - Create new project: './installation/create-new-project.md'
27 | - Usage: './usage.md'
28 | - Project Layout: './project-layout.md'
29 | - Customization: './customization.md'
30 | - Configuration: './webpack-chain.md'
31 | - Migration Guide: './migration-guide.md'
32 | - Migration Tool: './migrate.md'
33 | - Presets:
34 | - What are presets?: './presets.md'
35 | - Web Projects:
36 | - React: './packages/react.md'
37 | - Preact: './packages/preact.md'
38 | - Vue: './packages/vue.md'
39 | - Web: './packages/web.md'
40 | - Node.js: './packages/node.md'
41 | - React Components: './packages/react-components.md'
42 | - Libraries: './packages/library.md'
43 | - Linting:
44 | - Airbnb: './packages/airbnb.md'
45 | - StandardJS: './packages/standardjs.md'
46 | - Airbnb Base: './packages/airbnb-base.md'
47 | - Testing:
48 | - Jest: './packages/jest.md'
49 | - Karma: './packages/karma.md'
50 | - Mocha: './packages/mocha.md'
51 | - Middleware:
52 | - What is middleware?: './middleware.md'
53 | - banner: './packages/banner.md'
54 | - clean: './packages/clean.md'
55 | - compile-loader: './packages/compile-loader.md'
56 | - copy: './packages/copy.md'
57 | - dev-server: './packages/dev-server.md'
58 | - eslint: './packages/eslint.md'
59 | - font-loader: './packages/font-loader.md'
60 | - html-loader: './packages/html-loader.md'
61 | - html-template: './packages/html-template.md'
62 | - image-loader: './packages/image-loader.md'
63 | - start-server: './packages/start-server.md'
64 | - style-loader: './packages/style-loader.md'
65 | - style-minify: './packages/style-minify.md'
66 | - API: './api.md'
67 | - Creating Presets: './creating-presets.md'
68 | - Previous Versions:
69 | - v8 Documentation: 'https://release-v8.neutrinojs.org/'
70 | - v7 Documentation: 'https://release-v7.neutrinojs.org/'
71 | - v6 Documentation: 'https://github.com/neutrinojs/neutrino/tree/release/v6/docs'
72 | - v5 Documentation: 'https://github.com/neutrinojs/neutrino/tree/release/v5/docs'
73 | - v4 Documentation: 'https://github.com/neutrinojs/neutrino/tree/release/v4/docs'
74 | - FAQ: './faq.md'
75 | - Learning Resources: './learning-resources.md'
76 | - Contributing:
77 | - Overview: './contributing/index.md'
78 | - Development Process: './contributing/development.md'
79 | - Code of Conduct: './contributing/code-of-conduct.md'
80 |
81 | # https://squidfunk.github.io/mkdocs-material/getting-started/#extensions
82 | markdown_extensions:
83 | - admonition
84 | - codehilite:
85 | guess_lang: false
86 | - toc:
87 | permalink: true
88 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | # Using a non-root base directory/requirements file to prevent
3 | # Netlify from finding package.json and trying to install that:
4 | # https://github.com/netlify/build-image/issues/141
5 | base = "docs"
6 | publish = "build"
7 | command = "../scripts/build-docs.sh"
8 |
9 | # Redirect domain aliases to the primary domain.
10 |
11 | [[redirects]]
12 | from = "https://neutrino.js.org/*"
13 | to = "https://neutrinojs.org/:splat"
14 | force = true
15 |
16 | [[redirects]]
17 | from = "https://neutrinojs.netlify.com/*"
18 | to = "https://neutrinojs.org/:splat"
19 | force = true
20 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "neutrino",
3 | "private": true,
4 | "author": "Eli Perelman ",
5 | "license": "MPL-2.0",
6 | "homepage": "https://neutrinojs.org",
7 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
8 | "repository": "neutrinojs/neutrino",
9 | "engines": {
10 | "node": ">=12",
11 | "npm": ">=6.13.0",
12 | "yarn": ">=1.22.0"
13 | },
14 | "workspaces": [
15 | "packages/*"
16 | ],
17 | "scripts": {
18 | "changelog": "auto-changelog",
19 | "changelog:unreleased": "auto-changelog --package lerna.json",
20 | "docs:bootstrap": "pip install -r docs/requirements.txt",
21 | "docs:serve": "mkdocs serve",
22 | "link:all": "lerna exec yarn link",
23 | "lint": "eslint --no-eslintrc --config ./.eslintrc.js --cache --report-unused-disable-directives --format codeframe --ext js,jsx .",
24 | "prettier:check": "prettier --ignore-path .eslintignore --check \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
25 | "prettier:fix": "prettier --ignore-path .eslintignore --write \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
26 | "print-version": "node -p \"'v' +require('./lerna.json').version\"",
27 | "release:prepare": "lerna version && prettier --write lerna.json && yarn changelog:unreleased",
28 | "release:commit": "git commit --all --message $(yarn -s print-version) --edit",
29 | "release:tag": "git tag $(yarn -s print-version) && git push upstream $(yarn -s print-version)",
30 | "release:publish": "lerna publish from-package",
31 | "release:publish-next": "yarn release:publish --dist-tag next",
32 | "release:ci": "lerna publish preminor --registry http://localhost:4873 --no-git-reset --yes",
33 | "test": "ava --fail-fast packages/*/test \"!packages/create-project/test\"",
34 | "test:create-project": "ava --verbose packages/create-project/test",
35 | "validate:eslintrc:root": "eslint --no-eslintrc --print-config ./.eslintrc.js > /dev/null",
36 | "validate:eslintrc:eslint": "eslint --no-eslintrc --print-config ./packages/eslint/eslintrc.js > /dev/null",
37 | "validate:eslintrc:airbnb": "eslint --no-eslintrc --print-config ./packages/airbnb/eslintrc.js > /dev/null",
38 | "validate:eslintrc:airbnb-base": "eslint --no-eslintrc --print-config ./packages/airbnb-base/eslintrc.js > /dev/null",
39 | "validate:eslintrc:standardjs": "eslint --no-eslintrc --print-config ./packages/standardjs/eslintrc.js > /dev/null",
40 | "validate:eslintrc": "yarn validate:eslintrc:eslint && yarn validate:eslintrc:airbnb-base && yarn validate:eslintrc:airbnb && yarn validate:eslintrc:standardjs && yarn validate:eslintrc:root"
41 | },
42 | "devDependencies": {
43 | "auto-changelog": "^2.2.1",
44 | "ava": "^1.4.1",
45 | "eslint": "^7.16.0",
46 | "eslint-config-prettier": "^8.0.0",
47 | "eslint-plugin-prettier": "^4.0.0",
48 | "husky": "^4.3.6",
49 | "jest": "^26.6.3",
50 | "karma": "^5.2.3",
51 | "karma-cli": "^2.0.0",
52 | "lerna": "^3.22.1",
53 | "lint-staged": "^10.5.3",
54 | "mocha": "^8.2.1",
55 | "prettier": "^2.2.1",
56 | "verdaccio": "^5.1.0",
57 | "verdaccio-memory": "^10.0.0",
58 | "webpack": "^4.44.2",
59 | "webpack-cli": "^3.3.12",
60 | "webpack-dev-server": "^3.11.0"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/packages/airbnb-base/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 | eslintrc.js
3 |
--------------------------------------------------------------------------------
/packages/airbnb-base/eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('../neutrino');
2 | const middleware = require('.');
3 |
4 | module.exports = neutrino({
5 | use: middleware(),
6 | options: {
7 | root: __dirname,
8 | },
9 | }).eslintrc();
10 |
--------------------------------------------------------------------------------
/packages/airbnb-base/index.js:
--------------------------------------------------------------------------------
1 | const lint = require('@neutrinojs/eslint');
2 | const {
3 | rules: airbnbBaseStyle,
4 | } = require('eslint-config-airbnb-base/rules/style');
5 | const {
6 | rules: airbnbBaseBestPractices,
7 | } = require('eslint-config-airbnb-base/rules/best-practices');
8 |
9 | module.exports =
10 | ({ eslint = {}, ...opts } = {}) =>
11 | (neutrino) => {
12 | const baseConfig = eslint.baseConfig || {};
13 | neutrino.use(
14 | lint({
15 | ...opts,
16 | eslint: {
17 | ...eslint,
18 | baseConfig: {
19 | ...baseConfig,
20 | extends: [
21 | require.resolve('eslint-config-airbnb-base'),
22 | ...(baseConfig.extends || []),
23 | ],
24 | rules: {
25 | // Disable rules for which there are eslint-plugin-babel replacements:
26 | // https://github.com/babel/eslint-plugin-babel#rules
27 | 'new-cap': 'off',
28 | 'no-invalid-this': 'off',
29 | 'object-curly-spacing': 'off',
30 | semi: 'off',
31 | 'no-unused-expressions': 'off',
32 | // Ensure the replacement rules use the options set by airbnb-base rather than ESLint defaults.
33 | 'babel/new-cap': airbnbBaseStyle['new-cap'],
34 | 'babel/no-invalid-this':
35 | airbnbBaseBestPractices['no-invalid-this'],
36 | 'babel/object-curly-spacing':
37 | airbnbBaseStyle['object-curly-spacing'],
38 | 'babel/semi': airbnbBaseStyle.semi,
39 | 'babel/no-unused-expressions':
40 | airbnbBaseBestPractices['no-unused-expressions'],
41 | ...baseConfig.rules,
42 | },
43 | },
44 | },
45 | }),
46 | );
47 | };
48 |
--------------------------------------------------------------------------------
/packages/airbnb-base/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/airbnb-base",
3 | "version": "9.5.0",
4 | "description": "Neutrino preset for adding Airbnb's base JS ESLint config, following the Airbnb styleguide",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-preset",
9 | "airbnb",
10 | "eslint"
11 | ],
12 | "author": "Eli Perelman ",
13 | "license": "MPL-2.0",
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/neutrinojs/neutrino.git",
17 | "directory": "packages/airbnb-base"
18 | },
19 | "homepage": "https://neutrinojs.org",
20 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
21 | "publishConfig": {
22 | "access": "public"
23 | },
24 | "engines": {
25 | "node": ">=10",
26 | "npm": ">=5.4.0",
27 | "yarn": ">=1.2.1"
28 | },
29 | "dependencies": {
30 | "@neutrinojs/eslint": "9.5.0",
31 | "eslint-config-airbnb-base": "^14.2.1",
32 | "eslint-plugin-import": "^2.22.1"
33 | },
34 | "peerDependencies": {
35 | "eslint": "^6.0.0 || ^7.0.0",
36 | "neutrino": "^9.0.0",
37 | "webpack": "^4.0.0"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/packages/airbnb/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 | eslintrc.js
3 |
--------------------------------------------------------------------------------
/packages/airbnb/eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('../neutrino');
2 | const middleware = require('.');
3 |
4 | module.exports = neutrino({
5 | use: middleware(),
6 | options: {
7 | root: __dirname,
8 | },
9 | }).eslintrc();
10 |
--------------------------------------------------------------------------------
/packages/airbnb/index.js:
--------------------------------------------------------------------------------
1 | const lint = require('@neutrinojs/eslint');
2 | const {
3 | rules: airbnbBaseStyle,
4 | } = require('eslint-config-airbnb-base/rules/style');
5 | const {
6 | rules: airbnbBaseBestPractices,
7 | } = require('eslint-config-airbnb-base/rules/best-practices');
8 |
9 | module.exports =
10 | ({ eslint = {}, ...opts } = {}) =>
11 | (neutrino) => {
12 | const baseConfig = eslint.baseConfig || {};
13 | neutrino.use(
14 | lint({
15 | ...opts,
16 | eslint: {
17 | ...eslint,
18 | baseConfig: {
19 | ...baseConfig,
20 | extends: [
21 | require.resolve('eslint-config-airbnb'),
22 | require.resolve('eslint-config-airbnb/hooks'),
23 | ...(baseConfig.extends || []),
24 | ],
25 | rules: {
26 | // Override AirBnB's configuration of 'always', since they only set that value due to
27 | // babel-preset-airbnb not supporting class properties, whereas @neutrinojs/react does.
28 | 'react/state-in-constructor': ['error', 'never'],
29 | // Disable rules for which there are eslint-plugin-babel replacements:
30 | // https://github.com/babel/eslint-plugin-babel#rules
31 | 'new-cap': 'off',
32 | 'no-invalid-this': 'off',
33 | 'object-curly-spacing': 'off',
34 | semi: 'off',
35 | 'no-unused-expressions': 'off',
36 | // Ensure the replacement rules use the options set by airbnb rather than ESLint defaults.
37 | 'babel/new-cap': airbnbBaseStyle['new-cap'],
38 | 'babel/no-invalid-this':
39 | airbnbBaseBestPractices['no-invalid-this'],
40 | 'babel/object-curly-spacing':
41 | airbnbBaseStyle['object-curly-spacing'],
42 | 'babel/semi': airbnbBaseStyle.semi,
43 | 'babel/no-unused-expressions':
44 | airbnbBaseBestPractices['no-unused-expressions'],
45 | ...baseConfig.rules,
46 | },
47 | },
48 | },
49 | }),
50 | );
51 | };
52 |
--------------------------------------------------------------------------------
/packages/airbnb/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/airbnb",
3 | "version": "9.5.0",
4 | "description": "Neutrino preset for adding Airbnb's JS ESLint config for React, following the Airbnb styleguide",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-preset",
9 | "airbnb",
10 | "eslint"
11 | ],
12 | "author": "Eli Perelman ",
13 | "license": "MPL-2.0",
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/neutrinojs/neutrino.git",
17 | "directory": "packages/airbnb"
18 | },
19 | "homepage": "https://neutrinojs.org",
20 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
21 | "publishConfig": {
22 | "access": "public"
23 | },
24 | "engines": {
25 | "node": ">=10",
26 | "npm": ">=5.4.0",
27 | "yarn": ">=1.2.1"
28 | },
29 | "dependencies": {
30 | "@neutrinojs/eslint": "9.5.0",
31 | "eslint-config-airbnb": "^18.2.1",
32 | "eslint-config-airbnb-base": "^14.2.1",
33 | "eslint-plugin-import": "^2.22.1",
34 | "eslint-plugin-jsx-a11y": "^6.4.1",
35 | "eslint-plugin-react": "^7.21.5",
36 | "eslint-plugin-react-hooks": "^4.2.0"
37 | },
38 | "peerDependencies": {
39 | "eslint": "^6.0.0 || ^7.0.0",
40 | "neutrino": "^9.0.0",
41 | "webpack": "^4.0.0"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/packages/banner/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 |
--------------------------------------------------------------------------------
/packages/banner/README.md:
--------------------------------------------------------------------------------
1 | # Neutrino Banner Middleware
2 |
3 | `@neutrinojs/banner` is Neutrino middleware for injecting string content into
4 | source code files.
5 |
6 | [![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url]
7 |
8 | ## Requirements
9 |
10 | - Node.js 10+
11 | - Yarn v1.2.1+, or npm v5.4+
12 | - Neutrino 9
13 | - webpack 4
14 |
15 | ## Installation
16 |
17 | `@neutrinojs/banner` can be installed via the Yarn or npm clients.
18 |
19 | #### Yarn
20 |
21 | ```bash
22 | ❯ yarn add --dev @neutrinojs/banner
23 | ```
24 |
25 | #### npm
26 |
27 | ```bash
28 | ❯ npm install --save-dev @neutrinojs/banner
29 | ```
30 |
31 | ## Usage
32 |
33 | `@neutrinojs/banner` can be consumed from the Neutrino API, middleware, or
34 | presets. Require this package and plug it into Neutrino:
35 |
36 | ```js
37 | const banner = require('@neutrinojs/banner');
38 |
39 | // Use with default options
40 | neutrino.use(banner());
41 |
42 | // Also accepts options for webpack's BannerPlugin
43 | // https://webpack.js.org/plugins/banner-plugin/
44 |
45 | // Usage shows the default values of this middleware:
46 | neutrino.use(
47 | banner({
48 | banner: `require('source-map-support').install();`,
49 | test: neutrino.regexFromExtensions(),
50 | raw: true,
51 | entryOnly: true,
52 | // Override pluginId to add an additional banner plugin instance
53 | pluginId: 'banner',
54 | }),
55 | );
56 | ```
57 |
58 | ```js
59 | // Using in .neutrinorc.js
60 | const banner = require('@neutrinojs/banner');
61 |
62 | // Use with default options
63 | module.exports = {
64 | use: [banner()],
65 | };
66 |
67 | // Also accepts options for webpack's BannerPlugin
68 | // https://webpack.js.org/plugins/banner-plugin/
69 |
70 | // Usage shows the default values of this middleware:
71 | module.exports = {
72 | use: [
73 | banner({
74 | banner: `require('source-map-support').install();`,
75 | test: neutrino.regexFromExtensions(),
76 | raw: true,
77 | entryOnly: true,
78 | // Override pluginId to add an additional banner plugin instance
79 | pluginId: 'banner',
80 | }),
81 | ],
82 | };
83 | ```
84 |
85 | ## Customization
86 |
87 | `@neutrinojs/banner` creates some conventions to make overriding the
88 | configuration easier once you are ready to make changes.
89 |
90 | ### Plugins
91 |
92 | The following is a list of plugins and their identifiers which can be
93 | overridden:
94 |
95 | | Name | Description | NODE_ENV |
96 | | -------- | ---------------------------------------------------- | -------- |
97 | | `banner` | Injects string content into application source code. | all |
98 |
99 | ## Contributing
100 |
101 | This middleware is part of the
102 | [neutrino](https://github.com/neutrinojs/neutrino) repository, a monorepo
103 | containing all resources for developing Neutrino and its core presets and
104 | middleware. Follow the
105 | [contributing guide](https://neutrinojs.org/contributing/) for details.
106 |
107 | [npm-image]: https://img.shields.io/npm/v/@neutrinojs/banner.svg
108 | [npm-downloads]: https://img.shields.io/npm/dt/@neutrinojs/banner.svg
109 | [npm-url]: https://www.npmjs.com/package/@neutrinojs/banner
110 |
--------------------------------------------------------------------------------
/packages/banner/index.js:
--------------------------------------------------------------------------------
1 | module.exports =
2 | ({ pluginId = 'banner', ...options } = {}) =>
3 | (neutrino) => {
4 | neutrino.config
5 | .plugin(pluginId)
6 | .use(require.resolve('webpack/lib/BannerPlugin'), [
7 | {
8 | banner: "require('source-map-support').install();",
9 | test: neutrino.regexFromExtensions(),
10 | raw: true,
11 | entryOnly: true,
12 | ...options,
13 | },
14 | ]);
15 | };
16 |
--------------------------------------------------------------------------------
/packages/banner/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/banner",
3 | "version": "9.5.0",
4 | "description": "Neutrino middleware for injecting a banner into bundled files",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-middleware",
9 | "banner"
10 | ],
11 | "author": "Eli Perelman ",
12 | "license": "MPL-2.0",
13 | "repository": {
14 | "type": "git",
15 | "url": "https://github.com/neutrinojs/neutrino.git",
16 | "directory": "packages/banner"
17 | },
18 | "homepage": "https://neutrinojs.org",
19 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
20 | "publishConfig": {
21 | "access": "public"
22 | },
23 | "engines": {
24 | "node": ">=10",
25 | "npm": ">=5.4.0",
26 | "yarn": ">=1.2.1"
27 | },
28 | "peerDependencies": {
29 | "neutrino": "^9.0.0",
30 | "webpack": "^4.0.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/banner/test/middleware_test.js:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 | import Neutrino from '../../neutrino/Neutrino';
3 |
4 | const mw = (...args) => require('..')(...args);
5 | const options = { raw: false, entryOnly: false };
6 |
7 | test('loads middleware', (t) => {
8 | t.notThrows(() => require('..'));
9 | });
10 |
11 | test('uses middleware', (t) => {
12 | t.notThrows(() => new Neutrino().use(mw()));
13 | });
14 |
15 | test('uses with options', (t) => {
16 | t.notThrows(() => new Neutrino().use(mw(options)));
17 | });
18 |
19 | test('instantiates', (t) => {
20 | const api = new Neutrino();
21 |
22 | api.use(mw());
23 |
24 | t.notThrows(() => api.config.toConfig());
25 | });
26 |
27 | test('instantiates with options', (t) => {
28 | const api = new Neutrino();
29 |
30 | api.use(mw(options));
31 |
32 | t.notThrows(() => api.config.toConfig());
33 | });
34 |
--------------------------------------------------------------------------------
/packages/clean/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 |
--------------------------------------------------------------------------------
/packages/clean/README.md:
--------------------------------------------------------------------------------
1 | # Neutrino Clean Middleware
2 |
3 | `@neutrinojs/clean` is Neutrino middleware for removing or cleaning build
4 | directories.
5 |
6 | [![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url]
7 |
8 | By default, this plugin will remove all files inside webpack's `output.path`
9 | directory, as well as all unused webpack assets after every successful rebuild.
10 |
11 | ## Requirements
12 |
13 | - Node.js 10+
14 | - Yarn v1.2.1+, or npm v5.4+
15 | - Neutrino 9
16 | - webpack 4
17 |
18 | ## Installation
19 |
20 | `@neutrinojs/clean` can be installed via the Yarn or npm clients.
21 |
22 | #### Yarn
23 |
24 | ```bash
25 | ❯ yarn add --dev @neutrinojs/clean
26 | ```
27 |
28 | #### npm
29 |
30 | ```bash
31 | ❯ npm install --save-dev @neutrinojs/clean
32 | ```
33 |
34 | ## Usage
35 |
36 | `@neutrinojs/clean` can be consumed from the Neutrino API, middleware, or
37 | presets. Require this package and plug it into Neutrino:
38 |
39 | ```js
40 | const clean = require('@neutrinojs/clean');
41 |
42 | // Use with default options
43 | neutrino.use(clean());
44 |
45 | // Usage shows the default values of this middleware:
46 | neutrino.use(
47 | clean({
48 | verbose: neutrino.options.debug,
49 | // Override pluginId to add an additional clean plugin instance
50 | pluginId: 'clean',
51 | }),
52 | );
53 | ```
54 |
55 | ```js
56 | // Using in .neutrinorc.js
57 | const clean = require('@neutrinojs/clean');
58 |
59 | // Use with default options
60 | module.exports = {
61 | use: [clean()],
62 | };
63 |
64 | // Usage shows the default values of this middleware:
65 | module.exports = {
66 | use: [
67 | clean({
68 | verbose: neutrino.options.debug,
69 | // Override pluginId to add an additional banner plugin instance
70 | pluginId: 'clean',
71 | }),
72 | ],
73 | };
74 | ```
75 |
76 | Additional options can be specified to control the behavior of the underlying
77 | `clean-webpack-plugin`. See
78 | [`CleanWebpackPlugin`'s documentation](https://github.com/johnagan/clean-webpack-plugin)
79 | for available options.
80 |
81 | ## Clean external directories
82 |
83 | Pass the `dangerouslyAllowCleanPatternsOutsideProject: true` option to remove
84 | directories outside of the project root. This is disabled by default to prevent
85 | deletion of unintended directories.
86 |
87 | ```js
88 | module.exports = {
89 | use: [
90 | clean({
91 | dangerouslyAllowCleanPatternsOutsideProject: true,
92 | }),
93 | ],
94 | };
95 | ```
96 |
97 | ## Customization
98 |
99 | `@neutrinojs/clean` creates some conventions to make overriding the
100 | configuration easier once you are ready to make changes.
101 |
102 | ### Plugins
103 |
104 | The following is a list of plugins and their identifiers which can be
105 | overridden:
106 |
107 | | Name | Description | NODE_ENV |
108 | | ------- | ------------------------------------ | -------- |
109 | | `clean` | Removes directories before building. | all |
110 |
111 | ## Contributing
112 |
113 | This middleware is part of the
114 | [neutrino](https://github.com/neutrinojs/neutrino) repository, a monorepo
115 | containing all resources for developing Neutrino and its core presets and
116 | middleware. Follow the
117 | [contributing guide](https://neutrinojs.org/contributing/) for details.
118 |
119 | [npm-image]: https://img.shields.io/npm/v/@neutrinojs/clean.svg
120 | [npm-downloads]: https://img.shields.io/npm/dt/@neutrinojs/clean.svg
121 | [npm-url]: https://www.npmjs.com/package/@neutrinojs/clean
122 |
--------------------------------------------------------------------------------
/packages/clean/index.js:
--------------------------------------------------------------------------------
1 | module.exports =
2 | ({ pluginId = 'clean', ...opts } = {}) =>
3 | (neutrino) => {
4 | const options = {
5 | verbose: neutrino.options.debug,
6 | ...opts,
7 | };
8 |
9 | neutrino.config
10 | .plugin(pluginId)
11 | .use(require.resolve('clean-webpack-plugin'), [options])
12 | .init((Plugin, args) => new Plugin.CleanWebpackPlugin(...args));
13 | };
14 |
--------------------------------------------------------------------------------
/packages/clean/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/clean",
3 | "version": "9.5.0",
4 | "description": "Neutrino middleware for cleaning bundle output directories",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-middleware",
9 | "clean"
10 | ],
11 | "author": "Eli Perelman ",
12 | "license": "MPL-2.0",
13 | "repository": {
14 | "type": "git",
15 | "url": "https://github.com/neutrinojs/neutrino.git",
16 | "directory": "packages/clean"
17 | },
18 | "homepage": "https://neutrinojs.org",
19 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
20 | "publishConfig": {
21 | "access": "public"
22 | },
23 | "engines": {
24 | "node": ">=10",
25 | "npm": ">=5.4.0",
26 | "yarn": ">=1.2.1"
27 | },
28 | "dependencies": {
29 | "clean-webpack-plugin": "^3.0.0"
30 | },
31 | "peerDependencies": {
32 | "neutrino": "^9.0.0",
33 | "webpack": "^4.0.0"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/clean/test/middleware_test.js:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 | import Neutrino from '../../neutrino/Neutrino';
3 |
4 | const mw = (...args) => require('..')(...args);
5 | const options = { paths: ['sample'], root: __dirname };
6 |
7 | test('loads middleware', (t) => {
8 | t.notThrows(() => require('..'));
9 | });
10 |
11 | test('uses middleware', (t) => {
12 | t.notThrows(() => new Neutrino().use(mw()));
13 | });
14 |
15 | test('uses with options', (t) => {
16 | t.notThrows(() => new Neutrino().use(mw(options)));
17 | });
18 |
19 | test('instantiates', (t) => {
20 | const api = new Neutrino();
21 |
22 | api.use(mw());
23 |
24 | t.notThrows(() => api.config.toConfig());
25 | });
26 |
27 | test('instantiates with options', (t) => {
28 | const api = new Neutrino();
29 |
30 | api.use(mw(options));
31 |
32 | t.notThrows(() => api.config.toConfig());
33 | });
34 |
--------------------------------------------------------------------------------
/packages/compile-loader/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 |
--------------------------------------------------------------------------------
/packages/compile-loader/index.js:
--------------------------------------------------------------------------------
1 | const { DuplicateRuleError } = require('neutrino/errors');
2 |
3 | module.exports =
4 | ({ ruleId = 'compile', useId = 'babel', ...options } = {}) =>
5 | (neutrino) => {
6 | if (neutrino.config.module.rules.has(ruleId)) {
7 | throw new DuplicateRuleError('@neutrinojs/compile-loader', ruleId);
8 | }
9 |
10 | neutrino.config.module
11 | .rule(ruleId)
12 | .test(options.test || neutrino.regexFromExtensions())
13 | .when(options.include, (rule) => rule.include.merge(options.include))
14 | .when(options.exclude, (rule) => rule.exclude.merge(options.exclude))
15 | .use(useId)
16 | .loader(require.resolve('babel-loader'))
17 | .options({
18 | cacheDirectory: true,
19 | babelrc: false,
20 | configFile: false,
21 | ...(options.babel || {}),
22 | });
23 |
24 | neutrino.register('babel', (neutrino) =>
25 | neutrino.config.module.rule(ruleId).use(useId).get('options'),
26 | );
27 | };
28 |
--------------------------------------------------------------------------------
/packages/compile-loader/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/compile-loader",
3 | "version": "9.5.0",
4 | "description": "Neutrino middleware for compiling JavaScript using Babel configuration",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-middleware",
9 | "compile",
10 | "babel"
11 | ],
12 | "author": "Eli Perelman ",
13 | "license": "MPL-2.0",
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/neutrinojs/neutrino.git",
17 | "directory": "packages/compile-loader"
18 | },
19 | "homepage": "https://neutrinojs.org",
20 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
21 | "publishConfig": {
22 | "access": "public"
23 | },
24 | "engines": {
25 | "node": ">=10",
26 | "npm": ">=5.4.0",
27 | "yarn": ">=1.2.1"
28 | },
29 | "dependencies": {
30 | "@babel/core": "^7.12.10",
31 | "babel-loader": "^8.2.2"
32 | },
33 | "peerDependencies": {
34 | "neutrino": "^9.0.0",
35 | "webpack": "^4.0.0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/packages/compile-loader/test/middleware_test.js:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 | import Neutrino from '../../neutrino/Neutrino';
3 | import neutrino from '../../neutrino';
4 |
5 | const mw = (...args) => require('..')(...args);
6 | const options = { test: /\.js$/, babel: { cacheDirectory: false } };
7 |
8 | test('loads middleware', (t) => {
9 | t.notThrows(() => require('..'));
10 | });
11 |
12 | test('uses middleware', (t) => {
13 | const api = new Neutrino();
14 |
15 | t.notThrows(() => api.use(mw()));
16 | });
17 |
18 | test('uses with options', (t) => {
19 | const api = new Neutrino();
20 |
21 | t.notThrows(() => api.use(mw(options)));
22 | });
23 |
24 | test('instantiates', (t) => {
25 | const api = new Neutrino();
26 |
27 | api.use(mw());
28 |
29 | t.notThrows(() => api.config.toConfig());
30 | });
31 |
32 | test('instantiates with options', (t) => {
33 | const api = new Neutrino();
34 |
35 | api.use(mw(options));
36 |
37 | t.notThrows(() => api.config.toConfig());
38 | });
39 |
40 | test('exposes babel output handler', (t) => {
41 | const api = new Neutrino();
42 |
43 | api.use(mw());
44 |
45 | const handler = api.outputHandlers.get('babel');
46 |
47 | t.is(typeof handler, 'function');
48 | });
49 |
50 | test('exposes babel config from output', (t) => {
51 | const config = neutrino(mw()).output('babel');
52 |
53 | t.is(typeof config, 'object');
54 | });
55 |
56 | test('exposes babel method', (t) => {
57 | t.is(typeof neutrino(mw()).babel, 'function');
58 | });
59 |
60 | test('exposes babel config from method', (t) => {
61 | t.is(typeof neutrino(mw()).babel(), 'object');
62 | });
63 |
64 | test('throws when used twice', (t) => {
65 | const api = new Neutrino();
66 | api.use(mw());
67 | t.throws(
68 | () => api.use(mw()),
69 | /@neutrinojs\/compile-loader has been used twice with the same ruleId of 'compile'/,
70 | );
71 | });
72 |
--------------------------------------------------------------------------------
/packages/copy/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 |
--------------------------------------------------------------------------------
/packages/copy/README.md:
--------------------------------------------------------------------------------
1 | # Neutrino Copy Middleware
2 |
3 | `@neutrinojs/copy` is Neutrino middleware for copying files during building.
4 |
5 | [![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url]
6 |
7 | ## Requirements
8 |
9 | - Node.js 10+
10 | - Yarn v1.2.1+, or npm v5.4+
11 | - Neutrino 9
12 | - webpack 4
13 |
14 | ## Installation
15 |
16 | `@neutrinojs/copy` can be installed via the Yarn or npm clients.
17 |
18 | #### Yarn
19 |
20 | ```bash
21 | ❯ yarn add --dev @neutrinojs/copy
22 | ```
23 |
24 | #### npm
25 |
26 | ```bash
27 | ❯ npm install --save-dev @neutrinojs/copy
28 | ```
29 |
30 | ## Usage
31 |
32 | `@neutrinojs/copy` can be consumed from the Neutrino API, middleware, or
33 | presets. Require this package and plug it into Neutrino:
34 |
35 | ```js
36 | const copy = require('@neutrinojs/copy');
37 |
38 | // Use with default options
39 | neutrino.use(copy());
40 |
41 | // Usage shows the default values of this middleware:
42 | neutrino.use(
43 | copy({
44 | patterns: [],
45 | options: {
46 | logLevel: neutrino.options.debug ? 'debug' : 'warn',
47 | },
48 | pluginId: 'copy',
49 | }),
50 | );
51 | ```
52 |
53 | ```js
54 | // Using in .neutrinorc.js
55 | const copy = require('@neutrinojs/copy');
56 |
57 | // Use with default options
58 | module.exports = {
59 | use: [copy()],
60 | };
61 |
62 | // Usage shows the default values of this middleware:
63 | module.exports = {
64 | use: [
65 | copy({
66 | patterns: [],
67 | options: {
68 | logLevel: neutrino.options.debug ? 'debug' : 'warn',
69 | },
70 | pluginId: 'copy',
71 | }),
72 | ],
73 | };
74 | ```
75 |
76 | The `patterns` and `options` are defined from the
77 | [CopyWebpackPlugin](https://github.com/kevlened/copy-webpack-plugin). See their
78 | docs for details on valid values to specify.
79 |
80 | - `patterns`: An array of patterns specifying copy operations.
81 | - `options`: An object specifying copy options.
82 | - `pluginId`: The plugin identifier. Override this to add an additional copy
83 | plugin instance.
84 |
85 | ## Customization
86 |
87 | `@neutrinojs/copy` creates some conventions to make overriding the configuration
88 | easier once you are ready to make changes.
89 |
90 | ### Plugins
91 |
92 | The following is a list of plugins and their identifiers which can be
93 | overridden:
94 |
95 | | Name | Description | NODE_ENV |
96 | | ------ | --------------------------- | -------- |
97 | | `copy` | Copy files during building. | all |
98 |
99 | ## Contributing
100 |
101 | This middleware is part of the
102 | [neutrino](https://github.com/neutrinojs/neutrino) repository, a monorepo
103 | containing all resources for developing Neutrino and its core presets and
104 | middleware. Follow the
105 | [contributing guide](https://neutrinojs.org/contributing/) for details.
106 |
107 | [npm-image]: https://img.shields.io/npm/v/@neutrinojs/copy.svg
108 | [npm-downloads]: https://img.shields.io/npm/dt/@neutrinojs/copy.svg
109 | [npm-url]: https://www.npmjs.com/package/@neutrinojs/copy
110 |
--------------------------------------------------------------------------------
/packages/copy/index.js:
--------------------------------------------------------------------------------
1 | module.exports =
2 | ({ pluginId = 'copy', patterns = [], options = {} } = {}) =>
3 | (neutrino) => {
4 | neutrino.config
5 | .plugin(pluginId)
6 | .use(require.resolve('copy-webpack-plugin'), [
7 | patterns,
8 | {
9 | logLevel: neutrino.options.debug ? 'debug' : 'warn',
10 | ...options,
11 | },
12 | ]);
13 | };
14 |
--------------------------------------------------------------------------------
/packages/copy/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@neutrinojs/copy",
3 | "version": "9.5.0",
4 | "description": "Neutrino middleware for copying files to a bundle output directory",
5 | "main": "index.js",
6 | "keywords": [
7 | "neutrino",
8 | "neutrino-middleware",
9 | "copy",
10 | "copying"
11 | ],
12 | "author": "Eli Perelman ",
13 | "license": "MPL-2.0",
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/neutrinojs/neutrino.git",
17 | "directory": "packages/copy"
18 | },
19 | "homepage": "https://neutrinojs.org",
20 | "bugs": "https://github.com/neutrinojs/neutrino/issues",
21 | "publishConfig": {
22 | "access": "public"
23 | },
24 | "engines": {
25 | "node": ">=10",
26 | "npm": ">=5.4.0",
27 | "yarn": ">=1.2.1"
28 | },
29 | "dependencies": {
30 | "copy-webpack-plugin": "^5.1.2"
31 | },
32 | "peerDependencies": {
33 | "neutrino": "^9.0.0",
34 | "webpack": "^4.0.0"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/packages/copy/test/middleware_test.js:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 | import Neutrino from '../../neutrino/Neutrino';
3 |
4 | const mw = (...args) => require('..')(...args);
5 | const options = {
6 | patterns: ['shorthand-form', { from: 'source', to: 'dest' }],
7 | options: { ignore: /\.css$/ },
8 | };
9 |
10 | test('loads middleware', (t) => {
11 | t.notThrows(() => require('..'));
12 | });
13 |
14 | test('uses middleware', (t) => {
15 | t.notThrows(() => new Neutrino().use(mw()));
16 | });
17 |
18 | test('uses with options', (t) => {
19 | t.notThrows(() => new Neutrino().use(mw(options)));
20 | });
21 |
22 | test('instantiates', (t) => {
23 | const api = new Neutrino();
24 |
25 | api.use(mw());
26 |
27 | t.notThrows(() => api.config.toConfig());
28 | });
29 |
30 | test('instantiates with options', (t) => {
31 | const api = new Neutrino();
32 |
33 | api.use(mw(options));
34 |
35 | t.notThrows(() => api.config.toConfig());
36 | });
37 |
--------------------------------------------------------------------------------
/packages/create-project/.npmignore:
--------------------------------------------------------------------------------
1 | /test/
2 |
--------------------------------------------------------------------------------
/packages/create-project/bin/create-project.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const yargs = require('yargs');
4 | const { createEnv } = require('yeoman-environment');
5 | const { basename, isAbsolute, join, resolve } = require('path');
6 |
7 | const env = createEnv();
8 | const done = (exitCode) => process.exit(exitCode || 0);
9 | const dir = resolve(__dirname, '../commands/init');
10 |
11 | env.register(require.resolve(dir), 'create-project');
12 |
13 | const cli = yargs
14 | .command('')
15 | .option('debug', { description: 'Run in debug mode' })
16 | .option('registry', { description: 'Specify an alternate npm registry' })
17 | .demandCommand(1, 'Only is required')
18 | .help()
19 | .wrap(null).argv;
20 | const directory = isAbsolute(cli._[0])
21 | ? cli._[0]
22 | : join(process.cwd(), cli._[0]);
23 | const name = basename(directory);
24 |
25 | env.run(
26 | 'create-project',
27 | {
28 | directory,
29 | name,
30 | registry: cli.registry,
31 | debug: !!cli.debug,
32 | stdio: cli.debug ? 'inherit' : 'ignore',
33 | },
34 | done,
35 | );
36 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/airbnb-base/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | module.exports = neutrino().eslintrc();
4 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/airbnb/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | module.exports = neutrino().eslintrc();
4 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/jest/jest.config.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | process.env.NODE_ENV = process.env.NODE_ENV || 'test';
4 |
5 | module.exports = neutrino().jest();
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/jest/test/simple_test.js:
--------------------------------------------------------------------------------
1 | describe('simple', () => {
2 | it('should be sane', () => {
3 | expect(false).not.toBe(true);
4 | });
5 | });
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/karma/karma.conf.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | process.env.NODE_ENV = process.env.NODE_ENV || 'test';
4 |
5 | module.exports = neutrino().karma();
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/karma/test/simple_test.js:
--------------------------------------------------------------------------------
1 | import assert from 'assert';
2 |
3 | describe('simple', () => {
4 | it('should be sane', () => {
5 | assert.equal(true, !false);
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/library/src/index.js:
--------------------------------------------------------------------------------
1 | export default () => 'Welcome to <%= data.name %>';
2 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/library/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/mocha/.mocharc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | process.env.NODE_ENV = process.env.NODE_ENV || 'test';
4 |
5 | module.exports = neutrino().mocha();
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/mocha/test/simple_test.js:
--------------------------------------------------------------------------------
1 | import assert from 'assert';
2 |
3 | describe('simple', () => {
4 | it('should be sane', () => {
5 | assert.equal(true, !false);
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/neutrino/.neutrinorc.js.ejs:
--------------------------------------------------------------------------------
1 | <% middleware.forEach(({ name, package }) => { %>const <%= name %> = require('<%= package %>');
2 | <% })%>
3 | module.exports = {
4 | options: {
5 | root: __dirname,
6 | },
7 | use: [<% middleware.forEach(({ name, options }) => { %>
8 | <%= name %>(<%- options %>),<% })%>
9 | ],
10 | };
11 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/node/src/app.js:
--------------------------------------------------------------------------------
1 | const app = () =>
2 | '
Welcome to <%= data.name %>
';
3 |
4 | export default app;
5 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/node/src/index.js:
--------------------------------------------------------------------------------
1 | import { createServer } from 'http';
2 | import app from './app';
3 |
4 | const port = process.env.PORT || 3000;
5 |
6 | createServer((request, response) => response.end(app())).listen(port, () =>
7 | process.stdout.write(`Running on :${port}\n`),
8 | );
9 |
10 | if (module.hot) {
11 | module.hot.accept('./app');
12 | }
13 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/node/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/preact/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | padding: 20px;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/preact/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { h, Component } from 'preact';
2 | import './App.css';
3 |
4 | export default class App extends Component {
5 | state = {
6 | name: '<%= data.name %>',
7 | };
8 |
9 | render() {
10 | const { name } = this.state;
11 | return (
12 |
13 |
14 | Welcome to
15 | {name}
16 |
17 |
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/preact/src/index.jsx:
--------------------------------------------------------------------------------
1 | import { h, render } from 'preact';
2 |
3 | const root = document.getElementById('root');
4 | const load = async () => {
5 | const { default: App } = await import('./App');
6 |
7 | render(, root);
8 | };
9 |
10 | // This is needed for Hot Module Replacement
11 | if (module.hot) {
12 | module.hot.accept('./App', () => requestAnimationFrame(load));
13 | }
14 |
15 | load();
16 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/preact/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react-components/src/components/Example/index.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | // From https://reactjs.org/docs/hooks-state.html
4 | export default function Example() {
5 | // Declare a new state variable, which we'll call "count"
6 | const [count, setCount] = useState(0);
7 | const message = `You clicked ${count} times`;
8 |
9 | return (
10 |
11 |
{message}
12 |
15 |
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react-components/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 | import Example from './components/Example';
4 |
5 | render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react-components/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | padding: 20px;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { hot } from 'react-hot-loader';
2 | import React from 'react';
3 | import './App.css';
4 |
5 | const message = 'Welcome to <%= data.name %>';
6 | const App = () => (
7 |
8 |
{message}
9 |
10 | );
11 |
12 | export default hot(module)(App);
13 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from 'react-dom';
3 | import App from './App';
4 |
5 | render(, document.getElementById('root'));
6 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/react/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/standardjs/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const neutrino = require('neutrino');
2 |
3 | module.exports = neutrino().eslintrc();
4 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/vue/src/App.vue:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
Welcome to <%= data.name %>
13 |
14 |
15 |
16 |
21 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/vue/src/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 | import App from './App.vue';
3 |
4 | export default new Vue({
5 | el: '#root',
6 | render: (h) => h(App),
7 | });
8 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/vue/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Whilst the configuration object can be modified here, the recommended way of making
2 | // changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
3 | // Neutrino's inspect feature can be used to view/export the generated configuration.
4 | const neutrino = require('neutrino');
5 |
6 | module.exports = neutrino().webpack();
7 |
--------------------------------------------------------------------------------
/packages/create-project/commands/init/templates/web/src/index.js:
--------------------------------------------------------------------------------
1 | const root = document.getElementById('root');
2 |
3 | root.innerHTML =
4 | '