Skip to content

Commit

Permalink
docs(getting-started): add root-env-root-run-deps-graph.svg
Browse files Browse the repository at this point in the history
  • Loading branch information
jjangga0214 committed Nov 7, 2023
1 parent afc563f commit 6d5c613
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ So Haetae uses **a package name as a namespace by convention.**
<Callout>
**Multiple Reserved Record Data** <br/>
All *Reserved Record Data* are saved in the list [`reservedRecordDataList`](./apis/core#reservedrecorddatalist).
All *Reserved Record Data* are saved in the list [`core.reservedRecordDataList{:ts}`](./apis/core#reservedrecorddatalist).
The list is to be merged by [`deepmerge`](https://www.npmjs.com/package/deepmerge).
</Callout>
Expand Down Expand Up @@ -1456,8 +1456,12 @@ $ haetae myGreeting
⎣ hello: WORLD # <--- capitalized
```
### Hashing *`haetae.config.js`* example
Let's get into a more practical example.<br/>
You may want the config file's hash to be automatically recorded into every command's `env`.
By *Root Env*, it's done in a single place.
You don't have to duplicate the code in every command's `env`.
<TokenLinkCode tokens={{
'configure': './apis/haetae#configure',
Expand Down Expand Up @@ -1485,8 +1489,6 @@ export default configure({
```
</TokenLinkCode>
By *Root Env*, it's done in a single place.
```fish filename="Terminal" {7}
$ haetae myGreeting --env

Expand Down Expand Up @@ -1519,7 +1521,11 @@ haetaeConfig: await utils.hash(
```
</TokenLinkCode>
Evaluated `env` object is propagated to upper levels.
### Progagation
Dependency graph between *Root Env*, *Root Run*, *Command*'s *Run* and *Command*'s *Env* is like this.
<Image src="/getting-started/root-env-root-run-deps-graph.svg" alt="Dependeny graph of 'Root Run' and 'Root Env'"/>
<TokenLinkCode tokens={{
'configure': './apis/haetae#configure',
Expand Down Expand Up @@ -1547,7 +1553,6 @@ export default configure({
myCommand: {
env: { hello: 'world' },,
run: async ({ env }) => {
// Env from "myCommand"
assert(env.hello === 'world')
// ...
}
Expand All @@ -1557,6 +1562,8 @@ export default configure({
```
</TokenLinkCode>
## Custom Store
We've been using a local file *`.haetae/store.json`* as a store.
Expand Down
Loading

1 comment on commit 6d5c613

@vercel
Copy link

@vercel vercel bot commented on 6d5c613 Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

haetae – ./

haetae-git-main-jjangga0214.vercel.app
haetae-jjangga0214.vercel.app
haetae-mu.vercel.app

Please sign in to comment.