Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurankv committed Oct 27, 2024
1 parent 68e885c commit d611aa5
Show file tree
Hide file tree
Showing 6 changed files with 4,063 additions and 3,352 deletions.
2,672 changes: 1,309 additions & 1,363 deletions main.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions manual-update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { exec } from "child_process";

const url = "https://raw.githubusercontent.com/twibiral/obsidian-execute-code/master/src/main.ts";
let settingsText = readFileSync("src/Settings.ts", "utf8");
fetch(url).then(r => r.text()).then(text=>{
const languageAliases = /export const languageAliases = \[([\s\S]*?)\]/.exec(text)?.[1]?.replace(/\s*/g,"");
const canonicalLanguages = /export const canonicalLanguages = \[([\s\S]*?)\]/.exec(text)?.[1]?.replace(/\s*/g,"");
writeFileSync("src/Settings.ts",settingsText.replace(/const EXECUTE_CODE_LANGUAGE_ALIASES: Array<string> = \[([\s\S]*?)\]/,`const EXECUTE_CODE_LANGUAGE_ALIASES: Array<string> = [${languageAliases}]`).replace(/const EXECUTE_CODE_CANONICAL_LANGUAGES: Array<string> = \[([\s\S]*?)\]/,`const EXECUTE_CODE_CANONICAL_LANGUAGES: Array<string> = [${canonicalLanguages}]`));
fetch(url).then(r => r.text()).then(text =>
{
const languageAliases = /export const languageAliases = \[([\s\S]*?)\]/.exec(text)?.[1]?.replace(/\s*/g, "");
const canonicalLanguages = /export const canonicalLanguages = \[([\s\S]*?)\]/.exec(text)?.[1]?.replace(/\s*/g, "");
writeFileSync("src/Settings.ts", settingsText.replace(/const EXECUTE_CODE_LANGUAGE_ALIASES: Array<string> = \[([\s\S]*?)\]/, `const EXECUTE_CODE_LANGUAGE_ALIASES: Array<string> = [${languageAliases}]`).replace(/const EXECUTE_CODE_CANONICAL_LANGUAGES: Array<string> = \[([\s\S]*?)\]/, `const EXECUTE_CODE_CANONICAL_LANGUAGES: Array<string> = [${canonicalLanguages}]`));
});

exec("git fetch execute-code && git show execute-code/master:src/CodeBlockArgs.ts > src/External/ExecuteCode/CodeBlockArgs.ts && eslint --fix src/External/ExecuteCode/CodeBlockArgs.ts",(error)=>console.log(error));
exec("git fetch execute-code && git show execute-code/master:src/CodeBlockArgs.ts > src/External/ExecuteCode/CodeBlockArgs.ts && eslint --fix src/External/ExecuteCode/CodeBlockArgs.ts", (error) => console.log(error));
Loading

0 comments on commit d611aa5

Please sign in to comment.