How to use jsii-rosetta - 4 common examples

To help you get started, we’ve selected a few jsii-rosetta 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 aws / jsii / packages / jsii-pacmak / lib / targets / dotnet / dotnetdocgenerator.ts View on Github external
private renderRemarks(docs: spec.Docs): string[] {
    const ret: string[] = [];

    if (docs.remarks) {
      const translated = markDownToXmlDoc(this.convertSamplesInMarkdown(docs.remarks));
      ret.push(...translated.split('\n'));
      ret.push('');
    }

    // All the "tags" need to be rendered with empyt lines between them or they'll be word wrapped.

    if (docs.default) { emitDocAttribute('default', docs.default); }
    if (docs.stability) { emitDocAttribute('stability', this.nameutils.capitalizeWord(docs.stability)); }
    if (docs.see) { emitDocAttribute('see', docs.see); }
    if (docs.subclassable) { emitDocAttribute('subclassable', ''); }
    for (const [k, v] of Object.entries(docs.custom || {})) {
      const extraSpace = k === 'link' ? ' ' : ''; // Extra space for '@link' to keep unit tests happy
      emitDocAttribute(k, v + extraSpace);
    }

    // Remove leading and trailing empty lines
github aws / jsii / packages / jsii-pacmak / lib / targets / dotnet / dotnetdocgenerator.ts View on Github external
public emitMarkdownAsRemarks(markdown: string | undefined) {
    if (!markdown) { return; }

    const translated = markDownToXmlDoc(this.convertSamplesInMarkdown(markdown));
    const lines = translated.split('\n');

    this.code.line('/// ');
    for (const line of lines) {
      this.code.line(`/// ${line}`);
    }
    this.code.line('/// ');
  }
github aws / jsii / packages / jsii-pacmak / bin / jsii-pacmak.ts View on Github external
type: 'boolean',
      desc: 'Translate code samples on-the-fly if they can\'t be found in the samples tablet',
      default: true
    })
    .version(VERSION_DESC)
    .strict()
    .argv;

  logging.configure({ level: argv.verbose !== undefined ? argv.verbose : 0 });

  // Default to 4 threads in case of concurrency, good enough for most situations
  logging.debug('command line arguments:', argv);

  const timers = new Timers();

  const rosetta = new Rosetta({ liveConversion: argv['rosetta-translate-live'] });
  if (argv['rosetta-tablet']) {
    await rosetta.loadTabletFromFile(argv['rosetta-tablet']);
  }

  const modulesToPackage = await findJsiiModules(argv._, argv.recurse);
  logging.info(`Found ${modulesToPackage.length} modules to package`);
  if (modulesToPackage.length === 0) {
    logging.warn('Nothing to do');
    return;
  }

  if (argv.outdir) {
    for (const module of modulesToPackage) {
      module.outputDirectory = path.resolve(argv.outdir);
    }
github aws / jsii / packages / jsii-pacmak / lib / targets / dotnet / dotnetdocgenerator.ts View on Github external
private convertExample(example: string): string {
    const snippet = typeScriptSnippetFromSource(example, 'example');
    const translated = this.rosetta.translateSnippet(snippet, 'csharp');
    if (!translated) { return example; }
    return this.prefixDisclaimer(translated);
  }

jsii-rosetta

[![Join the chat at https://cdk.Dev](https://img.shields.io/static/v1?label=Slack&message=cdk.dev&color=brightgreen&logo=slack)](https://cdk.dev) [![All Contributors](https://img.shields.io/github/all-contributors/aws/jsii/main?label=%E2%9C%A8%20All%20Con

Apache-2.0
Latest version published 3 days ago

Package Health Score

80 / 100
Full package analysis

Similar packages