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


TypeScript compiler-cli.main函數代碼示例

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


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

示例1: modifyFile

export = (done: any) => {
  // Note: dirty hack until we're able to set config easier
  modifyFile(join(Config.TMP_DIR, 'tsconfig.json'), (content: string) => {
    const parsed = JSON.parse(content);
    parsed.files = parsed.files || [];
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
開發者ID:UIUXEngineering-Forks,項目名稱:angular2-seed,代碼行數:26,代碼來源:compile.ahead.prod.ts

示例2: modifyFile

export = (done: any) => {
  // Note: dirty hack until we're able to set config easier
  modifyFile(join(Config.TMP_DIR, 'tsconfig.json'), (content: string) => {
    const parsed = JSON.parse(content);
    const path = join(Config.PROJECT_ROOT, Config.TOOLS_DIR, 'manual_typings', 'project');
    parsed.files = parsed.files || [];
    parsed.files = parsed.files.concat(
      readdirSync(path)
      .filter(f => f.endsWith('d.ts'))
      .map(f => join(path, f)));
    parsed.files = parsed.files.filter((f: string, i: number) => parsed.files.indexOf(f) === i);
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
開發者ID:GeoscienceAustralia,項目名稱:gnss-site-manager,代碼行數:32,代碼來源:compile.ahead.prod.ts

示例3: modifyFile

export = (done: any) => {
  // Note: dirty hack until we're able to set config easier
  modifyFile(join(Config.TMP_DIR, 'tsconfig.json'), (content: string) => {
    const parsed = JSON.parse(content);
    const path = join(
      Config.PROJECT_ROOT,
      Config.TOOLS_DIR,
      'manual_typings',
      'project'
    );
    parsed.files = parsed.files || [];
    parsed.files = parsed.files.concat(
      readdirSync(path)
        .filter(f => f.endsWith('d.ts'))
        .map(f => join(path, f))
    );
    parsed.files = parsed.files.filter(
      (f: string, i: number) => parsed.files.indexOf(f) === i
    );
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv as any;

  // If a translation, tell the compiler
  if (args.lang) {
    let i18nFilePath = `${Config.LOCALE_DEST}/messages.${args.lang}.xlf`;
    let isExists = existsSync(i18nFilePath);
    if (isExists) {
      args['i18nFile'] = i18nFilePath;
      args['locale'] = args.lang;
      args['i18nFormat'] = 'xlf';
    } else {
      util.log(util.colors.gray('Translation file is not found'), util.colors.yellow(i18nFilePath));
      util.log(util.colors.gray(`Use 'npm run i18n' command to create your translation file`));
    }
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
開發者ID:baleboy,項目名稱:zephyrjs-ide,代碼行數:47,代碼來源:compile.ahead.prod.ts


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