/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/localize/tools/src/migrate/cli.ts
56 строк
1 KB
Alan Agius
refactor: replace `fast-glob` usage with `tinyglobby` (#60264)
07 мар 2025, 21:57
07 мар 2025, 21:57
45f899a
Код
Авторство
О чём код?
#!/usr/bin/env node /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import { ConsoleLogger, LogLevel, NodeJSFileSystem, setFileSystem, } from '@angular/compiler-cli/private/localize'; import {globSync} from 'tinyglobby'; import yargs from 'yargs'; import {migrateFiles} from './index'; const args = process.argv.slice(2); const options = yargs(args) .option('r', { alias: 'root', default: '.', describe: 'The root path for other paths provided in these options.\n' + 'This should either be absolute or relative to the current working directory.', type: 'string', }) .option('f', { alias: 'files', required: true, describe: 'A glob pattern indicating what files to migrate. This should be relative to the root path', type: 'string', }) .option('m', { alias: 'mapFile', required: true, describe: 'Path to the migration mapping file generated by `localize-extract`. This should be relative to the root path.', type: 'string', }) .strict() .help() .parseSync(); const fs = new NodeJSFileSystem(); setFileSystem(fs); const rootPath = options.r; const translationFilePaths = globSync(options.f, {cwd: rootPath, onlyFiles: true}); const logger = new ConsoleLogger(LogLevel.warn); migrateFiles({rootPath, translationFilePaths, mappingFilePath: options.m, logger}); process.exit(0);