Skip to content

Commit

Permalink
fix crypto-frontmatter
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh committed Nov 10, 2023
1 parent 5b60ade commit 85951da
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/crypto-frontmatter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface FrontmatterIndex {
decimals: number;
title?: string;
description?: string;
tags?: string[];
links?: FrontmatterLink[];
images?: FrontmatterImage[];
tags: string[];
links: FrontmatterLink[];
images: FrontmatterImage[];
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/crypto-frontmatter/src/index.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect, it } from '@jest/globals';
import { getFrontmatterCollection, getFrontmatterContent, getFrontmatterIndex } from './index';

it('should getFrontmatterCollection of eip155:1/erc20', async () => {
const collection = await getFrontmatterCollection('eip155:1', 'erc20');
const collection = getFrontmatterCollection('eip155:1', 'erc20');
expect(collection).toStrictEqual(
expect.arrayContaining([
expect.objectContaining({
Expand All @@ -16,7 +16,7 @@ it('should getFrontmatterCollection of eip155:1/erc20', async () => {
});

it('should getFrontmatterIndex of eip155:1/erc20:0x00000000008943c65cAf789FFFCF953bE156f6f8', async () => {
const frontmatterIndex = await getFrontmatterIndex('eip155:1/erc20:0x00000000008943c65cAf789FFFCF953bE156f6f8');
const frontmatterIndex = getFrontmatterIndex('eip155:1/erc20:0x00000000008943c65cAf789FFFCF953bE156f6f8');
expect(frontmatterIndex).toStrictEqual({
fileId: expect.stringMatching(/[0-f]{64}/),
type: 'Frontmatter',
Expand Down
2 changes: 1 addition & 1 deletion website/app/[caip2]/[asset]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
FrontmatterIndex,
getFrontmatterCollection,
getFrontmatterContent,
getFrontmatterIndex,
SupportedCollections,
} from 'crypto-frontmatter';
import { getFrontmatterContent } from 'crypto-frontmatter/content';
import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import type { ReactElement } from 'react';
Expand Down
22 changes: 18 additions & 4 deletions workspace/contented-config/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ export default function config(options) {
pattern: '**/README.md',
processor: MDProcessor,
fields: {
caip2: {
type: 'string',
resolve: () => {
return options.caip2;
},
},
namespace: {
type: 'string',
resolve: () => {
return options.namespace;
},
},
symbol: {
type: 'string',
required: true,
Expand All @@ -85,11 +97,15 @@ export default function config(options) {
},
tags: {
type: 'string[]',
required: false,
resolve: (value) => {
return value ?? [];
},
},
links: {
type: 'object',
required: false,
resolve: (value) => {
return value ?? [];
},
},
/**
* Populated by computeImageField
Expand All @@ -110,8 +126,6 @@ export default function config(options) {
type: fileContent.type,
fields: {
...fileContent.fields,
caip2: options.caip2,
namespace: options.namespace,
images: await computeImageField(fileContent, filePath),
},
html: fileContent.html,
Expand Down

0 comments on commit 85951da

Please sign in to comment.