Giter VIP home page Giter VIP logo

webextension-store-meta's Introduction

webextension-store-meta logo

webextension-store-meta

npm-version Build Status Coverage Status

Get browser extension(webextension) item meta from Chrome Web Store and Firefox add-ons.

This lib uses many fallback methods to improve stability and performance.

Who Use It

Shields.io Badgen
Quality metadata badges
for open source projects
Fast badge generating service

Installation

npm

npm add webextension-store-meta

yarn

yarn add webextension-store-meta

Usage

All stores share the same api.

const { ChromeWebStore } = require('webextension-store-meta/lib/chrome-web-store')
const chromeWebStore = await ChromeWebStore.load({
  id: 'xxxxxxx',
  qs: { hl: 'en' },
})
console.log(chromeWebStore.meta())

const { Amo } = require('webextension-store-meta/lib/amo')
const amo = await Amo.load({ id: 'xxxxxxx' })
console.log(amo.meta())

result = {
  name: expect.any(String),
  description: expect.any(String),
  ratingValue: expect.any(Number),
  ratingCount: expect.any(Number),
  users: expect.any(Number),
  price: expect.any(Number),
  priceCurrency: expect.any(String),
  version: expect.any(String),
  url: expect.any(String),
  image: expect.any(String),
  operatingSystem: expect.any(String),
}

Get individual property:

const { Amo } = require('webextension-store-meta/lib/amo')
const amo = await Amo.load({ id: 'xxxxxxx' })
console.log(amo.name())
console.log(amo.ratingValue())

Load config:

  • id {string} required - extension id.
  • qs {string|object} optional - querystring.
  • options object optional - undici.fetch options.

Development

git clone https://github.com/awesome-webextension/webextension-store-meta.git
cd webextension-store-meta
pnpm i
pnpm test

webextension-store-meta's People

Contributors

chris48s avatar crimx avatar xmcp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

webextension-store-meta's Issues

Downstreams are broken due to changed API behavior

ref: badges/shields#10094

Currently shields.io use this library like this:

import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store/index.js'
...
async fetch({ storeId }) {
    return await ChromeWebStore.load({ id: storeId })
    ...
}

However, console.log(ChromeWebStore) for v1.2.1 now gives us:

{
  ChromeWebStore: [class ChromeWebStore],
  default: [class ChromeWebStore]
}

Therefore it crashes with TypeError: ChromeWebStore.load is not a function.

badgen uses this library in a similar manner, which would also crash (but I haven't tested).

Broken with domutils v2

Hi there ๐Ÿ‘‹ We've run into an issue with this package in Shields.io because after updating some other dependencies in our tree (refs badges/shields#6611) domutils is now getting resolved to v2. domutils is an indirect dependency in our tree, and from what I can tell a direct, but undeclared, dependency here in webextension-store-meta.

Error snippet included below for reference, let me know if you have any questions or need any more information!

Error: Cannot find module 'domutils/lib/tagtypes'
Require stack:
- /home/circleci/project/node_modules/webextension-store-meta/lib/dom.js
- /home/circleci/project/node_modules/webextension-store-meta/lib/chrome-web-store/index.js
- /home/circleci/project/services/chrome-web-store/chrome-web-store-base.js
- /home/circleci/project/services/chrome-web-store/chrome-web-store-price.service.js
- /home/circleci/project/core/base-service/loader.js
- /home/circleci/project/core/base-service/loader.spec.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (node_modules/webextension-store-meta/lib/dom.js:1:36)
    ```

FetchError: maximum redirect reached

Hello.

Recently all our calls via this lib are failing with FetchError: maximum redirect reached

Example failing code:

import ChromeWebStore from 'webextension-store-meta/lib/chrome-web-store/index.js'

await ChromeWebStore.load({ id: 'iocghaljaochhkgajdilelogdkejkiil' })

feature request: typescript support

I added ES-module support for typescript support. It's outdated, but it worked, but I don't really know what I'm doing, so I didn't feel confident to open a PR, here's the code: https://github.com/cachho/webextension-store-meta

Now, with the breaking changes, I know that from my last attempt that I rather not do it again, so with this issue I'm asking if anyone could at typescript support. Thank you.

`.version()` returning null

example call:

import { ChromeWebStore } from 'webextension-store-meta/lib/chrome-web-store/index.js'

const data = await ChromeWebStore.load({ id: 'ikhdkkncnoglghljlkmcimlnlhkeamad' })

console.log(data.version())

seems to be broken for all examples I've checked.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.