How to use the @ngrx/data/schematics-core.visitTSSourceFiles function in @ngrx/data

To help you get started, we’ve selected a few @ngrx/data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngrx / platform / modules / data / schematics / ng-add / index.ts View on Github external
return (host: Tree) => {
    visitTSSourceFiles(host, sourceFile => {
      const ngrxDataImports = sourceFile.statements
        .filter(ts.isImportDeclaration)
        .filter(
          ({ moduleSpecifier }) =>
            moduleSpecifier.getText(sourceFile) === "'ngrx-data'"
        );

      if (ngrxDataImports.length === 0) {
        return;
      }

      const changes = [
        ...findNgrxDataImports(sourceFile, ngrxDataImports),
        ...findNgrxDataImportDeclarations(sourceFile, ngrxDataImports),
        ...findNgrxDataReplacements(sourceFile),
      ];