refactor: update entry points and bootstrap logic
This commit is contained in:
parent
2c185b8470
commit
33c1de7c75
@ -15,9 +15,10 @@
|
|||||||
"node": ">=24.0.0"
|
"node": ">=24.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run ./src/dev-entry.ts",
|
"dev": "bun run ./src/bootstrap-entry.ts",
|
||||||
"start": "bun run ./src/dev-entry.ts",
|
"start": "bun run ./src/bootstrap-entry.ts",
|
||||||
"version": "bun run ./src/dev-entry.ts --version"
|
"version": "bun run ./src/bootstrap-entry.ts --version",
|
||||||
|
"dev:restore-check": "bun run ./src/dev-entry.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alcalzone/ansi-tokenize": "*",
|
"@alcalzone/ansi-tokenize": "*",
|
||||||
|
|||||||
5
src/bootstrap-entry.ts
Normal file
5
src/bootstrap-entry.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { ensureBootstrapMacro } from './bootstrapMacro'
|
||||||
|
|
||||||
|
ensureBootstrapMacro()
|
||||||
|
|
||||||
|
await import('./entrypoints/cli.tsx')
|
||||||
29
src/bootstrapMacro.ts
Normal file
29
src/bootstrapMacro.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import pkg from '../package.json'
|
||||||
|
|
||||||
|
type MacroConfig = {
|
||||||
|
VERSION: string
|
||||||
|
BUILD_TIME: string
|
||||||
|
PACKAGE_URL: string
|
||||||
|
NATIVE_PACKAGE_URL: string
|
||||||
|
VERSION_CHANGELOG: string
|
||||||
|
ISSUES_EXPLAINER: string
|
||||||
|
FEEDBACK_CHANNEL: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultMacro: MacroConfig = {
|
||||||
|
VERSION: pkg.version,
|
||||||
|
BUILD_TIME: '',
|
||||||
|
PACKAGE_URL: pkg.name,
|
||||||
|
NATIVE_PACKAGE_URL: pkg.name,
|
||||||
|
VERSION_CHANGELOG: '',
|
||||||
|
ISSUES_EXPLAINER:
|
||||||
|
'file an issue at https://github.com/anthropics/claude-code/issues',
|
||||||
|
FEEDBACK_CHANNEL: 'github',
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ensureBootstrapMacro(): void {
|
||||||
|
if (!('MACRO' in globalThis)) {
|
||||||
|
;(globalThis as typeof globalThis & { MACRO: MacroConfig }).MACRO =
|
||||||
|
defaultMacro
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,32 +1,9 @@
|
|||||||
import pkg from '../package.json'
|
import pkg from '../package.json'
|
||||||
import { existsSync, readdirSync, readFileSync } from 'fs'
|
import { existsSync, readdirSync, readFileSync } from 'fs'
|
||||||
import { dirname, extname, join, resolve } from 'path'
|
import { dirname, extname, join, resolve } from 'path'
|
||||||
|
import { ensureBootstrapMacro } from './bootstrapMacro'
|
||||||
|
|
||||||
type MacroConfig = {
|
ensureBootstrapMacro()
|
||||||
VERSION: string
|
|
||||||
BUILD_TIME: string
|
|
||||||
PACKAGE_URL: string
|
|
||||||
NATIVE_PACKAGE_URL: string
|
|
||||||
VERSION_CHANGELOG: string
|
|
||||||
ISSUES_EXPLAINER: string
|
|
||||||
FEEDBACK_CHANNEL: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultMacro: MacroConfig = {
|
|
||||||
VERSION: pkg.version,
|
|
||||||
BUILD_TIME: '',
|
|
||||||
PACKAGE_URL: pkg.name,
|
|
||||||
NATIVE_PACKAGE_URL: pkg.name,
|
|
||||||
VERSION_CHANGELOG: '',
|
|
||||||
ISSUES_EXPLAINER:
|
|
||||||
'file an issue at https://github.com/anthropics/claude-code/issues',
|
|
||||||
FEEDBACK_CHANNEL: 'github',
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!('MACRO' in globalThis)) {
|
|
||||||
;(globalThis as typeof globalThis & { MACRO: MacroConfig }).MACRO =
|
|
||||||
defaultMacro
|
|
||||||
}
|
|
||||||
|
|
||||||
type MissingImport = {
|
type MissingImport = {
|
||||||
importer: string
|
importer: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user