Code Monkey home page Code Monkey logo

sync-monorepo-packages's Introduction

sync-monorepo-packages

Synchronizes package.json fields and arbitrary files in a monorepo

Features

  • Auto-discovery of packages via package.json workspaces and/or lerna.json
  • Optional manual control of destination packages
  • Helpful defaults
  • Detailed "dry run" mode
  • Summary of operations
  • Sync arbitrary files (e.g. README.md)

Install

Requires Node.js ^14.17.0 || ^16.13.0 || >=18.0.0

npm install sync-monorepo-packages --save-dev

or

$ npx sync-monorepo-packages --help

Usage

Here, I have pasted the output of --help because I am lazy:

sync-monorepo-packages [file..]

Synchronize files and metadata across packages in a monorepo

Positionals:
  file  One or more source files to sync                                [string]

Options:
      --help             Show help                                     [boolean]
      --version          Show version number                           [boolean]
  -D, --dry-run          Do not sync; print what would have changed (implies
                         --verbose)                                    [boolean]
  -f, --field, --fields  Fields in source package.json to sync [array] [default:
         ["keywords","author","repository","license","engines","publishConfig"]]
      --force            Overwrite destination file(s)                 [boolean]
  -p, --packages         Dirs/globs containing destination packages
                           [array] [default: (use workspaces and/or lerna.json)]
      --package-json     Sync package.json             [boolean] [default: true]
  -s, --source           Path to source package.json
                                      [string] [default: (closest package.json)]
  -v, --verbose          Print change details                          [boolean]
      --summary          Print summary                 [boolean] [default: true]
  -l, --lerna            Path to lerna.json, if any
                                 [string] [default: (lerna.json in current dir)]

Examples:
  sync-monorepo-packages --field keywords   Sync "keywords" and "author" from
  --field author -s ./foo/package.json      ./foo/package.json to packages found
                                            in lerna.json
  sync-monorepo-packages --packages ./foo   Using default fields, show what
  --dry-run --no-summary                    would have synced from package.json
                                            in current dir to packages in ./foo;
                                            hide summary
  sync-monorepo-packages --no-package-json  Sync ./README.md to each package
  ./README.md                               found in lerna.json. Do not sync
                                            anything in package.json

Found a bug? Report it at https://github.com/boneskull/sync-monorepo-packages

Notes

  • If there are other fields which would make sense to copy as a default, please suggest!
  • Use at your own risk! --dry-run is your friend
  • When copying files, directories may be created relative to the dirpath of lerna.json or package.json. For example, if you want to sync foo/bar.md to each package, packages/*/foo/bar.md will be the result. This may not work properly with explicitly-specified package directories! Use from project root to be sure.
  • There is an API that you can use. Go for it!

License

Copyright ยฉ 2019 Christopher Hiller. Licensed Apache-2.0

sync-monorepo-packages's People

Contributors

boneskull avatar github-actions[bot] avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sync-monorepo-packages's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update google-github-actions/release-please-action digest to db8f2c6
  • chore(deps): update definitelytyped (@types/debug, @types/mocha, @types/node, @types/pluralize, @types/yargs)
  • chore(deps): update dependency markdownlint-cli to v0.40.0
  • chore(deps): update dependency mocha to v10.4.0
  • chore(deps): update eslint-related packages (eslint, eslint-plugin-import)
  • fix(deps): update dependency fs-extra to v11.2.0
  • fix(deps): update dependency rfc6902 to v5.1.1
  • chore(deps): update dependency husky to v9
  • chore(deps): update google-github-actions/release-please-action action to v4
  • fix(deps): update dependency find-up to v7
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/nodejs.yml
  • actions/checkout v3@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/setup-node v3@1a4442cacd436585916779262731d5b162bc6ec7
.github/workflows/release.yml
  • google-github-actions/release-please-action v3@4c5670f886fe259db4d11222f7dff41c1382304d
npm
package.json
  • debug 4.3.4
  • find-up 5.0.0
  • fs-extra 11.1.1
  • globby 10.0.2
  • log-symbols 3.0.0
  • pluralize 8.0.0
  • read-pkg 5.2.0
  • rfc6902 5.0.1
  • rxjs 7.8.1
  • term-size 2.2.1
  • wrap-ansi 7.0.0
  • write-pkg 4.0.0
  • yargs 17.7.2
  • @commitlint/cli 17.8.1
  • @commitlint/config-conventional 17.8.1
  • @types/debug 4.1.10
  • @types/fs-extra 9.0.13
  • @types/mocha 10.0.3
  • @types/node 18.18.6
  • @types/pluralize 0.0.32
  • @types/sinon 10.0.20
  • @types/wrap-ansi 3.0.0
  • @types/yargs 17.0.29
  • eslint 8.52.0
  • eslint-config-prettier 8.10.0
  • eslint-config-standard 17.1.0
  • eslint-plugin-import 2.29.0
  • eslint-plugin-n 15.7.0
  • eslint-plugin-prettier 4.2.1
  • eslint-plugin-promise 6.1.1
  • execa 5.1.1
  • husky 8.0.3
  • lint-staged 13.3.0
  • markdownlint-cli 0.37.0
  • mocha 10.2.0
  • prettier 2.8.8
  • type-fest 3.13.1
  • typescript 4.7.4
  • unexpected 13.2.1
  • node ^14.17.0 || ^16.13.0 || >=18.0.0
  • npm >7
  • type-fest 3.13.1

  • Check this box to trigger a request for Renovate to run again on this repository

Support any JSON as source

We want to have a dedicated "prototype" JSON file, instead of appointing an existing package.json. So it would be more like extending, rather than synchronizing.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (:sematicCommits). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

file syncs

We need options to sync README.md, LICENSE, etc.

Add `--check`

We want to run this in CI, to make sure that the files that need to be synchronized are in-sync, without writing.

P.S. Thank you for making this!

use release-please

standard-version is deprecated/unmaintained afaik, so use release-please instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.