Skip to content

Commit

Permalink
feat(canyon-uploader): update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Nov 11, 2024
1 parent 379704f commit 27ebbae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/canyon-uploader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canyon-uploader",
"version": "0.0.1-beta.3",
"version": "0.0.1-beta.5",
"files": [
"bin",
"dist"
Expand Down
8 changes: 7 additions & 1 deletion tools/canyon-uploader/src/commands/hit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from "node:path";
import * as process from "node:process";
import axios from "axios";
export async function hitCommand(params, options) {
const { dsn, project_id:projectID, commit_sha:sha } = options;
const files = fs.readdirSync(path.resolve(process.cwd(), ".canyon_output"));
let data = {};
for (let i = 0; i < files.length; i++) {
Expand All @@ -16,5 +17,10 @@ export async function hitCommand(params, options) {
};
}

await axios.post("http://localhost:3000/upload", data, {});
await axios.post(dsn, {
projectID,
sha,
instrumentCwd: process.cwd(),
coverage: JSON.stringify(data),
}, {});
}
2 changes: 2 additions & 0 deletions tools/canyon-uploader/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ program
program
.command("hit")
.option("--dsn <dsn>", "dsn of the canyon server")
.option("--project_id <project_id>", "id of the project")
.option("--commit_sha <commit_sha>", "commit sha of the project")
.allowExcessArguments(false)
.allowUnknownOption(false)
.description("modify react native project code to adapt to canyon")
Expand Down

0 comments on commit 27ebbae

Please sign in to comment.