Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const modulePath = options.module!;
const text = host.read(modulePath)!.toString();
const source = ts.createSourceFile(
modulePath,
text,
ts.ScriptTarget.Latest,
true
);
const moduleToImport = options.effects
? 'EntityDataModule'
: 'EntityDataModuleWithoutEffects';
const effectsModuleImport = insertImport(
source,
modulePath,
moduleToImport,
'@ngrx/data'
);
const [dateEntityNgModuleImport] = addImportToModule(
source,
modulePath,
options.entityConfig
? [moduleToImport, 'forRoot(entityConfig)'].join('.')
: moduleToImport,
''
);
const changes = [effectsModuleImport, dateEntityNgModuleImport];
'@ngrx/data'
);
const [dateEntityNgModuleImport] = addImportToModule(
source,
modulePath,
options.entityConfig
? [moduleToImport, 'forRoot(entityConfig)'].join('.')
: moduleToImport,
''
);
const changes = [effectsModuleImport, dateEntityNgModuleImport];
if (options.entityConfig) {
const entityConfigImport = insertImport(
source,
modulePath,
'entityConfig',
'./entity-metadata'
);
changes.push(entityConfigImport);
}
commitChanges(host, source.fileName, changes);
return host;
};
}