mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
init
This commit is contained in:
committed by
Morten Olsen
parent
98e39a54cc
commit
ee37ac9d90
@@ -1,16 +1,18 @@
|
||||
import { fileURLToPath} from 'url';
|
||||
import { resolve, dirname } from 'path';
|
||||
import { writeFile, mkdir } from 'fs/promises';
|
||||
import { compile } from 'json-schema-to-typescript';
|
||||
import { fileURLToPath } from 'url'
|
||||
import { resolve, dirname } from 'path'
|
||||
import { writeFile, mkdir } from 'fs/promises'
|
||||
import { compile } from 'json-schema-to-typescript'
|
||||
|
||||
const root = fileURLToPath(new URL('..', import.meta.url));
|
||||
const root = fileURLToPath(new URL('..', import.meta.url))
|
||||
|
||||
const response = await fetch('https://raw.githubusercontent.com/jsonresume/resume-schema/master/schema.json');
|
||||
const schema = await response.json();
|
||||
const response = await fetch(
|
||||
'https://raw.githubusercontent.com/jsonresume/resume-schema/master/schema.json'
|
||||
)
|
||||
const schema = await response.json()
|
||||
|
||||
const types = await compile(schema, 'ResumeSchema', { bannerComment: '' });
|
||||
const types = await compile(schema, 'ResumeSchema', { bannerComment: '' })
|
||||
|
||||
const location = resolve(root, 'src/types/resume-schema.ts');
|
||||
console.log(`Writing to ${location}`);
|
||||
await mkdir(dirname(location), { recursive: true });
|
||||
await writeFile(location, types);
|
||||
const location = resolve(root, 'src/types/resume-schema.ts')
|
||||
console.log(`Writing to ${location}`)
|
||||
await mkdir(dirname(location), { recursive: true })
|
||||
await writeFile(location, types)
|
||||
|
||||
Reference in New Issue
Block a user