Skip to content

Execute multiple operations on multiple repositories

License

Notifications You must be signed in to change notification settings

Eomm/massive-wax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

massive-wax

oclif Version Downloads/week License

Edit every file of a list of GitHub repositories and open a PR ✨

This tool will:

  • fork
  • clone
  • edit the files
  • submit a PR

for you!

Example?

  • update all the package's of your ORG with the new greenkeeper.ignore
  • add the new support field in your package.json
  • update the LICENSE of your repos
  • all the things that are boring and need to be done to all your repos!!

Usage

$ npm install -g massive-wax
$ massive-wax COMMAND
running command...
$ massive-wax (-v|--version|version)
massive-wax/1.1.0 linux-x64 node-v10.24.1
$ massive-wax --help [COMMAND]
USAGE
  $ massive-wax COMMAND
...

Commands

massive-wax help [COMMAND]

display help for massive-wax

USAGE
  $ massive-wax help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

massive-wax upgrade

Process the files of many GitHub repositories as you want and open PR with changes!

USAGE
  $ massive-wax upgrade

OPTIONS
  -B, --pr-body=pr-body                [default: This is an automatic PR created with
                                       [massive-wax](https://github.com/Eomm/massive-wax)!] the body message of the PR

  -C, --[no-]commit                    commit the changes

  -F, --[no-]fork                      fork the project before cloning. Useful if you don't have the write grant

  -K, --token=token                    the GitHub token to fork the project and push the changes. You can set it via env
                                       named GITHUB_TOKEN

  -L, --[no-]clone                     clone the repo before executing the processors

  -O, --pr-origin=pr-origin            [default: master] the main branch in the origin repo

  -R, --[no-]pr                        open the PR to forked repo

  -b, --branch=branch                  [default: wax] the branch name where apply the changes

  -c, --commit-message=commit-message  [default: wax in action] the commit message

  -m, --match=match                    [default: .js$|.json$] the files that match this pattern will be processed

  -p, --processor=processor            (required) the processor(s) that will modify the cloned repo. It must be a node
                                       module

  -r, --repo=repo                      (required) the URL repo to upgrade. If it is a file, each line of the file must
                                       be a repo URL

  -t, --pr-title=pr-title              [default: automatic PR] the title of the PR

  -w, --work-path=work-path            [default: /home/runner/work/massive-wax/massive-wax] current working directory:
                                       where cloning the repos

DESCRIPTION
  ...
  This command will:
  - fork the repos in the GH account associated with the --token
  - clone the repos in your local env
  - process all the files of the cloned repos
  - commit the changes in a dedicated branch
  - open a PR to the `--pr-origin` branch in the origin repo

  All these steps are optionals.

EXAMPLES
  Change all the LICENCE file of your org
   $ upgrade -K GITHUB-TOKEN --fork -p='./toMit.js' -t='Changed license' -c='chore changed license' -O main -b 
  licensebranch -r repo-list.txt

See code: src/commands/upgrade.js

Processor

The processor file will be loaded relative to the PWD and it must be like this scaffolding:

module.exports = function factory (args, logger) {
  // DO WHAT YOU WANT IN SYNC
  // This function will be called for each REPO you are processing

  return {
    onRepo (repo) {
      // OPTIONAL, sync function called before processing the files
    },
    onFile (file) {
      // MANDATORY, do what you whant to each file of your project.
      // The files are processed sequentially and, if you return a promise
      // it will be waited.
      // If you will throw an error, it will be logged but all will continue
    },
    onComplete (repo) {
      // OPTIONAL, sync function called after all the processed files
    }
  }
}

License

Copyright Manuel Spigolon, Licensed under MIT.