-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use js for generateSlugs to avoid runtime issues/extra deps
- Loading branch information
Showing
3 changed files
with
200 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import fs from 'fs'; | ||
import { dirname } from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { Artist } from '../types'; | ||
import fetch from 'isomorphic-fetch'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
fetch('https://api.relisten.net/api/v2/artists') | ||
.then((res: Response) => res.json()) | ||
.then((json: object[]) => { | ||
const str = json.map((artist: Artist) => `"${artist.slug}"`).join(','); | ||
.then((res) => res.json()) | ||
.then((json) => { | ||
const str = json.map((artist) => `"${artist.slug}"`).join(','); | ||
|
||
fs.writeFileSync(__dirname + '/rawSlugs.ts', `export default [${str}]`); | ||
}); |
Oops, something went wrong.