Rename the script

This commit is contained in:
Hung Viet Nguyen 2022-03-14 22:51:49 +07:00
parent 88149c1e3b
commit 5104a57447
No known key found for this signature in database
GPG Key ID: CAFDC50535B4A074
2 changed files with 6 additions and 4 deletions

View File

@ -1,11 +1,13 @@
'use strict';
const fs = require('fs-extra');
const { addMissingKeyForSingleFile } = require('../add-missing-keys-to-other-languages');
const { addMissingKeyForSingleFile } = require('../add-missing-keys-to-other-language');
// Do not run this test in --watch mode.
// Since `addMissingKeyForSingleFile` makes changes to the files (`en.json`, `vi.json`),
// accidentally triggering this test to re-run infinite times (because of jest watch mode)
// You can use run `yarn test:unit scripts/front/__tests__/add-missing-keys-to-other-language.test.js`
// if you want to focus on this test.
describe('addMissingKeyForSingleFile', () => {
it('should add missing keys from en.json to translation file', async () => {
const TARGET_TRANSLATION_FILE_PATH = 'scripts/front/__tests__/vi.json';

View File

@ -1,9 +1,9 @@
// Add missing keys to non-english languages from `en.json`.
// This script eases the process of translating strapi to other languages.
// Usage:
// node scripts/front/add-missing-keys-to-other-languages.js [language]
// node scripts/front/add-missing-keys-to-other-language.js [language]
// Example:
// node scripts/front/add-missing-keys-to-other-languages.js vi
// node scripts/front/add-missing-keys-to-other-language.js vi
'use strict';
const { join, dirname } = require('path');
@ -61,7 +61,7 @@ const addMissingKeys = async (lang) => {
if (process.argv.length < 3) {
console.warn(
chalk.yellow(
'Please provide a language. For example:\nnode scripts/front/add-missing-keys-to-other-languages.js vi'
'Please provide a language. For example:\nnode scripts/front/add-missing-keys-to-other-language.js vi'
)
);
process.exit(1);