Update Antd dependency library with shell script batch pull,rc-componentWarehouse items
The project address
Demand background
Implementation approach
The technical implementation
The demo steps
Demand background
Sometimes see API can not achieve the requirements, want to see how to write the source code, usually have to go to the corresponding Github project address clone, more trouble, also easy to miss
Implementation approach
The method may be a little stupid, a little analysis of the process I go to pull, do not want to see if the direct technical implementation 🐶
- Check the GIthub address of the RC-ComponentThere are 94 items in the repository, and when I switch pages, instead of returning JSON data, IT’s a string, so I clicked on ithomePage
- This page looks just like I like, with all the project information in it, all we need is the Git address
- Because printing JQ traversal information on the browser is not easy to do on the console
- So we decided to use Node + Cherrio to get dom information, and then read and write to TXT
- I want to crawl through all the Github addresses and use shell scripts to iterate through them and then clone and update them
The technical implementation
- Get the page for homePage, usecheeioParse to DOM, and then you can manipulate dom just like JQ
- There is a Node Chinese moderators quick start tutorial recommended
- Write all project addresses in TXT
- Shell script traversal TXT, execute clone, update
The demo steps
yarn
node index.js
: Generate TXT, see the codebash clone.sh
: batch clonebash pull.sh
: Iterate through the.git projects in the current folder and execute Git pull