@nrwl/tao
Advanced tools
Comparing version 8.4.11-beta.3 to 8.4.12-beta.1
{ | ||
"name": "@nrwl/tao", | ||
"version": "8.4.11-beta.3", | ||
"version": "8.4.12-beta.1", | ||
"description": "CLI for generating code and running commands", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -265,3 +265,3 @@ "use strict"; | ||
workflow.reporter.subscribe(createRecorder(record, logger)); | ||
schematicOptions = params_1.coerceTypes(opts.schematicOptions, flattenedSchema); | ||
schematicOptions = params_1.convertAliases(params_1.coerceTypes(opts.schematicOptions, flattenedSchema), flattenedSchema); | ||
return [4 /*yield*/, workflow | ||
@@ -268,0 +268,0 @@ .execute({ |
@@ -20,1 +20,4 @@ import { logging } from '@angular-devkit/core'; | ||
}; | ||
export declare function convertAliases(opts: { | ||
[k: string]: any; | ||
}, schema: Schema): {}; |
@@ -103,1 +103,19 @@ "use strict"; | ||
exports.coerceTypes = coerceTypes; | ||
function convertAliases(opts, schema) { | ||
return Object.keys(opts).reduce(function (acc, k) { | ||
if (schema.properties[k]) { | ||
acc[k] = opts[k]; | ||
} | ||
else { | ||
var found = Object.entries(schema.properties).find(function (_a) { | ||
var _ = _a[0], d = _a[1]; | ||
return d.alias === k; | ||
}); | ||
if (found) { | ||
acc[found[0]] = opts[k]; | ||
} | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
exports.convertAliases = convertAliases; |
@@ -28,2 +28,18 @@ "use strict"; | ||
}); | ||
describe('convertAliases', function () { | ||
it('should replace aliases with actual keys', function () { | ||
expect(params_1.convertAliases({ d: 'test' }, { | ||
properties: { directory: { type: 'string', alias: 'd' } }, | ||
required: [], | ||
description: '' | ||
})).toEqual({ directory: 'test' }); | ||
}); | ||
it('should filter out unknown keys without alias', function () { | ||
expect(params_1.convertAliases({ d: 'test' }, { | ||
properties: { directory: { type: 'string' } }, | ||
required: [], | ||
description: '' | ||
})).toEqual({}); | ||
}); | ||
}); | ||
}); |
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
52621
893