npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

typescript-intl-cra

v0.4.2

Published

Extract messages of `Creact React App` from the command line. Also understands TypeScript

Downloads

72

Readme

Why

The main reason to give back life again to this tool is that at work we make pretty good use in for extracting and storing translation messages. After according to port our projects to TypeScript, we've realized that react-int-cra did not support the TypeScript syntax. Even the available options offered the possibility to add babel plugins, it did not work with the last versions of babel either. Of course, the project had been deprecated.

The author suggests to change to another library, but for now, we're more focused on evolving our product. No time for changing models in the toolchain. So after observing how the library works, we found easier to update it and include the TypeScript support than using a new instrument.

So now you're aware why don't expect nothing too fancy. It is just the same old fashion behavior updated to babel 7. And TypeScript support.

Please, refer to the original repository if you want to know more about suggested alternatives.

typescript-intl-cra

Extract messages of Creact React App from the command line.

Travis Codecov Status npm package npm downloads

prettier license

This is just a workaround for create-react-app #1227 and react-intl #869 in unofficial way.

Installation

$ yarn add typescript-intl-cra --dev

Demo

Standalone example based on Create-React-App: https://github.com/evenchange4/react-intl-po-example

$ typescript-intl-cra './src/**/*.js' -o messages.json

Output:

// messages.json

[
  {
    "id": "Account.account",
    "description": "Title",
    "defaultMessage": "帳戶",
    "filepath": "./src/containers/Account/messages.js"
  },
  {
    "id": "Account.myTestDevices",
    "defaultMessage": "我的測試裝置",
    "filepath": "./src/containers/Account/messages.js"
  },
  ...
]

API

$ typescript-intl-cra --help

Usage: typescript-intl-cra <pattern> [options]

<pattern> Glob pattern to specify files.
          Needs to be surrounded with quotes to prevent shell globbing.
          Guide to globs: https://github.com/isaacs/node-glob

Options:
  -o, --out-file  Output into a single file                             [string]
  -h, --help      Show help                                            [boolean]
  -v, --version   Show version number                                  [boolean]

Examples:
  typescript-intl-cra 'src/App.js'                   One file.
  typescript-intl-cra 'src/**/*.js'                  Pattern to specify files
  typescript-intl-cra 'src/**/*.js' -o message.json  Output into a single file.


For more information go to https://github.com/emoriarty/typescript-intl-cra

NPM Usage

import extract from 'typescript-intl-cra';

const result = extract('./src/**/*.js');

Development

Requirements

  • node >= 9
  • yarn >= 1.3.2
$ yarn install --pure-lockfile
$ yarn start

Test

$ yarn run format
$ yarn run eslint
$ yarn run flow
$ yarn run test:watch

NPM Release

Any git tags.

  1. Create a new git tag
  2. Update CHANGELOG.md
$ npm version patch
$ npm run changelog

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ yarn test).

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org