https://github.com/sxzz/monoman
Manage monorepo common files.
https://github.com/sxzz/monoman
cli monorepo
Last synced: 3 months 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 (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T11:24:47.000Z (about 1 year ago)
- Last Synced: 2024-04-22T12:38:56.289Z (about 1 year ago)
- Topics: cli, monorepo
- Language: TypeScript
- Homepage:
- Size: 365 KB
- Stars: 12
- 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 [](https://npmjs.com/package/monoman)
[](https://github.com/sxzz/monoman/actions/workflows/unit-test.yml)
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 [三咲智子](https://github.com/sxzz)