@20baht/cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +214 -2
- package/dist/application/create.js +72 -0
- package/dist/application/generate.js +239 -0
- package/dist/application/ports.js +1 -0
- package/dist/args.js +49 -0
- package/dist/cli.js +207 -0
- package/dist/domain/blueprint.js +6 -0
- package/dist/domain/create-plan.js +59 -0
- package/dist/domain/deploy-plan.js +82 -0
- package/dist/domain/form-dsl.js +120 -0
- package/dist/domain/generate-plan.js +60 -0
- package/dist/domain/naming.js +18 -0
- package/dist/domain/remote-plan.js +153 -0
- package/dist/domain/template-path.js +19 -0
- package/dist/infrastructure/fs-reader.js +19 -0
- package/dist/infrastructure/fs-writer.js +27 -0
- package/dist/infrastructure/shell-runner.js +32 -0
- package/dist/infrastructure/spawn-plan.js +35 -0
- package/dist/infrastructure/template-renderer.js +16 -0
- package/dist/infrastructure/template-source.js +28 -0
- package/package.json +53 -4
- 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 +43 -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 +30 -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 +32 -0
- package/templates/create/_github/workflows/ci.yml +56 -0
- package/templates/create/_gitignore +6 -0
- package/templates/create/_husky/pre-commit +3 -0
- package/templates/create/_prettierignore +3 -0
- package/templates/create/_prettierrc.json +4 -0
- package/templates/create/apps/api/package.json.hbs +21 -0
- package/templates/create/apps/api/src/index.test.ts.hbs +10 -0
- package/templates/create/apps/api/src/index.ts.hbs +14 -0
- package/templates/create/apps/api/tsconfig.json +7 -0
- package/templates/create/apps/web/index.html.hbs +20 -0
- package/templates/create/apps/web/package.json.hbs +24 -0
- package/templates/create/apps/web/src/App.tsx.hbs +31 -0
- package/templates/create/apps/web/src/app.css +27 -0
- package/templates/create/apps/web/src/health.test.ts.hbs +28 -0
- package/templates/create/apps/web/src/health.ts.hbs +14 -0
- package/templates/create/apps/web/src/main.tsx.hbs +20 -0
- package/templates/create/apps/web/src/vite-env.d.ts.hbs +1 -0
- package/templates/create/apps/web/tsconfig.json +8 -0
- package/templates/create/apps/web/vite.config.ts.hbs +6 -0
- package/templates/create/bahtui.json.hbs +7 -0
- package/templates/create/eslint.config.js +30 -0
- package/templates/create/knip.json +9 -0
- package/templates/create/libs/shared/eden/index.ts.hbs +9 -0
- package/templates/create/libs/shared/eden/package.json.hbs +15 -0
- package/templates/create/libs/shared/eden/tsconfig.json +4 -0
- package/templates/create/package.json.hbs +47 -0
- package/templates/create/tsconfig.base.json +17 -0
- 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/CLAUDE.md +3 -0
- package/templates/new/README.md.hbs +38 -0
- package/templates/new/_dependency-cruiser.mjs +9 -0
- package/templates/new/_github/actions/setup/action.yml +15 -0
- package/templates/new/_github/workflows/ci.yml +122 -0
- package/templates/new/_gitignore +12 -0
- package/templates/new/_gitleaks.toml +6 -0
- package/templates/new/_husky/commit-msg +1 -0
- package/templates/new/_husky/pre-commit +8 -0
- package/templates/new/_husky/pre-push +1 -0
- package/templates/new/_jscpd.json +20 -0
- package/templates/new/_mcp.json +9 -0
- package/templates/new/_prettierignore +5 -0
- package/templates/new/apps/_gitkeep +0 -0
- package/templates/new/commitlint.config.js +1 -0
- package/templates/new/eslint.config.ts.hbs +7 -0
- package/templates/new/knip.ts +7 -0
- package/templates/new/lint-staged.config.js +1 -0
- package/templates/new/package.json.hbs +51 -0
- package/templates/new/packages/_gitkeep +0 -0
- package/templates/new/renovate.json +23 -0
- package/templates/new/scripts/dev.ts +54 -0
- package/templates/new/scripts/each.ts +29 -0
- package/templates/new/scripts/workspaces.ts +24 -0
- package/templates/new/tsconfig.base.json +3 -0
- package/templates/new/tsconfig.json +7 -0
- 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 +38 -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,37 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
|
|
2
|
+
import { describeError } from '@{{project}}/kit'
|
|
3
|
+
import { BAHT_UI } from '@20baht/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 '@20baht/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
|
+
}
|