Skip to content

[DEPRECATED] Dev Documentation (English)

Zakaria RACHEDI edited this page Sep 15, 2019 · 1 revision

Documentation(dev)

Install the project

To install the project on your machine, it's simple: Clone this repository locally:

git clone https://github.com/kaido/deskofus.git

Install dependencies with npm:

npm install

Included commands

Commands Description
npm start Execute the application in your command line tool (NB: in some CLI inquirer is KO)
node lib/app.js Same as npm start but work on every CLI
npm run pkg-win Package the app into windows executable (no more need nodejs to be launched)
npm run pkg-linux Package the app into linux executable (no more need nodejs to be launched)
npm run pkg-mac Package the app into macos executable (no more need nodejs to be launched)
npm run pkg-all Package the app for Windows, Linux and MacOS in one time

Understand the project

To understand the project and subsequently to contribute to it, you need to understand first its tree structure.

Crawlit
└───README.md    
└───assets (only few images for styling the repo)
└───package.json
└───LICENSE
|
└───lib
│   └───app.js
|   └───getItems.js
|   |
│   └───cli-view
│   │   │   cmd.js
│   │   │   cmdSwitch.js
│   │   │   ...
│   └───item-crawler
│       │   getEquipments.js
│       │   getMounts.js
│       │   ...
└───node_modules

app.js and getItems.js

At the root of the project under lib/ you will find the app.js file which contains our main code (launch the app, load properties and global configuration of the application). In this same folder you will find the getItems.js file which manage the items scraping logic.

cli-view folder View management

The cli-view folder will contain the renderer code of our application and all the interactions with the app. Inside we can find :

  • cmd.js file : manage interactions between the user and the program.
  • cmdSwitch.js file : manage all categories links (Dofus & Dofus-Touch).

item-crawler folder Item catagories parsing management

This folder contains one file per categories and each file parse a category of the encyclopedia (request + storage).

Develop a module

To develop a module, there are few rules to respect :

  • Add the category's links to the file cmdSwitch.js in cmd-view/ (don't forget to add french & english version if need it).
  • Add the category's name into the switch in the function getData() of the file getItems.js.
  • Update the cmd.js file and add your category to the selection choice also create your questions if need it (look at the other categories as example).
  • Create a new file under item-crawler/.
  • Define the file name as getCategory.js.
  • Define the DOM scraping logic (look at the other files as example).

Enjoy guys ! Don't hesitate to ask questions or to use the discord ! 😃

Clone this wiki locally