Skip to content

Commit

Permalink
refactor(assets): deprecate uuid & enable identifier for examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Dec 8, 2020
1 parent 7dde5c7 commit 0466067
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/assets-types/typings/atom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default interface AtomAsset {
'name.en-US'?: string;
/**
* atom uuid
* @deprecated legacy HiTu DSM logic
*/
uuid?: string;
/**
Expand Down
5 changes: 5 additions & 0 deletions packages/assets-types/typings/example.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ export interface ExampleBaseAsset {
* The identifier from design draft of atom asset, such as Sketch symbol name
*/
designId?: string;
/**
* identifier for asset
*/
identifier: string;
/**
* uuid for asset
* @deprecated legacy HiTu DSM logic
*/
uuid?: string;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{
"type": "BLOCK",
"atomAssetId": "Foo",
"identifier": "222222",
"uuid": "222222",
"dependencies": {
"index.tsx": {
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-dumi/src/plugins/commands/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default (api: IApi) => {
api.register({
key: 'dumi.detectCodeBlock',
fn(block: ExampleBlockAsset) {
if (block.name || block.uuid) {
if (block.name || block.identifier) {
assetsPkg.assets.examples.push(block);
}
},
Expand Down
3 changes: 2 additions & 1 deletion packages/preset-dumi/src/transformer/remark/previewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ function applyCodeBlock(props: IPreviewerComponentProps, componentName: string)
tags: props.tags,
previewUrl: props.previewUrl,
atomAssetId: componentName,
// for HiTu DSM
identifier: props.identifier || props.uuid,
// for HiTu DSM, deprecated
uuid: props.uuid,
dependencies: {
// append npm dependencies
Expand Down

0 comments on commit 0466067

Please sign in to comment.