{"_id":"@bambiste/mix-env","name":"@bambiste/mix-env","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bambiste/mix-env","version":"0.1.0","description":"Sync .env files to/from GitHub Actions secrets across a monorepo — push local env files up as secrets, and materialize them back into files (locally, in CI, or on a VPS).","private":false,"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","bin":{"mix-env":"dist/lib/cli.js"},"exports":{"./package.json":"./package.json",".":{"development":"./src/index.ts","types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"dependencies":{"chalk":"^5.6.2","fast-glob":"^3.3.3","inquirer":"^13.1.0","tslib":"^2.3.0"},"devDependencies":{"@types/node":"^22.0.0","vitest":"^3.0.0"},"license":"MIT","scripts":{"build":"tsc -p tsconfig.lib.json","test":"vitest"},"_id":"@bambiste/mix-env@0.1.0","_integrity":"sha512-O08m4yeyRCdeLrzpMNN/Sw/JS/oLGf81I0boiXbozoSC1xWo5JCkWyD7cSrTGhszKtXFGzLMg9y+j5Sc6+V43Q==","_resolved":"/tmp/8c602da237ccab33da9a9b896d05d12c/bambiste-mix-env-0.1.0.tgz","_from":"file:bambiste-mix-env-0.1.0.tgz","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-O08m4yeyRCdeLrzpMNN/Sw/JS/oLGf81I0boiXbozoSC1xWo5JCkWyD7cSrTGhszKtXFGzLMg9y+j5Sc6+V43Q==","shasum":"ccbe3684b4beadb3200cf9a82f42f2f55e78b6e6","tarball":"https://registry.npmjs.org/@bambiste/mix-env/-/mix-env-0.1.0.tgz","fileCount":13,"unpackedSize":116509,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD5st1wK/y3mNfpDsQ8iGIj/eGsZx+tLEuydHyXTa0cxgIhAOA4h4rJlkl2bhma0wDHkLzhkAUvk8wMtG3KWCARGQxm"}]},"_npmUser":{"name":"bambiste","email":"ibrahima.toure.dev@gmail.com"},"directories":{},"maintainers":[{"name":"bambiste","email":"ibrahima.toure.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mix-env_0.1.0_1783931389754_0.7307523458476579"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-13T08:29:49.612Z","0.1.0":"2026-07-13T08:29:49.897Z","modified":"2026-07-13T08:29:50.092Z"},"maintainers":[{"name":"bambiste","email":"ibrahima.toure.dev@gmail.com"}],"description":"Sync .env files to/from GitHub Actions secrets across a monorepo — push local env files up as secrets, and materialize them back into files (locally, in CI, or on a VPS).","license":"MIT","readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/fluixi/assets/main/logos/128x128.png\" alt=\"mix\" width=\"120\" height=\"120\" />\n</p>\n\n# @bambiste/mix-env\n\n**Sync `.env` files to and from GitHub Actions secrets across a monorepo — push local env files up as secrets, and materialize them back into files locally, in CI, or on a VPS.**\n\n![License: MIT](https://img.shields.io/badge/License-MIT-22c55e.svg)\n![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white)\n![npm](https://img.shields.io/badge/registry-npm-cb3837?logo=npm)\n\n---\n\n`mix-env` solves a common monorepo problem: each app has a `.env.prod` (or `.env.dev`, …) full of secrets that must **not** be committed, but still need to reach CI and the server. It scans the workspace for matching env files, stores each one as a GitHub Actions secret, and can recreate them anywhere the secrets are available as environment variables.\n\n## How it works\n\n- Each env file becomes **one** secret named `<PACKAGE>_ENV_<TYPE>` holding the **base64** of the file:\n  - `packages/backend/.env.prod` → `BACKEND_ENV_PROD`\n  - `packages/storefront/.env.prod` → `STOREFRONT_ENV_PROD`\n- **push** (local, uses `gh`): find files → upload as secrets.\n- **pull** (CI / VPS): read those secrets from the environment → write the files back (mode `600`).\n\n> GitHub secrets are write-only — you can't read their values back via the API. So `pull` reads from `process.env`, which CI populates from the secrets (and which you forward to a VPS over SSH).\n\n## Install\n\n```bash\npnpm add -D @bambiste/mix-env\n# or run ad-hoc:\nnpx @bambiste/mix-env --help\n```\n\n## Push (local → GitHub secrets)\n\n```bash\nmix-env push                      # interactive: pick environment, confirm\nmix-env push --type production    # packages/*/.env.prod  -> *_ENV_PROD secrets\nmix-env push --type development   # packages/*/.env.dev   -> *_ENV_DEV secrets\nmix-env push --file .env.staging  # any custom file name\nmix-env push -t production -y --repo owner/name   # non-interactive\n```\n\n## Pull (secrets/env → files)\n\nRuns wherever the secret env vars are present:\n\n```bash\nmix-env pull --type production    # writes packages/*/.env.prod from *_ENV_PROD vars\n```\n\n### In a GitHub workflow\n```yaml\n- run: npx @bambiste/mix-env pull --type production\n  env:\n    BACKEND_ENV_PROD: ${{ secrets.BACKEND_ENV_PROD }}\n    STOREFRONT_ENV_PROD: ${{ secrets.STOREFRONT_ENV_PROD }}\n    # …one line per app secret\n```\n\n### On a VPS (over SSH)\nForward the secrets to the box, then materialize:\n```bash\nnpx @bambiste/mix-env pull --type production\n```\n\n## Programmatic API\n\n```ts\nimport { findEnvFiles, pushEnvFiles, pullEnvFiles, detectRepo } from '@bambiste/mix-env';\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-81945d9c0285736eb99f0c9093e4558e"}