@highlight-run/sourcemap-uploader
Advanced tools
Comparing version 0.0.6 to 0.0.9
44
index.js
@@ -9,5 +9,3 @@ #!/usr/bin/env node | ||
const AWS = require("aws-sdk"); | ||
const { v4: uuidv4 } = require("uuid"); | ||
const SERVER_URL = "http://localhost:5000"; | ||
const BUCKET_NAME = "source-maps-test"; | ||
@@ -29,3 +27,3 @@ | ||
() => {}, | ||
async ({ organizationId, apiKey, path }) => { | ||
async ({ organizationId, apiKey, version, path }) => { | ||
console.info(`Starting to upload source maps from ${path}`); | ||
@@ -45,3 +43,3 @@ | ||
fileList.map(({ path, name }) => | ||
uploadFile(organizationId, apiKey, path, name) | ||
uploadFile(organizationId, apiKey, version, path, name) | ||
) | ||
@@ -57,6 +55,11 @@ ); | ||
}) | ||
.option("version", { | ||
alias: "v", | ||
type: "string", | ||
describe: "The current version of your deploy", | ||
}) | ||
.option("path", { | ||
alias: "p", | ||
type: "string", | ||
default: "/build/static/js", | ||
default: "/build", | ||
describe: "Sets the directory of where the sourcemaps are", | ||
@@ -100,10 +103,12 @@ }) | ||
async function uploadFile(organizationId, apiKey, filePath, fileName) { | ||
const query = `query UploadSourceMap($apiKey: String!, $file: Upload!) { | ||
uploadSourceMap(apiKey: $apiKey, file: $file) | ||
}`; | ||
async function uploadFile(organizationId, apiKey, version, filePath, fileName) { | ||
const fileContent = readFileSync(filePath); | ||
// Setting up S3 upload parameters | ||
const bucketPath = `${organizationId}/${fileName}`; | ||
var bucketPath; | ||
if (version === null || version === undefined || version === "") { | ||
bucketPath = `${organizationId}/${fileName}`; | ||
} else { | ||
bucketPath = `${organizationId}/${version}/${fileName}`; | ||
} | ||
const params = { | ||
@@ -121,21 +126,2 @@ Bucket: BUCKET_NAME, | ||
}); | ||
// fetch("/graphql", { | ||
// method: "POST", | ||
// headers: { | ||
// "Content-Type": "application/json", | ||
// Accept: "application/json", | ||
// }, | ||
// body: JSON.stringify({ | ||
// query, | ||
// variables: { | ||
// apiKey, | ||
// file, | ||
// }, | ||
// }), | ||
// }); | ||
} | ||
function getS3Path() { | ||
return ``; | ||
} |
{ | ||
"name": "@highlight-run/sourcemap-uploader", | ||
"version": "0.0.6", | ||
"version": "0.0.9", | ||
"description": "Command line tool to upload source maps to Highlight", | ||
@@ -19,5 +19,4 @@ "main": "index.js", | ||
"glob": "^7.1.7", | ||
"uuid": "^8.3.2", | ||
"yargs": "^17.0.1" | ||
} | ||
} |
3
3944
105
- Removeduuid@^8.3.2
- Removeduuid@8.3.2(transitive)