Skip to content

Commit

Permalink
feat: arco-cli add the entry to create vue-library project
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium-Z committed Nov 30, 2021
1 parent c1f8278 commit c35f3d4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/arco-cli-init/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arco-design/arco-cli-init",
"version": "1.15.0",
"version": "1.16.0",
"description": "A module of Arco CLI to init a project",
"main": "lib/init.js",
"scripts": {
Expand Down
20 changes: 13 additions & 7 deletions packages/arco-cli-init/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ const MATERIAL_TYPE_MAP = {
name: locale.LABEL_COMPONENT,
template: '@arco-design/arco-template-vue-component',
},
'vue-library': {
name: locale.LABEL_LIBRARY,
template: '@arco-design/arco-template-vue-library',
},
'vue-monorepo': {
name: locale.LABEL_MONOREPO,
template: '@arco-design/arco-template-vue-monorepo',
Expand All @@ -85,7 +89,7 @@ const TYPES_FOR_REACT = [
'arco-design-pro',
];

const TYPES_FOR_VUE = ['vue-component', 'vue-monorepo'];
const TYPES_FOR_VUE = ['vue-component', 'vue-library', 'vue-monorepo'];

// Templates for Monorepo
const VALID_TYPES_IN_MONOREPO = [
Expand All @@ -94,6 +98,7 @@ const VALID_TYPES_IN_MONOREPO = [
'react-page',
'react-library',
'vue-component',
'vue-library',
];

const CATEGORIES_COMPONENT = [
Expand Down Expand Up @@ -292,24 +297,19 @@ async function inquiryMaterialMeta(meta: { [key: string]: any }): Promise<{
version: string;
category?: string[];
}> {
let pkgNamePrefix = 'rc';
let categories = [];

switch (meta.type) {
case 'vue-component':
pkgNamePrefix = 'vc';
categories = CATEGORIES_COMPONENT;
break;
case 'react-component':
pkgNamePrefix = 'rc';
categories = CATEGORIES_COMPONENT;
break;
case 'react-block':
pkgNamePrefix = 'rb';
categories = CATEGORIES_PAGE;
break;
case 'react-page':
pkgNamePrefix = 'rp';
break;
default:
break;
Expand All @@ -320,13 +320,19 @@ async function inquiryMaterialMeta(meta: { [key: string]: any }): Promise<{
type: 'input',
name: 'name',
message: locale.TIP_INPUT_PACKAGE_NAME,
default: meta.name || `@arco-design/${pkgNamePrefix}-xxx`,
default: meta.name,
validate: (input) => {
return input.trim() ? true : locale.ERROR_NO_PACKAGE_NAME;
},
},
{
type: 'input',
name: 'title',
message: locale.TIP_INPUT_TITLE,
default: meta.title || '',
validate: (input) => {
return input.trim() ? true : locale.ERROR_NO_TITLE;
},
},
{
type: 'input',
Expand Down
2 changes: 2 additions & 0 deletions packages/arco-cli-init/src/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ export default {
WARN_PATH_EXIST: '路径已经存在,确认要覆盖它吗?',

ERROR_NO_PROJECT_NAME: '请指定项目名称',
ERROR_NO_PACKAGE_NAME: '请输入 NPM 包名',
ERROR_NO_TITLE: '请输入物料标题',
ERROR_GIT_DIRTY: '请提交你的 Git 修改后继续操作',
};
4 changes: 2 additions & 2 deletions packages/arco-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arco-design/arco-cli",
"version": "1.21.2",
"version": "1.22.0",
"description": "Init an Arco material project quickly",
"keywords": [
"arco",
Expand All @@ -20,7 +20,7 @@
"@arco-design/arco-cli-auth": "^1.8.0",
"@arco-design/arco-cli-block": "^1.12.0",
"@arco-design/arco-cli-generate": "^1.10.0",
"@arco-design/arco-cli-init": "^1.15.0",
"@arco-design/arco-cli-init": "^1.16.0",
"@arco-design/arco-cli-publish": "^1.8.0",
"@arco-design/arco-cli-sync": "^1.11.0",
"@arco-design/arco-create-template-from-project": "^1.1.0",
Expand Down

0 comments on commit c35f3d4

Please sign in to comment.