Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ea6000a0 |
No files matched your search
@@ -56,11 +56,16 @@ T3CODE_DEV_INSTANCE=feature-xyz bun run dev:desktop
|
||||
bun run build
|
||||
bun run start
|
||||
|
||||
# Publish an alpha build without touching npm "latest"
|
||||
bun run version:alpha
|
||||
bun run publish:alpha
|
||||
|
||||
# Build a shareable macOS .dmg (arm64 by default)
|
||||
bun run dist:desktop:dmg
|
||||
|
||||
# Or from any project directory after publishing:
|
||||
npx t3
|
||||
npx t3@alpha
|
||||
```
|
||||
|
||||
## Scripts
|
||||
@@ -75,6 +80,8 @@ npx t3
|
||||
- `bun run build` — Builds contracts, web app, and server through Turbo.
|
||||
- `bun run typecheck` — Strict TypeScript checks for all packages.
|
||||
- `bun run test` — Runs workspace tests.
|
||||
- `bun run version:alpha` — Sets or increments the `t3` package to an `x.y.z-alpha.n` prerelease.
|
||||
- `bun run publish:alpha` — Builds `t3` and publishes it with the npm `alpha` dist-tag, leaving `latest` unchanged.
|
||||
- `bun run dist:desktop:dmg` — Builds a shareable macOS `.dmg` into `./release`.
|
||||
- `bun run dist:desktop:dmg:x64` — Builds an Intel macOS `.dmg`.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "t3",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.0-alpha.1",
|
||||
"bin": {
|
||||
"t3": "./dist/index.mjs"
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { EventEmitter } from "node:events";
|
||||
import readline from "node:readline";
|
||||
import serverPackage from "../package.json";
|
||||
|
||||
import {
|
||||
ApprovalRequestId,
|
||||
@@ -200,7 +201,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
clientInfo: {
|
||||
name: "t3code_desktop",
|
||||
title: "T3 Code Desktop",
|
||||
version: "0.1.0",
|
||||
version: serverPackage.version,
|
||||
},
|
||||
capabilities: {
|
||||
experimentalApi: false,
|
||||
|
||||
+7
-3
@@ -29,9 +29,13 @@
|
||||
"test:desktop-smoke": "turbo run smoke-test --filter=@t3tools/desktop",
|
||||
"fmt": "oxfmt",
|
||||
"build:contracts": "turbo run build --filter=@t3tools/contracts",
|
||||
"dist:desktop:dmg": "node scripts/build-desktop-dmg.mjs",
|
||||
"dist:desktop:dmg:arm64": "node scripts/build-desktop-dmg.mjs --arch arm64",
|
||||
"dist:desktop:dmg:x64": "node scripts/build-desktop-dmg.mjs --arch x64",
|
||||
"version:alpha": "node scripts/version-alpha.mjs",
|
||||
"version:alpha:dry-run": "node scripts/version-alpha.mjs --dry-run",
|
||||
"publish:alpha": "node scripts/publish-alpha.mjs",
|
||||
"publish:alpha:dry-run": "node scripts/publish-alpha.mjs --dry-run",
|
||||
"dist:desktop:dmg": "node --env-file=.env scripts/build-desktop-dmg.mjs",
|
||||
"dist:desktop:dmg:arm64": "node --env-file=.env scripts/build-desktop-dmg.mjs --arch arm64",
|
||||
"dist:desktop:dmg:x64": "node --env-file=.env scripts/build-desktop-dmg.mjs --arch x64",
|
||||
"clean": "rm -rf node_modules apps/*/node_modules packages/*/node_modules apps/*/dist apps/*/dist-electron packages/*/dist .turbo apps/*/.turbo packages/*/.turbo",
|
||||
"sync:vscode-icons": "node scripts/sync-vscode-icons.mjs"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import { chmodSync, cpSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const repoRoot = fileURLToPath(new URL("..", import.meta.url));
|
||||
const packageDir = fileURLToPath(new URL("../apps/server", import.meta.url));
|
||||
const packageJsonPath = fileURLToPath(new URL("../apps/server/package.json", import.meta.url));
|
||||
const rootPackageJsonPath = fileURLToPath(new URL("../package.json", import.meta.url));
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
||||
const rootPackageJson = JSON.parse(readFileSync(rootPackageJsonPath, "utf8"));
|
||||
const version = packageJson.version;
|
||||
const isDryRun = process.argv.includes("--dry-run");
|
||||
|
||||
if (!/^\d+\.\d+\.\d+-alpha\.\d+$/.test(version)) {
|
||||
throw new Error(
|
||||
`Refusing alpha publish because apps/server/package.json is "${version}". Use bun run version:alpha first.`,
|
||||
);
|
||||
}
|
||||
|
||||
const build = spawnSync("bun", ["run", "build", "--filter=t3"], {
|
||||
cwd: repoRoot,
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
if (build.status !== 0) {
|
||||
process.exit(build.status ?? 1);
|
||||
}
|
||||
|
||||
function readWorkspaceCatalog(rootManifest) {
|
||||
const workspaces = rootManifest?.workspaces;
|
||||
if (!workspaces || typeof workspaces !== "object" || Array.isArray(workspaces)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const catalog = workspaces.catalog;
|
||||
if (!catalog || typeof catalog !== "object" || Array.isArray(catalog)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
||||
function resolveCatalogDependencies(dependencies, catalog, dependencySourceLabel) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(dependencies ?? {}).map(([dependencyName, spec]) => {
|
||||
if (typeof spec !== "string" || !spec.startsWith("catalog:")) {
|
||||
return [dependencyName, spec];
|
||||
}
|
||||
|
||||
const catalogKey = spec.slice("catalog:".length).trim();
|
||||
const lookupKey = catalogKey.length > 0 ? catalogKey : dependencyName;
|
||||
const resolvedSpec = catalog[lookupKey];
|
||||
if (typeof resolvedSpec !== "string" || resolvedSpec.length === 0) {
|
||||
throw new Error(
|
||||
`Unable to resolve '${spec}' for ${dependencySourceLabel} dependency '${dependencyName}'.`,
|
||||
);
|
||||
}
|
||||
|
||||
return [dependencyName, resolvedSpec];
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const publishDir = mkdtempSync(path.join(os.tmpdir(), "t3-alpha-publish-"));
|
||||
cpSync(path.join(packageDir, "dist"), path.join(publishDir, "dist"), { recursive: true });
|
||||
mkdirSync(path.join(publishDir, "bin"), { recursive: true });
|
||||
writeFileSync(
|
||||
path.join(publishDir, "bin", "t3"),
|
||||
'#!/usr/bin/env node\nimport "../dist/index.mjs";\n',
|
||||
);
|
||||
chmodSync(path.join(publishDir, "bin", "t3"), 0o755);
|
||||
|
||||
const publishManifest = {
|
||||
name: packageJson.name,
|
||||
version: packageJson.version,
|
||||
type: packageJson.type,
|
||||
bin: {
|
||||
t3: "bin/t3",
|
||||
},
|
||||
main: packageJson.main,
|
||||
files: ["dist", "bin"],
|
||||
dependencies: resolveCatalogDependencies(
|
||||
packageJson.dependencies,
|
||||
readWorkspaceCatalog(rootPackageJson),
|
||||
"apps/server",
|
||||
),
|
||||
};
|
||||
|
||||
writeFileSync(path.join(publishDir, "package.json"), `${JSON.stringify(publishManifest, null, 2)}\n`);
|
||||
|
||||
const publishArgs = ["publish", "--tag", "alpha"];
|
||||
if (isDryRun) {
|
||||
publishArgs.push("--dry-run");
|
||||
}
|
||||
|
||||
const publish = spawnSync("npm", publishArgs, {
|
||||
cwd: publishDir,
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
rmSync(publishDir, { recursive: true, force: true });
|
||||
process.exit(publish.status ?? 1);
|
||||
@@ -0,0 +1,46 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const packageJsonPath = fileURLToPath(new URL("../apps/server/package.json", import.meta.url));
|
||||
const args = process.argv.slice(2);
|
||||
const dryRun = args.includes("--dry-run");
|
||||
const versionArg = args.find((arg) => arg !== "--dry-run");
|
||||
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
||||
const currentVersion = packageJson.version;
|
||||
|
||||
const alphaVersionPattern = /^\d+\.\d+\.\d+-alpha\.\d+$/;
|
||||
const alphaCounterPattern = /^(?<base>\d+\.\d+\.\d+)-alpha\.(?<counter>\d+)$/;
|
||||
|
||||
function nextAlphaVersion(version) {
|
||||
const alphaMatch = version.match(alphaCounterPattern);
|
||||
if (alphaMatch?.groups) {
|
||||
const counter = Number.parseInt(alphaMatch.groups.counter, 10);
|
||||
return `${alphaMatch.groups.base}-alpha.${counter + 1}`;
|
||||
}
|
||||
|
||||
if (version.includes("-")) {
|
||||
throw new Error(
|
||||
`Cannot derive an alpha version from prerelease version "${version}". Pass an explicit version instead.`,
|
||||
);
|
||||
}
|
||||
|
||||
return `${version}-alpha.0`;
|
||||
}
|
||||
|
||||
const nextVersion = versionArg ?? nextAlphaVersion(currentVersion);
|
||||
|
||||
if (!alphaVersionPattern.test(nextVersion)) {
|
||||
throw new Error(
|
||||
`Expected an explicit alpha version like "0.1.0-alpha.0", received "${nextVersion}".`,
|
||||
);
|
||||
}
|
||||
|
||||
if (dryRun) {
|
||||
console.log(nextVersion);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
packageJson.version = nextVersion;
|
||||
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
|
||||
console.log(`Updated apps/server/package.json to ${nextVersion}`);
|
||||
Reference in new issue
Block a user