Update Node.js and fix prompt interleaving

This commit is contained in:
Radon Rosborough 2020-06-07 16:45:54 -06:00
parent 76a1c8fa1d
commit 6784a2bdae
3 changed files with 15 additions and 5 deletions

View File

@ -66,7 +66,7 @@ export class Session {
} }
}; };
run = async () => { run = async () => {
const { repl, file, run } = this.config; const { repl, file, suffix, run } = this.config;
if (this.term) { if (this.term) {
this.term.kill(); this.term.kill();
} }
@ -82,8 +82,12 @@ export class Session {
); );
let cmdline: string[]; let cmdline: string[];
if (this.code || !repl) { if (this.code || !repl) {
let code = this.code;
if (suffix) {
code += suffix;
}
await new Promise((resolve, reject) => await new Promise((resolve, reject) =>
fs.writeFile(path.resolve(tmpdir, file), this.code, (err) => { fs.writeFile(path.resolve(tmpdir, file), code, (err) => {
if (err) { if (err) {
reject(err); reject(err);
} else { } else {

View File

@ -1,6 +1,8 @@
export interface LangConfig { export interface LangConfig {
repl?: string[]; repl?: string[];
file?: string; file?: string;
prefix?: string;
suffix?: string;
run?: string[] | string; run?: string[] | string;
monacoLang: string; monacoLang: string;
name: string; name: string;
@ -65,7 +67,8 @@ export const langs = {
nodejs: { nodejs: {
repl: ["node"], repl: ["node"],
file: "main.js", file: "main.js",
run: 'node -i -e "$(< main.js)"', suffix: '\n;require("repl").start();',
run: "node main.js",
name: "Node.js", name: "Node.js",
monacoLang: "javascript", monacoLang: "javascript",
}, },

View File

@ -12,13 +12,16 @@ uid="$1"
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get install -y curl gnupg apt-get install -y curl gnupg lsb-release
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
tee -a /etc/apt/sources.list.d/yarn.list >/dev/null <<"EOF" tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<"EOF"
deb https://deb.nodesource.com/node_14.x focal main
deb https://dl.yarnpkg.com/debian/ stable main deb https://dl.yarnpkg.com/debian/ stable main
deb-src https://deb.nodesource.com/node_14.x
EOF EOF
packages=" packages="