simplify exports
Some checks failed
Distribution check / Generated files check (push) Failing after -2m1s
NPM Audit Check / Check NPM audit (push) Successful in -2m10s
Unit tests / Unit tests (latest) (push) Successful in -2m0s
Unit tests / Unit tests (lts/*) (push) Successful in -2m0s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m59s

This commit is contained in:
2025-11-07 00:13:00 -05:00
parent 6c1e088d7f
commit 6d8f1d007d
4 changed files with 11 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
import fsp from 'fs/promises';
import * as YAML from 'yaml';
async function parse(previous, current) {
export async function parse(previous, current) {
const prev = await tryRead(previous);
const curr = await tryRead(current);
const actions = curr?.actions;
@@ -45,7 +45,7 @@ function isAdd(actions) {
function isMove(actions) {
return !!(actions.removeRepo && actions.addRepo);
}
async function tryRead(file) {
export async function tryRead(file) {
try {
const contents = await fsp.readFile(file, { encoding: 'utf-8' });
return YAML.parse(contents);
@@ -54,5 +54,4 @@ async function tryRead(file) {
return null;
}
}
export { parse, tryRead };
//# sourceMappingURL=pkgbase.js.map

File diff suppressed because one or more lines are too long

View File

@@ -2,14 +2,14 @@ import { type PathLike } from 'fs';
import fsp from 'fs/promises';
import * as YAML from 'yaml';
interface PackageInfo {
export interface PackageInfo {
package: string;
repository: string;
version: string;
architecture: string;
}
interface Actions {
export interface Actions {
addRepo: string | null;
removeRepo: string | null;
triggersBuild: boolean;
@@ -19,20 +19,20 @@ interface Actions {
triggersNoCheck: boolean;
}
interface Result {
export interface Result {
build: boolean;
move: PackageInfo[];
delete: PackageInfo[];
actions: Actions;
}
interface RepoContents {
export interface RepoContents {
version: string | null;
packages: string[];
debug: string[];
}
interface PkgBase {
export interface PkgBase {
actions: Actions;
team: string;
repos: {
@@ -51,7 +51,7 @@ interface PkgBase {
}
}
async function parse(previous: PathLike, current: PathLike): Promise<Result> {
export async function parse(previous: PathLike, current: PathLike): Promise<Result> {
const prev = await tryRead(previous);
const curr = await tryRead(current);
const actions = curr?.actions;
@@ -104,7 +104,7 @@ function isMove(actions: Actions): boolean {
return !!(actions.removeRepo && actions.addRepo);
}
async function tryRead(file: PathLike): Promise<PkgBase | null> {
export async function tryRead(file: PathLike): Promise<PkgBase | null> {
try {
const contents = await fsp.readFile(file, { encoding: 'utf-8' });
return YAML.parse(contents);
@@ -113,6 +113,3 @@ async function tryRead(file: PathLike): Promise<PkgBase | null> {
return null;
}
}
export { parse, tryRead };
export type { Actions, Result, RepoContents, PkgBase, PackageInfo };

View File

@@ -15,7 +15,7 @@ interface PackageFile {
sha512: string
};
async function main() {
export async function main() {
const mode = core.getInput('mode', { required: true }).toLocaleLowerCase() as Mode;
if (mode === 'parse') {
@@ -67,5 +67,3 @@ async function doParse() {
const diff = await parse(previous, current);
core.setOutput('parsed-data', JSON.stringify(diff));
}
export { main };