A CLI tool to automatically check for dependency of a specified package and then create a PR updating the package.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Automatic Pull requests like below
Currently works with only github.
This project is about building a simple CLI tool that will look through a file(currently only .csv file) and let the user know about the version of specified dependency of a project/repo listed in the file. It also writes the same info onto another file.
The link to the repository can be any one of the following format: (taken straight out of github-url-to-object page)
* 'github:monkey/business' * 'https://github.com/monkey/business' * 'https://github.com/monkey/business/tree/master' * 'github:monkey/business#nachos' * 'https://github.com/monkey/business/tree/master/nested/file.js' * 'https://github.com/monkey/business.git' * 'http://github.com/monkey/business' * 'git://github.com/monkey/business.git' * 'git+https://github.com/monkey/business.git'
In addition to the above mentioned task if the version is below specified version it'll automatically fork
, clone
, update
, push
and create a PR
to the original repo. Provided we tell it to do so.
- Platforms and Registry
- Libraries(for Core Functionality)
- Libraries (for Testing)
To get a local copy up and running follow these simple example steps.
In order to use this project/ repo / tool there are certain pre-requisites.
- node
- npm
npm install npm@latest -g
- A code Editor (e.g., Visual Studio, VS Code, Sublime Text, Atom etc.)
- Get your personal access token from github(required only when using the
-u
option. Not required for the-i
option). Follow this for creating your PAT(Personal Access Token) Creating a personal access token - Clone the repo
git clone https://github.com/dyte-submissions/dyte-vit-2022-Aritra779.git
- Install NPM packages
npm install
- (Optionally required for
-u
option) Enter your PAT(Personal Access Token) in a.env
file inG_TOKEN
variable. Change the name everywhere if you wish.G_TOKEN = 'ENTER YOUR PAT'
-
Move into the project directory from command line / shell / bash
cd dyte-vit-2022-Aritra779
-
For help run
myawesometool -h
or
myawesometool --help
-
For reading a CSV file and listing out dependency version satisfiability status run
myawesometool -i <somefile.csv> <package_name@version>
-
For creating an automated PR(pull request) along with the above task run
myawesometool -update -i <somefile.csv> <package_name@version>
This requires github PAT(Personal Access Token).
Also note that this will not update the mentioned package if the mentioned version isn't in the compatibility range mentioned in the package.json
-
For forcefully updating a package even if it might break certain features run
myawesometool -i -u -f <somefile.csv> <package_name@version>
-
For starting at a specified row index run
myawesometool -i -s4 <somefile.csv> <package_name@version>
OR
myawesometool -i --start=4 <somefile.csv> <package_name@version>
If the csv file has no header then pass
--start=-1
-
If you own all the repositories mentioned in the csv file or if you have write access or branch creation access to them then run
myawesometool -i -u -o <somefile.csv> <package_name@version>
Use this option when forking isn't necessary.
Currently mixture of self owned and not owned repository cannot be process together. Best action plan in that case would be to keep them in two differnt files and then use the tool.
-
npm test
currently has only 4 tests. Fork test and Pull test test the correspoding API calls. The API call is mocked. You can test it out without a worry. The other two tests are for testing out API call to get the package.json file of any repo. These two calls are also mocked. Hence you can test it out without a single worry.
-
Don't run it outside of the project directory for the time being (will be looked into later)
-
This tool expects the first column of the csv file to be the
name
of the repository, the second column to be thelink of the repository
. It'll also add theversion
in the 3rd column,version satisfiability condition
in 4th column and thegenerated PR link
in the 5th column. -
Note: After the task has been performed the auto generated directory named
Temporary_Directory
will be automatically deleted. But this takes some time, huge lot of time in some cases. Also it doesn't report the deletion progress. It'll only report when there's an error or when the complete deletion task is done. If you don't want to wait around for the deletion task then it's best to stop the process there and manually delete the directory. No harm will be done to the overall task since the core task has already been completed by that time. -
There's a sample_d.csv file with two repo links. First repo (named
test
) haveaxios 0.25.0
andreact 18.0.0
. Second one doesn't havereact
but haveaxios 0.23.0
. So for testing PR generation test with anything higher than the specified versions.
-
Basic Documention (High Priority) - More Documention (When More Features Arrive)
-
npm test
(Normal Priority) -
Move from 'have to work anyhow' to 'should be logically sound' (High Priority) - Reduce dependency (Low Priority)
-
csv-parser (Low Priority) -
csv-writer (Low Priority) -
get-repo-package-json (High Priority) - github-url-to-object (Not Likely)
- chalk (probably Not)
- commander (When there's a better option available)
-
- Robustness (Normal Priority)
- More features I can't think of right now (Low Priority)
- Added an additional flag
-s | --start
for specifying which row (0 indexed) of the file to start execution from - Added an additional flag
-o | --own
for specifying whether the user owns all the repository listed in the csv file. If this flag is passed forking won't be done. - Added a request limit checking logic that'll automatically stop the execution if the request limit per hour (according to github API) is about to be reached.
- Added a condition that'll check if the github PAT is defined in
.env
file underG_TOKEN
variable. If not then using-u | --update
will not perform the said task.
See the full list of changelog listed on CHANGELOG.md
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Aritra Dutta - aritra.dutta.366@gmail.com
Project Link: https://github.com/dyte-submissions/dyte-vit-2022-Aritra779