Permalink
Browse files

Add a manifest generator for OSS

Summary: Give OSS a script to generate enum and src manifests for `JSFbtTableBuilder`

Differential Revision: D13538875

fbshipit-source-id: a514acaf0e80bacbfba08265e8c3a622574fe9d6
  • Loading branch information...
jrwats authored and facebook-github-bot committed Dec 22, 2018
1 parent 92f1cd9 commit 5b562ccdb749008ad647d3be1eaa4d986a867e6f
@@ -1,10 +1,10 @@
node_modules/*
yarn.lock
yarn-error.log

demo-app/yarn-error.log
demo-app/yarn.lock
demo-app/.enum_manifest.json
demo-app/.src_manifest.json
demo-app/node_modules/*
demo-app/output
demo-app/source_strings.json
demo-app/src/translatedFbts.json
demo-app/node_modules/*
demo-app/yarn-error.log
@@ -1,4 +1,4 @@
# Contributing to **fbt**x
# Contributing to **fbt**
We want to make contributing to this project as easy and transparent as
possible.

@@ -9,39 +9,45 @@ FBT is an internationalization framework designed to be both intuitive and power
[See here](https://github.com/facebook/fbt)

## Requirements
* [node]()
* yarn
* babel
* [node](https://nodejs.org/)
* [yarn](https://yarnpkg.com/)
* [babel](https://babeljs.io/)

## Building fbt
...
```
git clone git@github.com:facebook/fbt.git;
cd fbt;
yarn install;
```

## Installing fbt
We have plans to make the transform and runtime installable as an npm package. Until then,
See how to use the source directly with Babel and Webpack in our demo-app:

## Installing __________
```
git clone git@github.com:facebook/fbt.git;
cd fbt/demo-app;
cd demo-app; # from fbt repo
yarn install;
yarn manifest;
yarn collect-fbts;
yarn translate-fbts;
yarn start;
```


## How fbt works
## How FBT works
FBT works by transforming your `<fbt>` and `fbt(...)` constructs in
Babel plugins. These plugins serve to extact strings from source and
lookup translate payloads generated at build-time.
Babel plugins. These plugins serve to extract strings from source and
lookup translate payloads generated at build-time. FBT creates tables
of all possible variations for the given fbt phrase and accesses this
at runtime

## Full documentation
https://facebook.github.io/fbt

## Join the __________ community
## Join the fbt community
* Website: https://facebook.github.io/fbt
* Facebook page: m.me/sjtbf
* Slack: https://fbtjs.slack.com
See the CONTRIBUTING file for how to help out.

## License
fbt is MIT licensed, as found in the LICENSE file.
FBT is MIT licensed, as found in the LICENSE file.
@@ -1,8 +1,11 @@
# Babel/Webpack/React OSS FBT Demo

* `yarn install` to pull in dependencies down
* `yarn build` to generate static files in `./output/`.
* `yarn start` to run a local server with hot reloading.
* `yarn manifest` to generate enum and source manifests
* `yarn collect-fbts` to collect FBT translatable texts
* `yarn translate-fbts` to generate translatedFbts.js from translation_input.json
* `yarn build` to generate static files in `./output/`.
* The commands above are required to run this step
* `yarn start` to run a local server with hot reloading.
* `yarn test ./src` to run unit tests.

This file was deleted.

Oops, something went wrong.
@@ -6,8 +6,10 @@
"license": "MIT",
"scripts": {
"build": "babel-node ../node_modules/webpack/bin/webpack",
"collect-fbts": "babel-node ../transform/babel-plugin-fbt/bin/collectFBT --json-input < src-manifest.json > source_strings.json",
"manifest": "babel-node ../transform/babel-plugin-fbt/bin/manifest --src src",
"collect-fbts": "babel-node ../transform/babel-plugin-fbt/bin/collectFBT --json-input < .src_manifest.json > source_strings.json",
"translate-fbts": "babel-node ../transform/babel-plugin-fbt/bin/translate.js --jenkins < ./translation_input.json > src/translatedFbts.json",
"clean-fbts": "rm .enum_manifest.json .src_manifest.json source_strings.json src/translatedFbts.json 2&> /dev/null || exit 0",
"start": "babel-node ../node_modules/webpack-dev-server/bin/webpack-dev-server --open",
"test": "babel-node ../node_modules/jest/bin/jest --config ./jest.config.json"
},

This file was deleted.

Oops, something went wrong.
@@ -57,7 +57,7 @@ module.exports = {
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-transform-flow-strip-types',
['../transform/babel-plugin-fbt/index.js', {
fbtEnumManifest: require('./enum-manifest.json')
fbtEnumManifest: require('./.enum_manifest.json')
}],
'../transform/babel-plugin-fbt-runtime/index.js',
]
Oops, something went wrong.

0 comments on commit 5b562cc

Please sign in to comment.