Skip to content

Instantly share code, notes, and snippets.

@plskz
Last active September 19, 2023 02:06
Show Gist options
  • Save plskz/5a37b1c892e955b8b61f562ac1041452 to your computer and use it in GitHub Desktop.
Save plskz/5a37b1c892e955b8b61f562ac1041452 to your computer and use it in GitHub Desktop.
FrontendMasters - get course contents then paste it to logseq
import jsonData from './developer-productivity.json'
const data = jsonData as Welcome;
export interface Welcome {
course: string;
url: string;
chapters: Chapter[];
}
export interface Chapter {
chapter: string;
lessons: Lesson[];
}
export interface Lesson {
lesson: string;
url: string;
items?: Item[];
}
export interface Item {
url: string;
type: Type;
timestamp: string;
body: string;
}
export enum Type {
Annotation = "annotation",
Note = "note",
}
console.log('- ## Contents');
for(const chapter of data.chapters) {
console.log(`\t- ### ${chapter.chapter}`);
for (const lesson of chapter.lessons) {
console.log(`\t\t- ${lesson.lesson}`);
}
}
@plskz
Copy link
Author

plskz commented Jun 29, 2023

Run

tsc --init

tsconfig.json

{
  "compilerOptions": {
    "resolveJsonModule": true,
    "target": "es2016",
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
  }
}

ts-node index.ts > output.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment