Minor fixes
This commit is contained in:
parent
21df6fa0f1
commit
42566af69e
@ -48,7 +48,7 @@ export const editorTokensProvider: MonacoTokensProvider = {
|
||||
// prettier-ignore
|
||||
operators: ["plus", "with", "minus", "without", "times", "of", "over", "between",
|
||||
"build", "knock", "up", "down", "is", "are", "was", "were", "ain't", "aren't",
|
||||
"wasn't", "weren't", "and", "or", "nor", "not"],
|
||||
"wasn't", "weren't", "and", "or", "nor", "not", "like"],
|
||||
|
||||
// prettier-ignore
|
||||
inbuiltFns: ["say", "shout", "whisper", "scream", "cast", "burn", "rock", "push",
|
||||
@ -91,7 +91,7 @@ export const editorTokensProvider: MonacoTokensProvider = {
|
||||
[/listen to/, "constant.function"],
|
||||
// Catchall for keywords
|
||||
[
|
||||
/[^ \s]+/,
|
||||
/[^\s]+\b/,
|
||||
{
|
||||
cases: {
|
||||
"@constants": "constant",
|
||||
|
@ -1,10 +1,9 @@
|
||||
// @ts-nocheck
|
||||
import React from "react";
|
||||
import { NextPage } from "next";
|
||||
import Head from "next/head";
|
||||
import { Mainframe } from "../../ui/Mainframe";
|
||||
import LangProvider from "../../languages/rockstar";
|
||||
const LANG_ID = "$LANG_ID";
|
||||
const LANG_ID = "rockstar";
|
||||
const LANG_NAME = "Rockstar";
|
||||
|
||||
const IDE: NextPage = () => {
|
||||
|
@ -21,6 +21,19 @@ if (fs.existsSync(dir)) {
|
||||
}
|
||||
fs.mkdirSync(dir);
|
||||
|
||||
/**
|
||||
* Remove the "// @ts-nocheck" line at the top of given file contents.
|
||||
* Returns null if file doesn't start with the comment.
|
||||
* @param {string} contents String containing contents, lines separated by "\n"
|
||||
* @returns Contents with first line removed
|
||||
*/
|
||||
const cropFirstLine = (contents) => {
|
||||
const lines = contents.split("\n");
|
||||
const firstLine = lines.shift();
|
||||
if (firstLine !== "// @ts-nocheck") return null;
|
||||
else return lines.join("\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Copy a file from source path to destination.
|
||||
* Also removes first line from file, which contains the "@ts-nocheck" comment
|
||||
@ -29,13 +42,12 @@ fs.mkdirSync(dir);
|
||||
*/
|
||||
const copyFile = (src, dest) => {
|
||||
const rawContents = fs.readFileSync(src).toString();
|
||||
const lines = rawContents.split("\n");
|
||||
const firstLine = lines.shift();
|
||||
if (firstLine !== "// @ts-nocheck") {
|
||||
const destContents = cropFirstLine(rawContents);
|
||||
if (destContents) {
|
||||
console.error(`Template file '${src}' doesn't have @ts-nocheck comment`);
|
||||
process.exit(1);
|
||||
}
|
||||
fs.writeFileSync(dest, lines.join("\n"));
|
||||
fs.writeFileSync(dest, destContents);
|
||||
};
|
||||
|
||||
{
|
||||
@ -62,7 +74,7 @@ const copyFile = (src, dest) => {
|
||||
// Generate Next.js page
|
||||
const src = path.resolve(__dirname, "./new-lang-template/ide-page.tsx");
|
||||
const dest = path.resolve(__dirname, `../pages/ide/${langId}.tsx`);
|
||||
const contents = fs.readFileSync(src).toString();
|
||||
const contents = cropFirstLine(fs.readFileSync(src).toString());
|
||||
const finalContents = contents
|
||||
.replace("$LANG_ID", langId)
|
||||
.replace("$LANG_NAME", langName);
|
||||
|
@ -29,12 +29,14 @@ export const Header = (props: Props) => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Button minimal large>
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
<Image src={logoImg} alt="logo" width={20} height={20} />
|
||||
<span style={{ marginLeft: 10 }}>Esolang Park</span>
|
||||
</div>
|
||||
</Button>
|
||||
<a href="/" title="Return to home page">
|
||||
<Button minimal large>
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
<Image src={logoImg} alt="logo" width={20} height={20} />
|
||||
<span style={{ marginLeft: 10 }}>Esolang Park</span>
|
||||
</div>
|
||||
</Button>
|
||||
</a>
|
||||
<Tag large minimal style={{ marginLeft: 10 }}>
|
||||
{props.langName}
|
||||
</Tag>
|
||||
|
Loading…
x
Reference in New Issue
Block a user