Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webext-buildtools-chrome-webstore-builder

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webext-buildtools-chrome-webstore-builder - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

dist/errors/index.d.ts

9

declarations/options.d.ts

@@ -35,2 +35,9 @@ import { PublishStatus, PublishTarget } from 'typed-chrome-webstore-api';

waitForSuccess?: IWaitForWebstoreOptions;
/**
* If true or not specified: if the same version is already uploaded throw an UploadVersionValidationError
* If false, do not repeat upload, just put information about uploaded version to the output asset and continue
* @default true
*/
throwIfVersionAlreadyUploaded?: boolean;
}

@@ -104,2 +111,4 @@

/**

@@ -106,0 +115,0 @@ * For uploadExt output, optional

15

dist/builder.js

@@ -86,5 +86,16 @@ "use strict";

if (this._inputManifest && this._inputManifest.version) {
await validateVersion_1.validateVersion(this._inputManifest.version, apiFacade, this._logWrapper);
const throwIfVersionAlreadyUploaded = !(this._options.upload &&
this._options.upload.throwIfVersionAlreadyUploaded === false);
const currentlyUploaded = await validateVersion_1.validateVersion(this._inputManifest.version, throwIfVersionAlreadyUploaded, apiFacade, this._logWrapper);
if (!throwIfVersionAlreadyUploaded && currentlyUploaded) {
result.getAssets().uploadedExt = new buildResult_1.ChromeWebstoreUploadedExtAsset({
extId: currentlyUploaded.id,
extVersion: currentlyUploaded.crxVersion,
apiResource: currentlyUploaded
});
}
}
result.getAssets().uploadedExt = await upload_1.upload(this._inputZipBuffer, this._options.upload || {}, apiFacade, this._inputManifest);
if (!result.getAssets().uploadedExt) {
result.getAssets().uploadedExt = await upload_1.upload(this._inputZipBuffer, this._options.upload || {}, apiFacade, this._inputManifest);
}
}

@@ -91,0 +102,0 @@ if (this._publishedExtRequired) {

10

dist/builder/upload.js

@@ -6,2 +6,3 @@ "use strict";

const buildResult_1 = require("../buildResult");
const errors_1 = require("../errors");
async function upload(inputZipBuffer, options, apiFacade, inputManifest) {

@@ -26,10 +27,13 @@ let uploadResult;

}
const uploadErrorMsg = Array.isArray(uploadResult.itemError)
const uploadErrorMsg = "Can't upload extension. " + (Array.isArray(uploadResult.itemError)
? uploadResult.itemError
.map(err => err.error_detail)
.join('. ')
: `Upload has ${uploadResult.uploadState} state`;
throw new Error(`Can't upload extension. ${uploadErrorMsg}`);
: `Upload has ${uploadResult.uploadState} state`);
if (uploadResult.isFailedBecauseOfPendingReview()) {
throw new errors_1.UploadInReviewError(uploadErrorMsg);
}
throw new Error(uploadErrorMsg);
}
exports.upload = upload;
//# sourceMappingURL=upload.js.map
import { LoggerWrapper } from 'webext-buildtools-utils';
import { ChromeWebstoreApiFacade } from '../chromeWebstoreApiFacade';
export declare function validateVersion(manifestVersion: string, apiFacade: ChromeWebstoreApiFacade, logWrapper: LoggerWrapper): Promise<void>;
import * as webstoreApi from 'typed-chrome-webstore-api';
/**
* @param manifestVersion
* @param throwIfAlreadyUploaded throw if current uploaded version equal to manifestVersion
* @param apiFacade
* @param logWrapper
* @return currently uploaded resource info
*/
export declare function validateVersion(manifestVersion: string, throwIfAlreadyUploaded: boolean, apiFacade: ChromeWebstoreApiFacade, logWrapper: LoggerWrapper): Promise<webstoreApi.WebstoreResource | null>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const semver = require("semver");
async function validateVersion(manifestVersion, apiFacade, logWrapper) {
if (semver.valid(manifestVersion)) {
const versions = require("compare-versions");
const errors_1 = require("../errors");
/**
* @param manifestVersion
* @param throwIfAlreadyUploaded throw if current uploaded version equal to manifestVersion
* @param apiFacade
* @param logWrapper
* @return currently uploaded resource info
*/
async function validateVersion(manifestVersion, throwIfAlreadyUploaded, apiFacade, logWrapper) {
if (versions.validate(manifestVersion)) {
logWrapper.info(`New extension version is '${manifestVersion}' (from manifest input)`);
}
else {
logWrapper.warn(`New extension semver version is invalid: '${manifestVersion}'`);
return;
throw new errors_1.InvalidManifestVersionError(manifestVersion);
}
const currentVersion = await apiFacade.getCurrentVersion();
if (currentVersion) {
if (semver.valid(currentVersion) && semver) {
logWrapper.info(`Version of currently published extension is '${currentVersion}'`);
const currentResource = await apiFacade.getCurrentlyUploadedResource();
const currentVersion = currentResource.crxVersion;
if (!currentVersion) {
return null;
}
if (versions.validate(currentVersion)) {
logWrapper.info(`Version of currently published extension is '${currentVersion}'`);
}
else {
logWrapper.warn(`Invalid semver version of published crx: '${currentVersion}'`);
return null;
}
if (versions.compare(manifestVersion, currentVersion, '=')) {
if (throwIfAlreadyUploaded) {
throw new errors_1.SameVersionAlreadyUploadedError(currentVersion);
}
else {
logWrapper.warn(`Invalid semver version of published crx: '${currentVersion}'`);
}
if (semver.lte(manifestVersion, currentVersion)) {
throw new Error(`New ${manifestVersion} version have to be ` +
`greater than the current ${currentVersion}`);
}
return currentResource;
}
if (versions.compare(manifestVersion, currentVersion, '<=')) {
throw new errors_1.NewerVersionAlreadyUploadedError(manifestVersion, currentVersion);
}
return null;
}
exports.validateVersion = validateVersion;
//# sourceMappingURL=validateVersion.js.map

@@ -14,5 +14,5 @@ /// <reference types="node" />

setLogMethod(logMethod?: ILogMethod): void;
getCurrentVersion(): Promise<string | undefined>;
uploadExisting(readStream: Buffer | Readable, waitForSuccess?: IWaitForWebstoreOptions): Promise<webstoreApi.IWebstoreResource>;
getCurrentlyUploadedResource(): Promise<webstoreApi.WebstoreResource>;
uploadExisting(readStream: Buffer | Readable, waitForSuccess?: IWaitForWebstoreOptions): Promise<webstoreApi.WebstoreResource>;
publish(target: webstoreApi.PublishTarget | string): Promise<webstoreApi.IPublishResponse>;
}

@@ -23,7 +23,7 @@ "use strict";

}
async getCurrentVersion() {
async getCurrentlyUploadedResource() {
this._logWrapper.info('Loading information about current ext version...');
const current = await this._api.getUpload(this._extensionId);
this._logWrapper.info('Finished: %o', current);
return current.crxVersion;
return current;
}

@@ -30,0 +30,0 @@ async uploadExisting(readStream, waitForSuccess) {

@@ -8,1 +8,2 @@ import { ChromeWebstoreBuilder } from './builder';

export * from './buildResult';
export * from './errors';

@@ -9,2 +9,3 @@ "use strict";

__export(require("./buildResult"));
__export(require("./errors"));
//# sourceMappingURL=index.js.map
{
"name": "webext-buildtools-chrome-webstore-builder",
"version": "1.0.8",
"version": "1.1.0",
"description": "webext-buildtools builder for deploying to Chrome Webstore. Based on chrome-webstore-upload",

@@ -32,4 +32,4 @@ "main": "dist",

"fs-extra": "^7.0.1",
"semver": "^5.6.0",
"typed-chrome-webstore-api": "^0.3.6",
"compare-versions": "^3.6.0",
"typed-chrome-webstore-api": "^0.4.9",
"webext-buildtools-utils": "^1.0.5"

@@ -41,3 +41,3 @@ },

"@types/fs-extra": "^5.0.5",
"@types/semver": "^5.5.0",
"@types/compare-versions": "^3.3.0",
"@types/axios": "^0.14.0",

@@ -44,0 +44,0 @@ "tslint": "^6.1.2",

@@ -88,2 +88,12 @@ [![Build Status](https://travis-ci.com/cardinalby/webext-buildtools-chrome-webstore-builder.svg?branch=master)](https://travis-ci.com/cardinalby/webext-buildtools-chrome-webstore-builder)

`const crxFilePath = buildResult.getAssets().publishedCrxFile.getValue()`<br>
`const crxBuffer = buildResult.getAssets().publishedCrxBuffer.getValue()`
`const crxBuffer = buildResult.getAssets().publishedCrxBuffer.getValue()`
### Errors
`builder.build()` call can be rejected with general `Error` or the following specific errors if
extension upload was required:
* `InvalidManifestVersionError` if manifest file has invalid extension version.
* `NewerVersionAlreadyUploadedError` if currently uploaded version is greater than the version in
the extension manifest.
* `SameVersionAlreadyUploadedError` if currently uploaded version equals to the version in
the extension manifest.
* `UploadInReviewError` if upload failed due to item currently in the review state.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc