1
0
Fork 0

feat(main): add project option, use to filter project sync

This commit is contained in:
ssube 2020-08-15 09:52:08 -05:00
parent 7bb4e95875
commit e4ab01ad10
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
8 changed files with 30 additions and 18 deletions

View File

@ -9,7 +9,7 @@ Individual labels: the equivalent of a checkbox.
<b>Signature:</b>
```typescript
export interface FlagLabel extends BaseLabel, LabelSet
export interface FlagLabel extends BaseLabel, ChangeSet
```
<b>Extends:</b> BaseLabel, LabelSet
<b>Extends:</b> BaseLabel, ChangeSet

View File

@ -9,9 +9,9 @@ The transition between two state values.
<b>Signature:</b>
```typescript
export interface StateChange extends LabelSet
export interface StateChange extends ChangeSet
```
<b>Extends:</b> LabelSet
<b>Extends:</b> ChangeSet
## Properties

View File

@ -9,9 +9,9 @@ Grouped labels: the equivalent of a radio group.
<b>Signature:</b>
```typescript
export interface StateLabel extends BaseLabel, LabelSet
export interface StateLabel extends BaseLabel, ChangeSet
```
<b>Extends:</b> BaseLabel, LabelSet
<b>Extends:</b> BaseLabel, ChangeSet
## Properties

View File

@ -21,9 +21,9 @@ This guide explains how to start using `cautious-journey` to manage project and
- [Commands](#commands)
- [Sync Labels](#sync-labels)
- [Sync Issues](#sync-issues)
- [Transitions](#transitions)
- [Flag Transitions](#flag-transitions)
- [State Transitions](#state-transitions)
- [Changes](#changes)
- [Flag Changes](#flag-changes)
- [State Changes](#state-changes)
## Setup
@ -83,12 +83,12 @@ TODO: what happens when you sync the project labels?
TODO: what happens when you sync the issue labels?
## Transitions
## Changes
### Flag Transitions
### Flag Changes
TODO: how are flag labels added and removed?
### State Transitions
### State Changes
TODO: how are state labels added and removed?

View File

@ -15,6 +15,7 @@ interface Parser<TData> {
export interface ParsedArgs {
config: string;
dryrun: boolean;
project?: Array<string>;
remote: string;
}
@ -45,6 +46,12 @@ export function createParser(modeset: Modeback): Parser<ParsedArgs> {
demand: false,
type: 'boolean',
},
project: {
alias: ['p'],
array: true,
demand: false,
type: 'string',
},
remote: {
alias: ['r'],
demand: true,

View File

@ -8,7 +8,7 @@ export interface LabelRef {
/**
* A set of labels to add and/or remove.
*/
export interface LabelSet {
export interface ChangeSet {
adds: Array<LabelRef>;
removes: Array<LabelRef>;
}
@ -34,14 +34,14 @@ export interface BaseLabel {
/**
* Individual labels: the equivalent of a checkbox.
*/
export interface FlagLabel extends BaseLabel, LabelSet {
export interface FlagLabel extends BaseLabel, ChangeSet {
/* empty */
}
/**
* The transition between two state values.
*/
export interface StateChange extends LabelSet {
export interface StateChange extends ChangeSet {
/**
* Required labels for this state change to occur.
*/
@ -61,7 +61,7 @@ export interface StateValue extends BaseLabel {
/**
* Grouped labels: the equivalent of a radio group.
*/
export interface StateLabel extends BaseLabel, LabelSet {
export interface StateLabel extends BaseLabel, ChangeSet {
/**
* Values for this state.
*/

View File

@ -1,4 +1,4 @@
import { InvalidArgumentError, isNil } from '@apextoaster/js-utils';
import { InvalidArgumentError, isNil, doesExist } from '@apextoaster/js-utils';
import { createSchema } from '@apextoaster/js-yaml-schema';
import { existsSync, readFileSync, realpathSync } from 'fs';
import { DEFAULT_SAFE_SCHEMA, safeLoad } from 'js-yaml';
@ -57,6 +57,11 @@ export async function main(argv: Array<string>): Promise<number> {
}, 'startup environment');
for (const project of config.projects) {
if (doesExist(args.project) && !args.project.includes(project.name)) {
logger.info({ project: project.name }, 'skipping project');
continue;
}
const remote = new GithubRemote({
...project.remote,
dryrun: args.dryrun,

View File

@ -18,7 +18,7 @@ export class GithubRemote implements Remote {
constructor(options: RemoteOptions) {
this.options = options;
options.logger.debug({ options }, 'github remote');
options.logger.debug(options, 'github remote');
}
public async connect() {