1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/generator-joplin/tools/updateCategories.ts

21 lines
677 B
TypeScript
Raw Normal View History

import { dirname } from 'path';
import { insertContentIntoFile } from '@joplin/tools/tool-utils';
const allCategories = require('@joplin/lib/pluginCategories.json');
const updateCategories = async () => {
const buildScriptPath = `${dirname(__dirname)}/generators/app/templates/webpack.config.js`;
const possibleCategoriesJson = JSON.stringify(allCategories).replace(/["]/g, '\'');
const possibleCategoriesLine = `const allPossibleCategories = ${possibleCategoriesJson};`;
await insertContentIntoFile(
buildScriptPath,
'// AUTO-GENERATED by updateCategories\n',
'\n// AUTO-GENERATED by updateCategories',
possibleCategoriesLine,
);
};
void updateCategories();