fix(cli): run binary through npm symlinks
This commit is contained in:
parent
4d985ead9f
commit
42b286e4f7
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@open-matrix/cli",
|
"name": "@open-matrix/cli",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Matrix package-author CLI.",
|
"description": "Matrix package-author CLI.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import { Command } from 'commander';
|
import { Command } from 'commander';
|
||||||
|
import { realpathSync } from 'node:fs';
|
||||||
import { pathToFileURL } from 'node:url';
|
import { pathToFileURL } from 'node:url';
|
||||||
import { initCommand } from './commands/init.js';
|
import { initCommand } from './commands/init.js';
|
||||||
import { actorCommand } from './commands/actor.js';
|
import { actorCommand } from './commands/actor.js';
|
||||||
@ -47,7 +48,7 @@ export function createProgram(): Command {
|
|||||||
program
|
program
|
||||||
.name('matrix')
|
.name('matrix')
|
||||||
.description('Matrix SDK CLI for package authors')
|
.description('Matrix SDK CLI for package authors')
|
||||||
.version('0.1.3');
|
.version('0.1.4');
|
||||||
|
|
||||||
const broker = program
|
const broker = program
|
||||||
.command('broker')
|
.command('broker')
|
||||||
@ -854,7 +855,7 @@ async function main(): Promise<void> {
|
|||||||
|
|
||||||
const invokedPath = process.argv[1];
|
const invokedPath = process.argv[1];
|
||||||
const isDirectExecution = Boolean(invokedPath)
|
const isDirectExecution = Boolean(invokedPath)
|
||||||
&& pathToFileURL(invokedPath).href === import.meta.url;
|
&& pathToFileURL(realpathSync(invokedPath)).href === import.meta.url;
|
||||||
|
|
||||||
if (isDirectExecution) {
|
if (isDirectExecution) {
|
||||||
main().catch((err) => {
|
main().catch((err) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user