@highlight-run/sourcemap-uploader
Advanced tools
Comparing version 0.0.2 to 0.0.4
32
index.js
@@ -9,2 +9,3 @@ #!/usr/bin/env node | ||
const AWS = require("aws-sdk"); | ||
const { v4: uuidv4 } = require("uuid"); | ||
@@ -25,3 +26,3 @@ const SERVER_URL = "http://localhost:5000"; | ||
() => {}, | ||
async ({ apiKey, path }) => { | ||
async ({ organizationId, apiKey, path, version }) => { | ||
console.info(`Starting to upload source maps from ${path}`); | ||
@@ -39,7 +40,22 @@ | ||
if (!version) { | ||
version = uuidv4(); | ||
console.info( | ||
`The version was not provided, Highlight will generate a hash for you: ${version}` | ||
); | ||
} | ||
await Promise.all( | ||
fileList.map(({ path, name }) => uploadFile(apiKey, path, name)) | ||
fileList.map(({ path, name }) => | ||
uploadFile(organizationId, apiKey, path, name, version) | ||
) | ||
); | ||
} | ||
) | ||
.option("organizationId", { | ||
alias: "id", | ||
type: "string", | ||
describe: "The Highlight organization ID", | ||
default: "113", | ||
}) | ||
.option("apiKey", { | ||
@@ -59,2 +75,9 @@ alias: "k", | ||
}) | ||
.option("version", { | ||
alias: "v", | ||
type: "string", | ||
default: "", | ||
describe: | ||
"The version of this build. This is typically a semantic version or Git hash.", | ||
}) | ||
.help("help").argv; | ||
@@ -96,3 +119,3 @@ | ||
async function uploadFile(apiKey, filePath, fileName) { | ||
async function uploadFile(organizationId, apiKey, filePath, fileName, version) { | ||
const query = `query UploadSourceMap($apiKey: String!, $file: Upload!) { | ||
@@ -104,5 +127,6 @@ uploadSourceMap(apiKey: $apiKey, file: $file) | ||
// Setting up S3 upload parameters | ||
const bucketPath = `${organizationId}/${version}/${fileName}`; | ||
const params = { | ||
Bucket: BUCKET_NAME, | ||
Key: `${fileName}`, | ||
Key: bucketPath, | ||
Body: fileContent, | ||
@@ -109,0 +133,0 @@ }; |
{ | ||
"name": "@highlight-run/sourcemap-uploader", | ||
"version": "0.0.2", | ||
"version": "0.0.4", | ||
"description": "Command line tool to upload source maps to Highlight", | ||
@@ -19,4 +19,5 @@ "main": "index.js", | ||
"glob": "^7.1.7", | ||
"uuid": "^8.3.2", | ||
"yargs": "^17.0.1" | ||
} | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
4836
4
136
0
22
4
+ Addeduuid@^8.3.2
+ Addeduuid@8.3.2(transitive)