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)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(options)](./cautious-journey.githubremote._constructor_.md) | | Constructs a new instance of the <code>GithubRemote</code> class |
## Methods
| 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)
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(options)](./cautious-journey.gitlabremote._constructor_.md) | | Constructs a new instance of the <code>GitlabRemote</code> class |
## Methods
| Method | Modifiers | Description |

View File

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

View File

@ -1,5 +1,6 @@
import { InvalidArgumentError } from '@apextoaster/js-utils';
import { ConfigData } from './config';
import { Commands, createParser } from './config/args';
import { GithubRemote } from './remote/github';
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));
// load config
const config = {
colors: [],
flags: [],
remotes: [],
states: [],
const config: ConfigData = {
projects: [{
colors: [],
flags: [],
name: '',
remote: {
data: {},
type: '',
},
states: [],
}],
};
/* eslint-disable-next-line no-console */