@bleedingdev/modern-js-create 3.2.0-ultramodern.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/LICENSE +21 -0
- package/README.md +112 -0
- package/bin/run.js +73 -0
- package/dist/index.js +2320 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locale/en.d.ts +55 -0
- package/dist/types/locale/index.d.ts +112 -0
- package/dist/types/locale/zh.d.ts +55 -0
- package/dist/types/ultramodern-workspace.d.ts +20 -0
- package/package.json +56 -0
- package/template/.browserslistrc +4 -0
- package/template/.github/workflows/ultramodern-gates.yml.handlebars +30 -0
- package/template/.gitignore.handlebars +30 -0
- package/template/.nvmrc +2 -0
- package/template/README.md +78 -0
- package/template/api/effect/index.ts.handlebars +61 -0
- package/template/api/lambda/hello.ts.handlebars +6 -0
- package/template/biome.json +41 -0
- package/template/modern.config.ts.handlebars +50 -0
- package/template/package.json.handlebars +47 -0
- package/template/postcss.config.mjs.handlebars +6 -0
- package/template/scripts/validate-ultramodern.mjs.handlebars +102 -0
- package/template/shared/effect/api.ts.handlebars +18 -0
- package/template/src/modern-app-env.d.ts +1 -0
- package/template/src/modern.runtime.ts.handlebars +9 -0
- package/template/src/routes/index.css.handlebars +118 -0
- package/template/src/routes/layout.tsx.handlebars +9 -0
- package/template/src/routes/page.tsx.handlebars +119 -0
- package/template/tailwind.config.ts.handlebars +10 -0
- package/template/tsconfig.json +16 -0
- package/template-workspace/README.md.handlebars +28 -0
- package/template-workspace/pnpm-workspace.yaml +5 -0
- package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +276 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const EN_LOCALE: {
|
|
2
|
+
prompt: {
|
|
3
|
+
projectName: string;
|
|
4
|
+
};
|
|
5
|
+
error: {
|
|
6
|
+
projectNameEmpty: string;
|
|
7
|
+
directoryExists: string;
|
|
8
|
+
invalidRouter: string;
|
|
9
|
+
invalidBffRuntime: string;
|
|
10
|
+
createFailed: string;
|
|
11
|
+
};
|
|
12
|
+
message: {
|
|
13
|
+
welcome: string;
|
|
14
|
+
success: string;
|
|
15
|
+
nextSteps: string;
|
|
16
|
+
step1: string;
|
|
17
|
+
step2: string;
|
|
18
|
+
step3: string;
|
|
19
|
+
};
|
|
20
|
+
help: {
|
|
21
|
+
title: string;
|
|
22
|
+
description: string;
|
|
23
|
+
usage: string;
|
|
24
|
+
usageExample: string;
|
|
25
|
+
options: string;
|
|
26
|
+
optionHelp: string;
|
|
27
|
+
optionVersion: string;
|
|
28
|
+
optionLang: string;
|
|
29
|
+
optionRouter: string;
|
|
30
|
+
optionBff: string;
|
|
31
|
+
optionBffRuntime: string;
|
|
32
|
+
optionTailwind: string;
|
|
33
|
+
optionWorkspace: string;
|
|
34
|
+
optionUltramodernWorkspace: string;
|
|
35
|
+
optionUltramodernPackageSource: string;
|
|
36
|
+
optionUltramodernPackageScope: string;
|
|
37
|
+
optionUltramodernPackageNamePrefix: string;
|
|
38
|
+
optionSub: string;
|
|
39
|
+
examples: string;
|
|
40
|
+
example1: string;
|
|
41
|
+
example2: string;
|
|
42
|
+
example3: string;
|
|
43
|
+
example4: string;
|
|
44
|
+
example5: string;
|
|
45
|
+
example6: string;
|
|
46
|
+
example7: string;
|
|
47
|
+
example8: string;
|
|
48
|
+
example9: string;
|
|
49
|
+
example10: string;
|
|
50
|
+
moreInfo: string;
|
|
51
|
+
};
|
|
52
|
+
version: {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { I18n } from '@modern-js/i18n-utils';
|
|
2
|
+
declare const i18n: I18n;
|
|
3
|
+
declare const localeKeys: {
|
|
4
|
+
prompt: {
|
|
5
|
+
projectName: string;
|
|
6
|
+
};
|
|
7
|
+
error: {
|
|
8
|
+
projectNameEmpty: string;
|
|
9
|
+
directoryExists: string;
|
|
10
|
+
invalidRouter: string;
|
|
11
|
+
invalidBffRuntime: string;
|
|
12
|
+
createFailed: string;
|
|
13
|
+
};
|
|
14
|
+
message: {
|
|
15
|
+
welcome: string;
|
|
16
|
+
success: string;
|
|
17
|
+
nextSteps: string;
|
|
18
|
+
step1: string;
|
|
19
|
+
step2: string;
|
|
20
|
+
step3: string;
|
|
21
|
+
};
|
|
22
|
+
help: {
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
usage: string;
|
|
26
|
+
usageExample: string;
|
|
27
|
+
options: string;
|
|
28
|
+
optionHelp: string;
|
|
29
|
+
optionVersion: string;
|
|
30
|
+
optionLang: string;
|
|
31
|
+
optionRouter: string;
|
|
32
|
+
optionBff: string;
|
|
33
|
+
optionBffRuntime: string;
|
|
34
|
+
optionTailwind: string;
|
|
35
|
+
optionWorkspace: string;
|
|
36
|
+
optionUltramodernWorkspace: string;
|
|
37
|
+
optionUltramodernPackageSource: string;
|
|
38
|
+
optionUltramodernPackageScope: string;
|
|
39
|
+
optionUltramodernPackageNamePrefix: string;
|
|
40
|
+
optionSub: string;
|
|
41
|
+
examples: string;
|
|
42
|
+
example1: string;
|
|
43
|
+
example2: string;
|
|
44
|
+
example3: string;
|
|
45
|
+
example4: string;
|
|
46
|
+
example5: string;
|
|
47
|
+
example6: string;
|
|
48
|
+
example7: string;
|
|
49
|
+
example8: string;
|
|
50
|
+
example9: string;
|
|
51
|
+
example10: string;
|
|
52
|
+
moreInfo: string;
|
|
53
|
+
};
|
|
54
|
+
version: {
|
|
55
|
+
message: string;
|
|
56
|
+
};
|
|
57
|
+
} | {
|
|
58
|
+
prompt: {
|
|
59
|
+
projectName: string;
|
|
60
|
+
};
|
|
61
|
+
error: {
|
|
62
|
+
projectNameEmpty: string;
|
|
63
|
+
directoryExists: string;
|
|
64
|
+
invalidRouter: string;
|
|
65
|
+
invalidBffRuntime: string;
|
|
66
|
+
createFailed: string;
|
|
67
|
+
};
|
|
68
|
+
message: {
|
|
69
|
+
welcome: string;
|
|
70
|
+
success: string;
|
|
71
|
+
nextSteps: string;
|
|
72
|
+
step1: string;
|
|
73
|
+
step2: string;
|
|
74
|
+
step3: string;
|
|
75
|
+
};
|
|
76
|
+
help: {
|
|
77
|
+
title: string;
|
|
78
|
+
description: string;
|
|
79
|
+
usage: string;
|
|
80
|
+
usageExample: string;
|
|
81
|
+
options: string;
|
|
82
|
+
optionHelp: string;
|
|
83
|
+
optionVersion: string;
|
|
84
|
+
optionLang: string;
|
|
85
|
+
optionRouter: string;
|
|
86
|
+
optionBff: string;
|
|
87
|
+
optionBffRuntime: string;
|
|
88
|
+
optionTailwind: string;
|
|
89
|
+
optionWorkspace: string;
|
|
90
|
+
optionUltramodernWorkspace: string;
|
|
91
|
+
optionUltramodernPackageSource: string;
|
|
92
|
+
optionUltramodernPackageScope: string;
|
|
93
|
+
optionUltramodernPackageNamePrefix: string;
|
|
94
|
+
optionSub: string;
|
|
95
|
+
examples: string;
|
|
96
|
+
example1: string;
|
|
97
|
+
example2: string;
|
|
98
|
+
example3: string;
|
|
99
|
+
example4: string;
|
|
100
|
+
example5: string;
|
|
101
|
+
example6: string;
|
|
102
|
+
example7: string;
|
|
103
|
+
example8: string;
|
|
104
|
+
example9: string;
|
|
105
|
+
example10: string;
|
|
106
|
+
moreInfo: string;
|
|
107
|
+
};
|
|
108
|
+
version: {
|
|
109
|
+
message: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export { i18n, localeKeys };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare const ZH_LOCALE: {
|
|
2
|
+
prompt: {
|
|
3
|
+
projectName: string;
|
|
4
|
+
};
|
|
5
|
+
error: {
|
|
6
|
+
projectNameEmpty: string;
|
|
7
|
+
directoryExists: string;
|
|
8
|
+
invalidRouter: string;
|
|
9
|
+
invalidBffRuntime: string;
|
|
10
|
+
createFailed: string;
|
|
11
|
+
};
|
|
12
|
+
message: {
|
|
13
|
+
welcome: string;
|
|
14
|
+
success: string;
|
|
15
|
+
nextSteps: string;
|
|
16
|
+
step1: string;
|
|
17
|
+
step2: string;
|
|
18
|
+
step3: string;
|
|
19
|
+
};
|
|
20
|
+
help: {
|
|
21
|
+
title: string;
|
|
22
|
+
description: string;
|
|
23
|
+
usage: string;
|
|
24
|
+
usageExample: string;
|
|
25
|
+
options: string;
|
|
26
|
+
optionHelp: string;
|
|
27
|
+
optionVersion: string;
|
|
28
|
+
optionLang: string;
|
|
29
|
+
optionRouter: string;
|
|
30
|
+
optionBff: string;
|
|
31
|
+
optionBffRuntime: string;
|
|
32
|
+
optionTailwind: string;
|
|
33
|
+
optionWorkspace: string;
|
|
34
|
+
optionUltramodernWorkspace: string;
|
|
35
|
+
optionUltramodernPackageSource: string;
|
|
36
|
+
optionUltramodernPackageScope: string;
|
|
37
|
+
optionUltramodernPackageNamePrefix: string;
|
|
38
|
+
optionSub: string;
|
|
39
|
+
examples: string;
|
|
40
|
+
example1: string;
|
|
41
|
+
example2: string;
|
|
42
|
+
example3: string;
|
|
43
|
+
example4: string;
|
|
44
|
+
example5: string;
|
|
45
|
+
example6: string;
|
|
46
|
+
example7: string;
|
|
47
|
+
example8: string;
|
|
48
|
+
example9: string;
|
|
49
|
+
example10: string;
|
|
50
|
+
moreInfo: string;
|
|
51
|
+
};
|
|
52
|
+
version: {
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type UltramodernPackageSourceStrategy = 'workspace' | 'install';
|
|
2
|
+
export type UltramodernWorkspaceOptions = {
|
|
3
|
+
targetDir: string;
|
|
4
|
+
packageName: string;
|
|
5
|
+
modernVersion: string;
|
|
6
|
+
packageSource?: {
|
|
7
|
+
strategy?: UltramodernPackageSourceStrategy;
|
|
8
|
+
modernPackageVersion?: string;
|
|
9
|
+
registry?: string;
|
|
10
|
+
aliasScope?: string;
|
|
11
|
+
aliasPackageNamePrefix?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const ULTRAMODERN_WORKSPACE_FLAG = "--ultramodern-workspace";
|
|
15
|
+
export declare function generateUltramodernWorkspace(options: UltramodernWorkspaceOptions): void;
|
|
16
|
+
export declare const ultramodernWorkspaceVersions: {
|
|
17
|
+
tanstackRouter: string;
|
|
18
|
+
moduleFederation: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bleedingdev/modern-js-create",
|
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
|
4
|
+
"homepage": "https://github.com/BleedingDev/ultramodern.js#readme",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/BleedingDev/ultramodern.js/issues"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/BleedingDev/ultramodern.js.git",
|
|
11
|
+
"directory": "packages/toolkit/create"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"react",
|
|
16
|
+
"framework",
|
|
17
|
+
"modern",
|
|
18
|
+
"modern.js"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"version": "3.2.0-ultramodern.0",
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"bin": {
|
|
28
|
+
"create": "bin/run.js"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"template",
|
|
35
|
+
"template-workspace",
|
|
36
|
+
"dist",
|
|
37
|
+
"bin.js"
|
|
38
|
+
],
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@rslib/core": "0.21.5",
|
|
41
|
+
"@types/node": "^25.8.0",
|
|
42
|
+
"@typescript/native-preview": "7.0.0-dev.20260516.1",
|
|
43
|
+
"tsx": "^4.22.0",
|
|
44
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.0"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"modern:source": "./src/index.ts",
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "rslib build && pnpm -w tsgo:dts \"$PWD\"",
|
|
53
|
+
"dev": "rslib build -w",
|
|
54
|
+
"start": "node ./dist/index.js"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Ultramodern Gates
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ultramodern-gates:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Setup pnpm
|
|
15
|
+
uses: pnpm/action-setup@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 20
|
|
21
|
+
cache: pnpm
|
|
22
|
+
|
|
23
|
+
- name: Install Dependencies
|
|
24
|
+
run: pnpm install
|
|
25
|
+
|
|
26
|
+
- name: Validate Ultramodern Contract
|
|
27
|
+
run: pnpm run ultramodern:check
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
run: pnpm run build
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
.env.local
|
|
6
|
+
.env.*.local
|
|
7
|
+
.history
|
|
8
|
+
*.log*
|
|
9
|
+
|
|
10
|
+
node_modules/
|
|
11
|
+
.yarn-integrity
|
|
12
|
+
.pnpm-store/
|
|
13
|
+
*.tsbuildinfo
|
|
14
|
+
.changeset/pre.json
|
|
15
|
+
|
|
16
|
+
dist/
|
|
17
|
+
coverage/
|
|
18
|
+
release/
|
|
19
|
+
output/
|
|
20
|
+
output_resource/
|
|
21
|
+
log/
|
|
22
|
+
|
|
23
|
+
.vscode/**/*
|
|
24
|
+
!.vscode/settings.json
|
|
25
|
+
!.vscode/extensions.json
|
|
26
|
+
.idea/
|
|
27
|
+
|
|
28
|
+
**/*/typings/auto-generated
|
|
29
|
+
|
|
30
|
+
modern.config.local.*
|
package/template/.nvmrc
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Modern.js `presetUltramodern` Starter
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
Install the dependencies:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Get Started
|
|
12
|
+
|
|
13
|
+
Start the dev server:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build the app for production:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Validate the generated Ultramodern preset contract locally:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm run ultramodern:check
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The generated preset defaults are opt-out. Disable specific contracts via env vars:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
MODERN_BASELINE_ENABLE_MF_SSR=false
|
|
35
|
+
MODERN_BASELINE_ENABLE_BFF_REQUEST_ID=false
|
|
36
|
+
MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS=false
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The generated starter also includes `.github/workflows/ultramodern-gates.yml`.
|
|
40
|
+
That workflow runs `pnpm run ultramodern:check` and `pnpm run build` on every
|
|
41
|
+
push and pull request so the `presetUltramodern(...)` contract stays explicit.
|
|
42
|
+
|
|
43
|
+
## Micro Vertical Workspaces
|
|
44
|
+
|
|
45
|
+
Inside a Micro Vertical workspace, generate shell, remote, and service packages
|
|
46
|
+
with `--sub` so the workspace root owns package-manager and CI policy:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx @modern-js/create apps/shell --router tanstack --tailwind --workspace --sub
|
|
50
|
+
npx @modern-js/create apps/remotes/catalog --router tanstack --tailwind --workspace --sub
|
|
51
|
+
npx @modern-js/create apps/remotes/design-system --router tanstack --tailwind --workspace --sub
|
|
52
|
+
npx @modern-js/create services/catalog-api --bff-runtime effect --workspace --sub
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The canonical topology is documented in
|
|
56
|
+
`docs/super-app-rfc-adr/WORKSPACE-0001-micro-vertical-workspace-scaffolding.md`.
|
|
57
|
+
Shell packages own route assembly and topology selection, remote packages own
|
|
58
|
+
route subtrees and degraded UI, service packages own Effect or explicit Hono
|
|
59
|
+
contracts, and shared packages are limited to tokens, primitives, generated
|
|
60
|
+
clients, or domain-neutral utilities.
|
|
61
|
+
|
|
62
|
+
If the design system needs independent deployment, keep it as a horizontal
|
|
63
|
+
Module Federation remote with the same topology, trust, SSR compatibility, and
|
|
64
|
+
fallback rules as the vertical remotes. Do not add a second preset or a
|
|
65
|
+
design-system-specific framework mode.
|
|
66
|
+
|
|
67
|
+
The public opinionated entrypoint is `presetUltramodern(...)`. The older
|
|
68
|
+
`withAppBaseline(...)` helper remains only as a compatibility alias.
|
|
69
|
+
|
|
70
|
+
Preview the production build locally:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pnpm serve
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For more information, see the
|
|
77
|
+
[UltraModern.js guide](https://modernjs.dev/en/guides/get-started/ultramodern.html)
|
|
78
|
+
and the [Modern.js documentation](https://modernjs.dev/en).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{{#if useEffectBff}}import {
|
|
2
|
+
Effect,
|
|
3
|
+
HttpApiBuilder,
|
|
4
|
+
Layer,
|
|
5
|
+
Schema,
|
|
6
|
+
ServiceMap,
|
|
7
|
+
defineEffectBff,
|
|
8
|
+
} from '@modern-js/plugin-bff/effect-server';
|
|
9
|
+
import { bffEffectApi } from '../../shared/effect/api';
|
|
10
|
+
|
|
11
|
+
class GreetingUnavailableError extends Schema.TaggedError<GreetingUnavailableError>()(
|
|
12
|
+
'GreetingUnavailableError',
|
|
13
|
+
{
|
|
14
|
+
message: Schema.String,
|
|
15
|
+
},
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
class GreetingService extends ServiceMap.Service<GreetingService>()('GreetingService', {
|
|
19
|
+
make: Effect.succeed({
|
|
20
|
+
hello: Effect.fn('GreetingService.hello')(function* () {
|
|
21
|
+
if (Date.now() < 0) {
|
|
22
|
+
return yield* Effect.fail(
|
|
23
|
+
new GreetingUnavailableError({
|
|
24
|
+
message: 'Greeting service is unavailable',
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
message: 'Hello from Effect HttpApi',
|
|
31
|
+
runtime: 'effect' as const,
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
}) {
|
|
36
|
+
static readonly layer = Layer.effect(this, this.make);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const greetingsLayer = HttpApiBuilder.group(bffEffectApi, 'greetings', handlers =>
|
|
40
|
+
handlers.handle('hello', () =>
|
|
41
|
+
GreetingService.use(service => service.hello()).pipe(
|
|
42
|
+
Effect.catchTag('GreetingUnavailableError', error =>
|
|
43
|
+
Effect.succeed({
|
|
44
|
+
message: error.message,
|
|
45
|
+
runtime: 'effect' as const,
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const layer = HttpApiBuilder.layer(bffEffectApi).pipe(
|
|
53
|
+
Layer.provide(greetingsLayer),
|
|
54
|
+
Layer.provide(GreetingService.layer),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export default defineEffectBff({
|
|
58
|
+
api: bffEffectApi,
|
|
59
|
+
layer,
|
|
60
|
+
});
|
|
61
|
+
{{/if}}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": false,
|
|
3
|
+
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
|
|
4
|
+
"vcs": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"defaultBranch": "main",
|
|
7
|
+
"clientKind": "git",
|
|
8
|
+
"useIgnoreFile": true
|
|
9
|
+
},
|
|
10
|
+
"formatter": {
|
|
11
|
+
"enabled": true,
|
|
12
|
+
"indentStyle": "space"
|
|
13
|
+
},
|
|
14
|
+
"javascript": {
|
|
15
|
+
"formatter": {
|
|
16
|
+
"quoteStyle": "single",
|
|
17
|
+
"arrowParentheses": "asNeeded",
|
|
18
|
+
"jsxQuoteStyle": "double",
|
|
19
|
+
"lineWidth": 80
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"linter": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"rules": {
|
|
25
|
+
"recommended": true,
|
|
26
|
+
"suspicious": {
|
|
27
|
+
"noDuplicateFontNames": "off"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
|
32
|
+
"files": {
|
|
33
|
+
"ignoreUnknown": true,
|
|
34
|
+
"includes": [
|
|
35
|
+
"**",
|
|
36
|
+
"!**/.vscode/**/*",
|
|
37
|
+
"!**/node_modules/**/*",
|
|
38
|
+
"!**/dist/**/*"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
{{#if enableBff}}import { bffPlugin } from '@modern-js/plugin-bff';
|
|
4
|
+
{{/if}}{{#if isTanstackRouter}}import { tanstackRouterPlugin } from '@modern-js/plugin-tanstack';
|
|
5
|
+
{{/if}}
|
|
6
|
+
|
|
7
|
+
const appId = process.env.MODERN_BASELINE_APP_ID || path.basename(process.cwd());
|
|
8
|
+
const enableModuleFederationSSR =
|
|
9
|
+
process.env.MODERN_BASELINE_ENABLE_MF_SSR !== 'false';
|
|
10
|
+
const enableBffRequestId =
|
|
11
|
+
process.env.MODERN_BASELINE_ENABLE_BFF_REQUEST_ID !== 'false';
|
|
12
|
+
const enableTelemetryExporters =
|
|
13
|
+
process.env.MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS !== 'false';
|
|
14
|
+
const telemetryFailLoudStartup =
|
|
15
|
+
process.env.MODERN_TELEMETRY_FAIL_LOUD_STARTUP !== 'false';
|
|
16
|
+
|
|
17
|
+
// https://modernjs.dev/en/configure/app/usage
|
|
18
|
+
export default defineConfig(
|
|
19
|
+
presetUltramodern(
|
|
20
|
+
{
|
|
21
|
+
plugins: [
|
|
22
|
+
appTools(),
|
|
23
|
+
{{#if isTanstackRouter}}
|
|
24
|
+
tanstackRouterPlugin(),
|
|
25
|
+
{{/if}}{{#if enableBff}}
|
|
26
|
+
bffPlugin(),
|
|
27
|
+
{{/if}}
|
|
28
|
+
],
|
|
29
|
+
{{#if enableBff}}
|
|
30
|
+
bff: {
|
|
31
|
+
runtimeFramework: '{{bffRuntime}}',
|
|
32
|
+
{{#if useEffectBff}}
|
|
33
|
+
effect: {
|
|
34
|
+
openapi: true,
|
|
35
|
+
},
|
|
36
|
+
{{/if}}
|
|
37
|
+
},
|
|
38
|
+
{{/if}}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
appId,
|
|
42
|
+
enableBffRequestId,
|
|
43
|
+
enableModuleFederationSSR,
|
|
44
|
+
enableTelemetryExporters,
|
|
45
|
+
telemetryFailLoudStartup,
|
|
46
|
+
otlpEndpoint: process.env.MODERN_TELEMETRY_OTLP_ENDPOINT,
|
|
47
|
+
victoriaMetricsEndpoint: process.env.MODERN_TELEMETRY_VICTORIA_ENDPOINT,
|
|
48
|
+
},
|
|
49
|
+
),
|
|
50
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"reset": "npx rimraf node_modules ./**/node_modules",
|
|
6
|
+
"dev": "modern dev",
|
|
7
|
+
"build": "modern build",
|
|
8
|
+
"serve": "modern serve",
|
|
9
|
+
"ultramodern:check": "node ./scripts/validate-ultramodern.mjs"{{#unless isSubproject}},
|
|
10
|
+
"lint": "biome check",
|
|
11
|
+
"prepare": "simple-git-hooks"{{/unless}}
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
}{{#unless isSubproject}},
|
|
16
|
+
"lint-staged": {
|
|
17
|
+
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
|
|
18
|
+
"biome check --files-ignore-unknown=true"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"simple-git-hooks": {
|
|
22
|
+
"pre-commit": "npx lint-staged"
|
|
23
|
+
}{{/unless}},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@modern-js/runtime": "{{version}}"{{#if isTanstackRouter}},
|
|
26
|
+
"@modern-js/plugin-tanstack": "{{version}}",
|
|
27
|
+
"@tanstack/react-router": "1.170.1"{{/if}},
|
|
28
|
+
"react": "^19.2.3",
|
|
29
|
+
"react-dom": "^19.2.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@modern-js/app-tools": "{{version}}",
|
|
33
|
+
"@modern-js/tsconfig": "{{version}}"{{#if enableBff}},
|
|
34
|
+
"@modern-js/plugin-bff": "{{version}}"{{/if}}{{#if enableTailwind}},
|
|
35
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
36
|
+
"postcss": "^8.5.6",
|
|
37
|
+
"tailwindcss": "^4.1.18"{{/if}}{{#unless isSubproject}},
|
|
38
|
+
"@biomejs/biome": "1.9.4"{{/unless}},
|
|
39
|
+
"@typescript/native-preview": "7.0.0-dev.20260516.1",
|
|
40
|
+
"@types/node": "^20",
|
|
41
|
+
"@types/react": "^19.1.8",
|
|
42
|
+
"@types/react-dom": "^19.1.6"{{#unless isSubproject}},
|
|
43
|
+
"lint-staged": "~15.4.0",
|
|
44
|
+
"simple-git-hooks": "^2.11.1"{{/unless}},
|
|
45
|
+
"rimraf": "^6.0.1"
|
|
46
|
+
}
|
|
47
|
+
}
|