Fix the linking script
This commit is contained in:
parent
3998cc7f8b
commit
92f2c9857e
@ -9,40 +9,30 @@ const singletonDependencies: string[] = ["react", "@types/react"];
|
|||||||
const rootDirPath = getThisCodebaseRootDirPath();
|
const rootDirPath = getThisCodebaseRootDirPath();
|
||||||
|
|
||||||
//NOTE: This is only required because of: https://github.com/garronej/ts-ci/blob/c0e207b9677523d4ec97fe672ddd72ccbb3c1cc4/README.md?plain=1#L54-L58
|
//NOTE: This is only required because of: https://github.com/garronej/ts-ci/blob/c0e207b9677523d4ec97fe672ddd72ccbb3c1cc4/README.md?plain=1#L54-L58
|
||||||
fs.writeFileSync(
|
{
|
||||||
pathJoin(rootDirPath, "dist", "package.json"),
|
let modifiedPackageJsonContent = fs
|
||||||
Buffer.from(
|
.readFileSync(pathJoin(rootDirPath, "package.json"))
|
||||||
JSON.stringify(
|
.toString("utf8");
|
||||||
(() => {
|
|
||||||
const packageJsonParsed = JSON.parse(
|
|
||||||
fs
|
|
||||||
.readFileSync(pathJoin(rootDirPath, "package.json"))
|
|
||||||
.toString("utf8")
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
modifiedPackageJsonContent = (() => {
|
||||||
...packageJsonParsed,
|
const o = JSON.parse(modifiedPackageJsonContent);
|
||||||
main: packageJsonParsed["main"]?.replace(/^dist\//, ""),
|
|
||||||
types: packageJsonParsed["types"]?.replace(/^dist\//, ""),
|
delete o.files;
|
||||||
module: packageJsonParsed["module"]?.replace(/^dist\//, ""),
|
|
||||||
exports: !("exports" in packageJsonParsed)
|
return JSON.stringify(o, null, 2);
|
||||||
? undefined
|
})();
|
||||||
: Object.fromEntries(
|
|
||||||
Object.entries(packageJsonParsed["exports"]).map(
|
modifiedPackageJsonContent = modifiedPackageJsonContent
|
||||||
([key, value]) => [
|
.replace(/"dist\//g, '"')
|
||||||
key,
|
.replace(/"\.\/dist\//g, '"./')
|
||||||
(value as string).replace(/^\.\/dist\//, "./")
|
.replace(/"!dist\//g, '"!')
|
||||||
]
|
.replace(/"!\.\/dist\//g, '"!./');
|
||||||
)
|
|
||||||
)
|
fs.writeFileSync(
|
||||||
};
|
pathJoin(rootDirPath, "dist", "package.json"),
|
||||||
})(),
|
Buffer.from(modifiedPackageJsonContent, "utf8")
|
||||||
null,
|
);
|
||||||
2
|
}
|
||||||
),
|
|
||||||
"utf8"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
const commonThirdPartyDeps = (() => {
|
const commonThirdPartyDeps = (() => {
|
||||||
// For example [ "@emotion" ] it's more convenient than
|
// For example [ "@emotion" ] it's more convenient than
|
||||||
|
Loading…
x
Reference in New Issue
Block a user