How to use the ng-packagr/lib/util/log.error 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 shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
log.info('============================================== SCSS BUNDLE ==============================================');
  log.info(`= Source: ${src}`);
  log.info(`= Dest: ${dest}`);
  log.info(`=`);

	const { found, bundledContent, imports } = await new Bundler(undefined, root).Bundle(src, ["./!(dist|node_modules)/**/*.scss"], undefined, ["^~"]);

	if (imports) {
		const filesNotFound = imports
			.filter(x => !x.found && !x.ignored)
			.map(x => x.filePath);

		if (filesNotFound.length) {
      log.error(`= Error: SCSS imports failed`);
      log.error('= ' + filesNotFound.join('\n= '));
      log.info('=========================================================================================================');
			throw new Error('One or more SCSS imports failed');
		}
	}

	if (found) {
    await writeFile(dest, bundledContent);
    log.success(`= Bundle OK`);
    log.info('=========================================================================================================');
	}
}
github shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
async function bundleScss(root: string, src: string, dest: string) {

  log.info('============================================== SCSS BUNDLE ==============================================');
  log.info(`= Source: ${src}`);
  log.info(`= Dest: ${dest}`);
  log.info(`=`);

	const { found, bundledContent, imports } = await new Bundler(undefined, root).Bundle(src, ["./!(dist|node_modules)/**/*.scss"], undefined, ["^~"]);

	if (imports) {
		const filesNotFound = imports
			.filter(x => !x.found && !x.ignored)
			.map(x => x.filePath);

		if (filesNotFound.length) {
      log.error(`= Error: SCSS imports failed`);
      log.error('= ' + filesNotFound.join('\n= '));
      log.info('=========================================================================================================');
			throw new Error('One or more SCSS imports failed');
		}
	}

	if (found) {
    await writeFile(dest, bundledContent);
    log.success(`= Bundle OK`);
    log.info('=========================================================================================================');
	}
}
github linnenschmidt / build-ng-packagr / packages / builders / src / build-ng-packagr / src / build / assets.ts View on Github external
if (!fs.existsSync(p)) {
              fs.mkdirSync(p);
            }
            return p;
          }, '');

          fs.copyFileSync(entry, to);
          log.success(` - from: ${entry}`);
          log.success(` - to: ${to}`);
        });
      });
    });

    return Promise.all(copyPromises);
  } catch (e) {
    log.error(e.message);
    return Promise.resolve();
  }
}