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

chore(README.md): add more comprehensive instructions for developing application kit bundles in readme #2346

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
81 changes: 63 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,70 @@ $ npx @commercetools-frontend/create-mc-app my-new-custom-application-project --

## Developing application-kit packages

Install the dependencies (uses yarn workspaces):
### Initial Installation
Copy link
Member

Choose a reason for hiding this comment

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

This all section can be removed to be honest. We can mention to check and ensure to have the .env.local file but I wouldn't document its content. Instead you can add more information and give hints in the template file itself.

Choose a reason for hiding this comment

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

Screen Shot 2021-09-21 at 2 44 09 PM

@emmenko
When you initially pull down the repo this is the result when you run yarn build:watch after adding the environment variables without running yarn build first.


```bash
$ yarn
```
1. Clone this repo

```bash
$ git clone https://github.com/commercetools/merchant-center-application-kit.git
```

2. Add necessary environment variables

> In the vscode file tree or the terminal, navigate to `merchant_center_application_kit/playground`, open `.env.local.template`, and add these values:
Copy link

Choose a reason for hiding this comment

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

This file shouldn't be modified––you'll want to duplicate it and rename to .env.local instead. No need to specify the method you'll use to do it, either; I'm sure there's an Emacs user in the org somewhere 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, changed in most recent commit

ByronDWall marked this conversation as resolved.
Show resolved Hide resolved

```bash
MC_API_URL="https://mc-api.europe-west1.gcp.commercetools.com" # for prod
APP_ID="" # can be an empty string for dev
CTP_INITIAL_PRODUCT_KEY=<your-project-name> # the name of any project you have access to on prod/stage
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be CTP_INITIAL_PROJECT_KEY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed it should be, thanks!

```

> In the vscode filetree or the terminal, change `.env.local.template` filename to `.env.local`

3. Build and run the application kit

> In a new terminal window, navigate to the project root directory - `/merchant_center_application_kit` - and run:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
> In a new terminal window, navigate to the project root directory - `/merchant_center_application_kit` - and run:
> In a new terminal window, navigate to the project root directory and run:


```bash
$ yarn && yarn prebuild && yarn build && yarn build:watch
Copy link
Member

Choose a reason for hiding this comment

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

This command does not make much sense. Simply run build.

Suggested change
$ yarn && yarn prebuild && yarn build && yarn build:watch
$ yarn build

FYI: prebuild is automatically executed when the build command is executed. Every npm script that starts with pre<name of command> does that.

```

> Confirm that the watch is running successfully, you should see:

```bash
> "info @commercetools-frontend/application-shell waiting for changes..."
>...
```

4. Build and run the [playground application](./playground):

> In a new terminal window, navigate to the project root directory - `/merchant_center_application_kit`, and run:

```bash
$ `yarn playground:build && yarn playground:start`
```

To run the tests:
> This should open a browser window and the standard merchant cernter login prompt, login using your account, and then the playground should load in the browser if permissions are set correctly (I am unclear on what those perms are or how to set them, so this is completely theoretical on my part at this point)

### RUNNING THE APP KIT AND PLAYGROUND AFTER INITIAL INSTALLATION
ByronDWall marked this conversation as resolved.
Show resolved Hide resolved

- Open 2 terminal windows

- In the first terminal run

```bash
$ yarn build:watch
```

- Once the watch process has completed and is listening,in the second terminalm window run

```bash
$ yarn playground:start
```

> The playground application consumes the app-kit dependencies as es modules, which means you need to bundle the packages first. We recommend to bundle the packages in watch mode in one terminal process and start the playground app in another terminal process.

## To run the tests:

```bash
$ yarn test
Expand All @@ -38,7 +95,7 @@ $ yarn test
$ yarn test:watch
```

Build the application bundles
## To Build the application bundles:

```bash
$ yarn build
Expand All @@ -47,18 +104,6 @@ $ yarn build
$ yarn build:bundles:watch
```

Start the [playground application](./playground):

> NOTE: the playground application consumes the app-kit dependencies's es modules, which means you need to bundle the packages first. We recommend to bundle the packages in watch mode in one terminal process and start the playground app in another terminal process.

```bash
// Terminal process 1
$ yarn build:bundles:watch

// Terminal process 2
$ yarn playground:start
```

## Documentation

Please look at the single packages in [`packages` folder](./packages) for documentation specific of each package.
Expand Down