https://github.com/sxzz/monoman
Manage monorepo common files.
https://github.com/sxzz/monoman
cli monorepo
Last synced: 16 days ago
JSON representation
Manage monorepo common files.
- Host: GitHub
- URL: https://github.com/sxzz/monoman
- Owner: sxzz
- License: mit
- Created: 2023-02-17T13:46:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-27T13:42:06.000Z (7 months ago)
- Last Synced: 2025-04-27T14:32:42.794Z (7 months ago)
- Topics: cli, monorepo
- Language: TypeScript
- Homepage:
- Size: 608 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# monoman
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Unit Test][unit-test-src]][unit-test-href]
Manage monorepo common files.
## Install
```bash
npm i monoman
```
## Usage
```
pnpm monoman [-c | --check | -w | --write]
```
```ts
// monoman.config.[ts,js]
import { defineConfig } from 'monoman'
export default defineConfig([
{
// Globs to match files
include: ['**/package.json'],
exclude: ['exclude/package.json'],
type: 'json',
contents(data: Record) {
data.name = 'monoman'
return data
},
},
{
include: ['**/package.json'],
exclude: ['exclude/package.json'],
type: 'text',
contents(text) {
return `${text} hello monoman!`
},
},
{
include = 'pnpm-lock.yaml',
exclude: ['exclude/pnpm-lock.yaml'],
type: 'yaml',
contents(data: Record) {
data.lockfileVersion = '9.0'
return data
},
},
])
```
See an [example](https://github.com/vue-macros/vue-macros/blob/main/monoman.config.ts) for more details.
## Presets
### `noDuplicatedDeps`
Make all dependencies in all `package.json` unique.
```ts
function noDuplicatedDeps({
include = 'packages/*/package.json',
exclude,
distinguishType = false,
types = ['dependencies', 'devDependencies'],
ignoreProtocols = ['file', 'link', 'workspace'],
}: {
include?: Arrayable
exclude?: Arrayable
distinguishType?: boolean
types?: string[]
ignoreProtocols?: string[]
} = {})
```
### `noDuplicatedPnpmLockfile`
```ts
function noDuplicatedPnpmLockfile({
include = 'pnpm-lock.yaml',
exclude,
deps = [],
}: {
/** Include files */
include?: Arrayable
/** Exclude files */
exclude?: Arrayable
/** Deps to check */
deps?: Arrayable
} = {})
```
## Sponsors
## License
[MIT](./LICENSE) License © 2023-PRESENT [Kevin Deng](https://github.com/sxzz)
[npm-version-src]: https://img.shields.io/npm/v/monoman.svg
[npm-version-href]: https://npmjs.com/package/monoman
[npm-downloads-src]: https://img.shields.io/npm/dm/monoman
[npm-downloads-href]: https://www.npmcharts.com/compare/monoman?interval=30
[unit-test-src]: https://github.com/sxzz/monoman/actions/workflows/unit-test.yml/badge.svg
[unit-test-href]: https://github.com/sxzz/monoman/actions/workflows/unit-test.yml