2024-05-11 15:50:05 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import yargs from 'yargs';
|
2024-12-25 14:34:46 +01:00
|
|
|
import { hideBin } from 'yargs/helpers';
|
2025-02-17 02:45:02 +01:00
|
|
|
import { createTranslationChangelog } from './TranslationChangelog.utils.ts';
|
|
|
|
|
import { TRANSLATION_CHANGELOG_YARG_OPTIONS_DEFAULT } from '../weblate/Weblate.constants.ts';
|
2024-05-28 14:24:13 +02:00
|
|
|
|
2024-12-25 14:34:46 +01:00
|
|
|
const { afterDate, beforeDate, requiredContributionCount, keepKnownContributors } = yargs(hideBin(process.argv))
|
2024-05-11 15:50:05 +02:00
|
|
|
.options({
|
|
|
|
|
afterDate: {
|
2024-05-28 14:04:15 +02:00
|
|
|
alias: 'ad',
|
2024-05-11 15:50:05 +02:00
|
|
|
description: 'IS0-8601 formatted date (included) (e.g. 2024-05-01)',
|
|
|
|
|
type: 'string',
|
|
|
|
|
demandOption: true,
|
|
|
|
|
},
|
|
|
|
|
beforeDate: {
|
2024-05-28 14:04:15 +02:00
|
|
|
alias: 'bd',
|
2024-05-11 15:50:05 +02:00
|
|
|
description: 'IS0-8601 formatted date (excluded) (e.g. 2024-05-11)',
|
|
|
|
|
type: 'string',
|
|
|
|
|
demandOption: true,
|
|
|
|
|
},
|
2024-05-28 14:04:15 +02:00
|
|
|
requiredContributionCount: {
|
|
|
|
|
alias: 'rcc',
|
|
|
|
|
description: 'The minimum number of contributions for a language to be considered a contributor',
|
|
|
|
|
type: 'number',
|
2025-02-09 23:32:40 +01:00
|
|
|
default: TRANSLATION_CHANGELOG_YARG_OPTIONS_DEFAULT.requiredContributionCount,
|
2024-05-28 14:04:15 +02:00
|
|
|
},
|
|
|
|
|
keepKnownContributors: {
|
|
|
|
|
alias: 'kc',
|
|
|
|
|
description: 'Ignore "requiredContributionCount" for known contributors of a language',
|
|
|
|
|
type: 'boolean',
|
2025-02-09 23:32:40 +01:00
|
|
|
default: TRANSLATION_CHANGELOG_YARG_OPTIONS_DEFAULT.keepKnownContributors,
|
2024-05-28 14:04:15 +02:00
|
|
|
},
|
2024-05-11 15:50:05 +02:00
|
|
|
})
|
|
|
|
|
.parseSync();
|
|
|
|
|
|
|
|
|
|
if (!afterDate || !beforeDate) {
|
|
|
|
|
throw new Error('The timespan (afterDate and beforeDate) has to be passed!');
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-09 23:32:40 +01:00
|
|
|
createTranslationChangelog(afterDate, beforeDate, requiredContributionCount, keepKnownContributors).then(console.log);
|