mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 13:54:01 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import fs from "fs/promises"
|
|
import path from "path"
|
|
|
|
describe("BunProc registry configuration", () => {
|
|
test("should not contain hardcoded registry parameters", async () => {
|
|
// Read the bun/index.ts file
|
|
const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
|
|
const content = await fs.readFile(bunIndexPath, "utf-8")
|
|
|
|
// Verify that no hardcoded registry is present
|
|
expect(content).not.toContain("--registry=")
|
|
expect(content).not.toContain("hasNpmRcConfig")
|
|
expect(content).not.toContain("NpmRc")
|
|
})
|
|
|
|
test("should use Bun's default registry resolution", async () => {
|
|
// Read the bun/index.ts file
|
|
const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
|
|
const content = await fs.readFile(bunIndexPath, "utf-8")
|
|
|
|
// Verify that it uses Bun's default resolution
|
|
expect(content).toContain("Bun's default registry resolution")
|
|
expect(content).toContain("Bun will use them automatically")
|
|
expect(content).toContain("No need to pass --registry flag")
|
|
})
|
|
|
|
test("should have correct command structure without registry", async () => {
|
|
// Read the bun/index.ts file
|
|
const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
|
|
const content = await fs.readFile(bunIndexPath, "utf-8")
|
|
|
|
// Extract the install function
|
|
const installFunctionMatch = content.match(/export async function install[\s\S]*?^ }/m)
|
|
expect(installFunctionMatch).toBeTruthy()
|
|
|
|
if (installFunctionMatch) {
|
|
const installFunction = installFunctionMatch[0]
|
|
|
|
// Verify expected arguments are present
|
|
expect(installFunction).toContain('"add"')
|
|
expect(installFunction).toContain('"--force"')
|
|
expect(installFunction).toContain('"--exact"')
|
|
expect(installFunction).toContain('"--cwd"')
|
|
expect(installFunction).toContain("Global.Path.cache")
|
|
expect(installFunction).toContain('pkg + "@" + version')
|
|
|
|
// Verify no registry argument is added
|
|
expect(installFunction).not.toContain('"--registry"')
|
|
expect(installFunction).not.toContain('args.push("--registry')
|
|
}
|
|
})
|
|
})
|