How to use the ng-packagr/lib/util/log.info 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
if (!options.tasks.data.sassBundle) {
    return;
  }

  const assets = normalizeAssetPatterns(
    options.tasks.data.sassBundle.entries,
    syncHost as any,
    root,
    projectRoot,
    sourceRoot,
  );

  const copyPatterns = buildCopyPatterns(root, assets);
  const copyOptions = { ignore: ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'] };

  log.info('Bundling a sass bundles...');

  const promises = copyPatterns.map( pattern => {
    const fullPattern = pattern.context + pattern.from.glob;
    const opts = { ...copyOptions, dot: pattern.from.dot };
    return globby(fullPattern, opts)
      .then(entries => {
        const entryPromises = entries.map( entry => {
          const cleanFilePath = entry.replace(pattern.context, '');
          const to = Path.resolve(root, pattern.to, cleanFilePath);
          const pathToFolder = Path.dirname(to);
          pathToFolder.split('/').reduce((p, folder) => {
            p += folder + '/';

            if (!FS.existsSync(p)) {
              FS.mkdirSync(p);
            }
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');
		}
	}
github shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
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');
github linnenschmidt / build-ng-packagr / packages / builders / src / build-ng-packagr / src / build / assets.ts View on Github external
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);
  }));
github shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
const syncHost = new virtualFs.SyncDelegateHost(host);

  if (!options.tasks.data.sassCompile) {
    return;
  }

  const assets = normalizeAssetPatterns(
    options.tasks.data.sassCompile.entries,
    syncHost as any,
    root,
    projectRoot,
    sourceRoot,
  );

  const copyPatterns = buildCopyPatterns(root, assets);
  log.info('Compiling sass bundles...');

  const destPath = Path.join(root, copyPatterns[0].to);

  const taskName = context.epNode.data.entryPoint.moduleId + ':css';
  task(taskName, () => {
    return buildScssPipeline(copyPatterns[0].context, [ Path.join(root, 'node_modules/') ], true).pipe(dest(destPath));
  });

  try {
    await new Promise( (resolve, reject) => {
      series(taskName)( (err?: any) => {
        if (err) {
          reject(err);
        } else {
          resolve();
        }