Skip to content

Commit 2aaf55b

Browse files
committed
feat: initial version
0 parents  commit 2aaf55b

31 files changed

+11517
-0
lines changed

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.eslintignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
tmp
2+
node_modules/
3+
.git
4+
examples/
5+
tmp/
6+
dist/
7+
public/
8+
**/vendor*/
9+
/lib
10+
/*.js
11+
/*.d.ts

.eslintrc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": [
3+
"groupon/typescript",
4+
"plugin:regexp/recommended"
5+
],
6+
"overrides": [
7+
{
8+
"files": "*.test.*",
9+
"env": {
10+
"mocha": true
11+
}
12+
},
13+
{
14+
"files": "*.test.{ts,tsx}",
15+
"parserOptions": {
16+
"project": "test/tsconfig.json"
17+
}
18+
}
19+
],
20+
"root": true
21+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lib/** linguist-generated=true

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/target
2+
node_modules/
3+
npm-debug.log
4+
/tmp
5+
/.nyc_output
6+
grpn-create.log
7+
/coverage

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore-engines=true
2+
registry=https://registry.npmjs.org

CONTRIBUTING.md

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<!-- Generated by npm init @grpn -->
2+
3+
# Contributing
4+
5+
🎉🏅 Thanks for helping us improve this project! 🙏
6+
7+
This document outlines some practices we care about.
8+
If you have any questions or suggestions about the process,
9+
feel free to [open an issue](#reporting-issues)
10+
.
11+
12+
## How Can I Contribute?
13+
14+
### Reporting Issues
15+
16+
If you find any mistakes in the docs or a bug in the code,
17+
please [open an issue in Github](https://github.com/groupon/gh-bulk-pr/issues/new) so we can look into it.
18+
You can also [create a PR](#contributing-code) fixing it yourself, or course.
19+
20+
If you report a bug, please follow these guidelines:
21+
22+
* Make sure the bug exists in the latest version.
23+
* Include instructions on how to reproduce the issue.
24+
The instructions should be as minimal as possible
25+
and answer the three big questions:
26+
1. What are the exact steps you took? This includes the exact versions of
27+
node, npm, and any packages involved.
28+
1. What result are you expecting?
29+
1. What is the actual result?
30+
31+
### Improving Documentation
32+
33+
For small documentation changes, you can use [Github's editing feature][ghedit].
34+
The only thing to keep in mind is to prefix the commit message with "docs: ".
35+
The default commit message generated by Github will lead to a failing CI build.
36+
37+
[ghedit]: https://help.github.com/articles/editing-files-in-another-user-s-repository/
38+
39+
For larger updates to the documentation
40+
it might be better to follow the
41+
[instructions for contributing code below](#contributing-code).
42+
43+
### Contributing Code
44+
45+
**Note:** If you're planning on making substantial changes,
46+
please [open an issue first to discuss your idea](#reporting-issues).
47+
Otherwise, you might end up investing a lot of work
48+
only to discover that it conflicts with plans the maintainers might have.
49+
50+
The general steps for creating a pull request are:
51+
52+
1. Create a branch for your change. Always start your branch from the latest default branch.
53+
We recommend using `git wf start some-feature-name` by using
54+
[git workflow][gitwf]. Run `npm install` to install the dependencies.
55+
1. If you're fixing a bug, be sure to write a test *first*. That way you can
56+
validate that the test actually catches the bug and doesn't pass.
57+
1. Make your changes to the code. Remember to update the tests if you add new
58+
features or change behavior.
59+
1. Run the tests via `npm test`. This will also run style checks and other
60+
validations. You might see errors about uncommitted files. This is
61+
expected until you commit your changes.
62+
1. Once you're done, `git add .` and `git commit`. Please follow the
63+
[commit message conventions](#commits--commit-messages) described below.
64+
1. Push your branch to Github & create a PR.
65+
66+
[gitwf]: https://github.com/groupon/git-workflow
67+
68+
#### Code Style
69+
70+
In addition to any linting rules the project might include, a few general rules
71+
of thumb:
72+
73+
* Try to match the style of the rest of the code.
74+
* We prefer simple code that is easy to understand over terse, expressive code.
75+
* We try to structure projects by semantics instead of role. E.g. we'd rather
76+
have a `tree.js` module that contains tree traversal-related helpers than
77+
a `helpers.js` module.
78+
* Actually, if you create helpers you might want to put those into a separate
79+
package. That way it's easier to reuse them.
80+
81+
#### Commits & Commit Messages
82+
83+
Please follow the [angular commit message conventions][angular-commits]. We
84+
use an automated tool for generating releases that depends on the conventions
85+
to determine the next version and the content of the changelog. Commit messages
86+
that don't follow the conventions will cause `npm test` (and thus CI) to fail.
87+
88+
The short summary - a commit message should look like this:
89+
90+
```
91+
<type>(<scope>): <subject>
92+
<BLANK LINE>
93+
<body>
94+
<BLANK LINE>
95+
<references>
96+
<BLANK LINE>
97+
<footer>
98+
```
99+
100+
Everything but the first line is optional.
101+
The empty lines between the different parts are required.
102+
103+
* `<type>`: One of the following:
104+
105+
|`<type>`| Explanation | Version change |
106+
| :----- | :---------- | :-------------: |
107+
| **feat** | 🚀 Introduces a new feature | minor |
108+
||
109+
| **fix** | 🐛 A bug fix | patch |
110+
| **perf** | ⚡ Performance optimizations| patch |
111+
| **refactor** | 📦️ Changes to the code structure without fixing bugs or adding features | patch |
112+
| **chore** | 🏡 Changes to the project setup and tools, dependency bumps, house-keeping | patch |
113+
| **build** | 🏡 Changes that affect the build system (e.g webpack, rollup, ...) | patch |
114+
| **revert** | ↩️ reverts a previous commit | patch |
115+
||
116+
| **docs** | 📝 Changes to the documentation | none |
117+
| **style** | 💅 Cleanup & lint rule fixes. Note that often it's better to just amend the previous commit if it introduced lint errors | none |
118+
| **test** | 🧪 Fixing existing tests or adding missing ones. Just like with **style**, if you add tests to a feature you just introduced in the previous commit, consider keeping the tests, and the feature in the same commit instead. | none |
119+
| **ci** | 🏡 Changes to your CI configuration & scripts | none |
120+
* `<subject>`: A [good git commit message subject](http://chris.beams.io/posts/git-commit/#limit-50).
121+
- Keep it brief. If possible the whole first line should have at most 50 characters.
122+
- Use an imperative mood. "Create" instead of "creates" or "created".
123+
- No period (".") at the end.
124+
* `<body>`: Motivation for the change and any context required for understanding the choices made.
125+
Just like the subject, it should use an imperative mood.
126+
* `<scope>`: The scope is optional and specifies the place of your commit. Use `*` for multiple places.
127+
* `<references>`: Any URLs relevant to the PR go here.
128+
Use one line per URL and prefix it with the kind of relationship, e.g. "Closes: " or "See: ".
129+
If you are referencing an issue in your commit body or PR description,
130+
never use `#123` but the full URL to the issue or PR you are referencing.
131+
That way the reference is easy to resolve from the git history without having to "guess" the correct link
132+
even if the commit got cherry-picked or merged into a different project.
133+
* `<footer>`: This part only applies if your commit introduces a breaking change.
134+
It's important this is present, otherwise the **major version** will not increase.
135+
See below for an example.
136+
137+
[angular-commits]: https://github.com/angular/angular.js/blob/9bff2ce8fb170d7a33d3ad551922d7e23e9f82fc/DEVELOPERS.md#commit-message-format
138+
139+
##### Examples
140+
141+
A feature that introduces a breaking change:
142+
143+
```
144+
feat: Support --yes CLI option
145+
146+
For existing projects all prompts can be inferred automatically.
147+
Manual confirmation for each default provides no value in that case.
148+
149+
Closes https://github.com/my/project/issues/123
150+
151+
BREAKING CHANGE: This removes support for interactive password entry.
152+
Users will have to login beforehand.
153+
```
154+
155+
A simple bug fix:
156+
157+
```
158+
fix: Handle multi-byte characters in search logic
159+
```
160+

LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright (c) 2022, Groupon, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its contributors
15+
may be used to endorse or promote products derived from this software
16+
without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28+
POSSIBILITY OF SUCH DAMAGE.

README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# GitHub CLI "bulk-pr" Extension
2+
3+
## Requirements
4+
5+
* [GitHub CLI](https://cli.github.com/)
6+
* [NodeJS](https://nodejs.org/) >= 14.x
7+
8+
## Installation
9+
10+
```
11+
$ gh extension install https://github.com/groupon/gh-bulk-pr
12+
```
13+
14+
The first time you run `gh bulk-pr` additional dependencies will be
15+
automatically installed.
16+
17+
## Usage
18+
19+
```
20+
$ gh bulk-pr --help
21+
Usage: gh bulk-pr [options] <repo...>
22+
23+
clone, edit, and open PRs against multiple repos
24+
25+
Options:
26+
-V, --version output the version number
27+
-c, --cmd-line <sh> Run given commands in a shell in the checked out repo (required)
28+
-j, --json Return output as JSON rows
29+
-a, --after-commit-cmd-line <sh> Run given commands after the -c results are committed (e.g. for
30+
post-commit tests)
31+
-C, --no-commit Assume that the commands executed will perform the commits themselves -
32+
requires --title
33+
-t, --title <t> Specify a title for the created PR (by default based on first line of the
34+
commit msg)
35+
-b, --branch <b> Specify branch name to create for PR (defaults to normalized title)
36+
-m, --commit-msg <msg> Use the given single-line commit msg
37+
-f, --commit-msg-file <path> Use the (multi-line) commit msg from the given file
38+
-p, --pr-msg-file <path> Use the PR msg from the given file; defaults to remaining lines from
39+
commit msg
40+
-d, --clone-base-dir <dir> Directory to do clones for PRs into (default:
41+
"/Users/dbushong/.local/share/gh-bulk-pr")
42+
--no-clone Use existing clone dir & branch
43+
-n, --dry-run Don't actually create branches or open the PR
44+
-h, --help display help for command
45+
```
46+
47+
This command allows you to create Bulk PRs, with repeatable commands, across
48+
a given list of PRs.
49+
50+
## Examples
51+
52+
Add a simple line to the README.md:
53+
54+
```
55+
$ gh bulk-pr \
56+
--cmd-line='echo Kilroy was here >> README.md' \
57+
--commit-msg='docs: enhance the README' \
58+
myorg/myrepo1 \
59+
myorg/myrepo2
60+
myorg/myrepo1: ran successfully in /Users/someuser/.local/share/gh-bulk-pr/myorg/myrepo1
61+
myorg/myrepo1: changes:
62+
M README.md
63+
myorg/myrepo1: opened PR: https://github.com/myorg/myrepo1/pull/650
64+
myorg/myrepo2: ran successfully in /Users/someuser/.local/share/gh-bulk-pr/myorg/myrepo2
65+
myorg/myrepo2: changes:
66+
M README.md
67+
myorg/myrepo2: opened PR: https://github.com/myorg/myrepo2/pull/47
68+
```

cli.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
require('./lib/cli.js');

gh-bulk-pr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash -e
2+
3+
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
4+
5+
if ! [ -d node_modules ]; then
6+
echo "gh bulk-pr: Performing one-time dependency installation" >&2
7+
npm ci --omit=dev
8+
fi
9+
10+
exec node lib/cli.js "$@"

lib/bulk-pr-cmd.d.ts

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)