#component 模板
./
├── .eslintrc
├── .si.yml
├── HISTORY.md
├── Makefile
├── README.md
├── examples
│ ├── example-a.md
│ └── example-b.md
├── .gitignore
├── .npmignore
├── index.js
├── cdn.js
├── package.json
├── src
│ ├── component.js
│ ├── index.js
│ └── index.less
├── tests
│ └── index-test.js
└── webpack.config.js
.eslintrc
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code..si.yml
如果该组件发布至内网,同时需要该组件的文档自动同步至 Si 那么请在该基础上修改相关内容, if dont understand this sentence delete this file XDHISTORY.md
History release note.Makefile
Publish to npm or xnpm, edit by yourself.README.md
Component readmeexamples
Doc dir/ .md file is the best practice..gitignore
git push ignore files.npmignore
npm publish ignore filescdn.js
Deploy to CDNindex.js
use as npm modulespackage.json
src
Source dirtests
Test cases*-test.js
webpack.config.js
Atool-build need this file
本示例采用 ES-6,发布至 npm 源.
一窥 package.json
"scripts": {
"start": "concurrently 'npm run compile' 'npm run doc'",
"compile": "rm -rf lib && babel src --out-dir lib && lessc src/index.less lib/index.css",
"build": "atool-build",
"lint": "eslint --ext .js src",
"test": "atool-test",
"doc": "atool-doc",
"doc-build": "atool-doc --build",
"gh-pages": "atool-doc --build && gh-pages -d __site"
},
"main": "./index",
"entry": {
"index": "./cdn"
}
start
concurrently compile and doccompile
es6 -> es5, less -> cssbuild
Deploy to CDN, you have to compile code by using atool-buildlint
run eslinttest
run test casesdoc
run doc serverdoc-build
run doc buildgh-pages
push doc build result __site/ to github gh-pages
如果你的仓库需要发布至内网请在 pkg.name 中添加 namespace 例如: @alipay/componeng-example
并且在 pkg 中新建一个字段 publishConfig
"publishConfig":{
"registry": "http://registry.npm.alibaba-inc.com"
}
目录中 .si.yml 在同步 si 静态服务所用, 如果发布至 npm 的包可以使用 gh-pages 即可以删除该文件。