@sonarly/sourcemap-uploader
v3.0.13
Published
NPM module to upload your JS sourcemaps files to Sonarly
Readme
sourcemap-uploader
An NPM module to upload your JS sourcemap files to your Sonarly instance.
Installation
npm i -D @Sonarly/sourcemap-uploaderCLI
Upload a sourcemap for one file:
sourcemap-uploader -s https://sonarly.mycompany.com/api -k API_KEY -p PROJECT_KEY file -m ./dist/index.js.map -u https://myapp.com/index.jsFor local development:
sourcemap-uploader -s http://localhost:8081/api -k API_KEY -p PROJECT_KEY file -m ./dist/index.js.map -u http://localhost:8081/assets/index.jsUpload all sourcemaps in a given directory.
The URL must correspond to the root where you upload JS files from the directory. In other words, if you have your app-42.js along with the app-42.js.map in the ./build folder and then want to upload it to your Sonarly instance so it can be reachable through the link https://myapp.com/static/app-42.js, then the command should be like:
sourcemap-uploader -s https://sonarly.mycompany.com/api -k API_KEY -p PROJECT_KEY dir -m ./build -u https://myapp.com/staticUse
-s(--server) to specify the URL of your Sonarly instance (must include /api path). Do not use this parameter if you use SaaS version of Sonarly (defaults to https://api.sonarly.dev)Use
-l(--logs) to enable verbose logging and see detailed request/response information.
NPM
There are two functions you can export from the package:
uploadFile(api_key, project_key, sourcemap_file_path, js_file_url, [server])
uploadDir(api_key, project_key, sourcemap_dir_path, js_dir_url, [server])Both functions return Promise with a result value to be the list of files for which sourcemaps were uploaded.
Dev
npm install
bash run-dev.sh