cli: add automatic exports compatibility entry point addition to files field

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-14 17:41:04 +01:00
parent a5e66e59cb
commit 1cece75317
2 changed files with 5 additions and 0 deletions
@@ -42,6 +42,8 @@ export interface ExtendedPackageJSON extends PackageJSON {
exports?: JsonValue;
typesVersions?: Record<string, Record<string, string[]>>;
files?: string[];
}
export type ExtendedPackage = {
@@ -212,6 +212,9 @@ async function writeExportsEntryPoints(
},
{ encoding: 'utf8', spaces: 2 },
);
if (Array.isArray(pkg.files) && !pkg.files.includes(entryPoint.name)) {
pkg.files.push(entryPoint.name);
}
}
if (Object.keys(exp).length > 0) {