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

Fix tslib dependency for format-currency #62983

Merged
merged 4 commits into from
Apr 25, 2022

Conversation

manzoorwanijk
Copy link
Member

@manzoorwanijk manzoorwanijk commented Apr 23, 2022

tslib must be a runtime dependency for all the packages that produce a CommonJS output. Otherwise there are errors as seen in #62981.

Changes proposed in this Pull Request

  • Move tslib from devDependencies to dependencies for format-currency package
  • Remove react from peerDependencies for it, because it doesn't need React at all.

Testing instructions

  • Boot up this PR and run yarn && yarn build-packages
  • Create a new project with this package.json
{
    "name": "test",
    "type": "module",
}
  • Run yarn add file:<path/to/wp-calypso/packages/format-currency/> to install the local package in your new project.
  • Create this index.js
import fc from '@automattic/format-currency';

const formatCurrency = fc.default || fc;

console.log( formatCurrency( 1.23, 'USD' ) );
  • Do yarn install.
  • Run it as node index.js
  • Confirm that the command succeeds and the output is $1.23

Fixes #62981

@manzoorwanijk manzoorwanijk added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 23, 2022
@manzoorwanijk manzoorwanijk requested review from anomiex and a team April 23, 2022 00:13
@manzoorwanijk manzoorwanijk self-assigned this Apr 23, 2022
@github-actions
Copy link

github-actions bot commented Apr 23, 2022

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@manzoorwanijk manzoorwanijk force-pushed the fix/format-currency-dependencies branch from e2e787d to 2dca95e Compare April 25, 2022 06:03
Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@manzoorwanijk manzoorwanijk merged commit 953273e into trunk Apr 25, 2022
@manzoorwanijk manzoorwanijk deleted the fix/format-currency-dependencies branch April 25, 2022 06:37
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 25, 2022
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.0.0 - 2022-04-25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean 1.0.1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes 🤦

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I create a PR for this or it can be fixed directly in trunk?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A PR sounds good 👍 We generally never touch trunk directly here.

Happy to approve it quickly for you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you go
#63044

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @manzoorwanijk 🙌

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.

[Bug]: @automattic/format-currency has an undeclared dependency on tslib
4 participants