You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove sample actions from the deployable codebase and save them as
reference documentation in docs/examples/ so developers can copy what
they need without shipping demo code in production.
Replace the standalone frontend (src/web) with a Commerce Admin panel
extension (commerce-backend-ui-1) that includes IMS authentication,
Experience Cloud Shell integration, and a minimal starter page.
Add a pre-build hook that automatically creates webpack configs for
commerce extensions with auto-generated code, so developers do not
need to set up webpack manually after running aio generate.
Other changes:
- Add .env.sample with all available environment variables
- Make the telemetry service name configurable via environment variable
- Rename telemetry config to newrelic-otel-config for clarity
- Update all dependencies to their latest stable versions
- Remove unused packages (cloudevents, uuid, ts-loader)
- Consolidate shared TypeScript settings into the base config
- Set minimum Node version to 22 to match the runtime target
- Update README with current architecture and setup instructions
Copy file name to clipboardExpand all lines: README.md
+30-42Lines changed: 30 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
# Aligent Typescript Template for Adobe AppBuilder
2
2
3
-
This repository contains a ready-to-build application including two actions and a simple frontend.
4
-
Frontend and action code is fully typed, actions are bundled with sourcemaps using `ts-loader` for step-through debugging.
3
+
This repository contains a ready-to-build application template for Adobe App Builder.
4
+
Action code is fully typed, bundled with sourcemaps using Babel for step-through debugging.
5
5
6
-
# Setup
6
+
##Setup
7
7
8
-
## Prerequisites
8
+
###Prerequisites
9
9
10
10
- Access to the [Adobe Developer Console](https://developer.adobe.com/developer-console/)
11
11
- Access to an existing AppBuilder project.
12
12
- If you're making a new project, follow the steps [here](https://developer.adobe.com/app-builder/docs/get_started/app_builder_get_started/first-app) to create an App project in the Adobe Developer Console.
13
13
- Up-to-date global installation of the [Adobe aio CLI](https://developer.adobe.com/runtime/docs/guides/tools/cli_install/)
14
14
15
-
## Set up the repository
15
+
###Set up the repository
16
16
17
17
```bash
18
18
npm ci # Install dependencies
@@ -27,12 +27,7 @@ aio console workspace select
27
27
28
28
Then run `aio app use` to build your `.aio` and `.env` files.
29
29
30
-
31
-
Add the `BASE_URL` environment variable required for the api-sample action to your `.env` file
32
-
33
-
```bash
34
-
BASE_URL=https://pokeapi.co/api/v2/pokemon/
35
-
```
30
+
Copy [`.env.sample`](.env.sample) to `.env` and fill in your values.
`port_number` is likely to be 9080, but if that's not the case, run `aio app dev` to see what the port number is. After this step, you'll be able to access your local development app at `https://[app_name].aligent.dev`. You'll also need to add `SERVER_HOST=0.0.0.0` to your `.env` file.
49
44
50
45
#### Commands
51
-
-`aio app dev` will serve **both**actions and frontend locally
52
-
-`aio app run` will **deploy** actions to the AppBuilder platform and serve the frontend locally
46
+
-`aio app dev` will serve actions locally
47
+
-`aio app run` will **deploy** actions to the AppBuilder platform
This project includes OpenTelemetry instrumentation via [`@adobe/aio-lib-telemetry`](https://github.com/adobe/aio-lib-telemetry), with traces, metrics, and logs exported to New Relic.
92
94
93
-
See [`src/actions/telemetry-example/index.ts`](src/actions/telemetry-example/index.ts) for a working example that demonstrates all of the features below.
95
+
See [`docs/examples/telemetry-example/`](docs/examples/telemetry-example/) for a working example that demonstrates all of the features below.
94
96
95
97
### Setup
96
98
97
99
1. Obtain an **Ingest - License** key from [New Relic API Keys](https://one.newrelic.com/launcher/api-keys-ui.api-keys-launcher).
98
100
99
-
2. Add it to your `.env` file:
101
+
2. Add the following to your `.env` file (see [`.env.sample`](.env.sample)):
100
102
101
103
```bash
104
+
TELEMETRY_SERVICE_NAME=my-app
102
105
NEW_RELIC_LICENSE_KEY=your_license_key_here
103
106
```
104
107
105
-
3. Pass it as an input to each instrumented action in`app.config.yaml`:
108
+
3. Pass them as inputs to each instrumented action in`app.config.yaml`:
106
109
107
110
```yaml
108
111
my-action:
@@ -112,6 +115,7 @@ See [`src/actions/telemetry-example/index.ts`](src/actions/telemetry-example/ind
112
115
inputs:
113
116
LOG_LEVEL: debug
114
117
ENABLE_TELEMETRY: true
118
+
TELEMETRY_SERVICE_NAME: $TELEMETRY_SERVICE_NAME
115
119
NEW_RELIC_LICENSE_KEY: $NEW_RELIC_LICENSE_KEY
116
120
```
117
121
@@ -241,9 +245,8 @@ The library automatically deserializes context from `params.__telemetryContext`
- Adds inline source maps to support runtime debugging breakpoints in Typescript files
283
+
- A `pre-app-build` hook automatically generates webpack configs for commerce extensions with `.generated` folders
287
284
288
285
## General pain points in this repository
289
286
290
287
This setup is brittle and confusing in a few areas. Some of that is because of the aio CLI's opinionated behaviour, some may be because the Typescript and package settings aren't quite right.
291
288
292
289
- `aio app test` (jest) and `aio app build` (webpack for actions) require a babel setup for typescript support
293
-
- Parcel will detect a standard `babel.config.js` file and warn about it
294
-
- Babel and parcel do not typecheck, so hooks are used to check types before building actions/web folders
295
-
- AppBuilder doesn't support ESM syntax for`*webpack-config.js`, so the whole package has to be commonjs. For consistency only the standard aligent config files (prettier, eslint) are kept as `.mjs`
296
-
- Jest doesn't understand the transpiled `.js` imports, requiring `moduleNameMapper` configuration in `jest.config.js`
290
+
- Babel does not typecheck, so hooks are used to check types before building
291
+
- AppBuilder doesn't support ESM syntax for`*webpack-config.cjs`, so the whole package has to be commonjs. For consistency only the standard aligent config files (prettier, eslint) are kept as `.mjs`
292
+
- Commerce extensions auto-generate ESM `.js` files in`.generated/` folders that need Babel transpilation — this is handled automatically by the `generate-webpack-configs.sh` hook
293
+
- Jest doesn't understand the transpiled `.js` imports, requiring `moduleNameMapper` configuration in `jest.config.cjs`
297
294
- `babel-jest` hoists mock declarations to the top of the files which can make it very tricky to mock nested functions from `@adobe/aio-sdk`; the `jest` import is not available at the time mocks are initialised
298
-
299
-
## Under development
300
-
301
-
- [ ] Deployment pipeline
302
-
- [ ] Pre-commit hooks
303
-
- [x] Front End calling deployed actions
304
-
- [ ] Front End extension point example
305
-
- [x] Cleaner tsconfig setup separating tests, actions, web code
306
-
- [x] Use Babel instead of ts-loader for action compiling
0 commit comments