1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00

Generator: Better handling of package.json keywords

This commit is contained in:
Laurent Cozic
2021-01-04 19:32:30 +00:00
parent 330ef6f7e6
commit 4a258a2427

View File

@@ -9,7 +9,14 @@ function mergePackageKey(parentKey, source, dest) {
const output = Object.assign({}, dest);
for (const k in source) {
if (!(k in output)) {
if (k === 'keywords' && !Array.isArray(output[k])) {
// Fix an earlier bugs where keywords were set to an empty object
output[k] = source[k];
} else if (k === 'keywords') {
// For keywords, make sure to add the "joplin-plugin" one
if (!output['keywords']) output['keywords'] = [];
if (output['keywords'].indexOf('joplin-plugin') < 0) output['keywords'].push('joplin-plugin');
} else if (!(k in output)) {
// If the key doesn't exist in the destination, add it
output[k] = source[k];
} else if (parentKey === 'devDependencies') {