Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dhis2/prop-types

Package Overview
Dependencies
Maintainers
15
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dhis2/prop-types - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

codemods/__testfixtures__/.eslintrc.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [3.0.0-beta.2](https://github.com/dhis2/prop-types/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-09-29)
### Bug Fixes
* publish codemod and add migration docs ([#260](https://github.com/dhis2/prop-types/issues/260)) ([7a0fc61](https://github.com/dhis2/prop-types/commit/7a0fc61b4970aef01537b93861b0c0bc969bdfca))
# [3.0.0-beta.1](https://github.com/dhis2/prop-types/compare/v2.0.4...v3.0.0-beta.1) (2021-09-19)

@@ -2,0 +9,0 @@

5

package.json
{
"name": "@dhis2/prop-types",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"main": "./build/cjs/index.js",

@@ -35,3 +35,4 @@ "module": "./build/es/index.js",

"files": [
"build"
"build",
"codemods"
],

@@ -38,0 +39,0 @@ "exports": {

@@ -220,2 +220,45 @@ # DHIS2 propTypes

## Migrating to `@dhis2/prop-types` V3
### Change summary
`@dhis2/prop-types` previously had a direct dependency on the `prop-types` library and also re-exported its exports:
- In v1 we used to export a default object that included all of the regular prop-types and the DHIS2 custom prop-types. We also exposed all the regular and custom prop-types as named exports.
- In v2 we took a slightly different approach:
- DHIS2 custom prop-types were available as named exports
- The default export was an object containing all the custom prop-types
- Regular prop-types were exported via the `PropTypes` export
- And now in v3 we do not re-export anything from the `prop-types` package anymore. Instead we simply expose our own custom prop-types functions as named exports.
### Migrating from v1 to v3
These are the steps to take:
1. Install version v3.0.0, for example by running `yarn upgrade @dhis2/prop-types --latest`. Ensure the `package.json` has an entry for `"@dhis2/prop-types": "^3.x.x"`
1. Prepare the files for the new version by running the codemod provided with this release:
- Ensure a recent version of `@dhis2/cli` is installed.
- Ensure the codemod is available by running:
```
d2 utils codemod list
```
You should see `@dhis2/prop-types:prop-types-v1-v3.js` listed.
- Apply the codemod by running:
```
d2 utils codemod apply @dhis2/prop-types:prop-types-v1-v3.js **/*.js`
```
1. Ensure the `prop-types` package is listed as a regular dependency in `package.json`.
1. Scan the project for imports from `@dhis2/prop-types` (doing a global search for `from '@dhis2/prop-types'` will do the trick).
- If any of these imports are encountered, the project still needs this dependency.
- Quite likely, the search will yield no results, which means the `@dhis2/prop-types` dependency should be removed.
### Migrating from v2 to v3
No codemod is available to transform the component files, but this should be fairly straightforward:
1. Replace `import { PropTypes } from '@dhis2/prop-types'` with `import PropTypes from 'prop-types'`.
1. The previous step should update most of the component files in the project correctly. If there are still component files left that import from `@dhis2/prop-types`, then probably these are actually using DHIS2 custom prop-types and these files should be addressed individually.
Once the component files have been updated, the dependencies in `package.json` need to be updated in eaxtly the same way as illustrated in step 3 and 4 of the v1 -> 3 migration section.
## Report an issue

@@ -222,0 +265,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc