Skip to content

Commit

Permalink
📝 docs: 更新 schema
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 8, 2021
1 parent d5e135e commit 2284eb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/journey-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"lint-staged": "lint-staged"
},
"lint-staged": {
"yml.ts": "yarn schema"
"**/types/yml.ts": "yarn schema"
},
"dependencies": {
"@ant-design/charts": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/journey-map/src/types/yml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface Config {
/**
* 解析后的 YML 数据
*/
export interface YMLJourneyMap {
export interface YMLJourneyMapRawData {
/**
* 旅程图名称
*/
Expand All @@ -59,7 +59,7 @@ export interface YMLJourneyMap {

/**
* 从 YML 转过来的数据
* 包含有 title config 等其他参数项
* 包含有 title config 等其他参数
*/
export interface YMLJourneyMapData extends JourneyMapData {
title?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/journey-map/src/utils/yml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { load } from 'js-yaml';
import type { YMLJourneyMap, YMLJourneyMapData } from '../types';
import type { YMLJourneyMapRawData, YMLJourneyMapData } from '../types';

/**
* YML 转 JSON
Expand All @@ -8,7 +8,7 @@ import type { YMLJourneyMap, YMLJourneyMapData } from '../types';
*/
export const YMLToJSON = (yml: string): YMLJourneyMapData => {
try {
const json = load(yml) as YMLJourneyMap;
const json = load(yml) as YMLJourneyMapRawData;

const { stages, title, config } = json;

Expand Down

0 comments on commit 2284eb5

Please sign in to comment.