Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(publish): add new option --remove-package-fields before publish #359

Merged
merged 10 commits into from Oct 14, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Oct 1, 2022

Description

adding a new option --remove-package-fields which will remove any fields we wish to be removed from each package.json of every packages just before publishing them the registry

# remove the entire "devDependencies" field 
lerna version --remove-package-fields 'devDependencies' 'scripts'

removing complex object(s) is also supported via the dot notation

# remove a single entry of a child field
lerna version --remove-package-fields 'scripts.build'

would remove

{ 
  script: {
-   "build": "tsc --project tsconfig.json",
    "build:dev": "tsc --incremental --watch"
  }
}

Motivation and Context

I have certain fields that I would like to be removed from the final packages in the npm registry, fields like devDependencies and scripts have no use for user of these npm packages. This new option will help a lot in cleaning fields that have no use for the external users (ie scripts will never be used outside of the project so there's no reason to keep it in the published package)

How Has This Been Tested?

new unit tests

Types of changes

  • Chore (change that has absolutely no effect on users)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Oct 1, 2022

Codecov Report

Merging #359 (287bca5) into main (0fc9af9) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #359      +/-   ##
==========================================
+ Coverage   96.16%   96.18%   +0.02%     
==========================================
  Files         145      146       +1     
  Lines        4266     4288      +22     
  Branches      975      982       +7     
==========================================
+ Hits         4102     4124      +22     
  Misses        164      164              
Impacted Files Coverage Δ
...kages/cli/src/cli-commands/cli-publish-commands.ts 100.00% <ø> (ø)
...ore/src/conventional-commits/get-github-commits.ts 100.00% <100.00%> (ø)
packages/core/src/utils/index.ts 100.00% <100.00%> (ø)
packages/core/src/utils/object-utils.ts 100.00% <100.00%> (ø)
packages/publish/src/publish-command.ts 99.04% <100.00%> (+0.02%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ghiscoding ghiscoding merged commit 45a2107 into main Oct 14, 2022
@ghiscoding ghiscoding deleted the feat/remove-package-fields branch October 14, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant