當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript logger.Logger類代碼示例

本文整理匯總了TypeScript中@ngtools/logger.Logger的典型用法代碼示例。如果您正苦於以下問題:TypeScript Logger類的具體用法?TypeScript Logger怎麽用?TypeScript Logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Logger類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: patch

export default function patch(args: string[], opts: any, logger: Logger): void {
  const newVersion = args[0];
  const incFn = opts.patch ? (v: SemVer) => v.inc('patch') : (v: SemVer) => v;

  if (!newVersion) {
    logger.fatal('Need to pass in a new version.');
    return;
  }

  const { packages } = require('../../../lib/packages');
  const rootPackageJson = path.join(__dirname, '../../../package.json');

  for (const packageName of Object.keys(packages)) {
    if (packageName == 'angular-cli') {
      // Skip the main package.
      continue;
    }

    const pkgJson = require(packages[packageName].packageJson);
    const version = new SemVer(pkgJson['version']);
    const oldVersion = version.toString();

    pkgJson['version'] = incFn(version).toString();
    fs.writeFileSync(packages[packageName].packageJson, JSON.stringify(pkgJson, null, 2) + '\n');

    logger.info(`${packageName}: ${oldVersion} => ${pkgJson['version']}`);
  }

  // Do the main package.
  const angularCliPackageJson = require(rootPackageJson);
  angularCliPackageJson['version'] = newVersion;
  fs.writeFileSync(rootPackageJson, JSON.stringify(angularCliPackageJson, null, 2) + '\n');
}
開發者ID:3L4CKD4RK,項目名稱:angular-cli,代碼行數:33,代碼來源:update-version.ts

示例2: catch

 return promise.then(() => {
   toolsLogger.info(name);
   try {
     return npmRun.execSync(`tsc -p ${path.relative(process.cwd(), pkg.root)}`);
   } catch (err) {
     toolsLogger.fatal(`Compilation error.\n${err.stdout}`);
   }
 });
開發者ID:RoPP,項目名稱:angular-cli,代碼行數:8,代碼來源:build.ts

示例3: Logger

    .then(() => {
      logger.info('Tarring all packages...');

      const tarLogger = new Logger('license', logger);
      return Promise.all(Object.keys(packages).map(pkgName => {
        const pkg = packages[pkgName];
        tarLogger.info(`${pkgName} => ${pkg.tar}`);
        return tarFiles(pkg.tar, pkg.dist);
      }));
    })
開發者ID:germanomarques,項目名稱:angular-cli,代碼行數:10,代碼來源:build.ts

示例4: Logger

    .then(() => {
      // Copy LICENSE into all the packages
      logger.info('Copying LICENSE...');

      const licenseLogger = new Logger('license', logger);
      return Promise.all(Object.keys(packages).map(pkgName => {
        const pkg = packages[pkgName];
        licenseLogger.info(`${pkgName}`);
        return copy('LICENSE', path.join(pkg.dist, 'LICENSE'));
      }));
    })
開發者ID:RoPP,項目名稱:angular-cli,代碼行數:11,代碼來源:build.ts

示例5: build

export function build(args: string[], _opts: any, logger: Logger): void {
  const inFile = args[1] as string;
  const outFile = args[2] as string;
  if (!inFile) {
    logger.fatal('Command build-schema needs an input file.');
    return;
  }

  const output = require('./build-schema').buildSchema(inFile, logger);
  if (outFile) {
    fs.writeFileSync(outFile, output, { encoding: 'utf-8' });
  } else {
    logger.info(output);
  }
}
開發者ID:3L4CKD4RK,項目名稱:angular-cli,代碼行數:15,代碼來源:build-schema.ts

示例6: changelog

export default function changelog(args: string[], _opts: any, logger: Logger): void {
  if (args.length == 0) {
    logger.fatal('publish changelog <start-tag>');
    return;
  }

  cl(config, null, {from: args[0]})
    .on('error', function (err: Error) {
      logger.error('Failed to generate changelog: ' + err);
    })
    .pipe(changelogStream)
    .on('close', prependDelta);
}
開發者ID:dahang,項目名稱:angular-cli,代碼行數:13,代碼來源:changelog.ts

示例7: if

    .then(() => {
      if (!opts.local) {
        return;
      }

      logger.info('Changing dependencies between packages to tar files...');
      logger.warn('=================================================');
      logger.warn('= THIS SHOULD NOT BE USED FOR PUBLISHING TO NPM =');
      logger.warn('=================================================');

      Object.keys(packages).forEach(pkgName => {
        const pkg = packages[pkgName];
        const json = JSON.parse(fs.readFileSync(pkg.packageJson).toString());

        if (!json['dependencies']) {
          json['dependencies'] = {};
        }
        if (!json['devDependencies']) {
          json['devDependencies'] = {};
        }

        for (const packageName of Object.keys(packages)) {
          if (json['dependencies'].hasOwnProperty(packageName)) {
            json['dependencies'][packageName] = packages[packageName].tar;
          } else if (json['devDependencies'].hasOwnProperty(packageName)) {
            json['devDependencies'][packageName] = packages[packageName].tar;
          }
        }

        fs.writeFileSync(pkg.distPackageJson, JSON.stringify(json, null, 2));
      });
    })
開發者ID:alexspring123,項目名稱:angular-cli,代碼行數:32,代碼來源:build.ts

示例8: Error

    .then((files: string[]) => {
      logger.info(`Found ${files.length} files...`);

      return files
        .map((fileName) => path.relative(packagesRoot, fileName))
        .filter((fileName) => {
          if (/^@angular[\\\/]cli[\\\/]blueprints/.test(fileName)) {
            return true;
          }
          if (/\.d\.ts$/.test(fileName)) {
            // The last thing we want is d.ts files...
            return false;
          }
          if (/\.spec\.ts$/.test(fileName)) {
            // Also spec.ts files...
            return false;
          }
          if (/spec-utils.ts/.test(fileName)) {
            // TODO: get rid of this by splitting spec utils in its own package.
            return false;
          }
          if (/\.ts$/.test(fileName)) {
            // Verify that it was actually built.
            if (!fs.existsSync(path.join(dist, fileName).replace(/ts$/, 'js'))) {
              throw new Error(`Source found but compiled file not found: "${fileName}".`);
            }

            // Skip all source files, since we have their JS files now.
            return false;
          }

          // The only remaining file we want to ignore is tsconfig and spec files.
          return !(/tsconfig\.json$/.test(fileName))
            && !(/\.spec\./.test(fileName))
            && !(/[\/\\]tests[\/\\]/.test(fileName));
        })
        .map((fileName) => {
          const source = path.join(packagesRoot, fileName);
          const dest = path.join(dist, fileName);

          if (fs.statSync(source).isDirectory()) {
            try {
              fs.mkdirSync(dest);
            } catch (err) {
              if (err.code != 'EEXIST') {
                throw err;
              }
            }
          } else {
            return copy(source, dest);
          }
        })
        .reduce((promise, current) => {
          return promise.then(() => current);
        }, Promise.resolve());
    })
開發者ID:RoPP,項目名稱:angular-cli,代碼行數:56,代碼來源:build.ts


注:本文中的@ngtools/logger.Logger類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。