generated from json-schema-org/repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused files and update code structure
resolves #14
- Loading branch information
1 parent
a683aa2
commit d63e324
Showing
14 changed files
with
82 additions
and
63 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,21 +1,26 @@ | ||
import { contentManager } from "@/lib/contentManager"; | ||
import { CodeFile } from "@/lib/types"; | ||
import fs from "fs"; | ||
|
||
export default function CodeEditor({ mdPath }: { mdPath: string }) { | ||
type moduleExports = { | ||
exports: CodeFile; | ||
}; | ||
|
||
export default function CodeEditor({ urlPath }: { urlPath: string }) { | ||
const folderName = contentManager.contentFolderName; | ||
const path = `./${folderName}/${mdPath}`.replace(".mdx", ".ts"); | ||
console.log(path); | ||
const path = `./${folderName}/${urlPath}/${contentManager.codeFileName}`; | ||
const fileContent = fs.readFileSync(path, "utf-8"); | ||
console.log(fileContent); | ||
const dynmicFunction = new Function("module", fileContent); | ||
const moduleExports = {}; | ||
const moduleExports: {} | moduleExports = {}; | ||
dynmicFunction(moduleExports); | ||
moduleExports.exports.validationLogicFunction(); | ||
console.log(moduleExports); | ||
const { exports } = moduleExports as moduleExports; | ||
const code = exports.code; | ||
|
||
console.log(); | ||
// const ast = parser.parse(fileContent, { | ||
// sourceType: "module", | ||
// plugins: ["jsx"], | ||
// }); | ||
|
||
return <div>CodeEditor</div>; | ||
return <div>{JSON.stringify(code, null, 2)}</div>; | ||
} |
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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const code = { | ||
step: 2, | ||
}; | ||
|
||
module.exports = { | ||
code, | ||
}; |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const code = { | ||
title: "Welcome to the course!", | ||
content: "this is the content", | ||
}; | ||
|
||
module.exports = { | ||
code, | ||
}; |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const code = { | ||
title: "Welcome to the course!", | ||
content: "this is the content", | ||
}; | ||
|
||
module.exports = { | ||
code, | ||
}; |
File renamed without changes.
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
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