Skip to content

Commit d6ff95f

Browse files
committedFeb 10, 2018
git-node: add metadata command
This commit now allows user to use `git node metadata` to retrieve and validate metadata
1 parent e91ab64 commit d6ff95f

File tree

4 files changed

+32
-15
lines changed

4 files changed

+32
-15
lines changed
 

‎bin/get-metadata

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const argv = require('../lib/args')();
5-
const getMetadata = require('../components/metadata');
6-
const CLI = require('../lib/cli');
4+
const path = require('path');
5+
const { runAsync } = require('../lib/run');
76

8-
const logStream = process.stdout.isTTY ? process.stdout : process.stderr;
9-
const cli = new CLI(logStream);
10-
11-
getMetadata(argv, cli).catch((err) => {
12-
if (cli.spinner.enabled) {
13-
cli.spinner.fail();
14-
}
15-
cli.error(err);
16-
process.exit(-1);
17-
});
7+
const script = path.join(
8+
__dirname, '..', 'components', 'git', 'git-node-metadata');
9+
runAsync(script, process.argv.slice(2));

‎components/git/git-node-help

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#!/usr/bin/env node
22

33
console.log(`
4+
Steps to get metadata for a pull request:
5+
==============================================================================
6+
$ cd path/to/node/project
7+
$ git node metadata $PRID # Retrieves metadata for a PR and validates
8+
# them against nodejs/node PR rules
9+
==============================================================================
10+
411
Steps to land a pull request:
512
==============================================================================
613
$ cd path/to/node/project

‎components/git/git-node-metadata

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
const argv = require('../../lib/args')();
5+
const getMetadata = require('../metadata');
6+
const CLI = require('../../lib/cli');
7+
const config = require('../../lib/config').getMergedConfig();
8+
9+
const logStream = process.stdout.isTTY ? process.stdout : process.stderr;
10+
const cli = new CLI(logStream);
11+
12+
getMetadata(Object.assign({}, config, argv), cli).catch((err) => {
13+
if (cli.spinner.enabled) {
14+
cli.spinner.fail();
15+
}
16+
cli.error(err);
17+
process.exit(-1);
18+
});

‎docs/git-node.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# git-node
22

3-
A custom Git command for landing pull requests. You can run it as
3+
A custom Git command for managing pull requests. You can run it as
44
`git-node` or `git node`. To see the help text, run `git node help`.
55

66
### Prerequistes
@@ -19,7 +19,7 @@ A custom Git command for landing pull requests. You can run it as
1919
```
2020
$ cd path/to/node/project
2121
$ ncu-config set upstream your-remote-name
22-
$ ncu-config set branch your-branch-name
22+
$ ncu-config set branch your-branch-name
2323
```
2424
2525
### Demo & Usage

0 commit comments

Comments
 (0)
Please sign in to comment.