React web component project. It used in AdminLTE style. Online preview please click here.
PS: latest version please check tag of this repo.
** NPM registry usage:**
- you should change the yarn config default registry:
yarn :
yarn config set registry http://registry.npm.taobao.org/, then change the file .yarnrc directly npm :npm config set registry http://registry.npm.taobao.org/ --global(To check if you'v changed registry : yarn config get registry && npm config get registry ) you can also useyarn config getto chanege the file.npmrcdirectly. - add in
package.json:
...
"dependencies": {
"admin-lte": "^2.3.8",
"fairy": "1.9.0",
...
}
...Github usage:
Add fairy github ssh URL in package.json:
...
"dependencies": {
"admin-lte": "^2.3.8",
"fairy": "git+ssh://git@github.com:cpp1992/Fairy.git#v1.9.0",
...
}
...After finishing one of above,next is the same:
Resolve dependency:
npm install
Possible Problems(npm install) :
- If you use
NPM registry usage,node-sassmay could not init successfully beacuse taobao registry doesn't have this module,you can usenpm config set registry http://registry.npm.taobao.org/(yarn is the same) to install this module , Or you can useSASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ yarn add node-sass,it can also help you. - If you use
Github usage,fairymay seek err, you should check if you have set the right github URL, it should copy from the github Pengpeng and you should not use any lock files such asyarn.lockandnpm.lock - Err:
cross-env is not recognized as an internal, beacuse of the settings of yarn, when your installation it will may delete this module , solution:npm install cross-env --save-dev
Include the css file in your project:
require('fairy/dist/css/fairy.css');Now you can use it in your project:
import { Box, Dialog } from 'fairy';* tips: For windows user first time install, please use the latest version of node.
And run npm install in cmd.
npm for window can't run well in Cygwin.
Clone the project:
git clone git@github.com:cpp1992/Fairy.git
Resolve dependency:
npm install
Don't forget to webpack if you have this step and then restart npm or yarn!
Run the project preview web:
npm start
Possible Problems(npm start):
An unexpected error occurred:"Unknown token 1:22", beacuse your yarn now don't support the registry mirror of taobao, solution delete the file.yarnrcandyarn init,then change the file.yarnrcdirectly to set registry(you could usenodepad++)
Now you can preview the component list:

Source code is in the components folder.
When new component done, add export in the components/index.js.
Add your component usage sample in src/list.js to tell the user how to use your component.
When you finish the code, please run eslint to check the code style and fix it:
npm run eslint
After that, run dist command to package the lib:
npm run dist
It will generate the package in dist folder.
Modify the version of package.json:
{
...
"version": "1.9.0",
...
}Mark the git tag of same version:
git tag v1.9.0
Push to the github:
git push origin v1.9.0