1 | # @expo/template-file
|
2 |
|
3 | `@expo/template-file` provides file-level variable substitution (Mustache template style).
|
4 |
|
5 | ## API
|
6 |
|
7 | ```ts
|
8 | templateFile(templateFilePath: string, outputFilePath: string, envs: Record<string, string | number>): Promise<void>
|
9 | ```
|
10 |
|
11 | ## Usage example
|
12 |
|
13 | ```ts
|
14 | import templateFile from '@expo/template-file';
|
15 |
|
16 | await templateFile('abc.json.template', 'abc.json', { ABC: 123, XYZ: 789 });
|
17 | ```
|
18 |
|
19 | `abc.json.template` file contents:
|
20 | ```
|
21 | {
|
22 | "someKey": {{ ABC }},
|
23 | "anotherKey": {{ XYZ }}
|
24 | }
|
25 | ```
|
26 |
|
27 | `abc.json` file should be created with the following contents:
|
28 | ```json
|
29 | {
|
30 | "someKey": 123,
|
31 | "anotherKey": 789
|
32 | }
|
33 | ```
|
34 |
|
35 | ## Repository
|
36 |
|
37 | https://github.com/expo/eas-build/tree/main/src/packages/template-file
|