Skip to content

Commit

Permalink
Add notes on developing the library and storefront in their README's
Browse files Browse the repository at this point in the history
  • Loading branch information
joerideg committed Nov 2, 2023
1 parent 858e91e commit 623172a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 30 deletions.
6 changes: 6 additions & 0 deletions brx-spartacus-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ Releasing a new version follows the standard angular appraoch for releasing libr
- Run `npm run build` to create the package build in `dist/`
- Inside `dist/` run `npm publish`

### Development

If developing this in tandem with the [storefront](../brx-spartacus-storefront) we suggest to use
[yalc](https://github.com/wclr/yalc) to publish from the `dist/` folder to your local system and `yalc link` it in the
storefront app.

## License

Published under [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) license.
61 changes: 31 additions & 30 deletions brx-spartacus-storefront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,62 @@
This project was generated with [Angular CLI](https://github.com/angular/angular-cli). Please check the documentation
for all the configuration and CLI commands.

## Development server
## Getting started

### Set Environment Varaibles
### Install dependencies and run the app as follows:

```bash
npm ci
npm start
```

Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. For more
on components and environment varaibles check out the Bloomreach Spartacus Library
[documentation](https://www.npmjs.com/package/@bloomreach/brx-spartacus-library).

## Development

If developing this in tandem with the [library](../brx-spartacus-library) we suggest to use
[yalc](https://github.com/wclr/yalc) to publish from the library's `dist/` folder to your local system and `yalc link` it in the
storefront app.

### Set Environment Variables

Configure environment variables in src > environments.ts file

```typescript
export const environment = {
production: true / false,
netlifyEnvUrl: "https://..../.netlify/functions/get-env-variables",
netlifyEnvUrl: 'https://..../.netlify/functions/get-env-variables',
libConfig: {
endpoint: "https://...../pages",
smEndPoint: "https://....",
smSuggestionEndPoint: "https://suggest.xyzz.com/api/",
accountId: "1234",
domainKey: "abc_123",
authKey: "etdr235dfh",
endpoint: 'https://...../pages',
smEndPoint: 'https://....',
smSuggestionEndPoint: 'https://suggest.xyzz.com/api/',
accountId: '1234',
domainKey: 'abc_123',
authKey: 'etdr235dfh',
},
appConfig: {
defaultLoadingTime: 2, // in seconds
},
};
```

### Install dependencies and run the app as follows:

```bash
npm ci
npm start
```

Navigate to `http://localhost:4200/`. The app will automatically reload if you change
any of the source files.
For more on components and environment varaibles check out the Bloomreach Spartacus Library [documentation](https://www.npmjs.com/package/@bloomreach/brx-spartacus-library).

## Production build

### Environment Varaibles
### Environment Variables

Configure environment variables(as [here](#set-environment-variables)) in src > environments.prod.ts file

### Install dependencies and build the app as follows:

```bash
npm ci
npm run build
```

### Accessing Environment Variables from Netlify

- Deploy Netlify function along with App distribution to Netlify
- Netlify provides an endpoint of the deployed function to access the environment variables
- Copy the endpoint URL from Netlify functions dashboard and add it to "netlifyEnvUrl" property in the environment file as shown above
- Copy the endpoint URL from Netlify functions dashboard and add it to "netlifyEnvUrl" property in the environment file
as shown above
- Use 'brx\_' as prefix while setting ENV variables names in Netlify (Eg: brx_endpoint)
- If adding/editing environment variables in Netlify, you'll need to rebuild and re-deploy the App to get the latest value of environment variables
- If adding/editing environment variables in Netlify, you'll need to rebuild and re-deploy the App to get the latest
value of environment variables

## Other links

Expand Down

0 comments on commit 623172a

Please sign in to comment.