ideal-cli
v1.0.0-alpha.11
Published
Frontend cli, includes pack, dll, lint, hooks and so on
Downloads
9
Maintainers
Readme
ideal-cli
Frontend cli
一、Features
- Support build(Webpack)
- development
- production
- library
- code format
- pre hooks check
- standard version
- dll
- build analysis
- browser compatibility
- commit lint
Coming soon
- [ ] Unit test(Jest)
二、Usages
npm i ideal-cli@latest -D -E
# First init configuration
npx ideal-cli init -h
三、Configurations
1. package.json
{
"scripts": {
"start": "ideal-cli start",
"build": "ideal-cli build",
"build-lib": "ideal-cli build-lib"
}
}
2. browserslist
Add configuration to package.json
{
"browserslist": [
"> 1%",
"not dead",
"not op_mini all",
"Firefox ESR",
"Chrome >= 68",
"IE 11",
"Firefox >= 56",
"Opera >= 48",
"Safari >= 11"
]
}
3. babelrc
If project uses react, you should config local .babelrc
:
{
"presets": [
"react-app"
]
}
4. lint
npx eslint --init
{
"lint": "eslint 'src/**/*.[tj]s?(x)'",
"lint-fix": "npm run lint -- --fix",
"format": "prettier 'src/**/*.[tj]s?(x)' --check --write && npm run lint-fix"
}
5. version
major.minor.patch
npm run release -- --first-release
npm run release -- --release-as (major|minor|patch)
6. Dll
Config package.json
{
"scripts": {
"prestart": "rimraf dist && ideal-cli dll",
"prebuild": "rimraf dist && ideal-cli dll"
}
}
Config your index.html.
<body>
<!-- contents -->
<!-- Inject DLL -->
<script src="%INJECT_DLL%"></script>
</body>
Config your project.config.js.
{
dllVendors: ['react', 'react-dom']
}
四、Optimization
- code splitting
- lazy loading
- tree shaking
- Shimming
- Cache
- Concurrency
五、Bundle analysis
npm run analyze
Analysis Website