feat: support multiple projects in one config
This commit is contained in:
parent
c2d54aa195
commit
0edbdea7d1
|
@ -0,0 +1,20 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [GithubRemote](./cautious-journey.githubremote.md) > [(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) | |
|
||||
|
|
@ -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 |
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [GitlabRemote](./cautious-journey.gitlabremote.md) > [(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) | |
|
||||
|
|
@ -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 |
|
||||
|
|
|
@ -5,6 +5,7 @@ import { RemoteOptions } from '../remote';
|
|||
* Config data for the app, loaded from CLI or DOM.
|
||||
*/
|
||||
export interface ConfigData {
|
||||
projects: Array<{
|
||||
/**
|
||||
* Color palette for labels without their own.
|
||||
*/
|
||||
|
@ -15,15 +16,21 @@ export interface ConfigData {
|
|||
*/
|
||||
flags: Array<FlagLabel>;
|
||||
|
||||
/**
|
||||
* Project name or path.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Remote APIs.
|
||||
*/
|
||||
remotes: Array<RemoteOptions>;
|
||||
remote: RemoteOptions;
|
||||
|
||||
/**
|
||||
* Grouped state labels.
|
||||
*/
|
||||
states: Array<StateLabel>;
|
||||
}>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,9 +40,15 @@ export interface ConfigData {
|
|||
*/
|
||||
export function initConfig(): ConfigData {
|
||||
return {
|
||||
projects: [{
|
||||
colors: [],
|
||||
flags: [],
|
||||
remotes: [],
|
||||
name: '',
|
||||
remote: {
|
||||
data: {},
|
||||
type: '',
|
||||
},
|
||||
states: [],
|
||||
}],
|
||||
};
|
||||
}
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -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 = {
|
||||
const config: ConfigData = {
|
||||
projects: [{
|
||||
colors: [],
|
||||
flags: [],
|
||||
remotes: [],
|
||||
name: '',
|
||||
remote: {
|
||||
data: {},
|
||||
type: '',
|
||||
},
|
||||
states: [],
|
||||
}],
|
||||
};
|
||||
|
||||
/* eslint-disable-next-line no-console */
|
||||
|
|
Loading…
Reference in New Issue