Prototype of HakuNeko based on NW.js + TypeScript + Vite
Make sure git and NodeJS + NPM are installed on your system.
First start by cloning the repository from https://github.com/manga-download/haruneko.git
git clone "https://github.com/manga-download/haruneko.git"
Then change into the project directory and install the dependencies
npm install
# If you are on Apple Silicon (arm64) and NW isn't starting, try:
# See: https://github.com/nwjs/nw.js/issues/8157
xattr -cr ./node_modules/nw/nwjs/nwjs.app
HakuNeko consists of two parts, a web-application that needs to be hosted and an NW.js client running the web-application.
As a developer you probably want to launch the application and also want changes made to the source code reflecting in the running application. This can be achieved by hosting the source code directly on http://localhost:3000
npm run serve:dev --workspace web
Then launch the NW.js application to load the hosted web-application
npm run launch:dev --workspace app/nw
The same procedure can be applied to run a production build of both parts, but these can not be modified while running. Host the production web-application on http://localhost:5000
npm run serve:prod --workspace web
And then start the production NW.js application
npm run launch:prod --workspace app/nw
After making changes to the source code, it is recommend to validate the code style, check for code smells and perform a static code analysis.
npm run check
To ensure the application behaves as expected, tests need to be added.
The popular jest
framework is used as test runner and for mocking.
All tests are written side by side to their (logical) corresponding implementation directly in the source code directory.
Overall, there are two test categories.
Unit tests (file extension ⋆.test.ts
) are very lightweight within a limited scope (e.g. single method of a class).
Component tests (file extension ⋆.spec.ts
) can be more complex and test relations and coherences within a module (e.g. a composed UI control).
To start these tests, simply run
npm run test
End-To-End tests (file extension ⋆.e2e.ts
) are performed by interacting with the (web-)application itself.
This includes tests which are consuming the engine API as well as tests that run against the UI.
The environment for these tests is a running instance of the NW.js production build, controlled by the tests through puppeteer
.
To start these tests, simply run
npm run test:e2e
Website tests (file extension ⋆.e2e.ts
in /src/engine/websites) will run some basic checks for each website.
The environment for these tests is a running instance of the NW.js production build, controlled by the tests through puppeteer
.
|
Running all tests will take very very long and may use up a lot of your internet bandwidth. |
To start these test(s), simply run
# Test all websites
npm run test:websites
# Test a certain website
npm run test:websites -- MangaDex