当前位置: 首页>>代码示例>>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;未经允许,请勿转载。