@dhis2/prop-types
Advanced tools
Comparing version 1.6.2 to 1.6.3
import fs from 'fs' | ||
import path from 'path' | ||
import propTypes from '../index.js' | ||
import dhis2PropTypes from '../index.js' | ||
const propTypesPath = path.join(__dirname, '../propTypes') | ||
const customPropTypes = fs | ||
.readdirSync(propTypesPath) | ||
const customPropTypesPath = path.join(__dirname, '../propTypes') | ||
const customPropTypeFilenames = fs | ||
.readdirSync(customPropTypesPath) | ||
.filter(file => { | ||
@@ -12,3 +12,3 @@ if (file === '.') return false | ||
const filePath = path.join(propTypesPath, file) | ||
const filePath = path.join(customPropTypesPath, file) | ||
if (fs.lstatSync(filePath).isDirectory()) return false | ||
@@ -18,23 +18,30 @@ | ||
}) | ||
.map(fileName => fileName.replace('.js', '')) | ||
.map(filename => filename.replace('.js', '')) | ||
describe('index', () => { | ||
it('should have a prop type for each custom prop type', () => { | ||
const actual = Object.keys(propTypes) | ||
const expected = expect.arrayContaining(customPropTypes) | ||
it('should export a prop type for each custom prop type file', () => { | ||
const actual = Object.keys(dhis2PropTypes) | ||
const expected = expect.arrayContaining(customPropTypeFilenames) | ||
expect(actual).toEqual(expected) | ||
}) | ||
it('should have the actual function as prop type', () => { | ||
customPropTypes.forEach(customPropType => { | ||
const propTypePath = path.join( | ||
propTypesPath, | ||
`${customPropType}.js` | ||
) | ||
const exportedModule = require(propTypePath) | ||
const exportedPropType = exportedModule[customPropType] | ||
it('should reexport the named export in each custom prop type file', () => { | ||
customPropTypeFilenames.forEach(filename => { | ||
const fullPath = path.join(customPropTypesPath, `${filename}.js`) | ||
const exportedModule = require(fullPath) | ||
// The filename is equal to the name of the named export | ||
const exportedPropType = exportedModule[filename] | ||
expect(exportedPropType).toBe(propTypes[customPropType]) | ||
expect(exportedPropType).toBe(dhis2PropTypes[filename]) | ||
}) | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
const originalPropTypes = require('prop-types') | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
}) | ||
}) |
@@ -6,32 +6,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "arrayWithLength", { | ||
enumerable: true, | ||
get: function get() { | ||
return _arrayWithLength.arrayWithLength; | ||
} | ||
}); | ||
Object.defineProperty(exports, "conditional", { | ||
enumerable: true, | ||
get: function get() { | ||
return _conditional.conditional; | ||
} | ||
}); | ||
Object.defineProperty(exports, "instanceOfComponent", { | ||
enumerable: true, | ||
get: function get() { | ||
return _instanceOfComponent.instanceOfComponent; | ||
} | ||
}); | ||
Object.defineProperty(exports, "mutuallyExclusive", { | ||
enumerable: true, | ||
get: function get() { | ||
return _mutuallyExclusive.mutuallyExclusive; | ||
} | ||
}); | ||
Object.defineProperty(exports, "requiredIf", { | ||
enumerable: true, | ||
get: function get() { | ||
return _requiredIf.requiredIf; | ||
} | ||
}); | ||
exports.default = void 0; | ||
@@ -53,8 +23,17 @@ | ||
_propTypes.default.arrayWithLength = _arrayWithLength.arrayWithLength; | ||
_propTypes.default.conditional = _conditional.conditional; | ||
_propTypes.default.instanceOfComponent = _instanceOfComponent.instanceOfComponent; | ||
_propTypes.default.mutuallyExclusive = _mutuallyExclusive.mutuallyExclusive; | ||
_propTypes.default.requiredIf = _requiredIf.requiredIf; | ||
var _default = _propTypes.default; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const dhis2PropTypes = _objectSpread({}, _propTypes.default, { | ||
arrayWithLength: _arrayWithLength.arrayWithLength, | ||
conditional: _conditional.conditional, | ||
instanceOfComponent: _instanceOfComponent.instanceOfComponent, | ||
mutuallyExclusive: _mutuallyExclusive.mutuallyExclusive, | ||
requiredIf: _requiredIf.requiredIf | ||
}); | ||
var _default = dhis2PropTypes; | ||
exports.default = _default; |
import fs from 'fs' | ||
import path from 'path' | ||
import propTypes from '../index.js' | ||
import dhis2PropTypes from '../index.js' | ||
const propTypesPath = path.join(__dirname, '../propTypes') | ||
const customPropTypes = fs | ||
.readdirSync(propTypesPath) | ||
const customPropTypesPath = path.join(__dirname, '../propTypes') | ||
const customPropTypeFilenames = fs | ||
.readdirSync(customPropTypesPath) | ||
.filter(file => { | ||
@@ -12,3 +12,3 @@ if (file === '.') return false | ||
const filePath = path.join(propTypesPath, file) | ||
const filePath = path.join(customPropTypesPath, file) | ||
if (fs.lstatSync(filePath).isDirectory()) return false | ||
@@ -18,23 +18,30 @@ | ||
}) | ||
.map(fileName => fileName.replace('.js', '')) | ||
.map(filename => filename.replace('.js', '')) | ||
describe('index', () => { | ||
it('should have a prop type for each custom prop type', () => { | ||
const actual = Object.keys(propTypes) | ||
const expected = expect.arrayContaining(customPropTypes) | ||
it('should export a prop type for each custom prop type file', () => { | ||
const actual = Object.keys(dhis2PropTypes) | ||
const expected = expect.arrayContaining(customPropTypeFilenames) | ||
expect(actual).toEqual(expected) | ||
}) | ||
it('should have the actual function as prop type', () => { | ||
customPropTypes.forEach(customPropType => { | ||
const propTypePath = path.join( | ||
propTypesPath, | ||
`${customPropType}.js` | ||
) | ||
const exportedModule = require(propTypePath) | ||
const exportedPropType = exportedModule[customPropType] | ||
it('should reexport the named export in each custom prop type file', () => { | ||
customPropTypeFilenames.forEach(filename => { | ||
const fullPath = path.join(customPropTypesPath, `${filename}.js`) | ||
const exportedModule = require(fullPath) | ||
// The filename is equal to the name of the named export | ||
const exportedPropType = exportedModule[filename] | ||
expect(exportedPropType).toBe(propTypes[customPropType]) | ||
expect(exportedPropType).toBe(dhis2PropTypes[filename]) | ||
}) | ||
}) | ||
it('should not overwrite existing prop-types in the prop-types package', () => { | ||
const originalPropTypes = require('prop-types') | ||
Object.keys(originalPropTypes).forEach(propType => { | ||
expect(dhis2PropTypes[propType]).toBe(originalPropTypes[propType]) | ||
}) | ||
}) | ||
}) |
@@ -7,8 +7,9 @@ import propTypes from 'prop-types'; | ||
import { requiredIf } from './propTypes/requiredIf.js'; | ||
propTypes.arrayWithLength = arrayWithLength; | ||
propTypes.conditional = conditional; | ||
propTypes.instanceOfComponent = instanceOfComponent; | ||
propTypes.mutuallyExclusive = mutuallyExclusive; | ||
propTypes.requiredIf = requiredIf; | ||
export { arrayWithLength, conditional, instanceOfComponent, mutuallyExclusive, requiredIf }; | ||
export default propTypes; | ||
const dhis2PropTypes = { ...propTypes, | ||
arrayWithLength, | ||
conditional, | ||
instanceOfComponent, | ||
mutuallyExclusive, | ||
requiredIf | ||
}; | ||
export default dhis2PropTypes; |
@@ -0,1 +1,8 @@ | ||
## [1.6.3](https://github.com/dhis2/prop-types/compare/v1.6.2...v1.6.3) (2020-04-02) | ||
### Bug Fixes | ||
* move all prop-types to default export ([08eb729](https://github.com/dhis2/prop-types/commit/08eb72964a42bea5385aeaa9d6b76f4b55e5be24)) | ||
## [1.6.2](https://github.com/dhis2/prop-types/compare/v1.6.1...v1.6.2) (2020-04-01) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@dhis2/prop-types", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"main": "./build/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./build/es/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
77677
0
1501