1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/packages/generator-joplin/tools/updateCategories.ts

21 lines
677 B
TypeScript

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();