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

Prevents cases like #8953
v1.18.x
Peter Jaszkowiak 4 years ago committed by GitHub
parent e1432caf92
commit ba3981e270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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';

Loading…
Cancel
Save