mirror of https://github.com/grafana/grafana
Build: Adds a fallback script to fix package.json main and types fields before packaging (#59628)
parent
798a8ceb9c
commit
0a9b238d39
@ -0,0 +1,21 @@ |
|||||||
|
const fs = require('fs'); |
||||||
|
|
||||||
|
const cwd = process.cwd(); |
||||||
|
const packageJson = require(`${cwd}/package.json`); |
||||||
|
|
||||||
|
const newPackageJson = { |
||||||
|
...packageJson, |
||||||
|
main: packageJson.publishConfig?.main ?? packageJson.main, |
||||||
|
}; |
||||||
|
|
||||||
|
if (packageJson.publishConfig?.types) { |
||||||
|
newPackageJson.types = packageJson.publishConfig.types; |
||||||
|
} |
||||||
|
|
||||||
|
if (packageJson.publishConfig?.module) { |
||||||
|
newPackageJson.module = packageJson.publishConfig.module; |
||||||
|
} |
||||||
|
|
||||||
|
try { |
||||||
|
fs.writeFileSync(`${cwd}/package.json`, JSON.stringify(newPackageJson, null, 2)); |
||||||
|
} catch (e) {} |
Loading…
Reference in new issue