nwb is a development tool for React apps, React components and other browser-focused npm modules.
reactis for quick development of React apps, starting from a single
.jsfile and building up:
react run app.jsstarts a development server.
react build app.jscreates a static build.
nwbis for common development tasks in a project’s
nwb startstarts a development server.
nwb testruns unit tests.
nwb buildcreates a static build.
nwb newcreates skeleton projects.
Table of Contents
- Quick Start Examples
- Quick React Development
Installing globally provides
nwb commands for quick React development and generating project skeletons preconfigured for development using nwb:
npm install -g nwb
Installing into a project provides an
nwb command for use in
npm install --save-dev nwb
nwb gets you started quickly , with workflows for starting from a single
.js file and building up, or generating skeleton projects ready for deployment or publishing out of the box, preconfigured for running unit tests locally and on Travis CI .
nwb owns core development dependencies so you don’t have to copy the same
devDependencies between projects and deal with keeping them up to date individually. Here’s an example of the effect nwb has on the amount of
devDependencies and configuration you need to manage.
nwb dynamically generates configuration , so you don’t have to copy configuration boilerplate between projects. It generates a comprehensive baseline configuration and allows you to use a single configuration file to tweak or add to it to suit your project.
Quick Start Examples
(Assuming a global install of nwb)
Start developing a React app from a single file, automatically installing missing dependencies from npm when they’re required; then create a static build for distribution:
$ touch app.js ... $ react run app.js --auto-install nwb: serve-react nwb: dev server listening at http://localhost:3000 ... $ react build app.js nwb: clean-app nwb: build-react ...
Create a new React app project and start a development server:
$ nwb new react-app github-issues ... nwb: installing dependencies ... $ cd github-issues $ npm start nwb: serve-react-app nwb: dev server listening at http://localhost:3000 ...
Create a new React component project and start a development server for its demo app:
$ nwb new react-component react-thing ? Do you want to create a UMD build for npm? Yes ? Which global variable should the UMD build export? ReactThing ? Do you want to create an ES6 modules build for npm? Yes ... nwb: installing dependencies ... $ cd react-thing $ npm start nwb: serve-react-demo nwb: dev server listening at http://localhost:3000 ...
Quick React Development
react command provides quick React development, starting from a single
.js file and working up.
Usage: react (run|build) [options] Options: -c, --config config file to use [default: nwb.config.js] -h, --help display this help message -v, --version print nwb's version Commands: react run <entry> [options] Serve a React app for development. Arguments: entry entry point for the app Options: --auto-install auto install missing npm dependencies --fallback serve the index page from any path --host hostname to bind the dev server to [default: localhost] --info show webpack module info --mount-id id for the <div> the app will render into [default: app] --port port to run the dev server on [default: 3000] --reload auto reload the page if hot reloading fails --title contents for <title> [default: React App] react build <entry> [dist_dir] [options] Create a static build for a React app. Arguments: entry entry point for the app dist_dir build output directory [default: dist/] Options: --mount-id id for the <div> the app will render into [default: app] --title contents for <title> [default: React App] --vendor create a separate vendor bundle
nwb command handles development tasks for different types of projects.
Since Semantic Versioning v2.0.0 specifies…
Major version zero (
0.y.z ) is for initial development. Anything may change at any time. The public API should not be considered stable.
…you can technically follow both SemVer and Sentimental Versioning at the same time.
This is what versions mean during nwb’s initial development:
0.yversions are majorish, anything may change – always read theCHANGES file orGitHub release notes to review what’s changed before upgrading .
Where possible , any changes required to the nwb config file format will be backwards-compatible in the
0.yversion they’re introduced in, with a deprecation warning when the old format is used. Support for the old format will then be dropped in the next
0.y.zversions are minorish, and may contain bug fixes, non-breaking changes, minor new features and non-breaking dependency changes.
I will be pinning my own projects’ nwb version range against these – e.g.
"nwb": "0.7.x"– but if in doubt , pin your dependencies against an exact version .
Version 1.0.0 defines the public API. The way in which the version number is incremented after this release is dependent on this public API and how it changes.
Operating system icons created with Icons8
转载本站任何文章请注明：转载至神刀安全网，谢谢神刀安全网 » Nwb – quick React development and configurable project dev tooling