
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
import-unifier
Advanced tools
Generic import consolidator for TypeScript projects. Merge imports from a source path into a target file.
Generic Import Consolidator for TypeScript Projects
import-unifier helps streamline imports by consolidating them from a source path into a single target file. It works seamlessly with any TypeScript project, keeping your imports clean, consistent, and maintainable.
# Using npm
npm install import-unifier --save-dev
# Using yarn
yarn add import-unifier --dev
import { consolidateImports } from "import-unifier";
consolidateImports({
tsConfigPath: "tsconfig.json", // optional (default: tsconfig.json)
sourceGlob: "src/**/*.tsx", // optional (default: src/**/*.ts{,x})
sourcePath: "src/components/", // required: folder to consolidate from
targetPath: "src/shared/components/index", // required: target file path
log: true // optional (default: true)
});
How it works:
sourceGlobsourcePathtargetPathindex.ts)npx consolidate-imports <tsConfigPath?> <sourcePath> <targetPath>
Arguments:
tsConfigPath (optional): Path to your TypeScript config (default: tsconfig.json)sourcePath (required): Folder or module path to consolidate imports fromtargetPath (required): File path where consolidated imports will be mergedExample:
npx consolidate-imports tsconfig.json src/components/ src/shared/components/index
// src/pages/Home.tsx
import { Button } from "src/components/Button";
import { Card } from "src/components/Card";
import { Modal } from "src/components/Modal";
// src/pages/Dashboard.tsx
import { Button } from "src/components/Button";
import { Table } from "src/components/Table";
// src/pages/Home.tsx
import { Button, Card, Modal } from "src/shared/components/index";
// src/pages/Dashboard.tsx
import { Button, Table } from "src/shared/components/index";
// src/shared/components/index.ts (auto-generated)
export { Button } from "../../components/Button";
export { Card } from "../../components/Card";
export { Modal } from "../../components/Modal";
export { Table } from "../../components/Table";
All imports from the source folder are merged into a single import pointing to the target file, making your codebase cleaner and more maintainable.
| Option | Type | Default | Description |
|---|---|---|---|
tsConfigPath | string | "tsconfig.json" | Path to TypeScript configuration file |
sourceGlob | string | "src/**/*.ts{,x}" | Glob pattern to match files for processing |
sourcePath | string | Required | Source folder/path to consolidate imports from |
targetPath | string | Required | Target file path for consolidated imports |
log | boolean | true | Enable logging of processed files |
MIT License © [Your Name]
Made with ❤️ for cleaner TypeScript codebases
FAQs
Generic import consolidator for TypeScript projects. Merge imports from a source path into a target file.
We found that import-unifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.