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

@allthings/react-intl-extract-messages

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allthings/react-intl-extract-messages

Extracts all `react-intl` related messages in typescript based projects.

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

react-intl-extract-messages

Extracts all react-intl related messages in typescript based projects.

Install

yarn add @allthings/react-intl-extract-messages

Usage

API

extractMessages(tsconfigFile[, options])

Returns an array of messages gathered by @allthings/babel-plugin-react-intl.

tsconfigFile

Type: string

Can be absolute or relative path to the tsconfig file, all information how to build the project is taken from there.

options

Type: object

An object of options which is handed over to @allthings/babel-plugin-react-intl

import { extractMessages } from '@allthings/react-intl-extract-messages'

const messages = extractMessages('../tsconfig.json', {
  // options passed to @allthings/babel-plugin-react-intl
})

console.log(messages)

// [
//   {
//     id: 'authorized-clients-list.revoke',
//     description: 'Revoke',
//     defaultMessage: 'Revoke',
//   },
//   {
//     id: 'authorized-clients-list.terms-of-use',
//     description: 'Terms of use',
//     defaultMessage: 'Terms of use',
//   },
//   // ...
// ]

CLI

react-intl-extract-messages --tsconfig tsconfig.json --out messages.json --options-file opts.json

If --out is omitted, the output will be written to stdout.

How

Basically it uses typescript to compile all the files to JS and then uses @allthings/babel-plugin-react-intl to extract the messages.

Tests

Run tests with yarn test.

This will extract messages from a fixture project and check it against a snapshot.

FAQs

Package last updated on 17 Oct 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