@falconer-ai/cli 0.1.0

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.
Files changed (2) hide show
  1. package/bin/falconer +65 -0
  2. package/package.json +20 -0
package/bin/falconer ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require('child_process')
4
+ const os = require('os')
5
+ const path = require('path')
6
+
7
+ const PLATFORMS = {
8
+ 'darwin arm64': {
9
+ package: '@falconer-ai/cli-darwin-arm64',
10
+ binary: 'falconer',
11
+ },
12
+ 'darwin x64': {
13
+ package: '@falconer-ai/cli-darwin-x64',
14
+ binary: 'falconer',
15
+ },
16
+ 'linux x64': {
17
+ package: '@falconer-ai/cli-linux-x64',
18
+ binary: 'falconer',
19
+ },
20
+ 'linux arm64': {
21
+ package: '@falconer-ai/cli-linux-arm64',
22
+ binary: 'falconer',
23
+ },
24
+ 'win32 x64': {
25
+ package: '@falconer-ai/cli-windows-x64',
26
+ binary: 'falconer.exe',
27
+ },
28
+ }
29
+
30
+ function getBinaryPath() {
31
+ const platformKey = `${process.platform} ${os.arch()}`
32
+ const platform = PLATFORMS[platformKey]
33
+
34
+ if (!platform) {
35
+ throw new Error(
36
+ `Unsupported platform: ${platformKey}\n` +
37
+ `Falconer CLI supports: ${Object.keys(PLATFORMS).join(', ')}`
38
+ )
39
+ }
40
+
41
+ try {
42
+ const binaryPath = require.resolve(
43
+ `${platform.package}/${platform.binary}`
44
+ )
45
+ return binaryPath
46
+ } catch (e) {
47
+ throw new Error(
48
+ `The package "${platform.package}" could not be found.\n\n` +
49
+ `If you installed with npm, make sure you didn't use "--no-optional" or "--omit=optional".\n` +
50
+ `The "optionalDependencies" feature is used to install the correct binary for your platform.`
51
+ )
52
+ }
53
+ }
54
+
55
+ const binaryPath = getBinaryPath()
56
+ const args = process.argv.slice(2)
57
+
58
+ try {
59
+ execFileSync(binaryPath, args, { stdio: 'inherit' })
60
+ } catch (e) {
61
+ if (e.status !== undefined) {
62
+ process.exit(e.status)
63
+ }
64
+ throw e
65
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@falconer-ai/cli",
3
+ "version": "0.1.0",
4
+ "description": "Falconer CLI - interact with your Falconer documents from the command line",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/FalconerAI/falconer.git"
8
+ },
9
+ "license": "MIT",
10
+ "bin": {
11
+ "falconer": "bin/falconer"
12
+ },
13
+ "optionalDependencies": {
14
+ "@falconer-ai/cli-darwin-arm64": "0.1.0",
15
+ "@falconer-ai/cli-darwin-x64": "0.1.0",
16
+ "@falconer-ai/cli-linux-x64": "0.1.0",
17
+ "@falconer-ai/cli-linux-arm64": "0.1.0",
18
+ "@falconer-ai/cli-windows-x64": "0.1.0"
19
+ }
20
+ }