fix: use package.name for theme.id (#8965)

Prevents cases like #8953
This commit is contained in:
Peter Jaszkowiak
2020-11-26 14:59:23 -07:00
committed by GitHub
parent e1432caf92
commit ba3981e270

View File

@@ -25,9 +25,16 @@ Themes.get = async () => {
themes = _.flatten(themes).filter(Boolean);
themes = await Promise.all(themes.map(async (theme) => {
const config = path.join(themePath, theme, 'theme.json');
const pack = path.join(themePath, theme, 'package.json');
try {
const file = await fs.promises.readFile(config, 'utf8');
const configObj = JSON.parse(file);
const [configFile, packageFile] = await Promise.all([
fs.promises.readFile(config, 'utf8'),
fs.promises.readFile(pack, 'utf8'),
]);
const configObj = JSON.parse(configFile);
const packageObj = JSON.parse(packageFile);
configObj.id = packageObj.name;
// Minor adjustments for API output
configObj.type = 'local';