Skip to content

Commit

Permalink
Move JS/TS client into trailbase-core/js/client to reduce the relianc…
Browse files Browse the repository at this point in the history
…e on symlinks and fix windows builds.
  • Loading branch information
ignatz committed Jan 5, 2025
1 parent 263ec54 commit c117bb9
Show file tree
Hide file tree
Showing 143 changed files with 270 additions and 85 deletions.
1 change: 1 addition & 0 deletions client/trailbase-ts
1 change: 0 additions & 1 deletion client/trailbase-ts/bindings

This file was deleted.

120 changes: 60 additions & 60 deletions pnpm-lock.yaml

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

8 changes: 4 additions & 4 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
packages:
- 'client/trailbase-ts'
- 'docs'
- 'trailbase-core/ui/admin'
- 'trailbase-core/ui/auth'
- 'trailbase-core/js/admin'
- 'trailbase-core/js/auth'
- 'trailbase-core/js/client'
- 'examples/blog/web'
- 'examples/coffeesearch'
- 'examples/tutorial/scripts'
- 'trailbase-core/js'
- 'trailbase-core/js/runtime'
options:
prefer-workspace-packages: true
strict-peer-dependencies: true
10 changes: 5 additions & 5 deletions trailbase-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ fn main() -> Result<()> {
build_protos()?;

// WARN: watching non-existent paths will also trigger rebuilds.
println!("cargo::rerun-if-changed=../client/trailbase-ts/src/");
println!("cargo::rerun-if-changed=js/client/src/");

{
let path = "ui/admin";
let path = "js/admin";
println!("cargo::rerun-if-changed={path}/src/components/");
println!("cargo::rerun-if-changed={path}/src/lib/");
build_js(path)?;
}

{
let path = "ui/auth";
let path = "js/auth";
println!("cargo::rerun-if-changed={path}/src/components/");
println!("cargo::rerun-if-changed={path}/src/lib/");
println!("cargo::rerun-if-changed={path}/src/pages/");
Expand All @@ -114,8 +114,8 @@ fn main() -> Result<()> {
}

{
println!("cargo::rerun-if-changed=js/src/");
build_js("js")?;
println!("cargo::rerun-if-changed=js/runtime/src/");
build_js("js/runtime")?;
}

return Ok(());
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions trailbase-core/js/client/bindings
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

import { createVitest } from "vitest/node";
import { cwd } from "node:process";
import { cwd, chdir } from "node:process";
import { join } from "node:path";
import { execa, type Subprocess } from "execa";

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
const port: number = 4005;

async function initTrailBase(): Promise<{ subprocess: Subprocess }> {
const pwd = cwd();
if (!pwd.endsWith("trailbase-ts")) {
if (!pwd.endsWith("client")) {
throw Error(`Unxpected CWD: ${pwd}`);
}

const build = await execa`cargo build`;
const root = join(pwd, "..", "..", "..");

const build = await execa({ cwd: root })`cargo build`;
if (build.failed) {
console.error("STDOUT:", build.stdout);
console.error("STDERR:", build.stderr);
throw Error("cargo build failed");
}

const subprocess = execa`cargo run -- --data-dir ../testfixture run -a 127.0.0.1:${port} --js-runtime-threads 1`;
const subprocess = execa({
cwd: root,
})`cargo run -- --data-dir client/testfixture run -a 127.0.0.1:${port} --js-runtime-threads 1`;

for (let i = 0; i < 100; ++i) {
if ((subprocess.exitCode ?? 0) > 0) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c117bb9

Please sign in to comment.