revert to use yarn

This commit is contained in:
Christian Kellner
2025-05-16 15:03:28 +02:00
parent c6fb856cb6
commit 0cbfaaf092
5 changed files with 63 additions and 8706 deletions

View File

@@ -13,18 +13,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 22 node-version: 20
cache: 'pnpm' cache: 'yarn'
- name: Install dependencies - run: yarn install
run: pnpm install - run: yarn test
- name: Run tests
run: pnpm test

View File

@@ -1,41 +1,49 @@
FROM node:22 AS builder FROM node:22
# Install chromium dependencies in a separate layer (cacheable)
RUN apt-get update && apt-get install -y chromium && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /fredy WORKDIR /fredy
RUN corepack enable \ # Copy only package.json + yarn.lock for dependency caching
&& corepack prepare pnpm@latest --activate COPY package.json yarn.lock ./
COPY . /fredy
COPY package.json pnpm-lock.yaml ./ RUN apt-get update && apt-get install -y chromium
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run prod
FROM node:22-slim
WORKDIR /fredy
RUN apt-get update \
&& apt-get install -y chromium \
&& rm -rf /var/lib/apt/lists/*
RUN corepack enable \
&& corepack prepare pnpm@latest --activate \
&& pnpm add -g pm2
COPY --from=builder /fredy/node_modules ./node_modules
COPY --from=builder /fredy/dist ./dist
COPY --from=builder /fredy/package.json ./
# Increase network timeout for npm registry
RUN yarn config set network-timeout 600000 && yarn install
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
RUN mkdir -p /db /conf \ # Global tools (cached separately)
&& chown 1000:1000 /db /conf \ # Timeout fix für yarn hinzugefügt
&& chmod 777 /db /conf \ RUN yarn config set network-timeout 600000
&& ln -s /db /fredy/db \
&& ln -s /conf /fredy/conf
RUN yarn install
RUN yarn global add pm2
# Copy application source code (after deps, cache friendly)
COPY . .
# Build step (assuming 'prod' is a build script)
RUN yarn run prod
# Prepare runtime dirs
RUN mkdir /db /conf && \
chown 1000:1000 /db /conf && \
chmod 777 -R /db/ && \
ln -s /db /fredy/db && ln -s /conf /fredy/conf
chown 1000:1000 /db /conf && \
chmod 777 -R /db/ && \
ln -s /db /fredy/db && ln -s /conf /fredy/conf
# Expose port & set runtime command
EXPOSE 9998 EXPOSE 9998
CMD ["pm2-runtime", "index.js"]
CMD pm2-runtime index.js
CMD ["pm2-runtime", "dist/index.js"]

View File

@@ -4,13 +4,13 @@
Searching an apartment in Germany can be a frustrating task. Not any longer though, as _Fredy_ will take over and will only notify you once new listings have been found that match your requirements. Searching an apartment in Germany can be a frustrating task. Not any longer though, as _Fredy_ will take over and will only notify you once new listings have been found that match your requirements.
_Fredy_ scrapes multiple services (Immonet, Immowelt etc.) and send new listings to you once they become available. The list of available services can easily be extended. For your convenience, _Fredy_ has a UI to help you configure your search jobs. _Fredy_ scrapes multiple services (Immonet, Immowelt etc.) and send new listings to you once they become available. The list of available services can easily be extended. For your convenience, _Fredy_ has a UI to help you configure your search jobs.
If _Fredy_ finds matching results, it will send them to you via Slack, Email, Telegram etc. (More adapters can be configured.) As _Fredy_ stores the listings it has found, new results will not be sent to you twice (and as a side-effect, _Fredy_ can show some statistics). Furthermore, _Fredy_ checks duplicates per scraping so that the same listings are not being sent twice or more when posted on various platforms (which happens more often than one might think). If _Fredy_ finds matching results, it will send them to you via Slack, Email, Telegram etc. (More adapters can be configured.) As _Fredy_ stores the listings it has found, new results will not be sent to you twice (and as a side-effect, _Fredy_ can show some statistics). Furthermore, _Fredy_ checks duplicates per scraping so that the same listings are not being sent twice or more when posted on various platforms (which happens more often than one might think).
<a href="https://www.producthunt.com/posts/fredy-find-real-estates-damn-easy?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-fredy&#0045;find&#0045;real&#0045;estates&#0045;damn&#0045;easy" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=965690&theme=light&t=1747292331626" alt="Fredy&#0032;&#0045;&#0032;Find&#0032;Real&#0032;Estates&#0032;Damn&#0032;EasY&#0032; - Your&#0032;personal&#0032;real&#0032;estate&#0032;search&#0032;bot | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a> <a href="https://www.producthunt.com/posts/fredy-find-real-estates-damn-easy?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-fredy&#0045;find&#0045;real&#0045;estates&#0045;damn&#0045;easy" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=965690&theme=light&t=1747292331626" alt="Fredy&#0032;&#0045;&#0032;Find&#0032;Real&#0032;Estates&#0032;Damn&#0032;EasY&#0032; - Your&#0032;personal&#0032;real&#0032;estate&#0032;search&#0032;bot | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
# Sponsorship [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/orangecoding) # Sponsorship [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/orangecoding)
If you like my work, consider becoming a sponsor. I'm not expecting anybody to pay for _Fredy_ or any other Open Source Project I'm maintaining, however keep in mind, I'm doing all of this in my spare time :) Thanks. If you like my work, consider becoming a sponsor. I'm not expecting anybody to pay for _Fredy_ or any other Open Source Project I'm maintaining, however keep in mind, I'm doing all of this in my spare time :) Thanks.
[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport) [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)
@@ -20,15 +20,14 @@ _Fredy_ is supported by JetBrains under Open Source Support Program
## Demo ## Demo
If you want to try out _Fredy_, you can access the demo version [here](https://fredy.orange-coding.net) 🤘 If you want to try out _Fredy_, you can access the demo version [here](https://fredy.orange-coding.net) 🤘
## Usage ## Usage
- Make sure to use Node.js 22 or above - Make sure to use Node.js 22 or above
- Run the following commands: - Run the following commands:
```ssh ```ssh
npm install -g pnpm //if you have not yet installed pnpm yarn (or npm install)
pnpm i yarn run prod
pnpm prod yarn run start
pnpm start
``` ```
_Fredy_ will start with the default port, set to `9998`. You can access _Fredy_ by opening your browser at `http://localhost:9998`. The default login is `admin`, both for username and password. You should change the password as soon as possible when you plan to run Fredy on a server. _Fredy_ will start with the default port, set to `9998`. You can access _Fredy_ by opening your browser at `http://localhost:9998`. The default login is `admin`, both for username and password. You should change the password as soon as possible when you plan to run Fredy on a server.
@@ -67,18 +66,18 @@ As an administrator, you can create, edit and remove users from _Fredy_. Be care
To run _Fredy_ in development mode, you need to run the backend & frontend separately. To run _Fredy_ in development mode, you need to run the backend & frontend separately.
Start the backend with: Start the backend with:
```shell ```shell
pnpm start yarn run start
``` ```
For the frontend, run: For the frontend, run:
```shell ```shell
pnpm dev yarn run dev
``` ```
You should now be able to access _Fredy_ from your browser. Check your Terminal to see what port the frontend is running on. You should now be able to access _Fredy_ from your browser. Check your Terminal to see what port the frontend is running on.
### Running Tests ### Running Tests
To run the tests, run To run the tests, run
```shell ```shell
pnpm test yarn run test
``` ```
# Architecture # Architecture
@@ -88,16 +87,16 @@ pnpm test
Immoscout has implemented advanced bot detection. In order to work around this, we are using a reversed engineered version of their mobile api. See See [Immoscout Reverse Engineering Documentation](https://github.com/orangecoding/fredy/blob/master/reverse-engineered-immoscout.md) Immoscout has implemented advanced bot detection. In order to work around this, we are using a reversed engineered version of their mobile api. See See [Immoscout Reverse Engineering Documentation](https://github.com/orangecoding/fredy/blob/master/reverse-engineered-immoscout.md)
# Analytics # Analytics
Fredy is completely free (and will always remain free). However, it would be a huge help if youd allow me to collect some analytical data. Fredy is completely free (and will always remain free). However, it would be a huge help if youd allow me to collect some analytical data.
Before you freak out, let me explain... Before you freak out, let me explain...
If you agree, Fredy will send a ping to my Mixpanel project each time it runs. If you agree, Fredy will send a ping to my Mixpanel project each time it runs.
The data includes: names of active adapters/providers, OS, architecture, Node version, and language. The information is entirely anonymous and helps me understand which adapters/providers are most frequently used.</p> The data includes: names of active adapters/providers, OS, architecture, Node version, and language. The information is entirely anonymous and helps me understand which adapters/providers are most frequently used.</p>
**Thanks**🤘 **Thanks**🤘
# Docker # Docker
Use the Dockerfile in this repository to build an image. Use the Dockerfile in this repository to build an image.
Example: `docker build -t fredy/fredy /path/to/your/Dockerfile` Example: `docker build -t fredy/fredy /path/to/your/Dockerfile`
Or use docker-compose: Or use docker-compose:
@@ -107,7 +106,7 @@ Or use the container that will be built automatically.
`docker pull ghcr.io/orangecoding/fredy:master` `docker pull ghcr.io/orangecoding/fredy:master`
## Create & run a container ## Create & run a container
Put your config.json into a path of your choice, such as `/path/to/your/conf/`. Put your config.json into a path of your choice, such as `/path/to/your/conf/`.
@@ -122,6 +121,6 @@ Thanks to all the people who already contributed!
See [Contributing](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTING.md) See [Contributing](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTING.md)
## Logs ## Logs
You can browse the logs with `docker logs fredy -f`. You can browse the logs with `docker logs fredy -f`.

View File

@@ -2,12 +2,11 @@
"name": "fredy", "name": "fredy",
"version": "12.0.0", "version": "12.0.0",
"description": "[F]ind [R]eal [E]states [d]amn eas[y].", "description": "[F]ind [R]eal [E]states [d]amn eas[y].",
"packageManager": "pnpm@9.1.0",
"scripts": { "scripts": {
"start": "node prod.js", "start": "node prod.js",
"dev": "pnpm install && rm -rf ./ui/public/* && vite", "dev": "yarn && rm -rf ./ui/public/* && vite",
"ui": "rm -rf ./ui/public/* && vite", "ui": "rm -rf ./ui/public/* && vite",
"prod": "pnpm install && vite build --emptyOutDir", "prod": "yarn && vite build --emptyOutDir",
"format": "prettier --write lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js --single-quote --print-width 120", "format": "prettier --write lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js --single-quote --print-width 120",
"test": "mocha --loader=esmock --timeout 3000000 test/**/*.test.js", "test": "mocha --loader=esmock --timeout 3000000 test/**/*.test.js",
"lint": "eslint ./index.js ./lib/**/*.js ./test/**/*.js ./ui/src/**/*.jsx" "lint": "eslint ./index.js ./lib/**/*.js ./test/**/*.js ./ui/src/**/*.jsx"
@@ -41,8 +40,8 @@
}, },
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=22.0.0", "node": ">=20.0.0",
"pnpm": ">=9.0.0" "npm": ">=7.0.0"
}, },
"browserslist": [ "browserslist": [
"> 0.5%", "> 0.5%",
@@ -106,4 +105,4 @@
"prettier": "3.5.3", "prettier": "3.5.3",
"redux-logger": "3.0.6" "redux-logger": "3.0.6"
} }
} }

8642
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff