UNPKG

@objectivity/angular-schematic-web-ci

Version:
47 lines 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.azureDevOps = void 0; const schematics_1 = require("@angular-devkit/schematics"); const core_1 = require("@angular-devkit/core"); const angular_schematic_utils_1 = require("@objectivity/angular-schematic-utils"); const schematics_utilities_1 = require("schematics-utilities"); function azureDevOps(options) { return (tree, _context) => { return schematics_1.chain([ createVstsCiBuildYamlFile(tree, options) ]); }; } exports.azureDevOps = azureDevOps; function createVstsCiBuildYamlFile(tree, options) { const templateSource = schematics_1.apply(schematics_1.url('./files'), [ schematics_1.applyTemplates(Object.assign(Object.assign(Object.assign({}, core_1.strings), options), getPaths(tree, options))), schematics_1.move('.'), angular_schematic_utils_1.overwriteIfExists(tree) ]); return schematics_1.chain([ schematics_1.mergeWith(templateSource) ]); } function getPaths(host, options) { const workspace = schematics_utilities_1.getWorkspace(host); const projectName = options.project; const workspaceProject = angular_schematic_utils_1.getProjectFromWorkspace(workspace, projectName); const karmaPath = getProjectKarmaPath(workspaceProject); const protractorPath = getProjectProtractorPath(workspaceProject); return { karmaConfigPath: karmaPath, protractorConfigPath: protractorPath, }; } function getProjectKarmaPath(project) { const testOptions = angular_schematic_utils_1.getProjectTargetOptions(project, 'test'); const karmaConfigFile = core_1.normalize(testOptions.karmaConfig); return karmaConfigFile.replace('karma.conf.js', 'karma-ci.conf.js'); } function getProjectProtractorPath(project) { const testOptions = angular_schematic_utils_1.getProjectTargetOptions(project, 'e2e'); const protractorConfigFile = core_1.normalize(testOptions.protractorConfig); return protractorConfigFile.replace('protractor.conf.js', 'protractor-ci.conf.js'); } //# sourceMappingURL=index.js.map