This is the web app components package library for the Terraware application from Terraformation.
This package primarily provides UI components for reuse in the web app repo.
If you're not a Terraformation employee, thanks for checking this repo out!
We're offering this project as Apache-licensed open source in the interest of sharing our technology with the world and being transparent about our work. Our mission is to accelerate global native forest restoration, and we believe we'll get there faster by sharing what we do.
For the moment, we're not asking for code contributions from the community. (Check our careers page if you're itching to work on this code!)
You may see references to some private repositories in the documentation. We're working toward opening more of our code, but not everything is ready yet.
Make sure you're using Node 24
With nvm:
nvm useyarnExecute the following commands:
yarn startYou can add a comment to your open pull request with the text "publish rc".
This will publish an RC build to NPM for use in your repo that consumes web-components with a tag like v2.3.58-rc.0.
In the project directory, you can run:
Runs the unit tests with Rstest. Pass --watch to rerun them as files change, or run
yarn test-coverage to write a coverage report to docs/coverage.
Builds the Storybook into the public folder.
Builds the published package into the dist folder with Rslib.
Execute the following commands:
yarn lintUpdate the style-dictionary/generate.sh script to download the tokens json and then run:
yarn build-dictionaryComponents read their text from the string tables in src/strings rather than taking it as props.
Use useStrings() in a component, or getStrings() in code that can't hold a hook. Applications
pick the language by calling setLocale('es') — until they do, everything renders in English.
src/strings/csv/en.csv is the only file you edit by hand. The src/strings/strings-*.ts tables are
generated from it and aren't checked in, so run this after editing the CSV:
yarn generate-stringsyarn install does this for you, which is also how CI gets the tables. If you see TypeScript
complaining that ./strings-en doesn't exist, that's the step you're missing.
Translations are generated with OpenAI, so you need an API key — get one from your OpenAI account
administrator or the OpenAI console, and put it in .env as
OPENAI_API_KEY. Then, after editing en.csv:
yarn translateThat translates the new or changed strings and regenerates the tables. If you'd rather not do it by
hand each time, yarn translate:start watches en.csv in the background instead. Editing a
translation directly in es.csv or fr.csv is fine too; autotranslate only touches strings whose
English text has changed.
- Copy svgs to
./assets - Run
yarn generate-assets, see new files under./src/components/svgas asset React components - Integrate new asset React component into
./src/components/Icon/icons/index.tsxif needed as an icon