Comparing version 0.7.4 to 0.8.0
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="0.8.0"></a> | ||
# [0.8.0](https://github.com/Igmat/baset/compare/v0.7.5...v0.8.0) (2018-02-28) | ||
**Note:** Version bump only for package baset-cli | ||
<a name="0.7.4"></a> | ||
@@ -8,0 +16,0 @@ ## [0.7.4](https://github.com/Igmat/baset/compare/v0.7.3...v0.7.4) (2018-02-26) |
@@ -12,3 +12,3 @@ "use strict"; | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
} | ||
}; | ||
const baset_core_1 = require("baset-core"); | ||
@@ -15,0 +15,0 @@ const glob_promise_1 = __importDefault(require("glob-promise")); |
@@ -12,3 +12,3 @@ "use strict"; | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
} | ||
}; | ||
const baset_core_1 = require("baset-core"); | ||
@@ -15,0 +15,0 @@ const glob_promise_1 = __importDefault(require("glob-promise")); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
} | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -11,3 +11,3 @@ if (mod && mod.__esModule) return mod; | ||
return result; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -14,0 +14,0 @@ const find_up_1 = require("find-up"); |
/// <reference types="yargs" /> | ||
import { utils } from 'baset-core'; | ||
import { ITestGroupOptions, utils } from 'baset-core'; | ||
import { Options } from 'yargs'; | ||
export interface IGlobalArgs { | ||
plugins: utils.IDictionary<string[]>; | ||
plugins: utils.IDictionary<ITestGroupOptions>; | ||
options: utils.IDictionary<any>; | ||
} | ||
export interface ITestGroupPlugins { | ||
baseliner: string; | ||
environment?: string; | ||
readers?: string[] | string; | ||
resolvers?: string[] | string; | ||
imports?: string[] | string; | ||
} | ||
export declare const options: utils.IDictionary<Options>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function resolveBasetPlugins(name) { | ||
return name.startsWith('baset') | ||
function groupPlugins(plugins) { | ||
const firstModule = plugins.slice(0, 1)[0]; | ||
const environment = resolveModule((firstModule.includes('-env-') && firstModule) || undefined); | ||
const firstImportIndex = Number(!!environment); | ||
const firstReaderIndex = plugins.findIndex(plugin => plugin.includes('-reader-')); | ||
const firstResolverIndex = plugins.findIndex(plugin => plugin.includes('-resolver-')); | ||
const imports = plugins.slice(firstImportIndex, firstReaderIndex).map(resolveModule); | ||
const readers = plugins.slice(firstReaderIndex, firstResolverIndex).map(resolveModule); | ||
const resolvers = plugins.slice(firstResolverIndex, -1).map(resolveModule); | ||
const baseliner = resolveModule(plugins.slice(-1)[0]); | ||
return { | ||
baseliner, | ||
environment, | ||
readers, | ||
resolvers, | ||
imports, | ||
}; | ||
} | ||
function getDefaultPlugins(plugins) { | ||
return { | ||
baseliner: resolveModule(plugins.baseliner), | ||
environment: resolveModule(plugins.environment), | ||
readers: (plugins.readers | ||
? Array.isArray(plugins.readers) | ||
? plugins.readers | ||
: [plugins.readers] | ||
: []).map(resolveModule), | ||
resolvers: (plugins.resolvers | ||
? Array.isArray(plugins.resolvers) | ||
? plugins.resolvers | ||
: [plugins.resolvers] | ||
: []).map(resolveModule), | ||
imports: (plugins.imports | ||
? Array.isArray(plugins.imports) | ||
? plugins.imports | ||
: [plugins.imports] | ||
: []).map(resolveModule), | ||
}; | ||
} | ||
function resolveModule(name) { | ||
return (name && name.startsWith('baset')) | ||
? `./node_modules/${name}` | ||
@@ -13,15 +52,17 @@ : name; | ||
default: { '.spec.js$': 'baset-baseliner-json' }, | ||
coerce: (plugins) => (plugins instanceof Array) | ||
coerce: (plugins) => (Array.isArray(plugins)) | ||
// if plugins is Array, then we get this arg from cli | ||
? plugins.reduce((result, plugin) => (Object.assign({}, result, { | ||
// regexp for spec // array of node modules | ||
[plugin.split(':')[0]]: plugin.split(':').slice(1).map(resolveBasetPlugins) })), {}) | ||
// regexp for spec // array of plugins | ||
[plugin.split(':')[0]]: groupPlugins(plugin.split(':').slice(1)) })), {}) | ||
// if not, then it defined in config | ||
: Object.keys(plugins).reduce( | ||
// we have to ensure that all values are arrays | ||
// we have to ensure that all values are in correct format | ||
(result, key) => { | ||
const plugin = plugins[key]; | ||
return Object.assign({}, result, { [key]: (plugin instanceof Array) | ||
? plugin.map(resolveBasetPlugins) | ||
: [resolveBasetPlugins(plugin)] }); | ||
return Object.assign({}, result, { [key]: (Array.isArray(plugin)) | ||
? groupPlugins(plugin) | ||
: (typeof plugin === 'string') | ||
? groupPlugins([plugin]) | ||
: getDefaultPlugins(plugin) }); | ||
}, {}), | ||
@@ -28,0 +69,0 @@ }, |
{ | ||
"name": "baset-cli", | ||
"version": "0.7.4", | ||
"version": "0.8.0", | ||
"description": "CLI for BaseT project.", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"@types/yargs": "^10.0.1", | ||
"baset": "^0.7.4", | ||
"baset": "^0.8.0", | ||
"doctoc": "^1.3.0", | ||
@@ -42,3 +42,3 @@ "tslint": "^5.9.1", | ||
"dependencies": { | ||
"baset-core": "^0.7.4", | ||
"baset-core": "^0.8.0", | ||
"find-up": "^2.1.0", | ||
@@ -45,0 +45,0 @@ "glob": "^7.1.2", |
Sorry, the diff of this file is not supported yet
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
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
21191
219
+ Addedbaset-core@0.8.0(transitive)
- Removedbaset-core@0.7.4(transitive)
Updatedbaset-core@^0.8.0