Skip to content

Commit

Permalink
fix: consider PUBLISHED_WITH_FRICTION_WARNING as a warning, instead o…
Browse files Browse the repository at this point in the history
…f an error (#47)

the code 'PUBLISHED_WITH_FRICTION_WARNING' is normally used when Google needs more time to review your extension (normally when you ask for broad user permissions), so it is published, but it still needs their approval before it is available to the public.
  • Loading branch information
exKAZUu authored and GabeDuarteM committed Nov 23, 2019
1 parent d1f058d commit d1b1507
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/@types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface Context {

export interface Logger {
log: (...args: any[]) => void
warn: (...args: any[]) => void
error: (...args: any[]) => void
}

Expand Down
22 changes: 17 additions & 5 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import AggregateError from 'aggregate-error'
import cwu from 'chrome-webstore-upload'
import { createReadStream } from 'fs-extra'

import Context from './@types/context'
import PluginConfig from './@types/pluginConfig'

const publish = async ({ extensionId, target, asset }: PluginConfig) => {
const errorWhitelist = ['PUBLISHED_WITH_FRICTION_WARNING']

const publish = async (
{ extensionId, target, asset }: PluginConfig,
{ logger }: Context,
) => {
const {
GOOGLE_CLIENT_ID: clientId,
GOOGLE_CLIENT_SECRET: clientSecret,
Expand Down Expand Up @@ -55,12 +61,18 @@ const publish = async ({ extensionId, target, asset }: PluginConfig) => {
if (!publishRes.status.includes('OK')) {
const errors: SemanticReleaseError[] = []
for (let i = 0; i < publishRes.status.length; i += 1) {
const message = publishRes.statusDetail[i]
const code = publishRes.status[i]
const err = new SemanticReleaseError(message, code)
errors.push(err)
const message = publishRes.statusDetail[i]
if (errorWhitelist.includes(code)) {
logger.warn(`${code}: ${message}`)
} else {
const err = new SemanticReleaseError(message, code)
errors.push(err)
}
}
if (errors.length > 0) {
throw new AggregateError(errors)
}
throw new AggregateError(errors)
}

return {
Expand Down

0 comments on commit d1b1507

Please sign in to comment.