mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 22:32:28 +00:00
feat: releases
This commit is contained in:
@@ -105,20 +105,45 @@ async function uploadToGitea() {
|
||||
|
||||
// Create main npm package
|
||||
async function createMainPackage() {
|
||||
await $`mkdir -p ./dist/tfcode`
|
||||
await $`cp -r ./bin ./dist/tfcode/bin`
|
||||
await $`mkdir -p ./dist/tfcode/bin`
|
||||
await Bun.file(`./dist/tfcode/postinstall.mjs`).write(await Bun.file("./script/postinstall-tfcode.mjs").text())
|
||||
await Bun.file(`./dist/tfcode/LICENSE`).write(await Bun.file("../../LICENSE").text())
|
||||
|
||||
// Create a simple wrapper script that runs the installed binary
|
||||
const wrapper = `#!/usr/bin/env node
|
||||
const { spawn } = require('child_process')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const binDir = path.join(__dirname, 'bin')
|
||||
const binary = process.platform === 'win32' ? 'tfcode.exe' : 'tfcode'
|
||||
const binaryPath = path.join(binDir, binary)
|
||||
|
||||
if (!fs.existsSync(binaryPath)) {
|
||||
console.error('tfcode binary not found. Run: npm install @toothfairyai/tfcode')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const child = spawn(binaryPath, process.argv.slice(2), {
|
||||
stdio: 'inherit',
|
||||
env: process.env
|
||||
})
|
||||
|
||||
child.on('exit', (code) => process.exit(code || 0))
|
||||
`
|
||||
await Bun.file(`./dist/tfcode/bin/tfcode.js`).write(wrapper)
|
||||
|
||||
// Create package.json
|
||||
await Bun.file(`./dist/tfcode/package.json`).write(
|
||||
JSON.stringify(
|
||||
{
|
||||
name: "@toothfairyai/tfcode",
|
||||
version: TFCODE_VERSION,
|
||||
bin: { tfcode: "./bin/tfcode" },
|
||||
bin: { tfcode: "./bin/tfcode.js" },
|
||||
scripts: { postinstall: "node ./postinstall.mjs" },
|
||||
license: pkg.license,
|
||||
optionalDependencies: binaries,
|
||||
engines: { node: ">=18" },
|
||||
homepage: "https://toothfairyai.com/developers/tfcode",
|
||||
repository: {
|
||||
type: "git",
|
||||
|
||||
Reference in New Issue
Block a user