Choerodon Boot
Choerodon front boot is a toolkit about front end package management, startup, compilation. It is mainly used to provide custom some configurations file to create a project of React that can be modified to some extent.
The construction project can be used on macOS
, Windows
or Linux
. Teams can be developed in modules, greatly speeding up development.
- The project uses
webpack
for construction. React
and Mobx
are used as the main development technology.
Install
$ npm install choerodon-front-boot -S
Configuration
- Create a configuration file named
config.js
import autoprefixer from 'autoprefixer';
const config = {
port: 9090,
output: './dist',
htmlTemplate: 'index.template.html',
devServerConfig: {},
postcssConfig: {
plugins: [
autoprefixer({
browsers: ['last 2 versions', 'Firefox ESR', '> 1%', 'ie >= 8', 'iOS >= 8', 'Android >= 4'],
}),
],
},
babelConfig(config, mode, env) {
return config;
},
webpackConfig(config, mode, env) {
return config;
},
enterPoints(mode, env) {
if (mode === 'start' || env === 'development') {
return {
API_HOST: 'http://api.example.org',
}
}
if (mode === 'build' || env === 'production') {
return {
API_HOST: 'an `enterpoint` placeholder string',
}
}
},
entryName: 'index',
root: '/',
routes: {
'iam': 'src/app/iam/containers/IAMIndex.js',
},
dashboard: {
iam: 'src/dashboard/*',
devops: [
'src/dashboard/Test',
'src/dashboard/Test2.js',
],
agile: {
components: 'src/dashboard/*',
locale: 'src/locale/*',
}
},
server: 'http://api.example.com',
fileServer: 'http://file.example.com',
clientid: 'localhost',
titlename: 'Choerodon',
favicon: 'favicon.ico',
theme: {
'primary-color': '#3F51B5',
},
}
Run
$choerodon-front-boot start --config config.js
Once running, open http://localhost:9090
Dist
$choerodon-front-boot build --config config.js
First, you should make sure that you have Menu.yml
under ./{1}/src/app/{1}/config/Menu.yml
. And also should have language/en.yml & language/zh.yml
。
A Menu.yml
file like this:
"iam": code
icon: IAM
sort: 1
delete: "true"
site:
- "organization":
sort: 1
Routes: /iam/organization
icon: manage_organization
permission:
- 'iam-service.organization.enableOrganization'
A language/en.yml
file like this:
"iam": "platform settings"
"iam.organization": "Organization"
Then, you can run the script to initialize the menu.
$python ./{1}/node_modules/choerodon-front-boot/structure/configAuto.py {1}
$python ./{1}/node_modules/choerodon-front-boot/structure/sql.py [-i HOST] [-p PORT] [-u USER] [-s PASSWD] [-a ATTRS] [-d DELETE]
{1}
is your module name.
Init Dashboard (0.7.0+)
First, you should make sure that you have dashboard.yml
under ./{1}/src/app/{1}/config/dashboard/dashboard.yml
. And also should have language/en.yml & language/zh.yml
。
A dashboard.yml
file like this:
dashboard:
- code: "Guide"
icon: APItest
title: "快速入门"
description: "新手指引"
level: site
sort: 1
- code: "Document"
icon: description
title: "文档"
description: "文档"
level: site
sort: 2
A language/en.yml
file like this:
"Guide": "Guide"
"Document": "Document"
Then, you can run the script to initialize the menu.
$python ./{1}/node_modules/choerodon-front-boot/structure/dashboard.py -o yml -m {1}
$python ./{1}/node_modules/choerodon-front-boot/structure/dashboard.py -o sql [-i HOST] [-p PORT] [-u USER] [-s PASSWD]
{1}
is your module name.
Dependencies
- Node environment (6.9.0+)
- Git environment
- Python environment(2.7)
Related documents and information
Reporting Issues
If you find any shortcomings or bugs, please describe them in the issue.
How to Contribute
Pull requests are welcome! Follow to know for more information on how to contribute.