How to use the ng-packagr/lib/ng-v5/discover-packages.discoverPackages function in ng-packagr

To help you get started, we’ve selected a few ng-packagr 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 linnenschmidt / build-ng-packagr / packages / builders / src / build-ng-packagr / src / build / assets.ts View on Github external
export function handleAssets(
  context: BuilderContext,
  options: NgPackagrBuilderOptions,
): Observable {
  const host = new NodeJsSyncHost();
  const projectPath = resolve(normalize(context.workspaceRoot), normalize(path.dirname(options.project)));
  const projectRoot = getSystemPath(projectPath);

  return from(discoverPackages({ project: projectRoot }).then(ngPackage => {
    log.info('Copying Assets');
    const syncHost = new virtualFs.SyncDelegateHost(host);

    if (options.assets.length === 0) {
      return Promise.resolve();
    }

    const assets = normalizeAssetPatterns(
      options.assets,
      syncHost,
      projectPath,
      projectPath,
      undefined,
    );

    return moveAssets(ngPackage.src, ngPackage.dest, assets);