@schibstedspain/generator-sui-react v7.0.1
generator-sui-react
A yeoman generator for Schibsted User Interface (sui) ReactJS components. By using this generator, you can create components to work as a part of a complex application (atoms or mollecules) or stand-alone components, ready for production.. For more information about atomic design, read the following blog post: http://bradfrost.com/blog/post/atomic-web-design/.
Features
The generator provides a basic structure to start developing a component, including coding standard rules, naming conventions and a unit testing suite.
- A basic structure for your component, prepared for publishing in npm or deploying to production
- Automatic installation of all npm dependencies
- Linting rules for all
js,jsx,s(c|a)ssandcssfiles - Support for ES2015
- Unit testing suite
- A local development environment with webpack
- A
docsfolder to generate the component's documentation and a deployment task to create a Github page. - A set of pre-commit rules for launching linting and tests before commiting changes in Github
- Common editor config rules
Previous steps
The SUI Generator for React.JS components is a Yeoman generator, so make sure to have already installed Node.JS and Yeoman first:
- Install Node.JS: nodejs.org/download
- Install Yeoman: http://yeoman.io/
You can install yeoman using npm:
$ npm install -g yoInstallation
To install the generator, just type in your terminal:
$ npm install -g @schibstedspain/generator-sui-reactTo make sure it's installed correctly, type yo in your terminal. A list of options should appear, including the installation of the generator:
~ ❯ yo
? 'Allo [your-username]! What would you like to do? (Use arrow keys)
Run a generator
❯ @schibstedspain/sui React
──────────────
Update your generators
Install a generator
Find some help
Get me out of here! Create your first React.JS component
First of all, let's create a folder for your component in the desired path with:
$ mkdir your-component-nameOnce created, enter the folder and aunch the generator by typing:
$ cd your-component-name
$ yo @schibstedspain/sui-reactYou will be prompted about the component name, the prefix you want to use and the Github repository url (which you should be created already), and that's it!
Folder structure
The generator will generate the following structure:
├── README.md
├── docs
│ ├── index.html
│ ├── index.jsx
│ └── style.scss
├── package.json
├── src
│ ├── index.jsx
│ ├── index.scss
│ └── sui-test
│ ├── _sui-test.scss
│ └── index.jsx
├── test
│ └── sui-test-test.js
└── webpack.config.jsPublishing
When you are ready to publish your component, a npm package will be generated, including the following folders: A lib folder with the same structure as the src folder, but with the js and jsx preprocessed with babel:
lib
├── index.js
├── index.scss
└── component-name
├── _component-name.scss
└── index.jsAnd a dist folder, with the js and css bundle.
dist
├── index.css
└── index.jsCommands allowed
clean:lib: cleans thelibfolderclean:dist: cleans thedistfolderpredist: executes the tasknpm run clean:distdist: creates ajsandcssbundle usingwebpackprelib: executes the tasknpm run clean:liblib: executes both tasksnpm run lib:scriptsandnpm run lib:styleslib:scripts: transpiles the code in thesrcfolder usingbabeland outputs the result in thelibfolderlib:styles: just copies the.scssfiles from thesrcfolder to thelibfolderprepublish: executes both tasksnpm run libandnpm run distlint: executes both tasksnpm run lint:eslintandnpm run lint:sasslint:eslint: lints your javascript files usingeslintlint:sass: lints your sass style files usingsass-linttest: executes your tests usingmochatest:watch: executes the tasknpm run testin watch mode, watching for changes in your source filesstart: executes bothnpm run start:openandnpm run start:serverstart:server: launcheswebpack-dev-serverin http://localhost:8080 with your application runningstart:open: opens a browser with http://localhost:8080predoc: cleans yourdocs/distfolderdoc: executesnpm run dist,npm run doc:copyandnpm run doc:publishtasksdoc:copy: copies the files generated in thedistfolder into yourdocsfolderdoc:publish: publishes your documentation in your repository's Github pagephoenix: cleans yournode_modulesfolder and launchesnpm installto restore all your dependencies
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago