Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/api-extractor

Package Overview
Dependencies
Maintainers
2
Versions
489
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/api-extractor

Analyze the exported API for a TypeScript library and generate reviews, documentation, and .d.ts rollups

  • 7.37.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-2.65%
Maintainers
2
Weekly downloads
 
Created

What is @microsoft/api-extractor?

@microsoft/api-extractor is a tool for managing and analyzing the public API surface of a TypeScript library. It helps in generating API reports, creating API documentation, and ensuring API compatibility.

What are @microsoft/api-extractor's main functionalities?

Generate API Report

This feature allows you to generate an API report for your TypeScript library. The report includes details about the public API surface, which can be used for documentation and compatibility checks.

const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');
const path = require('path');

const configPath = path.join(__dirname, 'api-extractor.json');
const extractorConfig = ExtractorConfig.loadFileAndPrepare(configPath);
const extractorResult = Extractor.invoke(extractorConfig, {
  localBuild: true,
  showVerboseMessages: true
});

if (extractorResult.succeeded) {
  console.log('API Extractor completed successfully');
} else {
  console.error(`API Extractor completed with ${extractorResult.errorCount} errors`);
}

Generate API Documentation

This feature allows you to generate API documentation from the TypeScript library. The documentation is based on the public API surface and can be used for reference and development purposes.

const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');
const path = require('path');

const configPath = path.join(__dirname, 'api-extractor.json');
const extractorConfig = ExtractorConfig.loadFileAndPrepare(configPath);
const extractorResult = Extractor.invoke(extractorConfig, {
  localBuild: true,
  showVerboseMessages: true
});

if (extractorResult.succeeded) {
  console.log('API documentation generated successfully');
} else {
  console.error(`API documentation generation failed with ${extractorResult.errorCount} errors`);
}

Ensure API Compatibility

This feature allows you to ensure API compatibility by comparing the current API surface with a previously generated API report. It helps in maintaining backward compatibility and avoiding breaking changes.

const { Extractor, ExtractorConfig } = require('@microsoft/api-extractor');
const path = require('path');

const configPath = path.join(__dirname, 'api-extractor.json');
const extractorConfig = ExtractorConfig.loadFileAndPrepare(configPath);
const extractorResult = Extractor.invoke(extractorConfig, {
  localBuild: true,
  showVerboseMessages: true
});

if (extractorResult.succeeded) {
  console.log('API compatibility check passed');
} else {
  console.error(`API compatibility check failed with ${extractorResult.errorCount} errors`);
}

Other packages similar to @microsoft/api-extractor

Keywords

FAQs

Package last updated on 26 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc