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


TypeScript tsc-wrapped.main函數代碼示例

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


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

示例1: copyFile

export = (done: any) => {
  // Note: dirty hack until we're able to set config easier
  copyFile('tsconfig.json', Config.TMP_DIR, join(Config.TMP_DIR, Config.BOOTSTRAP_DIR), (content: string) => {
    const parsed = JSON.parse(content);
    parsed.files = parsed.files || [];
    parsed.files.push('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 tsc.NgcCliOptions(args);
  tsc.main(join(Config.TMP_DIR, Config.BOOTSTRAP_DIR), cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
開發者ID:Sjiep,項目名稱:angular2-seed,代碼行數:26,代碼來源:compile.ahead.prod.ts

示例2: disabledTransformerPipelineNgcMain

function disabledTransformerPipelineNgcMain(
    args: any, consoleError: (s: string) => void = console.error): Promise<number> {
  const cliOptions = new tsc.NgcCliOptions(args);
  const project = args.p || args.project || '.';
  return tsc.main(project, cliOptions, disabledTransformerPipelineCodegen)
      .then(() => 0)
      .catch(e => {
        if (e instanceof tsc.UserError || isSyntaxError(e)) {
          consoleError(e.message);
        } else {
          consoleError(e.stack);
        }
        return Promise.resolve(1);
      });
}
開發者ID:DanielKucal,項目名稱:angular,代碼行數:15,代碼來源:main.ts

示例3: main

export function main(
    args: any, consoleError: (s: string) => void = console.error): Promise<number> {
  const project = args.p || args.project || '.';
  const cliOptions = new tsc.NgcCliOptions(args);

  return tsc.main(project, cliOptions, codegen).then(() => 0).catch(e => {
    if (e instanceof tsc.UserError || isSyntaxError(e)) {
      consoleError(e.message);
      return Promise.resolve(1);
    } else {
      consoleError(e.stack);
      consoleError('Compilation failed');
      return Promise.resolve(1);
    }
  });
}
開發者ID:JohnnyQQQQ,項目名稱:angular,代碼行數:16,代碼來源:main.ts

示例4: copyFile

export = (done: any) => {
  // Note: dirty hack until we're able to set config easier
  copyFile('tsconfig.json', Config.TMP_DIR, join(Config.TMP_DIR, Config.BOOTSTRAP_DIR), (content: string) => {
    const parsed = JSON.parse(content);
    parsed.files = parsed.files || [];
    parsed.files.push('main.ts');
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;
  const cliOptions = new tsc.NgcCliOptions(args);
  tsc.main(join(Config.TMP_DIR, Config.BOOTSTRAP_DIR), cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
開發者ID:ZarkoPernar,項目名稱:angular2-calendar,代碼行數:18,代碼來源:compile.ahead.prod.ts

示例5: extract

/**
 * Extract i18n messages from source code
 */
// Must be imported first, because angular2 decorators throws on load.
import 'reflect-metadata';

import * as tsc from '@angular/tsc-wrapped';
import * as ts from 'typescript';

import {Extractor} from './extractor';

function extract(
    ngOptions: tsc.AngularCompilerOptions, cliOptions: tsc.I18nExtractionCliOptions,
    program: ts.Program, host: ts.CompilerHost): Promise<void> {
  return Extractor.create(ngOptions, program, host).extract(cliOptions.i18nFormat);
}

// Entry point
if (require.main === module) {
  const args = require('minimist')(process.argv.slice(2));
  const project = args.p || args.project || '.';
  const cliOptions = new tsc.I18nExtractionCliOptions(args);
  tsc.main(project, cliOptions, extract, {noEmit: true})
      .then((exitCode: any) => process.exit(exitCode))
      .catch((e: any) => {
        console.error(e.stack);
        console.error('Extraction failed');
        process.exit(1);
      });
}
開發者ID:manekinekko,項目名稱:angular,代碼行數:30,代碼來源:extract_i18n.ts

示例6: codegen

#!/usr/bin/env node

// Must be imported first, because angular2 decorators throws on load.
import 'reflect-metadata';

import * as ts from 'typescript';
import * as tsc from '@angular/tsc-wrapped';

import {CodeGenerator} from './codegen';

function codegen(
    ngOptions: tsc.AngularCompilerOptions, program: ts.Program, host: ts.CompilerHost) {
  return CodeGenerator.create(ngOptions, program, host).codegen();
}

// CLI entry point
if (require.main === module) {
  const args = require('minimist')(process.argv.slice(2));
  tsc.main(args.p || args.project || '.', args.basePath, codegen)
      .then(exitCode => process.exit(exitCode))
      .catch(e => {
        console.error(e.stack);
        console.error('Compilation failed');
        process.exit(1);
      });
}
開發者ID:BharatBhatiya,項目名稱:test,代碼行數:26,代碼來源:main.ts

示例7: require

      case 'xmb':
        ext = 'xmb';
        serializer = new compiler.Xmb();
        break;
      case 'xliff':
      case 'xlf':
      default:
        ext = 'xlf';
        serializer = new compiler.Xliff();
        break;
    }

    const dstPath = path.join(ngOptions.genDir, `messages.${ext}`);
    host.writeFile(dstPath, messageBundle.write(serializer), false);
  });
}

// Entry point
if (require.main === module) {
  const args = require('minimist')(process.argv.slice(2));
  const project = args.p || args.project || '.';
  const cliOptions = new tsc.I18nExtractionCliOptions(args);
  tsc.main(project, cliOptions, extract)
      .then((exitCode: any) => process.exit(exitCode))
      .catch((e: any) => {
        console.error(e.stack);
        console.error('Extraction failed');
        process.exit(1);
      });
}
開發者ID:gonzofish,項目名稱:angular,代碼行數:30,代碼來源:extract_i18n.ts

示例8: tsc

export const ngc = (tsconfig: string, basePath: string): Promise<string> => {
  debug(`ngc ${tsconfig}, { basePath: ${basePath} })`);

  return tsc(tsconfig, { basePath })
    .then(() => readJson(tsconfig)
      .then(v => `${basePath}/${v.compilerOptions.outDir}/${v.angularCompilerOptions.flatModuleOutFile}`));
}
開發者ID:davidenke,項目名稱:ng-packagr,代碼行數:7,代碼來源:ngc.ts

示例9: tsc

task(`${packageName}:build:esm:tests`, () => tsc(tsconfigTests, {basePath: packageRoot}));
開發者ID:Daniel-McK,項目名稱:material2,代碼行數:1,代碼來源:package-tasks.ts


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