{"size": 735, "ext": "js", "max_stars_repo_path": "packages/app-desktop/tools/copyTinyMceLangs.js", "max_stars_repo_name": "laurent22/lerna-test", "max_stars_repo_stars_event_min_datetime": "2021-07-06T23:35:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-06T23:35:17.000Z", "max_issues_repo_path": "packages/app-desktop/tools/copyTinyMceLangs.js", "max_issues_repo_name": "gvvynplaine/joplin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/app-desktop/tools/copyTinyMceLangs.js", "max_forks_repo_name": "gvvynplaine/joplin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.625, "max_line_length": 108, "alphanum_fraction": 0.6598639456}
const fs = require('fs-extra');
const glob = require('glob');
const utils = require('@joplinapp/tools/gulp/utils');

async function main() {
	const sourceDir = `${__dirname}/../../../Assets/TinyMCE/langs`;
	const destDir = `${__dirname}/../node_modules/tinymce/langs`;
	console.info(`Copying ${sourceDir} => ${destDir}`);
	await utils.copyDir(sourceDir, destDir);

	const supportedLocales = glob.sync(`${sourceDir}/*.js`).map(s => {
		s = s.split('/');
		s = s[s.length - 1];
		s = s.split('.');
		return s[0];
	});

	const content = `module.exports = ${JSON.stringify(supportedLocales, null, 2)}`;

	await fs.writeFile(`${__dirname}/../gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js`, content, 'utf8');
}

module.exports = main;
