@shapeshift-labs/frontier-lang-cli 0.1.0 → 0.1.2
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/dist/index.js +12 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import { parseFrontierFile, parseFrontierSource } from '@shapeshift-labs/frontier-lang-parser';
|
|
4
5
|
import { checkDocument } from '@shapeshift-labs/frontier-lang-checker';
|
|
5
6
|
import { emitTypeScript } from '@shapeshift-labs/frontier-lang-typescript';
|
|
@@ -25,6 +26,15 @@ export async function runCli(argv = process.argv.slice(2), io = console) {
|
|
|
25
26
|
function output(io, value) { io.log(JSON.stringify(value, null, 2)); }
|
|
26
27
|
function help(io) { io.log('frontier-lang <parse|check|hash|emit-ts> <file.frontier> [--out file] [--strict-effects]'); }
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
function isDirectInvocation() {
|
|
30
|
+
if (!process.argv[1]) return false;
|
|
31
|
+
try {
|
|
32
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
33
|
+
} catch {
|
|
34
|
+
return fileURLToPath(import.meta.url) === process.argv[1];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isDirectInvocation()) {
|
|
29
39
|
runCli().catch((error) => { console.error(error.message); process.exitCode = 1; });
|
|
30
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshift-labs/frontier-lang-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Command line interface for parsing, checking, hashing, and emitting Frontier Lang projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@shapeshift-labs/frontier-lang-kernel": "^0.1.
|
|
48
|
+
"@shapeshift-labs/frontier-lang-kernel": "^0.1.1",
|
|
49
49
|
"@shapeshift-labs/frontier-lang-parser": "^0.1.0",
|
|
50
50
|
"@shapeshift-labs/frontier-lang-checker": "^0.1.0",
|
|
51
51
|
"@shapeshift-labs/frontier-lang-typescript": "^0.1.0"
|
|
52
52
|
},
|
|
53
53
|
"bin": {
|
|
54
|
-
"frontier-lang": "
|
|
54
|
+
"frontier-lang": "dist/index.js"
|
|
55
55
|
}
|
|
56
56
|
}
|