liferay-npm-build-tools-common
Advanced tools
Comparing version 2.0.0-rc.4 to 2.0.0
@@ -47,2 +47,24 @@ 'use strict'; | ||
}); | ||
describe('unrollImportsConfig handles null namespaces correctly', function () { | ||
it('when described the canonical way', function () { | ||
var imports = (0, _imports.unrollImportsConfig)({ | ||
'': { | ||
dep: '^1.0.0' | ||
} | ||
}); | ||
expect(imports['dep']).toMatchObject({ name: '', version: '^1.0.0' }); | ||
}); | ||
it('when described the sweet way', function () { | ||
var imports = (0, _imports.unrollImportsConfig)({ | ||
dep: { | ||
'/': '^1.0.0' | ||
} | ||
}); | ||
expect(imports['dep']).toMatchObject({ name: '', version: '^1.0.0' }); | ||
}); | ||
}); | ||
//# sourceMappingURL=imports.test.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -19,4 +19,11 @@ Object.defineProperty(exports, "__esModule", { | ||
Object.keys(importsConfig[namespace]).forEach(function (pkgName) { | ||
var version = importsConfig[namespace][pkgName]; | ||
if (pkgName === '/') { | ||
pkgName = namespace; | ||
namespace = ''; | ||
} | ||
if (imports[pkgName]) { | ||
throw new Error("Package " + pkgName + " is mapped to more than one import"); | ||
throw new Error('Package ' + pkgName + ' is mapped to more than one import'); | ||
} | ||
@@ -26,3 +33,3 @@ | ||
name: namespace, | ||
version: importsConfig[namespace][pkgName] | ||
version: version | ||
}; | ||
@@ -29,0 +36,0 @@ }); |
{ | ||
"name": "liferay-npm-build-tools-common", | ||
"version": "2.0.0-rc.4", | ||
"version": "2.0.0", | ||
"description": "Utility library for Liferay NPM Build Tools.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -45,1 +45,23 @@ import {unrollImportsConfig} from '../imports'; | ||
}); | ||
describe('unrollImportsConfig handles null namespaces correctly', () => { | ||
it('when described the canonical way', () => { | ||
const imports = unrollImportsConfig({ | ||
'': { | ||
dep: '^1.0.0', | ||
}, | ||
}); | ||
expect(imports['dep']).toMatchObject({name: '', version: '^1.0.0'}); | ||
}); | ||
it('when described the sweet way', () => { | ||
const imports = unrollImportsConfig({ | ||
dep: { | ||
'/': '^1.0.0', | ||
}, | ||
}); | ||
expect(imports['dep']).toMatchObject({name: '', version: '^1.0.0'}); | ||
}); | ||
}); |
@@ -13,2 +13,9 @@ /** | ||
Object.keys(importsConfig[namespace]).forEach(pkgName => { | ||
const version = importsConfig[namespace][pkgName]; | ||
if (pkgName === '/') { | ||
pkgName = namespace; | ||
namespace = ''; | ||
} | ||
if (imports[pkgName]) { | ||
@@ -22,3 +29,3 @@ throw new Error( | ||
name: namespace, | ||
version: importsConfig[namespace][pkgName], | ||
version, | ||
}; | ||
@@ -25,0 +32,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
119442
1916
1