@aligent/nx-appbuilder 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -96,16 +96,15 @@ The app generator always renders a **base** subtree into `<app-name>/`:
96
96
  - `package.json` - Pinned dependencies and `lint` / `lint:fix` / `check-types` / `test` scripts (per-target variants for actions, web and tests)
97
97
  - `package.json` `nx.targets` block - declares the custom `check-types` and `deploy` targets; `lint` and `test` are inferred by the `@nx/eslint/plugin` and `@nx/vitest` plugins from `eslint.config.mjs` and `vitest.config.ts`
98
98
  - `tsconfig.json` / `tsconfig.base.json` - TypeScript project config
99
- - `babel.actions.config.js` - Babel preset for App Builder actions
100
99
  - `eslint.config.mjs` / `prettier.config.mjs` - Lint and formatter config (`@aligent/ts-code-standards`). The eslint preset is `react` when `hasAdminUI=true` and `base` otherwise, so action-only apps don't load the React/JSX/a11y rules.
101
100
  - `vitest.config.ts` - Vitest config
102
101
  - `.editorconfig`, `.nvmrc`, `.gitignore`, `README.md`
103
102
 
104
103
  - **Action and test scaffolding**:
105
104
  - `src/actions/tsconfig.json` - TypeScript config for the App Builder actions
106
- - `src/actions/webpack-config.cjs` - Webpack config used by the `aio` CLI to compile actions via `babel-loader`
105
+ - `src/actions/webpack-config.cjs` - Webpack config used by the `aio` CLI to compile actions via `esbuild-loader` (targets the workspace's Node major)
107
106
  - `tests/tsconfig.json` - TypeScript config for the test suite
108
- - `hooks/check-action-types.sh` - `pre-app-build` hook that type-checks actions before deploy
107
+ - `hooks/check-action-types.sh` - Wired as the application-level `pre-app-build` hook in `app.config.yaml` so the action TypeScript is type-checked before every deploy. Custom (non-Adobe) actions also live under `application.runtimeManifest` in `app.config.yaml`; the scaffolded `ext.config.yaml` files are left for Adobe-generated content only.
109
108
  - `global-types/@adobe/aio-sdk/*.d.ts` - Local type augmentations for the Adobe AIO SDK
110
109
 
111
110
  - **Root updates**:
@@ -113,16 +112,16 @@ The app generator always renders a **base** subtree into `<app-name>/`:
113
112
 
114
113
  Additional subtrees are layered on top depending on the selected flags:
115
114
 
116
- | Flag | Subtree rendered | Notable additions |
117
- |-----------------------------------------------------------------|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
118
- | any of `hasAdminUI`, `hasBusinessConfig`, `hasCommerceWebhooks` | `commerce-extensibility/` | `app.commerce.config.ts`, `install.yaml`, `commerce/extensibility/1` extension config; pulls in `@adobe/aio-commerce-lib-app` / `-config`. |
119
- | `hasAdminUI` | `commerce-backend-ui/` | React 19 + Spectrum admin UI under `src/commerce-backend-ui-1/`, `web-src/` entry point, action utils, registration, `pre-app-build` web type-check hook. |
120
- | `hasBusinessConfig` | `commerce-config/` | `commerce/configuration/1` extension config wired into `app.commerce.config.ts`; adds a `businessConfig.schema` block to `app.commerce.config.ts`. |
121
- | `hasCommerceWebhooks` | none (modifies `commerce-extensibility/`) | Adds a `webhooks` section to `app.commerce.config.ts` for binding Commerce extensibility hooks to runtime actions or external URLs. No new files; relies on the `commerce-extensibility/` subtree being rendered. |
122
- | `hasRestActions` | `rest-actions/` | `src/actions/rest-sample.ts` registered as a web action in `app.config.yaml`. |
123
- | `hasEvents` | `events/` | `src/actions/handle-sample-event.ts`, sample Commerce + external event subscriptions, `aio-lib-events` global types. |
124
- | `hasScheduledActions` | `scheduled/` | `src/actions/cron-sample.ts` plus the `triggers`/`rules` entries that fire it on a cron schedule. |
125
- | `hasCustomInstallSteps` | `install-steps/` | `scripts/install/sample-step.js` and an `installation.customInstallationSteps` entry in `app.commerce.config.ts`. |
115
+ | Flag | Subtree rendered | Notable additions |
116
+ |-----------------------------------------------------------------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
117
+ | any of `hasAdminUI`, `hasBusinessConfig`, `hasCommerceWebhooks` | `commerce-extensibility/` | `app.commerce.config.ts`, `install.yaml`, `commerce/extensibility/1` extension config; pulls in `@adobe/aio-commerce-lib-app` / `-config`. |
118
+ | `hasAdminUI` | `commerce-backend-ui/` | React 19 + Spectrum admin UI under `src/commerce-backend-ui-1/`, `web-src/` entry point (with `module: Preserve` / `moduleResolution: Bundler` so the webpack/esbuild pipeline sees ESM-style imports), action utils, registration, `pre-app-build` web type-check hook. |
119
+ | `hasBusinessConfig` | `commerce-config/` | `commerce/configuration/1` extension config wired into `app.commerce.config.ts`; adds a `businessConfig.schema` block to `app.commerce.config.ts`. |
120
+ | `hasCommerceWebhooks` | none (modifies `commerce-extensibility/`) | Adds a `webhooks` section to `app.commerce.config.ts` for binding Commerce extensibility hooks to runtime actions or external URLs. No new files; relies on the `commerce-extensibility/` subtree being rendered. |
121
+ | `hasRestActions` | `rest-actions/` | `src/actions/rest-sample.ts` registered as a web action in `app.config.yaml`. |
122
+ | `hasEvents` | `events/` | `src/actions/handle-sample-event.ts`, sample Commerce + external event subscriptions, `aio-lib-events` global types. |
123
+ | `hasScheduledActions` | `scheduled/` | `src/actions/cron-sample.ts` plus the `triggers`/`rules` entries that fire it on a cron schedule. |
124
+ | `hasCustomInstallSteps` | `install-steps/` | `scripts/install/sample-step.js` and an `installation.customInstallationSteps` entry in `app.commerce.config.ts`. |
126
125
 
127
126
  #### Example
128
127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/nx-appbuilder",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./src/index.d.ts",
@@ -1,6 +1,8 @@
1
- // Webpack configuration required to compile typescript action and web source code
2
- // using the Adobe aio CLI. Adapted from https://github.com/adobe/aio-cli-plugin-app-dev, then switched to babel-loader
3
- // Appbuilder documentation: https://developer.adobe.com/app-builder/docs/guides/configuration/webpack-configuration/
1
+ // Webpack config for action source. esbuild-loader strips the TypeScript and
2
+ // targets the same Node version as the OpenWhisk runtime declared in
3
+ // ext.config.yaml. aio's webpack pipeline emits a CommonJS bundle
4
+ // (libraryTarget: 'commonjs2') which OpenWhisk loads via require().
5
+ // Appbuilder docs: https://developer.adobe.com/app-builder/docs/guides/configuration/webpack-configuration/
4
6
 
5
7
  const path = require('path');
6
8
 
@@ -18,15 +20,12 @@ module.exports = {
18
20
  module: {
19
21
  rules: [
20
22
  {
21
- // Test for .ts - in theory actions should never use .tsx
22
23
  test: /\.ts$/,
23
24
  exclude: /node_modules/,
24
- loader: 'babel-loader',
25
+ loader: 'esbuild-loader',
25
26
  options: {
26
- // Point to the babel config for actions
27
- // This is done to avoid Parcel reading the config file
28
- // while building web code
29
- configFile: './babel.actions.config.js',
27
+ loader: 'ts',
28
+ target: 'node<%= nodeMajor %>',
30
29
  },
31
30
  },
32
31
  ],
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "extends": "@aligent/ts-code-standards/tsconfigs-react",
3
3
  "compilerOptions": {
4
+ "module": "Preserve",
5
+ "moduleResolution": "Bundler",
4
6
  "allowImportingTsExtensions": true,
5
7
  "resolveJsonModule": true,
6
8
  "baseUrl": "../../..",
@@ -30,10 +30,8 @@ const ADMIN_UI_DEPS = (0, template_package_1.pickVersions)(TEMPLATE.dependencies
30
30
  ]);
31
31
  const BASE_DEV_DEPS = (0, template_package_1.pickVersions)(TEMPLATE.devDependencies, [
32
32
  '@aligent/ts-code-standards',
33
- '@babel/preset-env',
34
- '@babel/preset-typescript',
35
33
  '@types/node',
36
- 'babel-loader',
34
+ 'esbuild-loader',
37
35
  // `eslint` is also pinned at the workspace root; declaring it here keeps
38
36
  // the app's `lint` script resolvable independent of npm workspace hoisting.
39
37
  'eslint',
@@ -17,12 +17,10 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@aligent/ts-code-standards": "^4.2.0",
20
- "@babel/preset-env": "^7.26.9",
21
- "@babel/preset-typescript": "^7.27.0",
22
20
  "@types/node": "^22.14.0",
23
21
  "@types/react": "^19.1.0",
24
22
  "@types/react-dom": "^19.1.2",
25
- "babel-loader": "^10.0.0",
23
+ "esbuild-loader": "^4.3.0",
26
24
  "eslint": "^9.0.0",
27
25
  "prettier": "^3.8.1",
28
26
  "ts-loader": "^9.5.2",
@@ -1,6 +0,0 @@
1
- // Babel configuration allowing compilation of typescript files in both
2
- // test and src/action folders
3
- module.exports = {
4
- presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
5
- ignore: ['**/src/web/**', '**/node_modules/**'],
6
- };