1
0
Fork 0

feat: support multiple projects in one config

This commit is contained in:
ssube 2020-08-12 00:12:57 -05:00
parent c2d54aa195
commit 0edbdea7d1
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
6 changed files with 97 additions and 25 deletions

View File

@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GithubRemote](./cautious-journey.githubremote.md) &gt; [(constructor)](./cautious-journey.githubremote._constructor_.md)
## GithubRemote.(constructor)
Constructs a new instance of the `GithubRemote` class
<b>Signature:</b>
```typescript
constructor(options: RemoteOptions);
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [RemoteOptions](./cautious-journey.remoteoptions.md) | |

View File

@ -13,6 +13,12 @@ export declare class GithubRemote implements Remote
``` ```
<b>Implements:</b> [Remote](./cautious-journey.remote.md) <b>Implements:</b> [Remote](./cautious-journey.remote.md)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(options)](./cautious-journey.githubremote._constructor_.md) | | Constructs a new instance of the <code>GithubRemote</code> class |
## Methods ## Methods
| Method | Modifiers | Description | | Method | Modifiers | Description |

View File

@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [cautious-journey](./cautious-journey.md) &gt; [GitlabRemote](./cautious-journey.gitlabremote.md) &gt; [(constructor)](./cautious-journey.gitlabremote._constructor_.md)
## GitlabRemote.(constructor)
Constructs a new instance of the `GitlabRemote` class
<b>Signature:</b>
```typescript
constructor(options: RemoteOptions);
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| options | [RemoteOptions](./cautious-journey.remoteoptions.md) | |

View File

@ -13,6 +13,12 @@ export declare class GitlabRemote implements Remote
``` ```
<b>Implements:</b> [Remote](./cautious-journey.remote.md) <b>Implements:</b> [Remote](./cautious-journey.remote.md)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(options)](./cautious-journey.gitlabremote._constructor_.md) | | Constructs a new instance of the <code>GitlabRemote</code> class |
## Methods ## Methods
| Method | Modifiers | Description | | Method | Modifiers | Description |

View File

@ -5,25 +5,32 @@ import { RemoteOptions } from '../remote';
* Config data for the app, loaded from CLI or DOM. * Config data for the app, loaded from CLI or DOM.
*/ */
export interface ConfigData { export interface ConfigData {
/** projects: Array<{
* Color palette for labels without their own. /**
*/ * Color palette for labels without their own.
colors: Array<string>; */
colors: Array<string>;
/** /**
* Individual flag labels. * Individual flag labels.
*/ */
flags: Array<FlagLabel>; flags: Array<FlagLabel>;
/** /**
* Remote APIs. * Project name or path.
*/ */
remotes: Array<RemoteOptions>; name: string;
/** /**
* Grouped state labels. * Remote APIs.
*/ */
states: Array<StateLabel>; remote: RemoteOptions;
/**
* Grouped state labels.
*/
states: Array<StateLabel>;
}>;
} }
/** /**
@ -33,9 +40,15 @@ export interface ConfigData {
*/ */
export function initConfig(): ConfigData { export function initConfig(): ConfigData {
return { return {
colors: [], projects: [{
flags: [], colors: [],
remotes: [], flags: [],
states: [], name: '',
remote: {
data: {},
type: '',
},
states: [],
}],
}; };
} }

View File

@ -1,5 +1,6 @@
import { InvalidArgumentError } from '@apextoaster/js-utils'; import { InvalidArgumentError } from '@apextoaster/js-utils';
import { ConfigData } from './config';
import { Commands, createParser } from './config/args'; import { Commands, createParser } from './config/args';
import { GithubRemote } from './remote/github'; import { GithubRemote } from './remote/github';
import { syncIssues, syncLabels, SyncOptions } from './sync'; import { syncIssues, syncLabels, SyncOptions } from './sync';
@ -21,11 +22,17 @@ export async function main(argv: Array<string>): Promise<number> {
const args = parser.parse(argv.slice(SLICE_ARGS)); const args = parser.parse(argv.slice(SLICE_ARGS));
// load config // load config
const config = { const config: ConfigData = {
colors: [], projects: [{
flags: [], colors: [],
remotes: [], flags: [],
states: [], name: '',
remote: {
data: {},
type: '',
},
states: [],
}],
}; };
/* eslint-disable-next-line no-console */ /* eslint-disable-next-line no-console */