npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

neutrino-preset-taskcluster-web

v2.0.0

Published

TaskCluster preset for building Neutrino web applications

Downloads

5

Readme

TaskCluster Neutrino Web Preset

This neutrino preset enables building JSX-supported React-based web applications with a TaskCluster configuration for Webpack, ESLint, Babel, Karma+Mocha, along with a static local development server.

This preset extends the neutrino-preset-taskcluster and neutrino-preset-react presets by enhancing them with TaskCluster-Web-specific configuration.

Getting started

Install neutrino and neutrino-preset-taskcluster-web as development dependencies in your project:

# npm
npm install --save-dev neutrino neutrino-preset-taskcluster-web

# yarn
yarn add neutrino neutrino-preset-taskcluster-web --dev

Modify your package.json scripts to use the TaskCluster Web preset to build your project

{
  "config": {
    "preset": "neutrino-preset-taskcluster-web"
  },
  "scripts": {
    "start": "PORT=4000 neutrino start",
    "build": "neutrino build",
    "test": "neutrino test"
  }
}

Add your source code to src/, which is compiled using Babel's es2015, react, and stage-0 presets. A number of loaders are pre-configured, allowing you to use import and export for CSS, images, HTML, and JSON. During development, run npm start or yarn start to start a local development server for running the application. When you are ready to build your project into static assets, run npm run build or yarn run build which will create a build/ directory in the root of your project.

If you would like to use testing in your project, create a test/ directory, and write tests in JS files with file names ending in _test.js, e.g. test/homepage_test.js or test/users/admin_test.js. Run tests with npm test or yarn test, which will output results to the console, and also creates test coverage to a .coverage/ directory.

Overriding the preset

There may be times where this preset works well for you, but you need to change some of the defaults it provides. Maybe you don't like the opinion of the ESLint rules, or want to add more types of file loading. Whatever the reason for needing changes, you can either create a custom preset based on this one, or change the values on a project-by-project basis.

To override in your project, create a new file to use as a preset which will modify the existing one, e.g. custom-preset.js:

// bring in the existing preset
const preset = require('neutrino-preset-taskcluster-web');

// modify the preset

// re-export the preset
module.exports = preset;

Now you can pass this file to neutrino to use as the new preset:

{
  "config": {
    "preset": "custom-preset.js"
  }
}

You can also choose to load different presets for different targets if you so wish:

{
  "config": {
    "preset": "custom-preset.js"
  },
  "scripts": {
    "start": "neutrino start",
    "test": "neutrino test --preset some-other-preset",
    "build": "neutrino build --preset neutrino-preset-taskcluster-web"
  }
}

Overriding the default page template

By default, HTML files are built using the template.ejs from the neutrino-preset-web preset. If you wish to use a custom template or if the default just doesn't suit your needs, you can create a template.ejs file in your src/ directory, and it will be picked up automatically.