Skip to content

Commit

Permalink
fix(all): integrate some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Apr 16, 2019
1 parent eda06e0 commit dc6cde0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
31 changes: 16 additions & 15 deletions docs/guides/integrating-the-feature-hub.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,13 @@ Additionally, when a Feature App needs to be rendered on the server, its
/>
```

> **Note:**
> If the integrator has configured the CommonJS module loader on the server, the
> Feature App to be loaded via `serverSrc` must be provided as a CommonJS
> module.
> **Notes:**
>
> - If the integrator has configured the CommonJS module loader on the server,
> the Feature App to be loaded via `serverSrc` must be provided as a CommonJS
> module.
> - If `baseUrl` is specified as well, it will be prepended if `serverSrc` is a
> relative URL. In this case `baseUrl` must be an absolute URL.
#### `css`

Expand All @@ -250,10 +253,10 @@ You can also define a `css` prop to add stylesheets to the document:

Optionally, a relative or absolute `baseUrl` can be specified for two purposes:

1. as a common base URL for the [`src`](#src), [`serverSrc`](#serversrc), and
[`css`](#css) hrefs
1. to provide the Feature App with a base URL that it can use to reference its
own assets and/or [BFF][bff]
1. as a common base URL for a relative [`src`](#src), [`serverSrc`](#serversrc),
and [`css`](#css) hrefs
1. to provide the Feature App with a base URL with which it can refer to its own
resources

```jsx
<FeatureAppLoader
Expand Down Expand Up @@ -328,7 +331,7 @@ import {someFeatureAppDefinition} from './some-feature-app';
#### `baseUrl`

Optionally, a `baseUrl` can be specified to provide the Feature App with a base
URL that it can use to reference its own assets and/or [BFF][bff].
URL that it can use to reference its own resources:

```jsx
<FeatureAppLoader
Expand Down Expand Up @@ -426,9 +429,9 @@ is the URL of its module bundle:

Optionally, a `baseUrl` can be specified for two purposes:

1. as a common base URL for the [`src`](#src-1)
1. to provide the Feature App with a base URL that it can use to reference its
own assets and/or [BFF][bff]
1. as a common base URL for a relative [`src`](#src-1)
1. to provide the Feature App with a base URL with which it can refer to its own
resources

```html
<feature-app-loader
Expand Down Expand Up @@ -521,7 +524,7 @@ document.querySelector('#app').appendChild(featureAppContainer);
#### `baseUrl`

Optionally, a `baseUrl` can be specified to provide the Feature App with a base
URL that it can use to reference its own assets and/or [BFF][bff]
URL that it can use to reference its own resources:

```js
const featureAppContainer = document.createElement('feature-app-container');
Expand Down Expand Up @@ -724,5 +727,3 @@ someFeatureService2.foo(42);
[own-feature-service-definitions]:
/docs/guides/writing-a-feature-app#ownfeatureservicedefinitions
[sharing-npm-dependencies]: /docs/guides/sharing-npm-dependencies
[bff]:
https://www.thoughtworks.com/de/radar/techniques/bff-backend-for-frontends
8 changes: 3 additions & 5 deletions docs/guides/writing-a-feature-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ properties:
1. `idSpecifier` — An optional [ID specifier][idspecifier] that distinguishes
the Feature App instance from other Feature App instances with the same ID.

1. `baseUrl` — A base URL to to be used for referencing the Feature App's own
assets and/or [BFF][bff]. It is only set in the `env` if the integrator has
defined a `baseUrl` on the corresponding
1. `baseUrl` — A base URL to be used for referencing the Feature App's own
resources. It is only set in the `env` if the integrator has defined a
`baseUrl` on the corresponding
[`FeatureAppLoader`][feature-app-loader-base-url] or
[`FeatureAppContainer`][feature-app-container-base-url].

Expand Down Expand Up @@ -282,5 +282,3 @@ const myFeatureAppDefinition = {
[sharing-npm-dependencies]: /docs/guides/sharing-npm-dependencies
[semver]: https://semver.org
[issue-245]: https://github.com/sinnerschrader/feature-hub/issues/245
[bff]:
https://www.thoughtworks.com/de/radar/techniques/bff-backend-for-frontends
4 changes: 2 additions & 2 deletions packages/dom/src/internal/prepend-base-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function isAbsolute(url: string): boolean {
}

/**
* Prepends the given `url` with the given `baseUrl` (can be relative or
* absolute), unless `url` itself is absolute.
* Prepends the given `base` - which can be relative or absolute - to the `url`,
* unless the `url` is absolute.
*/
export function prependBaseUrl(base: string | undefined, url: string): string {
if (!base || isAbsolute(url)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/feature-app-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export interface FeatureAppLoaderProps {
readonly serverSrc?: string;

/**
* A list of stylesheets that should be added to the document. If [[baseUrl]]
* is specified, it will be prepended, unless [[Css.href]] is an absolute URL.
* A list of stylesheets to be added to the document. If [[baseUrl]] is
* specified, it will be prepended, unless [[Css.href]] is an absolute URL.
*/
readonly css?: Css[];

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/internal/prepend-base-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function isAbsolute(url: string): boolean {
}

/**
* Prepends the given `url` with the given `baseUrl` (can be relative or
* absolute), unless `url` itself is absolute.
* Prepends the given `base` - which can be relative or absolute - to the `url`,
* unless the `url` is absolute.
*/
export function prependBaseUrl(base: string | undefined, url: string): string {
if (!base || isAbsolute(url)) {
Expand Down

0 comments on commit dc6cde0

Please sign in to comment.