https://github.com/evenchange4/react-intl-cra
🔧 Extract messages of Creact React App from the command line.
https://github.com/evenchange4/react-intl-cra
create-react-app react-intl
Last synced: over 1 year ago
JSON representation
🔧 Extract messages of Creact React App from the command line.
- Host: GitHub
- URL: https://github.com/evenchange4/react-intl-cra
- Owner: evenchange4
- License: mit
- Created: 2017-12-14T05:19:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-04T01:57:41.000Z (about 7 years ago)
- Last Synced: 2025-02-27T06:08:03.104Z (over 1 year ago)
- Topics: create-react-app, react-intl
- Language: JavaScript
- Homepage:
- Size: 891 KB
- Stars: 67
- Watchers: 3
- Forks: 11
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚠️ Deprecated - This repository is no longer maintained
Please use [react-intl.macro](https://github.com/evenchange4/react-intl.macro) or [react-app-rewired](https://github.com/timarney/react-app-rewired) solution.
# react-intl-cra
> Extract messages of `Creact React App` from the command line.
[![Travis][build-badge]][build]
[![Codecov Status][codecov-badge]][codecov]
[![npm package][npm-badge]][npm]
[![npm downloads][npm-downloads]][npm]
[![prettier][prettier-badge]][prettier]
[![license][license-badge]][license]
This is just a workaround for [create-react-app #1227](https://github.com/facebookincubator/create-react-app/issues/1227#issuecomment-285738137) and [react-intl #869](https://github.com/yahoo/react-intl/issues/869) in unofficial way.
## Installation
```sh
$ yarn add react-intl-cra --dev
```
## Demo
Standalone example based on Create-React-App: https://github.com/evenchange4/react-intl-po-example
```json
$ react-intl-cra './src/**/*.js' -o messages.json
```
Output:
```json
// 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
```sh
$ react-intl-cra --help
Usage: react-intl-cra [options]
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:
react-intl-cra 'src/App.js' One file.
react-intl-cra 'src/**/*.js' Pattern to specify files
react-intl-cra 'src/**/*.js' -o message.json Output into a single file.
For more information go to https://github.com/evenchange4/react-intl-cra
```
## NPM Usage
```js
import extract from 'react-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`
```sh
$ 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](CHANGELOG.md)
## [LICENSE](LICENSE)
MIT: [http://michaelhsu.mit-license.org](http://michaelhsu.mit-license.org)
[build-badge]: https://img.shields.io/travis/evenchange4/react-intl-cra/master.svg?style=flat-square
[build]: https://travis-ci.org/evenchange4/react-intl-cra
[npm-badge]: https://img.shields.io/npm/v/react-intl-cra.svg?style=flat-square
[npm]: https://www.npmjs.org/package/react-intl-cra
[codecov-badge]: https://img.shields.io/codecov/c/github/evenchange4/react-intl-cra.svg?style=flat-square
[codecov]: https://codecov.io/github/evenchange4/react-intl-cra?branch=master
[npm-downloads]: https://img.shields.io/npm/dt/react-intl-cra.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/react-intl-cra.svg?style=flat-square
[license]: http://michaelhsu.mit-license.org/
[prettier-badge]: https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square
[prettier]: https://github.com/prettier/prettier