tycono 0.1.0 → 0.1.1
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/cli.js +11 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
8
|
+
const pkgRoot = join(__dirname, '..');
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// Register tsx loader from package's own node_modules
|
|
11
|
+
const tsxApiPath = pathToFileURL(join(pkgRoot, 'node_modules', 'tsx', 'dist', 'esm', 'api', 'index.mjs')).href;
|
|
12
|
+
const tsx = await import(tsxApiPath);
|
|
13
|
+
tsx.register();
|
|
14
|
+
|
|
15
|
+
// Now we can import .ts files
|
|
16
|
+
const entryPath = pathToFileURL(join(__dirname, 'tycono.ts')).href;
|
|
17
|
+
const { main } = await import(entryPath);
|
|
10
18
|
await main(process.argv.slice(2));
|