Skip to content

Commit

Permalink
chore(packages): fix typo and outdated schema URL (#56)
Browse files Browse the repository at this point in the history
#### What this PR does / why we need it:

As per title.
  • Loading branch information
fuxingloh authored Nov 20, 2023
1 parent 3f2a7b2 commit aab437e
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 38 deletions.
1 change: 1 addition & 0 deletions .idea/frontmatter.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/crypto-frontmatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface FrontmatterLink {

export interface FrontmatterImage {
type: string;
mine: string;
mime: string;
size: {
width: number;
height: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto-frontmatter/index.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ it('should getFrontmatter of eip155:1/erc20:0x00000000008943c65cAf789FFFCF953bE1
],
images: [
{
type: 'logo',
mine: 'image/png',
type: 'icon',
mime: 'image/png',
size: {
width: 512,
height: 512,
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-frontmatter/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"build": {
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"build": {
Expand Down
10 changes: 0 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"clean": {
"cache": false
Expand Down
2 changes: 1 addition & 1 deletion website/app/[caip2]/[slug]/AssetPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function generateMetadata(caip19: string): Promise<Metadata> {

export async function Page(props: { caip19: string }): Promise<ReactElement> {
const frontmatter = await fetchFrontmatter(props.caip19);
const image = frontmatter.fields.images?.find((image) => image.type === 'logo');
const image = frontmatter.fields.images?.find((image) => image.type === 'icon');

return (
<main className="flex h-full min-w-0 flex-grow flex-col">
Expand Down
2 changes: 1 addition & 1 deletion website/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"mirror": {
Expand Down
51 changes: 34 additions & 17 deletions workspace/contented-config/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,47 @@ async function generateContentHash(filePath) {
* @param fileId {string}
* @param namespace {string}
* @param filePath {string}
* @return {Promise<[{mine: string, path: string}]>}
* @return {Promise<[{mime: string, path: string}]>}
*/
async function computeImageField(fileId, namespace, filePath) {
const reference = filePath.replace(/\/README\.md$/, '');
const pngLogoPath = join('frontmatter', namespace, reference, 'logo.png');
if (existsSync(pngLogoPath) === false) {
return [];
}

const size = imageSize(pngLogoPath);
async function computeAs({ type, from, ext, mime }) {
const pngLogoPath = join('frontmatter', namespace, reference, from);
if (existsSync(pngLogoPath) === false) {
return [];
}

const imagePath = (await generateContentHash(pngLogoPath)) + '.png';
await copyFile(pngLogoPath, join(`_${namespace}`, imagePath));
const size = imageSize(pngLogoPath);
const imagePath = (await generateContentHash(pngLogoPath)) + ext;
await copyFile(pngLogoPath, join(`_${namespace}`, imagePath));

return [
{
type: 'logo',
mine: 'image/png',
size: {
width: size.width,
height: size.height,
return [
{
type: type,
mime: mime,
size: {
width: size.width,
height: size.height,
},
path: imagePath,
},
path: imagePath,
},
];
}

return [
...(await computeAs({
type: 'icon',
from: 'logo.png',
ext: '.png',
mime: 'image/png',
})),
...(await computeAs({
type: 'icon',
from: 'logo.svg',
ext: '.svg',
mime: 'image/svg+xml',
})),
];
}

Expand Down
2 changes: 1 addition & 1 deletion workspace/contented-config/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"build": {
Expand Down
2 changes: 1 addition & 1 deletion workspace/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = [
{
ignores: ['**/dist/*'],
ignores: ['**/*.js', '**/*.d.ts', '**/*.d.ts.map'],
},
require('@eslint/js').configs.recommended,
{
Expand Down
2 changes: 1 addition & 1 deletion workspace/sync-trustwallet-assets/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turborepo.org/schema.json",
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {
"sync": {
Expand Down

0 comments on commit aab437e

Please sign in to comment.