Refactor some stuff

pull/8427/head
Puru Vijay 4 years ago
parent 095ce28d72
commit cf2a93161f

@ -4,21 +4,8 @@ import { extract_frontmatter } from '../markdown';
const base = '../../site/content/tutorial/'; const base = '../../site/content/tutorial/';
/** @typedef {{
* title: string;
* slug: string;
* tutorials: {
* title: string;
* slug: string;
* dir: string;
* content: string;
* initial: { name: string; type: string; content: string }[]
* complete: { name: string; type: string; content: string }[]
* }[];
* }[]} TutorialData */
/** /**
* @returns {TutorialData} * @returns {import('./types').TutorialData}
*/ */
export function get_tutorial_data() { export function get_tutorial_data() {
const tutorials = []; const tutorials = [];
@ -80,7 +67,7 @@ export function get_tutorial_data() {
} }
/** /**
* @param {TutorialData} tutorial_data * @param {import('./types').TutorialData} tutorial_data
* @returns {import('./types').TutorialsList} * @returns {import('./types').TutorialsList}
*/ */
export function get_tutorial_list(tutorial_data) { export function get_tutorial_list(tutorial_data) {

@ -1,18 +1,10 @@
import * as fs from 'fs';
import * as path from 'path';
import { createShikiHighlighter } from 'shiki-twoslash'; import { createShikiHighlighter } from 'shiki-twoslash';
import { extract_frontmatter, transform } from '../markdown'; import { transform } from '../markdown';
// import { render, replace_placeholders } from './render.js';
// import { parse_route_id } from '../../../../../../packages/kit/src/utils/routing.js';
import { createHash } from 'crypto';
import { normalizeSlugify } from '../docs';
const base = '../../site/content/tutorial/';
const languages = { const languages = {
bash: 'bash', bash: 'bash',
env: 'bash', env: 'bash',
html: 'html', html: 'svelte',
svelte: 'svelte', svelte: 'svelte',
sv: 'svelte', sv: 'svelte',
js: 'javascript', js: 'javascript',
@ -23,7 +15,7 @@ const languages = {
}; };
/** /**
* @param {import('./get-tutorial-data').TutorialData} tutorial_data * @param {import('./types').TutorialData} tutorial_data
* @param {string} slug * @param {string} slug
*/ */
export async function get_parsed_tutorial(tutorial_data, slug) { export async function get_parsed_tutorial(tutorial_data, slug) {

@ -1,3 +1,16 @@
export type TutorialData = {
title: string;
slug: string;
tutorials: {
title: string;
slug: string;
dir: string;
content: string;
initial: { name: string; type: string; content: string }[];
complete: { name: string; type: string; content: string }[];
}[];
}[];
export interface Tutorial { export interface Tutorial {
title: string; title: string;
slug: string; slug: string;

Loading…
Cancel
Save