Skip to content

Instantly share code, notes, and snippets.

View ruvasik's full-sized avatar
👁️‍🗨️
I'm looking for job

Vladimir Alekseev ruvasik

👁️‍🗨️
I'm looking for job
View GitHub Profile
@ruvasik
ruvasik / log.ts
Created February 6, 2024 09:40
Controlled window.console
export const log = ((c: Console) => {
const log = (...args: unknown[]) => {
if (!import.meta.env.PROD) c.log(...(args as any[]));
};
log.warn = (...args: unknown[]) => {
if (!import.meta.env.PROD) c.warn(...(args as any[]));
};
log.debug = (...args: (boolean | number | string | object)[]) => {
@ruvasik
ruvasik / loadEnv.js
Created May 31, 2024 14:47
Powerful loading .env* files with yarn workspaces
// loadEnv.js
const dotenv = require('dotenv');
const dotenvExpand = require('dotenv-expand').expand;
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
// Функция для загрузки и расширения .env файлов с выводом для отладки
function loadAndExpandEnv(envPaths) {
envPaths.forEach(envPath => {