/
alt3rmann
/
n8n
Обзор
Документация
Войти
/
alt3rmann
/
n8n
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/reset.mjs
34 строки
1021 B
Irénée
chore: Add option to reset command to skip the confirmation question (#21369)
30 окт 2025, 12:58
Не верифицирован
30 окт 2025, 12:58
b63a64a
Код
Авторство
О чём код?
// Resets the repository by deleting all untracked files except for few exceptions. import { $, argv, echo, fs } from 'zx'; $.verbose = true; process.env.FORCE_COLOR = '1'; const excludePatterns = ['/.vscode/', '/.idea/', '.env', '/.claude/']; const excludeFlags = excludePatterns.map((exclude) => ['-e', exclude]).flat(); echo( `This will delete all untracked files except for those matching the following patterns: ${excludePatterns.map((x) => `"${x}"`).join(', ')}.`, ); const skipConfirmation = argv.force || argv.f; if (!skipConfirmation) { const answer = await question('❓ Do you want to continue? (y/n) '); if (!['y', 'Y', ''].includes(answer)) { echo('Aborting...'); process.exit(0); } } echo('🧹 Cleaning untracked files...'); await $({ verbose: false })`git clean -fxd ${excludeFlags}`; // In case node_modules is not removed by git clean fs.removeSync('node_modules'); echo('⏬ Running pnpm install...'); await $`pnpm install`; echo('🏗️ Running pnpm build...'); await $`pnpm build`;