パッケージの詳細

@userfrosting/merge-package-dependencies

userfrosting504MIT3.0.2

Merge NPM, Yarn or Bower package dependencies into one package, with semver rules respected.

package.json, bower.json, merge, npm

readme

merge-package-dependencies

Branch Status
master Continuous Integration codecov

A simple tool that can merge the dependency and devDependency dependency types for npm/yarn package.jsons or bower bower.jsons into a single package.json or bower.json object (and optionally file). To properly support frontend scenarios, this tool also merges resolutions, and ignores unnecessary field recommendations for private npm/yarn packages. Perfect for projects like UserFrosting where plugins (Sprinkles) provide virtually all functionality.

NOTE: While non-semver values are supported, they will act as an override and emit a warning (even if logging is disabled). This override behavior only applies to 'incoming' values. This behavior does not match npm, yarn or bower.

NOTE: This is currently an offline tool, and as such conflicts further down the dependency chain are not evaluated. There is however a duplicate dependency detection tool for yarn to allow the creation of workarounds in the meantime (see docs/api

NOTE: Any dependencies with a path specified as the version will not be adjusted, even if an output location is specified.

Install

npm i -D  @userfrosting/merge-package-dependencies

Usage

IMPORTANT
This is an ES module package targeting NodeJS ^12.17.0 || >=14.0.0, refer to the NodeJS ESM docs regarding how to correctly import. ESM loaders like @babel/loader or esm likely won't work as expected.

To merge multiple package.json's into a single object, and save to a specified location...

import * as mergePackages from "@userfrosting/merge-package-dependencies";

let result = mergePackages.yarn(
    {
        name: "pkg",
        version: "1.7.2",
    },
    [
        "../app/sprinkles/core/",
        "../app/sprinkles/account/",
        "../app/sprinkles/admin/"
    ],
    "../app/assets/"
);

API

See docs/api.

License

MIT

Contributing

See CONTRIBUTING.md.

更新履歴

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased]

[3.0.2] - 2022-03-16

[3.0.1] - 2021-07-10

Changed

  • Removed dependencies on lodash and fs-extra.

[3.0.0] - 2021-04-03

Changed

  • Removed esm loader in favour of native ESM support.
  • Raised minimum NodeJS version from 10 to 12.17.0.

[2.1.0] - 2020-04-28

Fixed

  • Issue with TypeScript types where return type was {} instead of input template.

[2.0.2] - 2020-04-27

Fixed

  • More cases of undefined in logging that was overlooked.

[2.0.1] - 2020-04-27

Fixed

  • Unnamed packages being identified as undefined in logging. File path will now be used as a fallback.
  • Optional template fields mistakenly marked as required.

[2.0.0] - 2020-04-25

This release is mainly focused on bringing project tooling up to date.

Added

  • Used exception types are now exported.
  • TypeScript types.

Changed

  • Major tooling refactor, API remains unchanged however exports may behave differently.
  • Major version updates for dependencies (chalk from 2.4.1 to 4, fs-extra from 7.0.1 to 9, semver from 5.6 to 7).

[1.2.1] 2018-11-22

Changed

  • Updated dependencies.

[1.2.0] - 2018-06-19

Added

  • Merge peerDependencies in Yarn and NPM packages. (thanks @FabianMeul)

[1.2.0-rc.2] - 2018-02-03

Fixed

  • Issue with internal yarnpkg/lockfile dependency that slipped testing.

[1.2.0-rc.1] - 2018-02-02

Added

  • Duplicate dependency checker that uses yarn.lock. This is a stop-gap solution for Yarn's inability to report flat mode dependency conflicts when running in a non-interactive context.
  • This changelog.

[1.1.0] - 2017-11-11

Changed

  • Dropped requirement of name and description for private package.json (NPM and Yarn).

[1.0.1] - 2017-07-28

Added

  • AppVeyor integration for automated unit testing.

Changed

  • Raised required node version to 6.
  • Directories are automatically created when saving merged package.

[1.0.0] - 2017-07-27

Initial release.