Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(vue-press): updating getting started #2517

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tidy-countries-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@equinor/fusion-framework-cli': patch
---

Make `app.config.ts` definition scopes optional by updating the `AppConfigFn` type to use `z.input<typeof ApiAppConfigSchema>`.
9 changes: 9 additions & 0 deletions .changeset/wild-chairs-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@equinor/fusion-framework-docs': patch
---

Updated `getting-started.md` documentation to:

- Correct JSON code block formatting.
- Update `app.config.ts` example to use `defineAppConfig` directly without `mergeAppConfigs`.
- Provide an example of configuring an HTTP client with endpoint details from environment configuration.
3 changes: 2 additions & 1 deletion packages/cli/src/lib/app-config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { z } from 'zod';
import {
loadConfig,
type ResolvedConfig,
Expand All @@ -18,7 +19,7 @@ type FindAppConfigOptions = FindConfigOptions & {
export type AppConfigFn = (
env: ConfigExecuterEnv,
args: { base: ApiAppConfig },
) => ApiAppConfig | Promise<ApiAppConfig | void> | void;
) => z.input<typeof ApiAppConfigSchema> | Promise<z.input<typeof ApiAppConfigSchema> | void> | void;
export type AppConfigExport = ApiAppConfig | AppConfigFn;

export const appConfigFilename = 'app.config';
Expand Down
20 changes: 12 additions & 8 deletions vue-press/src/guide/app/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,19 @@ export default configure;
@tab app.config.ts

```ts
import { mergeAppConfigs, defineAppConfig } from '@equinor/fusion-framework-cli';
import { defineAppConfig } from '@equinor/fusion-framework-cli';
export default defineAppConfig((_nev, { base }) =>
mergeAppConfigs(base, {
return {
environment: {
scope: 'foobar',
foo: 'foobar',
},
endpoints: {
api: {
url: 'https://foo.bars',
scopes: ['myscope/.default']
},
},
}),
},
);

```
Expand Down Expand Up @@ -177,7 +178,7 @@ upload this config to the application admin under `configs`

[read more about authentication](./authentication.md)

```json dsadsa
```json
// config.ENV.json
{
"services": {
Expand All @@ -193,8 +194,12 @@ configure application to create a http client based on dynamic config from app s
```ts
// config.ts
export const configure: AppModuleInitiator = (configurator, { env }) => {
configurator.configureHttpClient("myApi", env.config.environment.myApi);
};
const endpointApi = env.config?.getEndpoint('myApi');
configurator.configureHttpClient('myApi', {
baseUri: endpointApi?.url,
defaultScopes: endpointApi?.scopes,
});
// ... other config setting
```

create a util hook for accessing custom http client
Expand Down Expand Up @@ -237,7 +242,6 @@ export const configure = (configurator, { env: { basename } }) => {
}
```


### Enable context

[read more about context](../../modules/context/README.md)
Expand Down