Skip to content

Commit

Permalink
Merge pull request #902 from tidalcycles/build-warnings
Browse files Browse the repository at this point in the history
fix some build warnings
  • Loading branch information
felixroos committed Jan 12, 2024
2 parents 46a8597 + 9a0459f commit a053f40
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/metadata.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { getMetadata } from '../website/src/pages/metadata_parser';
import { getMetadata } from '../website/src/metadata_parser';

describe.concurrent('Metadata parser', () => {
it('loads a tag from inline comment', async () => {
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions website/src/my_patterns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getMetadata } from './metadata_parser';

export function getMyPatterns() {
const my = import.meta.glob('../../my-patterns/**', { as: 'raw', eager: true });
return Object.fromEntries(
Object.entries(my)
.filter(([name]) => name.endsWith('.txt'))
.map(([name, raw]) => [getMetadata(raw)['title'] || name.split('/').slice(-1), raw]),
);
}
3 changes: 2 additions & 1 deletion website/src/pages/examples/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as tunes from '../../../src/repl/tunes.mjs';
import HeadCommon from '../../components/HeadCommon.astro';
import { getMetadata } from '../metadata_parser';
import { getMetadata } from '../../metadata_parser';
const { BASE_URL } = import.meta.env;
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
Expand All @@ -25,3 +25,4 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL
}
</div>
</body>
../../metadata_parser
4 changes: 2 additions & 2 deletions website/src/pages/swatch/[name].png.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createCanvas } from 'canvas';
import { pianoroll } from '@strudel.cycles/core';
import { evaluate } from '@strudel.cycles/transpiler';
import '../../../../test/runtime.mjs';
import { getMyPatterns } from './list.json';
import { getMyPatterns } from '../../my_patterns';

export async function get({ params, request }) {
export async function GET({ params, request }) {
const patterns = await getMyPatterns();
const { name } = params;
const tune = patterns[name];
Expand Down
3 changes: 2 additions & 1 deletion website/src/pages/swatch/index.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { getMyPatterns } from './list.json';
import { getMyPatterns } from '../../my_patterns.js';
import { Content } from '../../../../my-patterns/README.md';
import HeadCommon from '../../components/HeadCommon.astro';
Expand Down Expand Up @@ -37,3 +37,4 @@ const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL
}
</div>
</body>
../../list.json
17 changes: 0 additions & 17 deletions website/src/pages/swatch/list.json.js

This file was deleted.

0 comments on commit a053f40

Please sign in to comment.