Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
!/cjs/**/*
!/esm/**/*
!/types/**/*
!/types-ts3.8/**/*
1 change: 1 addition & 0 deletions packages/gatsby/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
!/cjs/**/*
!/esm/**/*
!/types/**/*
!/types-ts3.8/**/*

# Gatsby specific
!gatsby-browser.js
Expand Down
15 changes: 9 additions & 6 deletions scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const buildDir = packageWithBundles ? NPM_BUILD_DIR : BUILD_DIR;

type PackageJsonEntryPoints = Record<typeof ENTRY_POINTS[number], string>;

interface TypeVersions {
[key: string]: {
[key: string]: string[];
};
};

interface PackageJson extends Record<string, unknown>, PackageJsonEntryPoints {
[EXPORT_MAP_ENTRY_POINT]: {
[key: string]: {
Expand All @@ -31,11 +37,7 @@ interface PackageJson extends Record<string, unknown>, PackageJsonEntryPoints {
types: string;
};
};
[TYPES_VERSIONS_ENTRY_POINT]: {
[key: string]: {
[key: string]: string[];
};
};
[TYPES_VERSIONS_ENTRY_POINT]: TypeVersions;
}

// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -81,7 +83,8 @@ if (newPkgJson[EXPORT_MAP_ENTRY_POINT]) {
if (newPkgJson[TYPES_VERSIONS_ENTRY_POINT]) {
Object.entries(newPkgJson[TYPES_VERSIONS_ENTRY_POINT]).forEach(([key, val]) => {
newPkgJson[TYPES_VERSIONS_ENTRY_POINT][key] = Object.entries(val).reduce((acc, [key, val]) => {
return { ...acc, [key]: val.map(v => v.replace(`${buildDir}/`, '')) };
const newKey = key.replace(`${buildDir}/`, '');
return { ...acc, [newKey]: val.map(v => v.replace(`${buildDir}/`, '')) };
}, {});
});
}
Expand Down