Compare commits
No commits in common. "15a8ff29e62f75e7953b36fa45fcfd6b7bfaf241" and "94b0eb4dad48b13ae7ec97702223305a071553d5" have entirely different histories.
15a8ff29e6
...
94b0eb4dad
|
|
@ -1,7 +1,7 @@
|
||||||
// Show the webapps hosted on this NOSEputer.
|
// Show the webapps hosted on this NOSEputer.
|
||||||
|
|
||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
import { apps } from "@/webapp"
|
import { apps } from "app/src/webapp"
|
||||||
|
|
||||||
const devMode = process.env.NODE_ENV !== "production"
|
const devMode = process.env.NODE_ENV !== "production"
|
||||||
|
|
||||||
|
|
@ -4,12 +4,12 @@ import { escapeHTML } from "bun"
|
||||||
import { readdirSync } from "fs"
|
import { readdirSync } from "fs"
|
||||||
import { join, extname } from "path"
|
import { join, extname } from "path"
|
||||||
|
|
||||||
import type { CommandOutput } from "@/shared/types"
|
import type { CommandOutput } from "app/src/shared/types"
|
||||||
import { NOSE_WWW } from "@/config"
|
import { NOSE_WWW } from "app/src/config"
|
||||||
import { isBinaryFile } from "@/utils"
|
import { isBinaryFile } from "app/src/utils"
|
||||||
|
import { highlight } from "../lib/highlight"
|
||||||
import { projectName, projectDir } from "@/project"
|
import { projectName, projectDir } from "@/project"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
import { highlight } from "../lib/highlight"
|
|
||||||
|
|
||||||
export default async function (path: string) {
|
export default async function (path: string) {
|
||||||
const project = projectName()
|
const project = projectName()
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
import { readdirSync } from "fs"
|
import { readdirSync } from "fs"
|
||||||
import { join, extname } from "path"
|
import { join, extname } from "path"
|
||||||
|
|
||||||
import type { CommandOutput } from "@/shared/types"
|
import type { CommandOutput } from "app/src/shared/types"
|
||||||
import { NOSE_WWW } from "@/config"
|
import { NOSE_WWW } from "app/src/config"
|
||||||
import { isBinaryFile } from "@/utils"
|
import { isBinaryFile } from "app/src/utils"
|
||||||
import { countChar } from "@/shared/utils"
|
import { countChar } from "app/src/shared/utils"
|
||||||
import { projectName, projectDir } from "@/project"
|
import { projectName, projectDir } from "@/project"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// Show some debugging information.
|
// Show some debugging information.
|
||||||
|
|
||||||
import { NOSE_STARTED, NOSE_SYS_BIN, NOSE_DIR, GIT_SHA } from "@/config"
|
import { NOSE_STARTED, NOSE_SYS, NOSE_DIR, GIT_SHA } from "@/config"
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
return [
|
return [
|
||||||
|
|
@ -12,7 +12,7 @@ export default function () {
|
||||||
`USER=${process.env.USER || "(none)"}`,
|
`USER=${process.env.USER || "(none)"}`,
|
||||||
`PWD=${process.env.PWD || "(none)"}`,
|
`PWD=${process.env.PWD || "(none)"}`,
|
||||||
`NOSE_STARTED=${NOSE_STARTED}`,
|
`NOSE_STARTED=${NOSE_STARTED}`,
|
||||||
`NOSE_SYS_BIN=${NOSE_SYS_BIN}`,
|
`NOSE_SYS=${NOSE_SYS}`,
|
||||||
`NOSE_DIR=${NOSE_DIR}`,
|
`NOSE_DIR=${NOSE_DIR}`,
|
||||||
`GIT_SHA=${GIT_SHA.slice(0, 8)}`,
|
`GIT_SHA=${GIT_SHA.slice(0, 8)}`,
|
||||||
].join("\n")
|
].join("\n")
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Load a project so you can work on it.
|
// Load a project so you can work on it.
|
||||||
|
|
||||||
import { apps } from "@/webapp"
|
import { apps } from "app/src/webapp"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
|
|
||||||
export default function (project: string) {
|
export default function (project: string) {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Look around.
|
// Look around.
|
||||||
|
|
||||||
import { readdirSync } from "fs"
|
import { readdirSync } from "fs"
|
||||||
import { NOSE_WWW } from "@/config"
|
import { NOSE_WWW } from "app/src/config"
|
||||||
import { projectName, projectDir } from "@/project"
|
import { projectName, projectDir } from "@/project"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
|
|
||||||
|
|
@ -2,9 +2,10 @@
|
||||||
//
|
//
|
||||||
// Essentially `mkdir -p`.
|
// Essentially `mkdir -p`.
|
||||||
|
|
||||||
import { mkdirSync, readdirSync } from "fs"
|
import { mkdirSync } from "fs"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import { projectDir } from "@/project"
|
import { projectDir } from "@/project"
|
||||||
|
import { readdirSync } from "fs"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
|
|
||||||
export default async function (path: string) {
|
export default async function (path: string) {
|
||||||
|
|
@ -4,9 +4,10 @@
|
||||||
|
|
||||||
import { mkdirSync, writeFileSync } from "fs"
|
import { mkdirSync, writeFileSync } from "fs"
|
||||||
import { join } from "path"
|
import { join } from "path"
|
||||||
import { apps } from "@/webapp"
|
|
||||||
import { NOSE_WWW } from "@/config"
|
import { apps } from "app/src/webapp"
|
||||||
import { isDir } from "@/utils"
|
import { NOSE_WWW } from "app/src/config"
|
||||||
|
import { isDir } from "app/src/utils"
|
||||||
|
|
||||||
import load from "./load"
|
import load from "./load"
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Show the projects on this NOSEputer.
|
// Show the projects on this NOSEputer.
|
||||||
|
|
||||||
import { apps } from "@/webapp"
|
import { apps } from "app/src/webapp"
|
||||||
import { sessionGet } from "@/session"
|
import { sessionGet } from "@/session"
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Share a webapp with the public internet.
|
// Share a webapp with the public internet.
|
||||||
|
|
||||||
import { apps } from "@/webapp"
|
import { apps } from "app/src/webapp"
|
||||||
import { connectSneaker, sneakers, sneakerUrl } from "@/sneaker"
|
import { connectSneaker, sneakers, sneakerUrl } from "app/src/sneaker"
|
||||||
|
|
||||||
export default async function (app: string) {
|
export default async function (app: string) {
|
||||||
if (!app) {
|
if (!app) {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Stop sharing a webapp with the public internet.
|
// Stop sharing a webapp with the public internet.
|
||||||
|
|
||||||
import { apps } from "@/webapp"
|
import { apps } from "app/src/webapp"
|
||||||
import { disconnectSneaker, sneakers } from "@/sneaker"
|
import { disconnectSneaker, sneakers } from "app/src/sneaker"
|
||||||
|
|
||||||
export default async function (app: string) {
|
export default async function (app: string) {
|
||||||
if (!app) {
|
if (!app) {
|
||||||
24
app/package.json
Normal file
24
app/package.json
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"name": "pluto",
|
||||||
|
"module": "src/server.tsx",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"start": "bun src/server.tsx",
|
||||||
|
"runner": "env NODE_ENV=production bun run src/runner.ts",
|
||||||
|
"prod": "env NODE_ENV=production bun src/server.tsx",
|
||||||
|
"dev": "env BUN_HOT=1 bun --hot src/server.tsx",
|
||||||
|
"deploy": "./scripts/deploy.sh",
|
||||||
|
"push": "./scripts/deploy.sh",
|
||||||
|
"remote:install": "./scripts/remote-install.sh",
|
||||||
|
"remote:start": "./scripts/remote-start.sh",
|
||||||
|
"remote:stop": "./scripts/remote-stop.sh",
|
||||||
|
"remote:restart": "./scripts/remote-restart.sh"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"kleur": "^4.1.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
# It isn't enough to modify this yet.
|
# It isn't enough to modify this yet.
|
||||||
# You also need to manually update the nose-pluto.service file.
|
# You also need to manually update the nose-pluto.service file.
|
||||||
HOST="${HOST:-nose@nose-pluto.local}"
|
HOST="${HOST:-nose@nose-pluto.local}"
|
||||||
DEST="${DEST:-~/.nose}"
|
DEST="${DEST:-~/nose}"
|
||||||
REPO="${REPO:-https://git.nose.space/defunkt/nose-pluto}"
|
REPO="${REPO:-https://git.nose.space/defunkt/nose-pluto}"
|
||||||
|
|
@ -3,10 +3,10 @@ set -e
|
||||||
|
|
||||||
# Get absolute path of this script’s directory
|
# Get absolute path of this script’s directory
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ROOT_DIR="$SCRIPT_DIR/.."
|
ROOT_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
# Run deploy + config with absolute paths
|
# Run deploy + config with absolute paths
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/app/scripts/config.sh"
|
||||||
|
|
||||||
# Make sure we're up-to-date
|
# Make sure we're up-to-date
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
@ -5,10 +5,9 @@ Wants=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=nose
|
User=nose
|
||||||
WorkingDirectory=/home/nose/.nose/
|
WorkingDirectory=/home/nose/nose/app
|
||||||
Environment=PORT=80
|
Environment=PORT=80
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
Environment=NOSE_DIR=/home/nose/nose/
|
|
||||||
ExecStart=/home/nose/.bun/bin/bun start
|
ExecStart=/home/nose/.bun/bin/bun start
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=1
|
RestartSec=1
|
||||||
|
|
@ -3,10 +3,10 @@ set -e
|
||||||
|
|
||||||
# Get absolute path of this script’s directory
|
# Get absolute path of this script’s directory
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ROOT_DIR="$SCRIPT_DIR/.."
|
ROOT_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
# Run deploy + config with absolute paths
|
# Run deploy + config with absolute paths
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/app/scripts/config.sh"
|
||||||
|
|
||||||
# Run remote install on the target
|
# Run remote install on the target
|
||||||
ssh "$HOST" "git clone $REPO $DEST && cd $DEST && ./scripts/install.sh && sudo systemctl start nose-pluto.service"
|
ssh "$HOST" "git clone $REPO $DEST && cd $DEST && ./app/scripts/install.sh && sudo systemctl start nose-pluto.service"
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ROOT_DIR="$SCRIPT_DIR/.."
|
ROOT_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/app/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl restart nose-pluto.service"
|
ssh "$HOST" "sudo systemctl restart nose-pluto.service"
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ROOT_DIR="$SCRIPT_DIR/.."
|
ROOT_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/app/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl start nose-pluto.service"
|
ssh "$HOST" "sudo systemctl start nose-pluto.service"
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
ROOT_DIR="$SCRIPT_DIR/.."
|
ROOT_DIR="$SCRIPT_DIR/../.."
|
||||||
|
|
||||||
source "$ROOT_DIR/scripts/config.sh"
|
source "$ROOT_DIR/app/scripts/config.sh"
|
||||||
|
|
||||||
ssh "$HOST" "sudo systemctl stop nose-pluto.service"
|
ssh "$HOST" "sudo systemctl stop nose-pluto.service"
|
||||||
|
|
@ -9,9 +9,14 @@ import { sendAll } from "./websocket"
|
||||||
import { expectDir } from "./utils"
|
import { expectDir } from "./utils"
|
||||||
import { NOSE_SYS_BIN, NOSE_BIN } from "./config"
|
import { NOSE_SYS_BIN, NOSE_BIN } from "./config"
|
||||||
|
|
||||||
export function initCommands() {
|
const sysCmdWatcher = watch(NOSE_SYS_BIN, async (event, filename) =>
|
||||||
startWatchers()
|
sendAll({ type: "commands", data: await commands() })
|
||||||
}
|
)
|
||||||
|
|
||||||
|
expectDir(NOSE_BIN)
|
||||||
|
const usrCmdWatcher = watch(NOSE_BIN, async (event, filename) => {
|
||||||
|
sendAll({ type: "commands", data: await commands() })
|
||||||
|
})
|
||||||
|
|
||||||
export async function commands(): Promise<string[]> {
|
export async function commands(): Promise<string[]> {
|
||||||
return (await findCommands(NOSE_SYS_BIN)).concat(await findCommands(NOSE_BIN))
|
return (await findCommands(NOSE_SYS_BIN)).concat(await findCommands(NOSE_BIN))
|
||||||
|
|
@ -41,22 +46,9 @@ export function commandExists(cmd: string): boolean {
|
||||||
return commandPath(cmd) !== undefined
|
return commandPath(cmd) !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function commandSource(name: string): Promise<string> {
|
export async function commandSource(name: string): Promise<string> {
|
||||||
const path = commandPath(name)
|
const path = commandPath(name)
|
||||||
if (!path) return ""
|
if (!path) return ""
|
||||||
return Bun.file(path).text()
|
return Bun.file(path).text()
|
||||||
}
|
}
|
||||||
|
|
||||||
let sysCmdWatcher
|
|
||||||
let usrCmdWatcher
|
|
||||||
function startWatchers() {
|
|
||||||
expectDir(NOSE_BIN)
|
|
||||||
|
|
||||||
sysCmdWatcher = watch(NOSE_SYS_BIN, async (event, filename) =>
|
|
||||||
sendAll({ type: "commands", data: await commands() })
|
|
||||||
)
|
|
||||||
|
|
||||||
usrCmdWatcher = watch(NOSE_BIN, async (event, filename) => {
|
|
||||||
sendAll({ type: "commands", data: await commands() })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
|
import { resolve, join } from "node:path"
|
||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
import { resolve, join } from "path"
|
|
||||||
import { untilde } from "./utils"
|
|
||||||
|
|
||||||
export const NOSE_ICON = ` ͡° ͜ʖ ͡°`
|
export const NOSE_ICON = ` ͡° ͜ʖ ͡°`
|
||||||
|
|
||||||
export const NOSE_SYS_BIN = resolve("./bin")
|
export const NOSE_SYS = resolve("./nose")
|
||||||
|
export const NOSE_SYS_BIN = join(NOSE_SYS, "bin")
|
||||||
|
|
||||||
export const NOSE_DIR = resolve(untilde(process.env.NOSE_DIR || "./nose"))
|
export const NOSE_DIR = resolve("..")
|
||||||
export const NOSE_BIN = join(NOSE_DIR, "bin")
|
export const NOSE_BIN = join(NOSE_DIR, "bin")
|
||||||
export const NOSE_WWW = join(NOSE_DIR, "www")
|
export const NOSE_WWW = join(NOSE_DIR, "www")
|
||||||
|
|
||||||
|
|
@ -19,7 +19,6 @@ export async function initDNS() {
|
||||||
if (process.env.NODE_ENV !== "production") return
|
if (process.env.NODE_ENV !== "production") return
|
||||||
dnsInit = true
|
dnsInit = true
|
||||||
|
|
||||||
startWatcher()
|
|
||||||
apps().forEach(publishAppDNS)
|
apps().forEach(publishAppDNS)
|
||||||
|
|
||||||
const signals = ["SIGINT", "SIGTERM"]
|
const signals = ["SIGINT", "SIGTERM"]
|
||||||
|
|
@ -42,17 +41,15 @@ export function publishAppDNS(app: string) {
|
||||||
return dnsEntries[app]
|
return dnsEntries[app]
|
||||||
}
|
}
|
||||||
|
|
||||||
let wwwWatcher
|
// exit process with error if no WWW dir
|
||||||
function startWatcher() {
|
expectDir(NOSE_WWW)
|
||||||
expectDir(NOSE_WWW)
|
|
||||||
|
|
||||||
wwwWatcher = watch(NOSE_WWW, (event, filename) => {
|
const wwwWatcher = watch(NOSE_WWW, (event, filename) => {
|
||||||
const www = apps()
|
const www = apps()
|
||||||
www.forEach(publishAppDNS)
|
www.forEach(publishAppDNS)
|
||||||
for (const name in dnsEntries)
|
for (const name in dnsEntries)
|
||||||
if (!www.includes(name)) {
|
if (!www.includes(name)) {
|
||||||
dnsEntries[name].kill("SIGTERM")
|
dnsEntries[name].kill("SIGTERM")
|
||||||
delete dnsEntries[name]
|
delete dnsEntries[name]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { prettyJSON } from "hono/pretty-json"
|
||||||
import color from "kleur"
|
import color from "kleur"
|
||||||
|
|
||||||
import type { Message } from "./shared/types"
|
import type { Message } from "./shared/types"
|
||||||
import { NOSE_ICON, NOSE_BIN, NOSE_WWW, NOSE_DATA, NOSE_DIR } from "./config"
|
import { NOSE_ICON, NOSE_BIN, NOSE_WWW, NOSE_DATA } from "./config"
|
||||||
import { transpile, isFile, tilde } from "./utils"
|
import { transpile, isFile, tilde } from "./utils"
|
||||||
import { serveApp } from "./webapp"
|
import { serveApp } from "./webapp"
|
||||||
import { initDNS } from "./dns"
|
import { initDNS } from "./dns"
|
||||||
|
|
@ -18,8 +18,6 @@ import { Layout } from "./html/layout"
|
||||||
import { Terminal } from "./html/terminal"
|
import { Terminal } from "./html/terminal"
|
||||||
import { dispatchMessage } from "./dispatch"
|
import { dispatchMessage } from "./dispatch"
|
||||||
import { initSneakers, disconnectSneakers } from "./sneaker"
|
import { initSneakers, disconnectSneakers } from "./sneaker"
|
||||||
import { initNoseDir } from "./nosedir"
|
|
||||||
import { initCommands } from "./commands"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hono setup
|
// Hono setup
|
||||||
|
|
@ -157,12 +155,9 @@ if (process.env.NODE_ENV === "production") {
|
||||||
|
|
||||||
console.log(color.cyan(NOSE_ICON))
|
console.log(color.cyan(NOSE_ICON))
|
||||||
console.log(color.blue("NOSE_DATA:"), color.yellow(tilde(NOSE_DATA)))
|
console.log(color.blue("NOSE_DATA:"), color.yellow(tilde(NOSE_DATA)))
|
||||||
console.log(color.blue("NOSE_DIR:"), color.yellow(tilde(NOSE_DIR)))
|
|
||||||
console.log(color.blue("NOSE_BIN:"), color.yellow(tilde(NOSE_BIN)))
|
console.log(color.blue("NOSE_BIN:"), color.yellow(tilde(NOSE_BIN)))
|
||||||
console.log(color.blue("NOSE_WWW:"), color.yellow(tilde(NOSE_WWW)))
|
console.log(color.blue("NOSE_WWW:"), color.yellow(tilde(NOSE_WWW)))
|
||||||
|
|
||||||
await initNoseDir()
|
|
||||||
initCommands()
|
|
||||||
initSneakers()
|
initSneakers()
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// with the public internet. It requires a sneaker server, usually hosted by us.
|
// with the public internet. It requires a sneaker server, usually hosted by us.
|
||||||
|
|
||||||
import nose from "./server"
|
import nose from "./server"
|
||||||
import { clearState, setState, getState } from "./state"
|
import { clearState, setState, getState } from "app/src/state"
|
||||||
|
|
||||||
const SNEAKER_URL = "nose.space"
|
const SNEAKER_URL = "nose.space"
|
||||||
const SNEAKER_TLS = true
|
const SNEAKER_TLS = true
|
||||||
|
|
@ -3,23 +3,16 @@
|
||||||
|
|
||||||
import { statSync } from "fs"
|
import { statSync } from "fs"
|
||||||
import { basename } from "path"
|
import { basename } from "path"
|
||||||
import { stat } from "fs/promises"
|
import { stat } from "node:fs/promises"
|
||||||
|
|
||||||
// Convert /Users/$USER or /home/$USER to ~ for simplicity
|
import { NOSE_ICON } from "./config"
|
||||||
export function tilde(path: string): string {
|
|
||||||
return path.replace(new RegExp(`/(Users|home)/${process.env.USER}`), "~")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert ~ to /Users/$USER or /home/$USER for simplicity
|
|
||||||
export function untilde(path: string): string {
|
|
||||||
const prefix = process.platform === 'darwin' ? 'Users' : 'home'
|
|
||||||
return path.replace("~", `/${prefix}/${process.env.USER}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// End the process with an instructive error if a directory doesn't exist.
|
// End the process with an instructive error if a directory doesn't exist.
|
||||||
export function expectDir(path: string) {
|
export function expectDir(path: string) {
|
||||||
if (!isDir(path)) {
|
if (!isDir(path)) {
|
||||||
console.error(`No ${basename(path)} directory detected.`)
|
console.error(NOSE_ICON)
|
||||||
|
console.error(`No ${basename(path)} directory detected. Please run:`)
|
||||||
|
console.error("\tmkdir -p", path)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -77,6 +70,11 @@ export async function isBinaryFile(path: string): Promise<boolean> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert /Users/$USER or /home/$USER to ~ for simplicity
|
||||||
|
export function tilde(path: string): string {
|
||||||
|
return path.replace(new RegExp(`/(Users|home)/${process.env.USER}`), "~")
|
||||||
|
}
|
||||||
|
|
||||||
const transpiler = new Bun.Transpiler({ loader: 'tsx' })
|
const transpiler = new Bun.Transpiler({ loader: 'tsx' })
|
||||||
const transpileCache: Record<string, string> = {}
|
const transpileCache: Record<string, string> = {}
|
||||||
|
|
||||||
4
app/tsconfig.json
Normal file
4
app/tsconfig.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"include": ["./**/*"]
|
||||||
|
}
|
||||||
0
nose/global.d.ts → global.d.ts
vendored
0
nose/global.d.ts → global.d.ts
vendored
|
|
@ -1,39 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
// Environment setup & latest features
|
|
||||||
"lib": [
|
|
||||||
"ESNext",
|
|
||||||
"DOM"
|
|
||||||
],
|
|
||||||
"target": "ESNext",
|
|
||||||
"module": "Preserve",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "hono/jsx",
|
|
||||||
"allowJs": true,
|
|
||||||
// Bundler mode
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"noEmit": true,
|
|
||||||
// Best practices
|
|
||||||
"strict": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"noUncheckedIndexedAccess": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
// Some stricter flags (disabled by default)
|
|
||||||
"noUnusedLocals": false,
|
|
||||||
"noUnusedParameters": false,
|
|
||||||
"noPropertyAccessFromIndexSignature": false,
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"@utils": [
|
|
||||||
"/home/nose/.nose/src/utils.tsx"
|
|
||||||
],
|
|
||||||
"@/*": [
|
|
||||||
"/home/nose/.nose/src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB |
|
|
@ -1,24 +0,0 @@
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>chris!</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link href="/main.css" rel="stylesheet" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<div class="tile text">
|
|
||||||
<div class="text-content">
|
|
||||||
<h1>@defunkt</h1>
|
|
||||||
<p>This is my website. I am Chris.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="tile burger">
|
|
||||||
<img src="burger.png" alt="Burger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tile {
|
|
||||||
flex: 1;
|
|
||||||
/* equal width columns */
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text-content {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.burger img {
|
|
||||||
max-width: 90%;
|
|
||||||
max-height: 90%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 150 KiB |
|
|
@ -1,15 +0,0 @@
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>corey</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>@probablycorey</h1>
|
|
||||||
<p>This is my website. I am Corey.</p>
|
|
||||||
<img src="/hotdog.png" />
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export default () =>
|
|
||||||
"hiya"
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Hello</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Wolfie Man</h1>
|
|
||||||
<p>Toy Rivian Truck</p>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
49
package.json
49
package.json
|
|
@ -1,24 +1,29 @@
|
||||||
{
|
{
|
||||||
"name": "pluto",
|
"name": "nose-pluto",
|
||||||
"module": "src/server.tsx",
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"workspaces": [
|
||||||
"scripts": {
|
"app"
|
||||||
"start": "bun src/server.tsx",
|
],
|
||||||
"runner": "env NODE_ENV=production bun run src/runner.ts",
|
"scripts": {
|
||||||
"prod": "env NODE_ENV=production bun src/server.tsx",
|
"runner": "bun run --cwd ./app runner",
|
||||||
"dev": "env BUN_HOT=1 bun --hot src/server.tsx",
|
"dev": "bun run --cwd ./app dev",
|
||||||
"deploy": "./scripts/deploy.sh",
|
"start": "bun run --cwd ./app start",
|
||||||
"push": "./scripts/deploy.sh",
|
"push": "bun run --cwd ./app push",
|
||||||
"remote:install": "./scripts/remote-install.sh",
|
"remote:install": "bun run --cwd ./app remote:install",
|
||||||
"remote:start": "./scripts/remote-start.sh",
|
"remote:start": "bun run --cwd ./app remote:start",
|
||||||
"remote:stop": "./scripts/remote-stop.sh",
|
"remote:stop": "bun run --cwd ./app remote:stop",
|
||||||
"remote:restart": "./scripts/remote-restart.sh"
|
"remote:restart": "bun run --cwd ./app remote:restart"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"dependencies": {
|
||||||
"typescript": "^5"
|
"hono": "^4.9.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"devDependencies": {
|
||||||
"kleur": "^4.1.5"
|
"@types/bun": "latest"
|
||||||
|
},
|
||||||
|
"alias": {
|
||||||
|
"@nose": "./app/src/helpers.tsx",
|
||||||
|
"@config": "./app/src/config.ts",
|
||||||
|
"@/*": "./app/src/*"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user