@warpgogol/repo-extract
v1.2.8
Published
Extract apps and packages from a TurboRepo monorepo into standalone public repositories
Downloads
1,116
Maintainers
Readme
@warpgogol/repo-extract
Extract apps and packages from a TurboRepo monorepo into standalone public repositories.
Features
- Extracts one or more workspace projects from a Turborepo monorepo
- Standalone mode for single-package export (flattens to repo root)
- Monorepo mode for multi-app export (preserves workspace structure)
- Declarative post-process rules: copy, patch, delete
- Optional
@warpgogol/changelog-liveintegration for changelog generation - Secret scanning with configurable skip
- Git history transfer by path prefix
- Auto-generated CI workflow with npm publish
- Zod-validated
extract.config.yamlconfiguration - CLI + programmatic API
Quick start
# Install
npm install -g @warpgogol/repo-extract
# Extract a project (dry-run first)
repo-extract --config extract.config.yaml --dry-run
# Extract for real
repo-extract --config extract.config.yaml --dest /path/to/dest --verboseOr use without global install:
npx @warpgogol/repo-extract --config extract.config.yaml --dry-runCLI flags
| Flag | Description |
| ----------------- | ------------------------------------------------ |
| --config <path> | Path to extract.config.yaml (required) |
| --dest <path> | Destination directory (overrides config default) |
| --dry-run | Print plan without writing files |
| --verbose | Verbose output |
Configuration
Create an extract.config.yaml in your project:
Standalone single-package export
projectDir: packages/my-package
destName: my-package
standalone: true
git:
remote: [email protected]:user/my-package.git
autoPush: trueStandalone mode flattens the package to the repo root — src/, tests/, package.json, etc. become top-level. Workspace dependencies (workspace:*) are replaced with *, and @warpgogol/* devDependencies are stripped (except the package itself).
Multi-app monorepo export
projectDir: apps/my-app
destName: my-app
appDirs:
- apps/my-app/frontend
- apps/my-app/backend
projectRootFiles:
- README.md
- LICENSE
- CONTRIBUTING.md
git:
remote: [email protected]:user/my-app.git
autoPush: trueMonorepo mode preserves the workspace structure, copies monorepo config files (turbo.json, pnpm-workspace.yaml, etc.), auto-discovers package dependencies, and generates tsconfig.base.json.
Post-process rules
postProcess:
- action: copy
from: src/config.yaml
to: dist/config.yaml
- action: patch
file: package.json
find: "workspace:*"
replace: "^1.0.0"
- action: patch
file: tsconfig.json
removeLinesMatching: "customConditions"
- action: delete
path: AGENTS.mdSecret scanning
By default, the export scans for common secret patterns (AWS keys, private keys, GitHub tokens, generic API keys) before committing. If secrets are found, the export aborts.
skipSecretScan: true # disable scanning (not recommended)
ignoreDirs:
- .input
- spec
excludePathSegments:
- .input/signing-key
- secrets
excludeExtensions:
- .db
- .sqliteOptional changelog integration
If changelog.config.yaml exists in the project directory and @warpgogol/changelog-live is installed, the export automatically generates a changelog before committing. The generated commit message includes the AI-generated changelog summary.
Programmatic API
import { extractProject, loadConfig } from "@warpgogol/repo-extract";
const config = await loadConfig("extract.config.yaml");
await extractProject(config, { dest: "../my-package" });Exports
| Export | Description |
| ------------------------------------------ | -------------------------------------------- |
| extractProject(config, options) | Run the full extraction pipeline |
| loadConfig(path) | Load and validate an extract.config.yaml |
| scanForSecrets(dir) | Scan a directory for secret patterns |
| transferGitHistory(root, dest, prefixes) | Transfer filtered git history |
| commitExport(dest, message, gitConfig) | Commit and optionally push |
| generateCiWorkflow() | Generate a GitHub Actions CI workflow string |
| fixStandalonePackageJson(dest) | Fix package.json for standalone export |
| fixStandaloneVitestConfig(dest) | Fix vitest.config.ts for standalone export |
Changelog
Community
License
Apache-2.0 — see LICENSE
