@asterai/cli 0.2.1 → 0.2.3

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/README.md CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @asterai/cli
20
20
  $ asterai COMMAND
21
21
  running command...
22
22
  $ asterai (--version)
23
- @asterai/cli/0.2.1 linux-x64 node-v20.12.2
23
+ @asterai/cli/0.2.3 darwin-arm64 node-v20.12.2
24
24
  $ asterai --help [COMMAND]
25
25
  USAGE
26
26
  $ asterai COMMAND
@@ -53,7 +53,7 @@ EXAMPLES
53
53
  $ asterai auth
54
54
  ```
55
55
 
56
- _See code: [src/commands/auth.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.1/src/commands/auth.ts)_
56
+ _See code: [src/commands/auth.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.3/src/commands/auth.ts)_
57
57
 
58
58
  ## `asterai build [INPUT]`
59
59
 
@@ -73,7 +73,7 @@ EXAMPLES
73
73
  $ asterai build
74
74
  ```
75
75
 
76
- _See code: [src/commands/build.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.1/src/commands/build.ts)_
76
+ _See code: [src/commands/build.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.3/src/commands/build.ts)_
77
77
 
78
78
  ## `asterai codegen`
79
79
 
@@ -94,7 +94,7 @@ EXAMPLES
94
94
  $ asterai codegen
95
95
  ```
96
96
 
97
- _See code: [src/commands/codegen.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.1/src/commands/codegen.ts)_
97
+ _See code: [src/commands/codegen.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.3/src/commands/codegen.ts)_
98
98
 
99
99
  ## `asterai deploy [INPUT]`
100
100
 
@@ -117,7 +117,7 @@ EXAMPLES
117
117
  $ asterai deploy --app 66a46b12-b1a7-4b72-a64a-0e4fe21902b6
118
118
  ```
119
119
 
120
- _See code: [src/commands/deploy.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.1/src/commands/deploy.ts)_
120
+ _See code: [src/commands/deploy.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.3/src/commands/deploy.ts)_
121
121
 
122
122
  ## `asterai help [COMMAND]`
123
123
 
@@ -137,7 +137,7 @@ DESCRIPTION
137
137
  Display help for asterai.
138
138
  ```
139
139
 
140
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.22/src/commands/help.ts)_
140
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.0/src/commands/help.ts)_
141
141
 
142
142
  ## `asterai init [OUTDIR]`
143
143
 
@@ -154,5 +154,5 @@ EXAMPLES
154
154
  $ asterai init project-name
155
155
  ```
156
156
 
157
- _See code: [src/commands/init.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.1/src/commands/init.ts)_
157
+ _See code: [src/commands/init.ts](https://github.com/asterai-io/asterai-sdk/blob/v0.2.3/src/commands/init.ts)_
158
158
  <!-- commandsstop -->
@@ -2,8 +2,8 @@ import { Command, Flags } from "@oclif/core";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import { execSync } from "node:child_process";
5
- // Relative path from the CLI root directory.
6
- const AS_PROTO_GEN_PATH = "node_modules/.bin/as-proto-gen";
5
+ // Relative path from the plugin root directory.
6
+ const AS_PROTO_GEN_PATH = "./node_modules/@asterai/sdk/node_modules/.bin/as-proto-gen";
7
7
  export default class Codegen extends Command {
8
8
  static args = {};
9
9
  static description = "Generate code from the plugin manifest";
@@ -35,12 +35,20 @@ export const codegen = (flags) => {
35
35
  else {
36
36
  deleteOldGeneratedFiles(outDir);
37
37
  }
38
- const cliRootDir = getCliRootDir();
39
- const absoluteAsProtoGenPath = path.join(cliRootDir, AS_PROTO_GEN_PATH);
38
+ const absoluteAsProtoGenPath = path.join(baseDir, AS_PROTO_GEN_PATH);
39
+ try {
40
+ execSync("protoc --version");
41
+ }
42
+ catch (e) {
43
+ console.error("No protoc binary found. " +
44
+ "Is protocol buffers installed on the system? " +
45
+ "Download protocol buffers here: https://protobuf.dev/downloads");
46
+ return;
47
+ }
40
48
  try {
41
49
  execSync("protoc " +
42
- `--plugin=protoc-gen-as=${absoluteAsProtoGenPath} ` +
43
- `--as_out=./${flags.outputDir} ./${flags.manifest}`);
50
+ `--plugin='protoc-gen-as=${absoluteAsProtoGenPath}' ` +
51
+ `--as_out='./${flags.outputDir}' ./${flags.manifest}`);
44
52
  }
45
53
  catch (e) {
46
54
  console.error("Failed to generate protobuf types:", e);
@@ -57,7 +65,3 @@ const deleteOldGeneratedFiles = (outDir) => {
57
65
  fs.unlinkSync(deletePath);
58
66
  }
59
67
  };
60
- const getCliRootDir = () => {
61
- const fullCliBinPath = path.parse(process.argv[1]).dir;
62
- return path.join(fullCliBinPath, "../");
63
- };
@@ -198,5 +198,5 @@
198
198
  ]
199
199
  }
200
200
  },
201
- "version": "0.2.1"
201
+ "version": "0.2.3"
202
202
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@asterai/cli",
3
3
  "description": "CLI for building and deploying asterai plugins",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "author": "asterai <support@asterai.io>",
6
6
  "repository": "asterai-io/asterai-sdk",
7
7
  "homepage": "https://github.com/asterai-io/asterai-sdk",