@orxataguy/tyr 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/tyr.js +0 -1
- package/package.json +1 -1
- package/src/core/Kernel.ts +0 -14
package/bin/tyr.js
CHANGED
|
@@ -8,7 +8,6 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
8
8
|
const __dirname = dirname(__filename);
|
|
9
9
|
const packageRoot = resolve(__dirname, '..');
|
|
10
10
|
|
|
11
|
-
// Locate tsx's CLI entry directly from its package.json — no shell, no .cmd wrappers
|
|
12
11
|
const tsxPkg = JSON.parse(readFileSync(join(packageRoot, 'node_modules', 'tsx', 'package.json'), 'utf-8'));
|
|
13
12
|
const tsxBinField = tsxPkg.bin;
|
|
14
13
|
const tsxBinRelative = typeof tsxBinField === 'string' ? tsxBinField : (tsxBinField.tsx ?? tsxBinField['tsx']);
|
package/package.json
CHANGED
package/src/core/Kernel.ts
CHANGED
|
@@ -22,10 +22,6 @@ interface TyrConfig {
|
|
|
22
22
|
export interface TyrContext {
|
|
23
23
|
frameworkRoot: string;
|
|
24
24
|
userRoot: string;
|
|
25
|
-
logger: any;
|
|
26
|
-
shell: any;
|
|
27
|
-
fs: any;
|
|
28
|
-
docker?: any;
|
|
29
25
|
run: (commandName: string, args?: string[]) => Promise<void>;
|
|
30
26
|
task: <T>(description: string, action: () => Promise<T> | T, next?: boolean, onFail?: () => void) => Promise<T | undefined>;
|
|
31
27
|
fail: (msg: string, suggestion?: string) => never;
|
|
@@ -54,12 +50,10 @@ export class Kernel {
|
|
|
54
50
|
public async boot(args: string[]): Promise<void> {
|
|
55
51
|
const isDebug = args.includes('--debug');
|
|
56
52
|
|
|
57
|
-
// Load all env vars from ~/.tyr/.env once, before anything else
|
|
58
53
|
(dotenv as any).config({ path: path.join(this.userRoot, '.env'), quiet: true });
|
|
59
54
|
|
|
60
55
|
await this.container.init(isDebug);
|
|
61
56
|
|
|
62
|
-
// All commands live in ~/.tyr/map.yml — the framework ships no runtime commands
|
|
63
57
|
this.config = { commands: {}, aliases: {} };
|
|
64
58
|
|
|
65
59
|
const userConfigPath = path.join(this.userRoot, 'map.yml');
|
|
@@ -67,7 +61,6 @@ export class Kernel {
|
|
|
67
61
|
try {
|
|
68
62
|
const raw = yaml.load(fs.readFileSync(userConfigPath, 'utf8')) as TyrConfig;
|
|
69
63
|
for (const [name, cmdPath] of Object.entries(raw.commands ?? {})) {
|
|
70
|
-
// Absolute paths used as-is; relative paths resolved from userRoot
|
|
71
64
|
this.config.commands[name] = path.isAbsolute(cmdPath)
|
|
72
65
|
? cmdPath
|
|
73
66
|
: path.resolve(this.userRoot, cmdPath);
|
|
@@ -91,7 +84,6 @@ export class Kernel {
|
|
|
91
84
|
return;
|
|
92
85
|
}
|
|
93
86
|
|
|
94
|
-
// --version / -v
|
|
95
87
|
if (commandName === '--version' || commandName === '-v') {
|
|
96
88
|
const pkgPath = path.resolve(this.frameworkRoot, 'package.json');
|
|
97
89
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
@@ -99,7 +91,6 @@ export class Kernel {
|
|
|
99
91
|
return;
|
|
100
92
|
}
|
|
101
93
|
|
|
102
|
-
// --update: pull latest changes from the linked ~/.tyr git repo
|
|
103
94
|
if (commandName === '--update') {
|
|
104
95
|
const shell = this.container.get().shell;
|
|
105
96
|
const gitDir = path.join(this.userRoot, '.git');
|
|
@@ -115,7 +106,6 @@ export class Kernel {
|
|
|
115
106
|
return;
|
|
116
107
|
}
|
|
117
108
|
|
|
118
|
-
// --upgrade: update the Tyr npm package itself
|
|
119
109
|
if (commandName === '--upgrade') {
|
|
120
110
|
const pkgPath = path.resolve(this.frameworkRoot, 'package.json');
|
|
121
111
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
@@ -126,7 +116,6 @@ export class Kernel {
|
|
|
126
116
|
return;
|
|
127
117
|
}
|
|
128
118
|
|
|
129
|
-
// --help / -h: lists all available commands with their documentation
|
|
130
119
|
if (commandName === '--help' || commandName === '-h') {
|
|
131
120
|
const helpContext = {
|
|
132
121
|
...this.container.get(),
|
|
@@ -168,7 +157,6 @@ export class Kernel {
|
|
|
168
157
|
fail: (msg: string, suggestion?: string) => { throw new TyrError(msg, null, suggestion, commandName); }
|
|
169
158
|
};
|
|
170
159
|
|
|
171
|
-
// --config (needs context for fs/logger)
|
|
172
160
|
if (commandName === '--config') {
|
|
173
161
|
await config(context)(args.slice(1));
|
|
174
162
|
return;
|
|
@@ -202,12 +190,10 @@ export class Kernel {
|
|
|
202
190
|
}
|
|
203
191
|
|
|
204
192
|
try {
|
|
205
|
-
// Absolute paths (user commands) are used directly; relative paths resolve from frameworkRoot
|
|
206
193
|
const absolutePath = path.isAbsolute(scriptPath)
|
|
207
194
|
? scriptPath
|
|
208
195
|
: path.resolve(this.frameworkRoot, scriptPath);
|
|
209
196
|
|
|
210
|
-
// Convert to file:// URL — required by ESM on Windows for absolute paths
|
|
211
197
|
const moduleUrl = pathToFileURL(absolutePath).href;
|
|
212
198
|
const module = await import(moduleUrl);
|
|
213
199
|
|