bank20baht-cli 0.5.0 → 0.7.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 +61 -2
- package/dist/application/create.js +13 -2
- package/dist/application/generate.js +95 -0
- package/dist/args.js +1 -0
- package/dist/cli.js +41 -4
- package/dist/domain/create-plan.js +21 -3
- package/dist/domain/deploy-plan.js +82 -0
- package/dist/domain/form-dsl.js +2 -0
- package/dist/domain/remote-plan.js +156 -0
- package/package.json +4 -3
- package/templates/angular/README.md.hbs +46 -0
- package/templates/angular/_dependency-cruiser.mjs +51 -0
- package/templates/angular/apps/server/package.json +30 -0
- package/templates/angular/apps/server/src/app.ts +14 -0
- package/templates/angular/apps/server/src/index.ts +8 -0
- package/templates/angular/apps/server/test/app.test.ts +12 -0
- package/templates/angular/apps/server/tsconfig.json +7 -0
- package/templates/angular/apps/server/tsconfig.types.json +12 -0
- package/templates/angular/apps/shell/_editorconfig +17 -0
- package/templates/angular/apps/shell/angular.json +115 -0
- package/templates/angular/apps/shell/federation.config.mjs +44 -0
- package/templates/angular/apps/shell/package.json +42 -0
- package/templates/angular/apps/shell/public/federation.manifest.json +1 -0
- package/templates/angular/apps/shell/src/app/app.config.ts +20 -0
- package/templates/angular/apps/shell/src/app/app.css +4 -0
- package/templates/angular/apps/shell/src/app/app.html.hbs +16 -0
- package/templates/angular/apps/shell/src/app/app.routes.ts.hbs +39 -0
- package/templates/angular/apps/shell/src/app/app.ts +57 -0
- package/templates/angular/apps/shell/src/app/core/federation/load-remote.ts +31 -0
- package/templates/angular/apps/shell/src/app/core/federation/manifest.spec.ts +46 -0
- package/templates/angular/apps/shell/src/app/core/federation/manifest.ts +37 -0
- package/templates/angular/apps/shell/src/app/core/federation/remote-loader.ts +20 -0
- package/templates/angular/apps/shell/src/app/core/federation/timeout.ts +17 -0
- package/templates/angular/apps/shell/src/app/modules/home/home.component.ts.hbs +46 -0
- package/templates/angular/apps/shell/src/app/modules/unavailable/unavailable.component.ts +39 -0
- package/templates/angular/apps/shell/src/bootstrap.ts +25 -0
- package/templates/angular/apps/shell/src/environments/environment.development.ts +10 -0
- package/templates/angular/apps/shell/src/environments/environment.ts +10 -0
- package/templates/angular/apps/shell/src/index.html.hbs +12 -0
- package/templates/angular/apps/shell/src/main.ts +43 -0
- package/templates/angular/apps/shell/src/styles.css +19 -0
- package/templates/angular/apps/shell/tsconfig.app.json +10 -0
- package/templates/angular/apps/shell/tsconfig.federation.json +4 -0
- package/templates/angular/apps/shell/tsconfig.json.hbs +39 -0
- package/templates/angular/apps/shell/tsconfig.spec.json +9 -0
- package/templates/angular/bahtui.json +6 -0
- package/templates/angular/eslint.config.ts.hbs +28 -0
- package/templates/angular/knip.ts +27 -0
- package/templates/angular/package.json.hbs +52 -0
- package/templates/angular/packages/kit/package.json.hbs +27 -0
- package/templates/angular/packages/kit/src/api.ts +21 -0
- package/templates/angular/packages/kit/src/errors.ts +28 -0
- package/templates/angular/packages/kit/src/index.ts +2 -0
- package/templates/angular/packages/kit/test/errors.test.ts +28 -0
- package/templates/angular/packages/kit/tsconfig.json +9 -0
- package/templates/create/README.md.hbs +1 -1
- package/templates/create/_gitignore +1 -0
- package/templates/create/apps/web/index.html.hbs +8 -0
- package/templates/create/apps/web/package.json.hbs +1 -0
- package/templates/create/apps/web/src/App.tsx.hbs +18 -7
- package/templates/create/apps/web/src/app.css +27 -0
- package/templates/create/apps/web/src/health.test.ts.hbs +18 -4
- package/templates/create/apps/web/src/health.ts.hbs +8 -0
- package/templates/create/apps/web/src/main.tsx.hbs +12 -1
- package/templates/create/package.json.hbs +15 -5
- package/templates/deploy/deploy/__project__.service.hbs +23 -0
- package/templates/deploy/deploy/env.example.hbs +4 -0
- package/templates/deploy/deploy/install.sh.hbs +58 -0
- package/templates/deploy/deploy/nginx.conf.hbs +67 -0
- package/templates/deploy/scripts/deploy.ts.hbs +33 -0
- package/templates/deploy/scripts/preview.ts.hbs +57 -0
- package/templates/deploy/scripts/release.ts.hbs +48 -0
- package/templates/new/_gitignore +3 -0
- package/templates/new/_prettierignore +1 -0
- package/templates/new/package.json.hbs +2 -2
- package/templates/remote/_editorconfig +17 -0
- package/templates/remote/angular.json.hbs +95 -0
- package/templates/remote/federation.config.mjs.hbs +48 -0
- package/templates/remote/package.json.hbs +37 -0
- package/templates/remote/src/app/__name__.routes.ts.hbs +12 -0
- package/templates/remote/src/app/modules/__name__/__name__.component.ts.hbs +37 -0
- package/templates/remote/src/app/services/__name__.service.ts.hbs +14 -0
- package/templates/remote/src/index.html.hbs +11 -0
- package/templates/remote/src/main.ts.hbs +3 -0
- package/templates/remote/tsconfig.app.json +10 -0
- package/templates/remote/tsconfig.federation.json +4 -0
- package/templates/remote/tsconfig.json.hbs +36 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { withNativeFederation, fromPackageJson } from '@angular-architects/native-federation/config'
|
|
2
|
+
|
|
3
|
+
export default withNativeFederation({
|
|
4
|
+
name: '{{app}}',
|
|
5
|
+
|
|
6
|
+
shared: fromPackageJson({
|
|
7
|
+
singleton: true,
|
|
8
|
+
strictVersion: true,
|
|
9
|
+
requiredVersion: 'auto',
|
|
10
|
+
build: 'package',
|
|
11
|
+
})
|
|
12
|
+
// includeSecondaries is an opt-out of ignoreUnusedDeps, so all of
|
|
13
|
+
// @angular/core is shared to prevent mismatches.
|
|
14
|
+
.patch(['@angular/core'], { includeSecondaries: { keepAll: true } })
|
|
15
|
+
// Same for bank20baht-ui: the host and the remotes may import different entry
|
|
16
|
+
// points of it. Unshared, each side bundles its own copy of the elements and
|
|
17
|
+
// the second customElements.define('baht-button') throws.
|
|
18
|
+
.patch(['bank20baht-ui'], { includeSecondaries: { keepAll: true } }),
|
|
19
|
+
|
|
20
|
+
skip: [
|
|
21
|
+
'rxjs/ajax',
|
|
22
|
+
'rxjs/fetch',
|
|
23
|
+
'rxjs/testing',
|
|
24
|
+
'rxjs/webSocket',
|
|
25
|
+
// Server / React entry points of bank20baht-ui (pulled in by keepAll above).
|
|
26
|
+
'bank20baht-ui/ssr',
|
|
27
|
+
'bank20baht-ui/hydrate',
|
|
28
|
+
'bank20baht-ui/react',
|
|
29
|
+
// marked's command-line entry imports Node built-ins.
|
|
30
|
+
/^marked\/bin/,
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
// The kit (a tsconfig path into packages/kit) is compiled into each app, not shared.
|
|
34
|
+
sharedMappings: [],
|
|
35
|
+
|
|
36
|
+
exposes: {
|
|
37
|
+
'./Routes': './src/app/{{name}}.routes.ts',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
features: {
|
|
41
|
+
// Off: the unused-dependency scan (sheriff) refuses sources outside the app folder, and
|
|
42
|
+
// the kit lives in packages/kit. Every package.json dependency is shared instead, so each
|
|
43
|
+
// app lists bank20baht-ui's optional peers (marked, dompurify, flatpickr) itself.
|
|
44
|
+
ignoreUnusedDeps: false,
|
|
45
|
+
// Groups chunks in remoteEntry.json for a smaller metadata file.
|
|
46
|
+
denseChunking: true,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{app}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"ng": "ng",
|
|
7
|
+
"dev": "ng serve",
|
|
8
|
+
"build": "ng build",
|
|
9
|
+
"typecheck": "tsc -b --noEmit",
|
|
10
|
+
"pretypecheck": "bun run --filter server build:types",
|
|
11
|
+
"prebuild": "bun run --filter server build:types"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@angular-architects/native-federation": "^22.2.1",
|
|
15
|
+
"@angular/common": "^22.2.0",
|
|
16
|
+
"@angular/compiler": "^22.2.0",
|
|
17
|
+
"@angular/core": "^22.2.0",
|
|
18
|
+
"@angular/platform-browser": "^22.2.0",
|
|
19
|
+
"@angular/router": "^22.2.0",
|
|
20
|
+
"bank20baht-ui": "0.19.0",
|
|
21
|
+
"bank20baht-ui-angular": "0.2.0",
|
|
22
|
+
"dompurify": "3.4.17",
|
|
23
|
+
"es-module-shims": "^2.8.0",
|
|
24
|
+
"flatpickr": "4.6.13",
|
|
25
|
+
"marked": "18.1.3",
|
|
26
|
+
"ngx-eden": "^0.2.0",
|
|
27
|
+
"rxjs": "~7.8.0",
|
|
28
|
+
"tslib": "^2.3.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@angular/build": "^22.2.0",
|
|
32
|
+
"@angular/cli": "^22.2.0",
|
|
33
|
+
"@angular/compiler-cli": "^22.2.0",
|
|
34
|
+
"@softarc/native-federation-orchestrator": "^4.6.0",
|
|
35
|
+
"typescript": "~6.0.2"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Routes } from '@angular/router'
|
|
2
|
+
|
|
3
|
+
import { {{pascal}}Component } from './modules/{{name}}/{{name}}.component'
|
|
4
|
+
|
|
5
|
+
/** What the host mounts under `/{{name}}` (exposed as `./Routes`). */
|
|
6
|
+
export const routes: Routes = [
|
|
7
|
+
{
|
|
8
|
+
path: '',
|
|
9
|
+
title: '{{title}}',
|
|
10
|
+
component: {{pascal}}Component,
|
|
11
|
+
},
|
|
12
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
|
|
2
|
+
import { describeError } from '@{{project}}/kit'
|
|
3
|
+
import { BAHT_UI } from 'bank20baht-ui-angular'
|
|
4
|
+
import { {{pascal}}Service } from '../../services/{{name}}.service'
|
|
5
|
+
|
|
6
|
+
/** The {{title}} page: what the server says at `GET /api/hello`. */
|
|
7
|
+
@Component({
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
imports: [BAHT_UI],
|
|
10
|
+
selector: '{{name}}-page',
|
|
11
|
+
template: `
|
|
12
|
+
<div class="app-page">
|
|
13
|
+
<baht-page-header
|
|
14
|
+
heading="{{title}}"
|
|
15
|
+
description="A remote, loaded by the host at runtime."
|
|
16
|
+
></baht-page-header>
|
|
17
|
+
<baht-card heading="From the server">
|
|
18
|
+
@if (hello.error(); as error) {
|
|
19
|
+
<baht-error-state
|
|
20
|
+
heading="The server did not answer"
|
|
21
|
+
[message]="describeError(error)"
|
|
22
|
+
retry-label="Try again"
|
|
23
|
+
(bahtRetry)="hello.reload()"
|
|
24
|
+
></baht-error-state>
|
|
25
|
+
} @else if (hello.value(); as body) {
|
|
26
|
+
<p [textContent]="body.message"></p>
|
|
27
|
+
} @else {
|
|
28
|
+
<baht-skeleton variant="text"></baht-skeleton>
|
|
29
|
+
}
|
|
30
|
+
</baht-card>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
})
|
|
34
|
+
export class {{pascal}}Component {
|
|
35
|
+
protected readonly hello = inject({{pascal}}Service).hello()
|
|
36
|
+
protected readonly describeError = describeError
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Injectable, inject } from '@angular/core'
|
|
2
|
+
import { Api } from '@{{project}}/kit'
|
|
3
|
+
import { edenResource } from 'ngx-eden'
|
|
4
|
+
|
|
5
|
+
/** Everything the {{title}} pages ask the server. */
|
|
6
|
+
@Injectable({ providedIn: 'root' })
|
|
7
|
+
export class {{pascal}}Service {
|
|
8
|
+
private readonly api = inject(Api).client.api
|
|
9
|
+
|
|
10
|
+
/** `GET /api/hello` as a resource; create it in an injection context (a field initializer). */
|
|
11
|
+
hello() {
|
|
12
|
+
return edenResource(() => this.api.hello.get.$request())
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>{{app}} (remote)</title>
|
|
6
|
+
<meta name="robots" content="noindex" />
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<p>{{app}} is a Native Federation remote. Open it through the host.</p>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"extends": "./tsconfig.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"types": []
|
|
7
|
+
},
|
|
8
|
+
"include": ["src/**/*.ts"],
|
|
9
|
+
"exclude": ["src/**/*.spec.ts"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
+
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
+
{
|
|
4
|
+
"compileOnSave": false,
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noUncheckedIndexedAccess": true,
|
|
8
|
+
"exactOptionalPropertyTypes": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"noImplicitOverride": true,
|
|
11
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noFallthroughCasesInSwitch": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"experimentalDecorators": true,
|
|
17
|
+
"importHelpers": true,
|
|
18
|
+
"target": "ES2022",
|
|
19
|
+
"module": "preserve",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@{{project}}/kit": ["../../packages/kit/src/index.ts"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"angularCompilerOptions": {
|
|
25
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
26
|
+
"strictInjectionParameters": true,
|
|
27
|
+
"strictTemplates": true,
|
|
28
|
+
"strictInputAccessModifiers": true
|
|
29
|
+
},
|
|
30
|
+
"files": [],
|
|
31
|
+
"references": [
|
|
32
|
+
{
|
|
33
|
+
"path": "./tsconfig.app.json"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|