Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 1x 3x 3x 3x 3x 2x 2x 2x 2x 2x 2x | import {Schema as ProxyOptions} from './schema'; import {apply, chain, MergeStrategy, mergeWith, move, Rule, url} from '@angular-devkit/schematics'; import {updateWorkspace} from '@schematics/angular/utility/workspace'; export default function (options: ProxyOptions): Rule { return () => { return chain([ mergeWith(apply(url('./files'), [ move(''), ]), MergeStrategy.Overwrite), updateProjectWorkspace() ]); }; } function updateProjectWorkspace(): () => Rule { return () => { return updateWorkspace(workspace => { const projectName = workspace.extensions.defaultProject as string; const project = workspace.projects.get(projectName); Iif (!project) { return; } // Add proxy config const serve = project.targets.get('serve'); Iif (!serve) throw new Error(`expected node projects/${projectName}/architect/serve in angular.json`); (<any>serve.options)['proxyConfig'] = 'proxy.conf.json'; }); } } |