a react project cli, help you create a react project with webpack or vite quickly
🏠 Homepage
this is a React project cli, but not have template, you can create your own template by yourself use it;
you need to change create.js downloadPath to your own template path
const downloadPath = `direct:${baseUrl}/${answers.type}-${answers.frame}-template.git#master`
in your template you need to set variables and add ask.ts file
module.exports = [
{
name: 'description',
message: 'Please enter project description:',
},
{
name: 'author',
message: 'Please enter project author:',
},
{
name: 'apiPrefix',
message: 'Please enter project apiPrefix:',
default: 'api/1.0',
// @ts-ignore
validate: function (input) {
const done = this.async();
setTimeout(function () {
// 校验是否为空,是否是字符串
if (!input.trim()) {
done('You can provide a apiPrefix, or not it will be default【api/1.0】');
return;
}
const pattern = /[a-zA-Z0-9]$/;
if (!pattern.test(input.trim())) {
done(
'The apiPrefix is must end with letter or number, like default 【api/1.0】',
);
return;
}
done(null, true);
}, 500);
},
},
{
name: 'proxy',
message: 'Please enter project proxy:',
default: 'https://www.test.com',
// @ts-ignore
validate: function (input) {
const done = this.async();
setTimeout(function () {
// 校验是否为空,是否是字符串
if (!input.trim()) {
done(
'You can provide a proxy, or not it will be default【https://www.test.com】',
);
return;
}
const pattern =
/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?/;
if (!pattern.test(input.trim())) {
done(
'The proxy is must end with letter or number, like default 【https://www.test.com】',
);
return;
}
done(null, true);
}, 300);
},
},
];
npm install
npm link
wb-cli init [projectName]
npm install -g wb-fe-cli
wb-cli init [projectName] # init project
wb-cli update # update version
👤 bo.wang
- Website: https://blog.wangboweb.site
- Github: @BoWang816
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!
Copyright © 2020 bo.wang.
This project is ISC licensed.
This README was generated with ❤️ by readme-md-generator