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

View File

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