@aligent/nx-appbuilder 0.3.0 → 0.4.1
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 +12 -13
- package/package.json +3 -3
- package/src/generators/app/files/base/src/actions/webpack-config.cjs.template +8 -9
- package/src/generators/app/files/commerce-backend-ui/src/commerce-backend-ui-1/web-src/tsconfig.json.template +2 -0
- package/src/generators/app/lib/compose-package-json.js +1 -3
- package/src/generators/app/lib/template-package/package.json +2 -4
- package/src/generators/app/files/base/babel.actions.config.js.template +0 -6
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 `
|
|
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
|
|
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
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"directory": "packages/nx-appbuilder"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nx/devkit": "22.
|
|
14
|
-
"enquirer": "
|
|
13
|
+
"@nx/devkit": "22.7.5",
|
|
14
|
+
"enquirer": "2.4.1"
|
|
15
15
|
},
|
|
16
16
|
"generators": "./generators.json",
|
|
17
17
|
"author": "Aligent",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
// Webpack
|
|
2
|
-
//
|
|
3
|
-
//
|
|
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: '
|
|
25
|
+
loader: 'esbuild-loader',
|
|
25
26
|
options: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// while building web code
|
|
29
|
-
configFile: './babel.actions.config.js',
|
|
27
|
+
loader: 'ts',
|
|
28
|
+
target: 'node<%= nodeMajor %>',
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
31
|
],
|
|
@@ -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
|
-
'
|
|
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,13 +17,11 @@
|
|
|
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
|
-
"
|
|
26
|
-
"eslint": "^
|
|
23
|
+
"esbuild-loader": "^4.3.0",
|
|
24
|
+
"eslint": "^10.4.1",
|
|
27
25
|
"prettier": "^3.8.1",
|
|
28
26
|
"ts-loader": "^9.5.2",
|
|
29
27
|
"type-fest": "^4.39.1",
|
|
@@ -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
|
-
};
|