Skip to content

Commit

Permalink
chore(deps): bump webextension-store-meta from 1.0.5 to 1.1.0; run [c…
Browse files Browse the repository at this point in the history
…hromewebstore] (#9972)

* chore(deps): bump webextension-store-meta from 1.0.5 to 1.1.0

Bumps [webextension-store-meta](https://github.com/awesome-webextension/webextension-store-meta) from 1.0.5 to 1.1.0.
- [Changelog](https://github.com/awesome-webextension/webextension-store-meta/blob/main/CHANGELOG.md)
- [Commits](https://github.com/awesome-webextension/webextension-store-meta/commits)

---
updated-dependencies:
- dependency-name: webextension-store-meta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* deprecate price badge

`price` and `priceCurrency` fields have been removed

* fix formatting on users badge

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: chris48s <git@chris-shaw.dev>
  • Loading branch information
dependabot[bot] and chris48s authored Feb 18, 2024
1 parent c4062a7 commit a68e47c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 62 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"semver": "~7.6.0",
"simple-icons": "11.4.0",
"smol-toml": "1.1.4",
"webextension-store-meta": "^1.0.5",
"webextension-store-meta": "^1.1.0",
"xpath": "~0.0.34"
},
"scripts": {
Expand Down
45 changes: 8 additions & 37 deletions services/chrome-web-store/chrome-web-store-price.service.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
import { currencyFromCode } from '../text-formatters.js'
import { NotFound, pathParams } from '../index.js'
import BaseChromeWebStoreService from './chrome-web-store-base.js'
import { deprecatedService } from '../index.js'

export default class ChromeWebStorePrice extends BaseChromeWebStoreService {
static category = 'funding'
static route = { base: 'chrome-web-store/price', pattern: ':storeId' }
const ChromeWebStorePrice = deprecatedService({
category: 'funding',
route: { base: 'chrome-web-store/price', pattern: ':storeId' },
label: 'price',
dateAdded: new Date('2024-02-18'),
})

static openApi = {
'/chrome-web-store/price/{storeId}': {
get: {
summary: 'Chrome Web Store Price',
parameters: pathParams({
name: 'storeId',
example: 'ogffaloegjglncjfehdfplabnoondfjo',
}),
},
},
}

static defaultBadgeData = { label: 'price' }

static render({ priceCurrency, price }) {
return {
message: `${currencyFromCode(priceCurrency) + price}`,
color: 'brightgreen',
}
}

async handle({ storeId }) {
const chromeWebStore = await this.fetch({ storeId })
const priceCurrency = chromeWebStore.priceCurrency()
const price = chromeWebStore.price()
if (priceCurrency == null || price == null) {
throw new NotFound({ prettyMessage: 'not found' })
}
return this.constructor.render({ priceCurrency, price })
}
}
export default ChromeWebStorePrice
28 changes: 10 additions & 18 deletions services/chrome-web-store/chrome-web-store-price.tester.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
import Joi from 'joi'
import { createServiceTester } from '../tester.js'
export const t = await createServiceTester()
import { ServiceTester } from '../tester.js'

t.create('Price')
.get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json')
.expectBadge({
label: 'price',
message: Joi.string().regex(/^\$\d+(.\d{1,2})?$/),
})
export const t = new ServiceTester({
id: 'ChromeWebStorePrice',
title: 'ChromeWebStorePrice',
pathPrefix: '/chrome-web-store/price',
})

t.create('Price (not found)')
.get('/invalid-name-of-addon.json')
.expectBadge({ label: 'price', message: 'not found' })

// Keep this "inaccessible" test, since this service does not use BaseService#_request.
t.create('Price (inaccessible)')
.get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json')
.networkOff()
.expectBadge({ label: 'price', message: 'inaccessible' })
t.create('Price').get('/alhjnofcnnpeaphgeakdhkebafjcpeae.json').expectBadge({
label: 'price',
message: 'no longer available',
})
4 changes: 3 additions & 1 deletion services/chrome-web-store/chrome-web-store-users.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class ChromeWebStoreUsers extends BaseChromeWebStoreService {
if (downloads == null) {
throw new NotFound({ prettyMessage: 'not found' })
}
return renderDownloadsBadge({ downloads })
return renderDownloadsBadge({
downloads: String(downloads.replace(',', '')),
})
}
}

Expand Down

0 comments on commit a68e47c

Please sign in to comment.