Skip to content

Commit

Permalink
add description
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Sep 23, 2019
1 parent 222b380 commit 205da68
Show file tree
Hide file tree
Showing 31 changed files with 633 additions and 29 deletions.
94 changes: 94 additions & 0 deletions .script/genBlockConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const fs = require('fs');
const { join } = require('path');
const gitUrl = 'https://github.com/ant-design/pro-blocks';
const tagsKey = {
list: '列表',
search: '搜索',
articles: '文章',
table: '表格',
form: '表单',
step: '步骤',
basic: '基本',
card: '卡片',
applications: '应用',
projects: '项目',
profile: '详情',
advanced: '高级',
result: '结果',
fail: '失败',
success: '成功',
user: '用户',
login: '登录',
register: '注册',
account: '账号',
center: '个人中心',
settings: '设置',
dashboard: 'dashboard',
analysis: '分析',
monitor: '监控',
workplace: '工作台',
editor: '编辑器',
flow: '流程图',
koni: '拓扑结构图',
mind: '脑图',
exception: '异常',
};
/**
* 从文件数组映射为 pro 的路由
* @param {*} name
*/
const genBlockName = name =>
name
.match(/[A-Z]?[a-z]+|[0-9]+/g)
.map(p => p.toLowerCase())
.join('/');

/**
* 从文件数组映射为 tags 列表
* @param {*} name
*/
const genBlockTags = name =>
Array.from(new Set(name.match(/[A-Z]?[a-z]+|[0-9]+/g).map(p => p.toLowerCase()))).map(
key => tagsKey[key] || key,
);

/**
* 遍历文件地址
* @param path
*/
const getFolderTreeData = filePath => {
const files = fs.readdirSync(filePath);
return files
.map(fileName => {
const status = fs.statSync(join(filePath, fileName));
// 是文件夹 并且不已 . 开头且最深三层
if (status.isDirectory() && fileName.indexOf('.') !== 0) {
const absPkgPath = join(filePath, fileName, 'package.json');
if (fs.existsSync(absPkgPath)) {
const pkg = require(absPkgPath);
return {
title: fileName,
value: fileName,
key: fileName,
description: pkg.description,
url: `${gitUrl}/tree/master/${fileName}`,
type: 'block',
path: fileName,
isPage: true,
defaultPath: `/${fileName}`,
img: `https://github.com/ant-design/pro-blocks/raw/master/${fileName}/snapshot.png`,
tags: genBlockTags(fileName),
name: fileName,
previewUrl: `https://preview.pro.ant.design/${genBlockName(fileName)}`,
};
}
}
return undefined;
})
.filter(obj => obj);
};

fs.writeFileSync(
join(__dirname, '..', 'blockList.json'),
JSON.stringify(getFolderTreeData(join(__dirname, '../')), null, 2),
);
2 changes: 1 addition & 1 deletion AccountCenter/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/account-center",
"version": "0.0.1",
"description": "AccountCenter",
"description": "个人中心一般用于暂时用户的基本信息,已经相关的信息展示。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/accountcenter"
Expand Down
2 changes: 1 addition & 1 deletion AccountSettings/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/account-settings",
"version": "0.0.1",
"description": "AccountSettings",
"description": "通常是用于用户设置名称、头像、用途、私密性等信息。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/accountsettings"
Expand Down
2 changes: 1 addition & 1 deletion DashboardAnalysis/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/analysis",
"version": "0.0.1",
"description": "Analysis",
"description": "将同一主题下的多种下钻维度呈现在页面中,让用户能够研究多组数据并发现趋势,用户可操作数据,调整数据范围满足更精准的分析需求。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/analysis"
Expand Down
2 changes: 1 addition & 1 deletion DashboardMonitor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/monitor",
"version": "0.0.1",
"description": "Monitor",
"description": "常用于数据报表细节信息的展示,根据业务诉求可配置文本、列表、可视化图表等。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/monitor"
Expand Down
2 changes: 1 addition & 1 deletion DashboardWorkplace/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/workplace",
"version": "0.0.1",
"description": "Workplace",
"description": "工作台将应用中每个部分最关键的数据提取出来,在一个页面呈现,便于全局分析和决策。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/workplace"
Expand Down
2 changes: 1 addition & 1 deletion EditorFlow/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/flow",
"version": "0.0.1",
"description": "flow",
"description": "千言万语不如一张图,流程图是表示算法思路的最好方法。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow"
Expand Down
2 changes: 1 addition & 1 deletion EditorKoni/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/flow",
"version": "0.0.1",
"description": "flow",
"description": "拓扑结构图可以清晰展示网络节点和通信介质构成的网络结构。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow"
Expand Down
2 changes: 1 addition & 1 deletion EditorMind/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/flow",
"version": "0.0.1",
"description": "flow",
"description": "脑图是表达发散性思维的有效工具,它简单却又很有效,是一种非常实用展示工具。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow"
Expand Down
2 changes: 1 addition & 1 deletion Exception403/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pro-blocks/exception-403",
"version": "0.0.1",
"description": "Exception403",
"description": "403 Forbidden 代表客户端错误,指的是服务器端有能力处理该请求,但是拒绝授权访问,一般是权限异常导致。",
"repository": {
"type": "git",
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception403"
Expand Down
2 changes: 1 addition & 1 deletion Exception404/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pro-blocks/exception-404",
"version": "0.0.1",
"description": "Exception404",
"description": "404 Not Found 代表请求失败,请求所希望得到的资源未被在服务器上发现",
"repository": {
"type": "git",
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception404"
Expand Down
2 changes: 1 addition & 1 deletion Exception500/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pro-blocks/exception-500",
"version": "0.0.1",
"description": "Exception500",
"description": "500 Internal Server Error,是表示服务器端错误的响应状态码。",
"repository": {
"type": "git",
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception500"
Expand Down
2 changes: 1 addition & 1 deletion FormAdvancedForm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/advanced-form",
"version": "0.0.1",
"description": "AdvancedForm",
"description": "高级表单常适用于一次性输入和提交大批量数据的场景。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/advancedform"
Expand Down
2 changes: 1 addition & 1 deletion FormBasicForm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/basic-form",
"version": "0.0.1",
"description": "BasicForm",
"description": "表单页用于向用户收集或验证信息,基础表单常用于数据项较少的表单场景。",
"main": "src/index.js",
"scripts": {
"dev": "umi dev"
Expand Down
2 changes: 1 addition & 1 deletion FormStepForm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/step-form",
"version": "0.0.1",
"description": "StepForm",
"description": "分布表单使用与将一个冗长或用户不熟悉的表单任务分成多个步骤,指导用户完成的场景。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/stepform"
Expand Down
2 changes: 1 addition & 1 deletion ListBasicList/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/basic-list",
"version": "0.0.1",
"description": "BasicList",
"description": "用于陈列一类事务性主题,用户常常将这个页面当做开始事务的入口,主要以浏览方式寻找条目。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/basiclist"
Expand Down
2 changes: 1 addition & 1 deletion ListCardList/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/card-list",
"version": "0.0.1",
"description": "CardList",
"description": "卡片组成的列表,一般用于展示有图的列表,更加美观。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/cardlist"
Expand Down
2 changes: 1 addition & 1 deletion ListSearch/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/search-list",
"version": "0.0.1",
"description": "SearchListApplications",
"description": "一个基本多标签页面,用于展示搜索列表。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistapplications"
Expand Down
2 changes: 1 addition & 1 deletion ListSearchApplications/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/search-list-applications",
"version": "0.0.1",
"description": "SearchListApplications",
"description": "常用于陈列某一主题下的大量条目,并提供丰富的数据筛选功能帮助用户匹配出需要的数据自己。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistapplications"
Expand Down
2 changes: 1 addition & 1 deletion ListSearchArticles/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/search-list-articles",
"version": "0.0.1",
"description": "SearchListArticles",
"description": "常用于陈列某一主题下的大量条目,并提供丰富的数据筛选功能帮助用户匹配出需要的数据自己。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistarticles"
Expand Down
2 changes: 1 addition & 1 deletion ListSearchProjects/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/search-list-projects",
"version": "0.0.1",
"description": "SearchListProjects",
"description": "常用于陈列某一主题下的大量条目,并提供丰富的数据筛选功能帮助用户匹配出需要的数据自己。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistprojects"
Expand Down
2 changes: 1 addition & 1 deletion ListTableList/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/table-list",
"version": "0.0.1",
"description": "TableList",
"description": "一个标准的表格增删改查页面,可以派生出百分之八十的后台页面。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/tablelist"
Expand Down
2 changes: 1 addition & 1 deletion ProfileAdvanced/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/advanced-profile",
"version": "0.0.1",
"description": "AdvancedProfile",
"description": "一个复杂的详情页,可以展示一个对象的基本信息和其相关的新息和操作。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/advancedprofile"
Expand Down
2 changes: 1 addition & 1 deletion ProfileBasic/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/basic-profile",
"version": "0.0.1",
"description": "BasicProfile",
"description": "详情页可以向用户展示一个对象完整的描述信息,并且可以对一个对象进行编辑操作。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/basicprofile"
Expand Down
2 changes: 1 addition & 1 deletion ResultFail/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/result-fail",
"version": "0.0.1",
"description": "ResultFail",
"description": "告知用户操作后所产生的失败结果,引导用户接下来的行动。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/resultfail"
Expand Down
2 changes: 1 addition & 1 deletion ResultSuccess/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/result-success",
"version": "0.0.1",
"description": "ResultSuccess",
"description": "告知用户操作后所产生的成功结果,引导用户接下来的行动。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/resultsuccess"
Expand Down
2 changes: 1 addition & 1 deletion UserLogin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/user-login",
"version": "0.0.1",
"description": "UserLogin",
"description": "用户登录界面,支持用户名密码和手机号登录。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/userlogin"
Expand Down
2 changes: 1 addition & 1 deletion UserRegister/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/user-register",
"version": "0.0.1",
"description": "UserRegister",
"description": "用户注册是使用,用于填写基本的账号信息。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/userregister"
Expand Down
2 changes: 1 addition & 1 deletion UserRegisterResult/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@umi-block/user-register-result",
"version": "0.0.1",
"description": "UserRegisterResult",
"description": "用于展示注册的结果。",
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/userregisterresult"
Expand Down
Loading

0 comments on commit 205da68

Please sign in to comment.