Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
generator-adz-scaffold
Advanced tools
Yeoman generator for ReactJS - lets you quickly set up a project including karma test runner and Webpack module system.
Install generator-react-webpack
:
npm install -g generator-react-webpack
Make a new directory, and cd
into it:
mkdir my-new-project && cd $_
Run yo react-webpack
, optionally passing an app name:
yo react-webpack [app-name]
Run grunt
for building and grunt serve
for preview in the browser at localhost.
Available generators:
Note: Generators are to be run from the root directory of your app.
Sets up a new ReactJS app, generating all the boilerplate you need to get started. The app generator also facilitates the following:
Example:
yo react-webpack
Generates a JSX component in src/scripts/components
and it's corresponding test in src/spec/components
.
Example:
yo react-webpack:component foo
Produces src/scripts/components/Foo.jsx
(javascript - JSX):
/**
* @jsx React.DOM
*/
'use strict';
var React = require('react/addons');
var Foo = React.createClass({
render: function () {
return (
<div>
<p>Content for Foo</p>
</div>
)
}
});
module.exports = Foo;
And test/spec/components/Foo.js
(javascript - jasmine):
'use strict';
describe('Foo', function () {
var Foo, component;
beforeEach(function () {
Foo = require('../../../src/scripts/components/Foo');
component = Foo();
});
it('should create a new instance of Foo', function () {
expect(component).toBeDefined();
});
});
And src/styles/Foo.css
:
.Foo{
border: 1px dashed #f00;
}
Options are available as additional installs to the initial application generation phase.
A complete routing library for React. This option only adds the basic hooks to get started with react router.
Running grunt test
will run the unit tests with karma. Tests are written using Jasmine by default.
The react-webpack generator automates the setup of a ReactJS project using the specific structure detailed below:
project
- src
- scripts
-components
ComponentOne.js
ComponentTwo.js
main.js
- styles
main.css
normalize.css
index.html
- test
- spec
- components
ComponentOne.js
ComponentTwo.js
- helpers
- react
addons.js
phantomjs-shims.js
Gruntfile.js
karma.conf.js
I have tried to keep the project structure as simple as possible and understand it may not suit everyone.
I have opted to follow @floydophone convention of uppercase for component file naming e.g. Component.js. I am open to suggestions if there is a general objection to this decision.
Each component is a module and can be required using the Webpack module system. Webpack uses Loaders which means you can also require CSS and a host of other file types. Read the Webpack documentation to find out more.
Out the box the Gruntfile is configured with the following:
src/scripts/main.js
. This is included in the src/index.html
file by default and will reload in the browser as and when it is recompiled.karma.conf.js
located in the project root. This will run all tests using PhantomJS by default but supports many other browsers.Included in the project is the normalize.css script. There is also a src/styles/main.css
script that's required by the core src/scripts/components/App.js
component using Webpack.
Please use JSXHint for linting JSX and the corresponding Sublime package if using SLT3 SublimeLinter-jsxhint. Note this is a global npm install and JSX files will need to be associated with the JSX file type withing SLT3.
Thanks to all who contributed to generator-angular as the majority of code here has been shamelessy sourced from that repos.
Thanks to Edd Hannay for his Webpack optimisations, my local merge and testing meant his additions lost his signature (my fault sorry) so big thanks Edd.
Contributions are welcomed. When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix.
FAQs
Yeoman generator for ReactJS and Webpack
The npm package generator-adz-scaffold receives a total of 7 weekly downloads. As such, generator-adz-scaffold popularity was classified as not popular.
We found that generator-adz-scaffold demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.