Compare commits
2 Commits
38c1c68924
...
fix/config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
116b91d2ae | ||
| 543388e18b |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mosaic/gateway",
|
"name": "@mosaic/gateway",
|
||||||
"version": "0.1.0",
|
"version": "0.0.5",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mosaic/config",
|
"name": "@mosaic/config",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mosaic/mosaic",
|
"name": "@mosaic/mosaic",
|
||||||
"version": "0.0.17",
|
"version": "0.0.19",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",
|
||||||
@@ -18,7 +18,9 @@
|
|||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./dist/index.js"
|
||||||
}
|
},
|
||||||
|
"./package.json": "./package.json",
|
||||||
|
"./framework/*": "./framework/*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
import { execFileSync, execSync, spawnSync } from 'node:child_process';
|
import { execFileSync, execSync, spawnSync } from 'node:child_process';
|
||||||
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, rmSync } from 'node:fs';
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, rmSync } from 'node:fs';
|
||||||
import { createRequire } from 'node:module';
|
|
||||||
import { homedir } from 'node:os';
|
import { homedir } from 'node:os';
|
||||||
import { join, dirname } from 'node:path';
|
import { join, dirname } from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { Command } from 'commander';
|
import type { Command } from 'commander';
|
||||||
|
|
||||||
const MOSAIC_HOME = process.env['MOSAIC_HOME'] ?? join(homedir(), '.config', 'mosaic');
|
const MOSAIC_HOME = process.env['MOSAIC_HOME'] ?? join(homedir(), '.config', 'mosaic');
|
||||||
@@ -498,14 +498,10 @@ function delegateToScript(scriptPath: string, args: string[], env?: Record<strin
|
|||||||
* CLI version) over the deployed copy in ~/.config/mosaic/ (may be stale).
|
* CLI version) over the deployed copy in ~/.config/mosaic/ (may be stale).
|
||||||
*/
|
*/
|
||||||
function resolveTool(...segments: string[]): string {
|
function resolveTool(...segments: string[]): string {
|
||||||
try {
|
// Resolve relative to the built file: dist/commands/launch.js → ../../framework/tools/...
|
||||||
const req = createRequire(import.meta.url);
|
const thisFile = fileURLToPath(import.meta.url);
|
||||||
const mosaicPkg = dirname(req.resolve('@mosaic/mosaic/package.json'));
|
const bundled = join(dirname(thisFile), '..', '..', 'framework', 'tools', ...segments);
|
||||||
const bundled = join(mosaicPkg, 'framework', 'tools', ...segments);
|
|
||||||
if (existsSync(bundled)) return bundled;
|
if (existsSync(bundled)) return bundled;
|
||||||
} catch {
|
|
||||||
// Fall through to deployed copy
|
|
||||||
}
|
|
||||||
return join(MOSAIC_HOME, 'tools', ...segments);
|
return join(MOSAIC_HOME, 'tools', ...segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user