diff --git a/packages/arco-cli-init/package.json b/packages/arco-cli-init/package.json index 2f7d01ef..2a4e0e92 100644 --- a/packages/arco-cli-init/package.json +++ b/packages/arco-cli-init/package.json @@ -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": { diff --git a/packages/arco-cli-init/src/init.ts b/packages/arco-cli-init/src/init.ts index 54ac95f2..53bfb63a 100644 --- a/packages/arco-cli-init/src/init.ts +++ b/packages/arco-cli-init/src/init.ts @@ -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', @@ -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 = [ @@ -94,6 +98,7 @@ const VALID_TYPES_IN_MONOREPO = [ 'react-page', 'react-library', 'vue-component', + 'vue-library', ]; const CATEGORIES_COMPONENT = [ @@ -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; @@ -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', diff --git a/packages/arco-cli-init/src/locale/zh-CN.ts b/packages/arco-cli-init/src/locale/zh-CN.ts index f2732c0c..43cc3f01 100644 --- a/packages/arco-cli-init/src/locale/zh-CN.ts +++ b/packages/arco-cli-init/src/locale/zh-CN.ts @@ -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 修改后继续操作', }; diff --git a/packages/arco-cli/package.json b/packages/arco-cli/package.json index ed7c6709..4b3999d5 100644 --- a/packages/arco-cli/package.json +++ b/packages/arco-cli/package.json @@ -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", @@ -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",