monoman
TypeScript icon, indicating that this package has built-in type declarations

0.7.1 • Public • Published

monoman npm

Unit Test

Manage monorepo common files.

Install

npm i monoman

Usage

pnpm monoman [-c | --check | -w | --write]
// 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<string, string>) {
      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<string, string>) {
      data.lockfileVersion = '9.0'
      return data
    },
  },
])

See an example for more details.

Presets

noDuplicatedDeps

Make all dependencies in all package.json unique.

function noDuplicatedDeps({
  include = 'packages/*/package.json',
  exclude,
  distinguishType = false,
  types = ['dependencies', 'devDependencies'],
  ignoreProtocols = ['file', 'link', 'workspace'],
}: {
  include?: Arrayable<string>
  exclude?: Arrayable<string>
  distinguishType?: boolean
  types?: string[]
  ignoreProtocols?: string[]
} = {})

noDuplicatedPnpmLockfile

function noDuplicatedPnpmLockfile({
  include = 'pnpm-lock.yaml',
  exclude,
  deps = [],
}: {
  /** Include files */
  include?: Arrayable<string>
  /** Exclude files */
  exclude?: Arrayable<string>
  /** Deps to check */
  deps?: Arrayable<string>
} = {})

Sponsors

License

MIT License © 2023-PRESENT 三咲智子

Readme

Keywords

none

Package Sidebar

Install

npm i monoman

Weekly Downloads

1,031

Version

0.7.1

License

MIT

Unpacked Size

12.5 kB

Total Files

6

Last publish

Collaborators

  • sxzz