feat(sync): use config labels per project
This commit is contained in:
parent
28c9ee8865
commit
41be935a2f
|
@ -1,11 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [config](./cautious-journey.syncoptions.config.md)
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [flags](./cautious-journey.syncoptions.flags.md)
|
||||
|
||||
## SyncOptions.config property
|
||||
## SyncOptions.flags property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
config: ConfigData;
|
||||
flags: Array<FlagLabel>;
|
||||
```
|
|
@ -14,7 +14,8 @@ export interface SyncOptions
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [config](./cautious-journey.syncoptions.config.md) | ConfigData | |
|
||||
| [flags](./cautious-journey.syncoptions.flags.md) | Array<[FlagLabel](./cautious-journey.flaglabel.md)<!-- -->> | |
|
||||
| [project](./cautious-journey.syncoptions.project.md) | string | |
|
||||
| [remote](./cautious-journey.syncoptions.remote.md) | [Remote](./cautious-journey.remote.md) | |
|
||||
| [states](./cautious-journey.syncoptions.states.md) | Array<[StateLabel](./cautious-journey.statelabel.md)<!-- -->> | |
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [cautious-journey](./cautious-journey.md) > [SyncOptions](./cautious-journey.syncoptions.md) > [states](./cautious-journey.syncoptions.states.md)
|
||||
|
||||
## SyncOptions.states property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
states: Array<StateLabel>;
|
||||
```
|
|
@ -68,6 +68,10 @@ export interface StateLabel extends BaseLabel, LabelSet {
|
|||
values: Array<StateValue>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the set of unique names for a list of flags and a list of states, with all state values
|
||||
* qualified and included.
|
||||
*/
|
||||
export function getLabelNames(flags: Array<FlagLabel>, states: Array<StateLabel>): Set<string> {
|
||||
const labels = [];
|
||||
|
||||
|
|
|
@ -62,9 +62,10 @@ export async function main(argv: Array<string>): Promise<number> {
|
|||
|
||||
// mode switch
|
||||
const options: SyncOptions = {
|
||||
config,
|
||||
flags: project.flags,
|
||||
project: project.name,
|
||||
remote,
|
||||
states: project.states,
|
||||
};
|
||||
switch (mode) {
|
||||
case Commands.ISSUES:
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { ConfigData } from './config';
|
||||
import { getLabelNames } from './labels';
|
||||
import { FlagLabel, getLabelNames, StateLabel } from './labels';
|
||||
import { Remote } from './remote';
|
||||
|
||||
// TODO: turn this back on/remove the disable pragma
|
||||
/* eslint-disable no-console */
|
||||
|
||||
export interface SyncOptions {
|
||||
config: ConfigData;
|
||||
flags: Array<FlagLabel>;
|
||||
project: string;
|
||||
remote: Remote;
|
||||
states: Array<StateLabel>;
|
||||
}
|
||||
|
||||
export async function syncIssues(options: SyncOptions): Promise<unknown> {
|
||||
|
@ -29,7 +29,7 @@ export async function syncLabels(options: SyncOptions): Promise<unknown> {
|
|||
});
|
||||
|
||||
const existingLabels = new Set(labels.map((l) => l.name));
|
||||
const expectedLabels = getLabelNames(options.config.projects[0].flags, options.config.projects[0].states);
|
||||
const expectedLabels = getLabelNames(options.flags, options.states);
|
||||
|
||||
for (const label of labels) {
|
||||
const exists = existingLabels.has(label.name);
|
||||
|
|
Loading…
Reference in New Issue