liferay-npm-bundler-plugin-namespace-packages
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -11,2 +11,6 @@ 'use strict'; | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _readJsonSync = require('read-json-sync'); | ||
@@ -22,12 +26,10 @@ | ||
var fixturesDir = process.cwd() + '/packages/' + 'liferay-npm-bundler-plugin-namespace-packages/' + 'src/__tests__/project'; | ||
var fixturesDir = _path2.default.join(__dirname, '__fixtures__'); | ||
it('namespaces packages correctly for the root package', function () { | ||
var rootPkgJson = (0, _readJsonSync2.default)(fixturesDir + '/package.json'); | ||
var dir = fixturesDir; | ||
var pkgJson = (0, _readJsonSync2.default)(dir + '/package.json'); | ||
var pkgJson = (0, _readJsonSync2.default)(fixturesDir + '/project/package.json'); | ||
var pkg = new _pkgDesc2.default(pkgJson.name, pkgJson.version, fixturesDir, true); | ||
var log = new _pluginLogger2.default(); | ||
(0, _index2.default)({ pkg: pkg, log: log, rootPkgJson: rootPkgJson }, { pkgJson: pkgJson }); | ||
(0, _index2.default)({ pkg: pkg, log: log, rootPkgJson: pkgJson }, { pkgJson: pkgJson }); | ||
@@ -38,4 +40,4 @@ expect(pkgJson).toMatchSnapshot(); | ||
it('namespaces packages correctly for non-root package', function () { | ||
var rootPkgJson = (0, _readJsonSync2.default)(fixturesDir + '/package.json'); | ||
var dir = fixturesDir + '/node_modules/is-finite'; | ||
var rootPkgJson = (0, _readJsonSync2.default)(fixturesDir + '/project/package.json'); | ||
var dir = fixturesDir + '/project/node_modules/is-finite'; | ||
var pkgJson = (0, _readJsonSync2.default)(dir + '/package.json'); | ||
@@ -51,4 +53,4 @@ var pkg = new _pkgDesc2.default(pkgJson.name, pkgJson.version, dir); | ||
it('logs results correctly', function () { | ||
var rootPkgJson = (0, _readJsonSync2.default)(fixturesDir + '/package.json'); | ||
var dir = fixturesDir + '/node_modules/is-finite'; | ||
var rootPkgJson = (0, _readJsonSync2.default)(fixturesDir + '/project/package.json'); | ||
var dir = fixturesDir + '/project/node_modules/is-finite'; | ||
var pkgJson = (0, _readJsonSync2.default)(dir + '/package.json'); | ||
@@ -55,0 +57,0 @@ var pkg = new _pkgDesc2.default(pkgJson.name, pkgJson.version, dir); |
{ | ||
"name": "liferay-npm-bundler-plugin-namespace-packages", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "A liferay-npm-bundler plugin to namespace package names based on root project's name.", | ||
@@ -16,4 +16,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"liferay-npm-build-tools-common": "2.1.1" | ||
"liferay-npm-build-tools-common": "2.2.0" | ||
} | ||
} |
import PkgDesc from 'liferay-npm-build-tools-common/lib/pkg-desc'; | ||
import PluginLogger from 'liferay-npm-build-tools-common/lib/plugin-logger'; | ||
import path from 'path'; | ||
import readJsonSync from 'read-json-sync'; | ||
import plugin from '../index'; | ||
const fixturesDir = | ||
`${process.cwd()}/packages/` + | ||
`liferay-npm-bundler-plugin-namespace-packages/` + | ||
`src/__tests__/project`; | ||
const fixturesDir = path.join(__dirname, '__fixtures__'); | ||
it('namespaces packages correctly for the root package', () => { | ||
const rootPkgJson = readJsonSync(`${fixturesDir}/package.json`); | ||
const dir = fixturesDir; | ||
const pkgJson = readJsonSync(`${dir}/package.json`); | ||
const pkgJson = readJsonSync(`${fixturesDir}/project/package.json`); | ||
const pkg = new PkgDesc(pkgJson.name, pkgJson.version, fixturesDir, true); | ||
const log = new PluginLogger(); | ||
plugin({pkg, log, rootPkgJson}, {pkgJson}); | ||
plugin({pkg, log, rootPkgJson: pkgJson}, {pkgJson}); | ||
@@ -24,4 +20,4 @@ expect(pkgJson).toMatchSnapshot(); | ||
it('namespaces packages correctly for non-root package', () => { | ||
const rootPkgJson = readJsonSync(`${fixturesDir}/package.json`); | ||
const dir = `${fixturesDir}/node_modules/is-finite`; | ||
const rootPkgJson = readJsonSync(`${fixturesDir}/project/package.json`); | ||
const dir = `${fixturesDir}/project/node_modules/is-finite`; | ||
const pkgJson = readJsonSync(`${dir}/package.json`); | ||
@@ -37,4 +33,4 @@ const pkg = new PkgDesc(pkgJson.name, pkgJson.version, dir); | ||
it('logs results correctly', () => { | ||
const rootPkgJson = readJsonSync(`${fixturesDir}/package.json`); | ||
const dir = `${fixturesDir}/node_modules/is-finite`; | ||
const rootPkgJson = readJsonSync(`${fixturesDir}/project/package.json`); | ||
const dir = `${fixturesDir}/project/node_modules/is-finite`; | ||
const pkgJson = readJsonSync(`${dir}/package.json`); | ||
@@ -41,0 +37,0 @@ const pkg = new PkgDesc(pkgJson.name, pkgJson.version, dir); |
Sorry, the diff of this file is not supported yet
14536
117
+ Addedliferay-npm-build-tools-common@2.2.0(transitive)
- Removedliferay-npm-build-tools-common@2.1.1(transitive)