Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby in terminal #12

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_ASSETS_URL = '/fs'
#VITE_ASSETS_URL = 'http://localhost:8787'
#VITE_WORKER_URL=http://localhost:8787
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_GITHUB_CLIENT_ID=6211bec51d65250aee37
VITE_WORKER_URL=https://worker.runruby.dev
VITE_ASSETS_URL = 'https://static.runruby.dev'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ tmp
*.njsproj
*.sln
*.sw?
public/fs

27 changes: 27 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node

import fs from "fs";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import { execSync } from "child_process";
import { snapshot } from "@webcontainer/snapshot";

const __dirname = dirname(fileURLToPath(import.meta.url));

const fsDir = join(__dirname, "../public/fs");
if (!fs.existsSync(fsDir)) {
fs.mkdirSync(fsDir, { recursive: true });
}

const stubs = await snapshot(join(__dirname, "../src/stubs"));
fs.writeFileSync(join(fsDir, "stubs"), stubs);

execSync("npm i && npm run build", {
cwd: join(__dirname, "../packages/ruby-cli"),
});

const ruby = await snapshot(join(__dirname, "../packages/ruby-cli/dist"));

fs.writeFileSync(join(fsDir, "ruby"), ruby);

console.log("Snapshots created successfully.");
168 changes: 133 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"author": "Svyatoslav Kryukov <me@skryukov.dev>",
"license": "MIT",
"scripts": {
"dev": "vite",
"dev": "npm run build:wasm && vite",
"build": "tsc && vite build",
"format": "prettier --write .",
"build:wasm": "node bin/build.js",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand All @@ -20,26 +21,32 @@
"@nanostores/react": "^0.7.1",
"@ruby/3.3-wasm-wasi": "^2.6.2",
"@ruby/wasm-wasi": "^2.5.0",
"@webcontainer/api": "^1.1.9",
"@webcontainer/snapshot": "^0.1.0",
"@xterm/addon-fit": "^0.9.0",
"@xterm/xterm": "^5.4.0",
"dexie": "^3.2.5",
"dexie-react-hooks": "^1.1.7",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"nanoid": "^5.0.5",
"nanostores": "^0.9.5",
"nanostores": "^0.10.0",
"react": "^18.2.0",
"react-arborist": "^3.4.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-responsive": "^9.0.2",
"strip-ansi": "^7.1.0"
"react-responsive": "^10.0.0",
"strip-ansi": "^7.1.0",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
},
"devDependencies": {
"@types/file-saver": "^2.0.7",
"@types/node": "^20.11.24",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
Loading
Loading