GithubHelp home page GithubHelp logo

topmonks / hlidac-shopu Goto Github PK

View Code? Open in Web Editor NEW
61.0 10.0 21.0 292.92 MB

Hlídač shopů

Home Page: https://www.hlidacshopu.cz

License: Eclipse Public License 2.0

JavaScript 67.71% HTML 1.64% CSS 0.10% Swift 0.46% Shell 0.23% SCSS 1.88% TypeScript 1.42% Dockerfile 0.53% Nunjucks 26.02%
firefox-extension chrome-extension safari-extension pwa-app pulumi-aws esm ios-app

hlidac-shopu's Introduction

Hlídač Shopů

CircleCI codecov CodeFactor CodeScene Code Health CodeScene System Mastery

PWA a rozšíření do nejrošířenějších prohlížečů, které zobrazuje historická data cen na největších českých a slovenských e-shopech vč. Reálné slevy.


PWA and browser extension shows historical prices for biggest czech and slovak e-commerce websites.

Install

Development

We are using package.json scripts (run yarn run for a list) for project automation.

Prerequisites

If you only want to build the Firefox extension, it is enough to install Docker and follow the guide in the next step.

You will need:

  • Node.js 18 (we use nvm for Node.js version management)
  • yarn (we use Workspaces. You can't use npm. Sorry)
  • Firefox
  • Chrome
  • XCode Command Line Tools (for Safari and iOS development)
  • Pulumi (for Infrastructure and backend development)
  • jq (for Extension distribution)

We have install scripts for Debian and macOS. See scripts folder for install scripts for your system.

On debian run bash ./scripts/install-debian-tools.sh - this will use apt-get to install jq. On macOS run bash ./scripts/install-macos-tools.sh - this will use homebrew to install jq, nvm and pulumi.

Step by step build of Firefox extension for reviewers

Install Docker for your OS (all OSes are supported) and then execute the following command from the root of the project:

./scripts/build-firefox-extension-dockerized.sh

Execution of this command might take a while. Built extension will be placed in the dist folder.

Building extensions

All extensions (except Safari version) will be built to ./dist folder by calling the npm build script.

Firefox supports Dark and Light themes for action icons, and we are optimising action icons for these. Chrome doesn't support action icons theming via manifest.json so we use background.js script to add support for themes programmatically. We are removing background.js script, and it's entry in manifest, in build step with other unnecessary files.

Content script content.js is written in ESM, but ESM is not widely supported in content scripts. So we use simple bundle script yarn build:extension to convert ESM to IIFE bundle.

Firefox extension

To build Firefox extension run yarn build:firefox. It will create extension-dist folder for development time and packaged extension in ./dist folder.

Chrome extension

To build Chrome extension run yarn build:chrome. It will create package in ./dist folder.

Safari extension

  1. Run yarn build:extension to get latest bundle script, domains (eshops) permissions and current version for Safari
  2. Distribute app by XCode: yarn start:safari > Product > Archive > Distribute App*
  3. Manually send new app version to Review on Itunes Connect - you will need to be logged in as TopMonks developer (credentials in 1Password)

* Use autosigning feature and use the TopMonks s.r.o Apple developer team account. If this fails with missing private key, download one named "itunes Mac App Distribution mac_app.cer" from TopMonks 1Password.

Updating extension version

To check current version in package.json, manifest.json and about.html run

./version.sh

Update to new version run

./version.sh x.y.z

Extension development

For seamless development experience we have yarn watch:extension script with incremental builds on source files changes.

We also have convenient script yarn start:chrome and yarn start:firefox to start browsers with already registered extension and automatic reloading on changes.

For visual testing at scale, there is ./scripts/screenshotter.mjs. This will run Chrome with installed extension and take a screenshot of embedded widget on every supported e-shop. You can find resulting pictures in ./screenshots folder.

Extension release

Release process of extension is fully automated. To start the release process, you have to:

  1. run ./version.sh to see current version and then bump it with ./version.sh x.y.z
  2. Commit & create tag in github repository in following format: extension-x.y.z, where x.y.z is the version you set in previous step.

Web www.hlidacshopu.cz development

Website has it's own Blendid configuration. Start www.hlidacshopu.cz development with following command:

yarn start:www.hlidacshopu.cz

Cloudinary

Sites have ability to automatically upload images to Cloudinary and generate Cloudinary URLs. Cloudinary needs to be properly configured. Our Cloudinary credentials are stored in 1password team vault Hlidac shopu. Use 1password CLI to get credentials and set them as environment variables:

op run --env-file=.env --no-masking -- yarn build:www.hlidacshopu.cz

If this step is skipped you will get following error:

cloudinaryUrl Unknown cloud_name

You can enable Cloudinary aut-upload by setting cloudinary: true in task-config.json file. You can also configure source and destination paths in path-config.json file. By default, will be uploaded everything in cloudinary directory. Auto-uploader will generate images.json data file, that will be loaded into Nunjucks context via collections: ["images"] setting in task-config.json file.

We have implementation of helpers to generate Cloudinary URLs. One cloudinaryUrl filter for Nunjucks templates that should work in conjunction with generated images.json. Usage should be as follows:

<img src="{{ images["picture.png"]["public_id"] | cloudinaryUrl(width=300, height=240) }}" alt="">

You can use all supported transformations in JS SDK, for more details see Cloudinary JS SDK.

Other sources


Update @hlidac-shopu/lib version for actors

  1. Update version @hlidac-shopu/lib in ./lib/package.json
  2. Publish package to npm. Login credential are in TopMonks 1password.
    cd lib
    npm login
    npm publish --access public --tag latest
  3. Update version @hlidac-shopu/lib across the project
    yarn up @hlidac-shopu/lib -i

© 2018-2022 TopMonks s.r.o.; Licensed under EPL-2.0

hlidac-shopu's People

Contributors

annakaufman avatar chudovskyr avatar code-factor avatar dependabot-preview[bot] avatar dependabot[bot] avatar hamzaalwan avatar jakubbalada avatar janfiedler avatar janpokorny avatar jjetmar avatar junkycoder avatar ladasnajberk avatar lanvucz avatar martinagelnerova avatar masa331 avatar metalwarrior665 avatar oodoow avatar petrpatek avatar rarous avatar renovate-bot avatar renovate[bot] avatar salax avatar sauermar avatar strajk avatar theodik avatar thujer avatar trnkapavel avatar vaclav-slavik avatar zpelechova 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hlidac-shopu's Issues

Appka pro iOS

iOS bohužel neumí Web Share Target API a tak nelze PWA použít jako na Androidu. Bylo by fajn mít iOS appku, která:

  • Implementuje share extension na úrovni systému
  • Embedduje PWA do WebView a bude jí předávat informace ze share (GET parametr url).

slovenské eshopy

Ak by sa vám chcelo pridať podporu pre eurá a slovenské eshopy, aspoň tie, ktoré sú aj na SK aj CZ, teda majú podobný web, mnohých z nás by to potešilo.

Na oplátku spropagujeme toto rozšírenie aj na Slovensku vrámci Paralelnej Polis.

Počítání slevy v % na webu

Screenshot 2019-11-06 at 10 57 19
https://www.hlidacshopu.cz/?url=https%3A%2F%2Fwww.czc.cz%2Fxiaomi-mi-band-4-cerna%2F263000a%2Fprodukt

Správně je 31%

Viditelna hlaska, pokud nemam historicky data

Pokud navstivim produkt, pro ktery nemam historicky data(z elasticu se vrati prazdne), tak se mi v tele grafu zobrazi nejaka hlaska typu "Pro tento produkt nemame data". Aby bylo jasne, ze to neni rozbity ale jen to neni nascrapovany

Vice cen v ramci jednoho dne

Muze se stat, ze pro nektery den budeme mit vic zaznamu - treba v obdobi black friday bezi scrapery casteji. Zamyslet se nad nejakym zpusobem, jak by to slo v grafu zobrazit. Aktualne graf pocita pouze s jednim udajem na den

Endpoint pro recenze

Pro potřeby website je třeba přidat API endpoint s výpisem recenzí z jendotlivých storů a počtem stažení. Každá recenze by měla obsahovat pokud možno jméno, hodnocení, avatar, text recenze a datum, kdy byla přidána. Stejný endpoint by měl vracet i statistiku počtu stažení v jednotlivých storech.

Příklad API:

GET /reviews

{
  stats: {
    chrome: { downloads: 3748, reviews: 25 },
    firefox: { download: 357, reviews: 6 }
  },
  reviews: [
    {name: "Franta Vocásek", rating: 5, avatar: "https://....png", text: "Miluji to", date: "2019-11-01", sourceUrl: "https://" }
  ]
}

Data by se měly udržovat v DynamoDB a aktualizovat zhruba jednou za den.

PWA

Na adrese https://www.hlidacshopu.cz/app/ běží PWA, kterou lze nainstalovat do systému. Je to přesunutá micro app z HP. Další vývoj bude probíhat tu a PWA nahradí výsledkový modál.

Primární motivací je zjednodušit práci s hlídačem mobilním uživatelům, kteří si nemohu nainstalovat rozšíření do mobilního prohlížeče. (Jediný mobilní prohlížeč, který to umožňuje je Firefox pro Android.) Android podporuje Web Share Target API, který umožňuje ověřovat vývoj cen pomocí systémového sdílení. Podpora na iOS aktuálně chybí [issue], a snažíme se to vyřešit pomocí #33. Ta počítá s touto PWA pro embedd ve WebView.

Tato issue slouží pro sběr připomínek a chyb.

Endpoint pro e-shopy

Pro potřeby website by bylo fajn mít enpoint, který vrátí seznam aktuálně podporovaných e-shopů s jejich statistikou.

Příklad API:

GET /e-shops

[
  {key: "alza", 
   name: "Alza.cz",
   url: "https://www.alza.cz",
   allProducts: 400000,
   bfProducts: 2000,
   avgClaimedDiscount: 0.43,
   avgRealDiscount: 0.21}
]

Vypinaci tlacitko

V liste v hlavicce prohlizece budu mit jednoduchyvypinaci tlacitko

Přesunout www.hlidacshopu.cz z topmonks-webs

topmonks-webs bylo dobré místo na rychlý rozjezd webíku, ale postupně se objevuje potřeba sdílet kód mezi extensions a PWA.

  • Vytvořit website scaffolding pomocí topmonks/blendid
  • Vytvořit resources pro website pomocí Pulumi Website
  • Přesunout zdojové kódy
  • Nastavit build pomocí CircleCI, který udělá deploy do AWS Hlídače
  • Zrušit website www.hlidacshopu.cz v topmonks-webs

Sledování produktů

Ke grafům přidat čudl na sledování, v bublině pak ukazovat náhled ceny + menší historie. Notifikace při změně?

Loga nasich firem

Pridat nekam do extension viditelne loga/odkazy/neco nasich firem

Právník Notino.cz má rozmazaný screenshoty v PDFku

Screenshoty jsou totálně nečitelný

image

Nic s tím neuděláme, ale přijde mi hezký si to tady poznamenat, když už pan Malý investuje čas do čtení našeho repository, ale místo aby nám dal k public issue komentář a komunikoval jako normální lidi, tak posílá bububu dopisy. Ach jo, vždyť je mladej a tohle nemá zapotřebí...

Script pro automaticke verze

Priprava nove verze ted obnasi

  1. rucni prepsani verze v manifest.json
  2. rucni prepsani verze v about.html
  3. commitnout zmenu verze
  4. spusteni npm run bundle:osx (coz udela dalsi commit)

Idealni by byl script npm run version 1.3.3, ktery by toto udelal automaticky.

Definovat události pro přechod na instalaci extension

Vyvolat událost při kliku na tlačítko "Nainstalovat rozšíření do prohlížeče" jak pro Chrome, ta Firefaox, stejně tak při kliu na loga jednotlivých browserů vč. informace o jaký browser se jedná. Tuty události pak nastavit v GA jako Goals.

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.