@apm-insight-web/upload-sourcemaps
Advanced tools
Comparing version 0.0.7 to 0.0.8-alpha.1.0
@@ -8,2 +8,3 @@ import { Command } from 'clipanion'; | ||
export declare class UploadSourcemapsCommand extends Command { | ||
static paths: never[][]; | ||
static upload({ paths, app_id, host }: UploadOptions): Promise<void>; | ||
@@ -25,3 +26,3 @@ static getPath(p: string): string; | ||
app_id: string; | ||
paths: string[]; | ||
_paths: string[]; | ||
execute(): Promise<void>; | ||
@@ -28,0 +29,0 @@ uploadDirs(): Promise<void>; |
@@ -6,12 +6,12 @@ "use strict"; | ||
// https://code.byted.org/appmonitor/rangers_monitor_api_idl/blob/master/webview/mapping/mapping.thrift | ||
const fs_1 = tslib_1.__importDefault(require("fs")); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const fs_1 = (0, tslib_1.__importDefault)(require("fs")); | ||
const path_1 = (0, tslib_1.__importDefault)(require("path")); | ||
const util_1 = require("util"); | ||
const chalk_1 = tslib_1.__importDefault(require("chalk")); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const clipanion_1 = require("clipanion"); | ||
const form_data_1 = tslib_1.__importDefault(require("form-data")); | ||
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch")); | ||
const form_data_1 = (0, tslib_1.__importDefault)(require("form-data")); | ||
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch")); | ||
const URI = '/perfguard/api/guest/web/mapping/upload'; | ||
const HOST = 'datarangers.com.cn'; | ||
const readdirAsync = util_1.promisify(fs_1.default.readdir); | ||
const readdirAsync = (0, util_1.promisify)(fs_1.default.readdir); | ||
const consoleReporter = { | ||
@@ -29,4 +29,11 @@ warning(msg) { | ||
class UploadSourcemapsCommand extends clipanion_1.Command { | ||
constructor() { | ||
super(...arguments); | ||
this.host = clipanion_1.Option.String(`--host`); | ||
this.release = clipanion_1.Option.String(`--release`); | ||
this.app_id = clipanion_1.Option.String(`--app_id`); | ||
this._paths = clipanion_1.Option.Array(`--paths`); | ||
} | ||
static upload({ paths, app_id, host = HOST }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
for (const dir of paths) { | ||
@@ -46,3 +53,3 @@ yield this.uploadDir({ dir: this.getPath(dir), app_id, host }); | ||
static uploadDir({ dir, app_id, host }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const files = yield readdirAsync(dir); | ||
@@ -58,3 +65,3 @@ for (const fileName of files) { | ||
static uploadFile({ filePath, mapURL, app_id, host, }) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const URL = `https://${host}${URI}`; | ||
@@ -65,3 +72,3 @@ const form = new form_data_1.default(); | ||
try { | ||
const res = yield node_fetch_1.default(URL, { | ||
const res = yield (0, node_fetch_1.default)(URL, { | ||
method: 'POST', | ||
@@ -91,5 +98,5 @@ headers: { | ||
var _a; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
return UploadSourcemapsCommand.upload({ | ||
paths: this.paths, | ||
paths: this._paths, | ||
app_id: this.app_id, | ||
@@ -101,25 +108,4 @@ host: (_a = this.host) !== null && _a !== void 0 ? _a : HOST, | ||
} | ||
tslib_1.__decorate([ | ||
clipanion_1.Command.String(`--host`), | ||
tslib_1.__metadata("design:type", String) | ||
], UploadSourcemapsCommand.prototype, "host", void 0); | ||
tslib_1.__decorate([ | ||
clipanion_1.Command.String(`--release`), | ||
tslib_1.__metadata("design:type", String) | ||
], UploadSourcemapsCommand.prototype, "release", void 0); | ||
tslib_1.__decorate([ | ||
clipanion_1.Command.String(`--app_id`), | ||
tslib_1.__metadata("design:type", String) | ||
], UploadSourcemapsCommand.prototype, "app_id", void 0); | ||
tslib_1.__decorate([ | ||
clipanion_1.Command.Array(`--paths`), | ||
tslib_1.__metadata("design:type", Array) | ||
], UploadSourcemapsCommand.prototype, "paths", void 0); | ||
tslib_1.__decorate([ | ||
clipanion_1.Command.Path(), | ||
tslib_1.__metadata("design:type", Function), | ||
tslib_1.__metadata("design:paramtypes", []), | ||
tslib_1.__metadata("design:returntype", void 0) | ||
], UploadSourcemapsCommand.prototype, "execute", null); | ||
exports.UploadSourcemapsCommand = UploadSourcemapsCommand; | ||
UploadSourcemapsCommand.paths = [clipanion_1.Command.Default]; | ||
//# sourceMappingURL=upload-sourcemaps.js.map |
{ | ||
"name": "@apm-insight-web/upload-sourcemaps", | ||
"version": "0.0.7", | ||
"version": "0.0.8-alpha.1.0", | ||
"main": "dist/index.js", | ||
@@ -14,4 +14,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"chalk": "^4.1.1", | ||
"clipanion": "^2.6.2", | ||
"chalk": "^4.1.2", | ||
"clipanion": "^3.0.1", | ||
"form-data": "^4.0.0", | ||
@@ -25,3 +25,3 @@ "node-fetch": "^2.6.1" | ||
}, | ||
"gitHead": "e4cea836e62dc8015b6c4c1a2915d5a504543e23" | ||
"gitHead": "e647d6ceb345ae3aed9ef60d6037ec3521365e16" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11025
166
1
+ Addedclipanion@3.2.1(transitive)
+ Addedtypanion@3.14.0(transitive)
- Removedclipanion@2.6.2(transitive)
Updatedchalk@^4.1.2
Updatedclipanion@^3.0.1