@bleedingdev/modern-js-create 3.2.0-ultramodern.0 → 3.2.0-ultramodern.10
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 -0
- package/dist/index.js +252 -49
- package/dist/types/locale/index.d.ts +2 -111
- package/package.json +5 -2
- package/template/.agents/skills-lock.json +34 -0
- package/template/AGENTS.md +20 -0
- package/template/README.md +6 -5
- package/template/api/effect/index.ts.handlebars +7 -45
- package/template/api/lambda/hello.ts.handlebars +1 -1
- package/template/modern.config.ts.handlebars +21 -25
- package/template/oxfmt.config.ts +8 -0
- package/template/oxlint.config.ts +12 -0
- package/template/package.json.handlebars +41 -26
- package/template/scripts/bootstrap-agent-skills.mjs +95 -0
- package/template/scripts/validate-ultramodern.mjs.handlebars +81 -17
- package/template/shared/effect/api.ts.handlebars +1 -2
- package/template/src/modern.runtime.ts.handlebars +2 -4
- package/template/src/routes/index.css.handlebars +14 -3
- package/template/src/routes/page.tsx.handlebars +35 -18
- package/template/tsconfig.json +106 -2
- package/template-workspace/.agents/rstackjs-agent-skills-LICENSE +21 -0
- package/template-workspace/.agents/skills/rsbuild-best-practices/SKILL.md +57 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/SKILL.md +96 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/command-map.md +113 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/common-analysis-patterns.md +190 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +88 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +138 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +71 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/install-rsdoctor.md +39 -0
- package/template-workspace/.agents/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +103 -0
- package/template-workspace/.agents/skills/rslib-best-practices/SKILL.md +58 -0
- package/template-workspace/.agents/skills/rslib-modern-package/SKILL.md +173 -0
- package/template-workspace/.agents/skills/rspack-best-practices/SKILL.md +70 -0
- package/template-workspace/.agents/skills/rspack-tracing/SKILL.md +75 -0
- package/template-workspace/.agents/skills/rspack-tracing/references/bottlenecks.md +47 -0
- package/template-workspace/.agents/skills/rspack-tracing/references/tracing-guide.md +38 -0
- package/template-workspace/.agents/skills/rspack-tracing/scripts/analyze_trace.js +184 -0
- package/template-workspace/.agents/skills/rstest-best-practices/SKILL.md +133 -0
- package/template-workspace/.agents/skills-lock.json +95 -0
- package/template-workspace/AGENTS.md +45 -0
- package/template-workspace/README.md.handlebars +8 -7
- package/template-workspace/oxfmt.config.ts +7 -0
- package/template-workspace/oxlint.config.ts +12 -0
- package/template-workspace/pnpm-workspace.yaml +12 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +106 -0
- package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +127 -0
- package/template/biome.json +0 -41
package/README.md
CHANGED
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
|
14
14
|
|
|
15
|
+
For UltraModern.js, use the BleedingDev create package. It defaults to the
|
|
16
|
+
canonical SuperApp workspace and published BleedingDev package aliases:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm dlx @bleedingdev/modern-js-create my-super-app
|
|
20
|
+
```
|
|
21
|
+
|
|
15
22
|
### Router Template
|
|
16
23
|
|
|
17
24
|
You can scaffold a TanStack Router first template:
|
|
@@ -89,6 +96,11 @@ See
|
|
|
89
96
|
`docs/super-app-rfc-adr/WORKSPACE-0001-micro-vertical-workspace-scaffolding.md`
|
|
90
97
|
for the canonical workspace topology and local orchestration model.
|
|
91
98
|
|
|
99
|
+
The published `@bleedingdev/modern-js-create` package is the preferred
|
|
100
|
+
UltraModern.js entrypoint. The lower-level `--ultramodern-*` flags remain
|
|
101
|
+
available for release engineering and local package-source testing, but users
|
|
102
|
+
should not need them for normal app creation.
|
|
103
|
+
|
|
92
104
|
### Local Monorepo Testing
|
|
93
105
|
|
|
94
106
|
When testing unreleased Modern.js packages from a local monorepo checkout, use
|
package/dist/index.js
CHANGED
|
@@ -485,7 +485,7 @@ const EN_LOCALE = {
|
|
|
485
485
|
example7: ' create my-app --bff',
|
|
486
486
|
example8: ' create my-app --router tanstack --bff-runtime effect',
|
|
487
487
|
example9: ' create my-app --router tanstack --bff-runtime effect --workspace',
|
|
488
|
-
example10: ' create my-super-app
|
|
488
|
+
example10: ' pnpm dlx @bleedingdev/modern-js-create my-super-app',
|
|
489
489
|
moreInfo: '📚 Learn more: https://modernjs.dev'
|
|
490
490
|
},
|
|
491
491
|
version: {
|
|
@@ -556,10 +556,32 @@ const ultramodern_workspace_dirname = node_path.dirname(fileURLToPath(import.met
|
|
|
556
556
|
const workspaceTemplateDir = node_path.resolve(ultramodern_workspace_dirname, '..', 'template-workspace');
|
|
557
557
|
const TANSTACK_ROUTER_VERSION = '1.170.1';
|
|
558
558
|
const MODULE_FEDERATION_VERSION = '2.4.0';
|
|
559
|
-
const
|
|
559
|
+
const EFFECT_TSGO_VERSION = '0.7.3';
|
|
560
|
+
const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260518.1';
|
|
561
|
+
const OXLINT_VERSION = '1.65.0';
|
|
562
|
+
const OXFMT_VERSION = '0.50.0';
|
|
563
|
+
const ULTRACITE_VERSION = '7.7.0';
|
|
560
564
|
const REACT_VERSION = '^19.2.6';
|
|
561
565
|
const REACT_DOM_VERSION = '^19.2.6';
|
|
562
566
|
const WORKSPACE_PACKAGE_VERSION = 'workspace:*';
|
|
567
|
+
const RSTACK_AGENT_SKILLS_COMMIT = '61c948b42512e223bad44b83af4080eba48b2677';
|
|
568
|
+
const baselineAgentSkills = [
|
|
569
|
+
'rsbuild-best-practices',
|
|
570
|
+
'rspack-best-practices',
|
|
571
|
+
'rspack-tracing',
|
|
572
|
+
'rsdoctor-analysis',
|
|
573
|
+
'rslib-best-practices',
|
|
574
|
+
'rslib-modern-package',
|
|
575
|
+
'rstest-best-practices'
|
|
576
|
+
];
|
|
577
|
+
const privateAgentSkills = [
|
|
578
|
+
'plan-graph',
|
|
579
|
+
'dag',
|
|
580
|
+
'subagent-graph',
|
|
581
|
+
'helm',
|
|
582
|
+
'debugger-mode'
|
|
583
|
+
];
|
|
584
|
+
const effectTsgoTypecheckCommand = "node -e \"const fs = require('node:fs'); const { execFileSync, spawnSync } = require('node:child_process'); const bin = execFileSync('effect-tsgo', ['get-exe-path'], { encoding: 'utf8' }).trim(); if (process.platform !== 'win32') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, ['--noEmit', '-p', 'tsconfig.json'], { stdio: 'inherit' }); process.exit(result.status ?? 1);\"";
|
|
563
585
|
const modernPackageNames = [
|
|
564
586
|
'@modern-js/app-tools',
|
|
565
587
|
'@modern-js/plugin-bff',
|
|
@@ -706,6 +728,81 @@ const effectService = {
|
|
|
706
728
|
}
|
|
707
729
|
}
|
|
708
730
|
};
|
|
731
|
+
const effectDiagnostics = [
|
|
732
|
+
'anyUnknownInErrorContext',
|
|
733
|
+
'classSelfMismatch',
|
|
734
|
+
'duplicatePackage',
|
|
735
|
+
'effectFnImplicitAny',
|
|
736
|
+
'floatingEffect',
|
|
737
|
+
'genericEffectServices',
|
|
738
|
+
'missingEffectContext',
|
|
739
|
+
'missingEffectError',
|
|
740
|
+
'missingLayerContext',
|
|
741
|
+
'missingReturnYieldStar',
|
|
742
|
+
'missingStarInYieldEffectGen',
|
|
743
|
+
'nonObjectEffectServiceType',
|
|
744
|
+
'outdatedApi',
|
|
745
|
+
'overriddenSchemaConstructor',
|
|
746
|
+
'catchUnfailableEffect',
|
|
747
|
+
'effectFnIife',
|
|
748
|
+
'effectGenUsesAdapter',
|
|
749
|
+
'effectInFailure',
|
|
750
|
+
'effectInVoidSuccess',
|
|
751
|
+
'globalErrorInEffectCatch',
|
|
752
|
+
'globalErrorInEffectFailure',
|
|
753
|
+
'layerMergeAllWithDependencies',
|
|
754
|
+
'lazyPromiseInEffectSync',
|
|
755
|
+
'leakingRequirements',
|
|
756
|
+
'multipleEffectProvide',
|
|
757
|
+
'returnEffectInGen',
|
|
758
|
+
'runEffectInsideEffect',
|
|
759
|
+
'schemaSyncInEffect',
|
|
760
|
+
'scopeInLayerEffect',
|
|
761
|
+
'strictEffectProvide',
|
|
762
|
+
'tryCatchInEffectGen',
|
|
763
|
+
'unknownInEffectCatch',
|
|
764
|
+
'asyncFunction',
|
|
765
|
+
'cryptoRandomUUID',
|
|
766
|
+
'cryptoRandomUUIDInEffect',
|
|
767
|
+
'extendsNativeError',
|
|
768
|
+
'globalConsole',
|
|
769
|
+
'globalConsoleInEffect',
|
|
770
|
+
'globalDate',
|
|
771
|
+
'globalDateInEffect',
|
|
772
|
+
'globalFetch',
|
|
773
|
+
'globalFetchInEffect',
|
|
774
|
+
'globalRandom',
|
|
775
|
+
'globalRandomInEffect',
|
|
776
|
+
'globalTimers',
|
|
777
|
+
'globalTimersInEffect',
|
|
778
|
+
'instanceOfSchema',
|
|
779
|
+
'newPromise',
|
|
780
|
+
'nodeBuiltinImport',
|
|
781
|
+
'preferSchemaOverJson',
|
|
782
|
+
'processEnv',
|
|
783
|
+
'processEnvInEffect',
|
|
784
|
+
'unsafeEffectTypeAssertion',
|
|
785
|
+
'catchAllToMapError',
|
|
786
|
+
'deterministicKeys',
|
|
787
|
+
'effectDoNotation',
|
|
788
|
+
'effectFnOpportunity',
|
|
789
|
+
'effectMapFlatten',
|
|
790
|
+
'effectMapVoid',
|
|
791
|
+
'effectSucceedWithVoid',
|
|
792
|
+
'missedPipeableOpportunity',
|
|
793
|
+
'missingEffectServiceDependency',
|
|
794
|
+
'nestedEffectGenYield',
|
|
795
|
+
'redundantSchemaTagIdentifier',
|
|
796
|
+
'schemaStructWithTag',
|
|
797
|
+
'schemaUnionOfLiterals',
|
|
798
|
+
'serviceNotAsClass',
|
|
799
|
+
'strictBooleanExpressions',
|
|
800
|
+
'unnecessaryArrowBlock',
|
|
801
|
+
'unnecessaryEffectGen',
|
|
802
|
+
'unnecessaryFailYieldableError',
|
|
803
|
+
'unnecessaryPipe',
|
|
804
|
+
'unnecessaryPipeChain'
|
|
805
|
+
];
|
|
709
806
|
const sharedPackages = [
|
|
710
807
|
{
|
|
711
808
|
id: 'shared-contracts',
|
|
@@ -834,10 +931,11 @@ function appDependencies(scope, packageSource) {
|
|
|
834
931
|
function appDevDependencies(packageSource) {
|
|
835
932
|
return {
|
|
836
933
|
'@modern-js/app-tools': modernPackageSpecifier('@modern-js/app-tools', packageSource),
|
|
934
|
+
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
935
|
+
"@typescript/native-preview": TYPESCRIPT_NATIVE_PREVIEW_VERSION,
|
|
837
936
|
'@types/node': '^20',
|
|
838
937
|
'@types/react': '^19.1.8',
|
|
839
|
-
'@types/react-dom': '^19.1.6'
|
|
840
|
-
typescript: TYPESCRIPT_VERSION
|
|
938
|
+
'@types/react-dom': '^19.1.6'
|
|
841
939
|
};
|
|
842
940
|
}
|
|
843
941
|
function createRootPackageJson(scope, packageSource) {
|
|
@@ -845,6 +943,7 @@ function createRootPackageJson(scope, packageSource) {
|
|
|
845
943
|
private: true,
|
|
846
944
|
name: scope,
|
|
847
945
|
version: '0.1.0',
|
|
946
|
+
packageManager: 'pnpm@11.1.2',
|
|
848
947
|
scripts: {
|
|
849
948
|
dev: `pnpm --parallel --filter ${ultramodern_workspace_packageName(scope, shellApp.packageSuffix)} --filter ${ultramodern_workspace_packageName(scope, 'remote-commerce')} --filter ${ultramodern_workspace_packageName(scope, 'remote-identity')} --filter ${ultramodern_workspace_packageName(scope, 'remote-design-system')} dev`,
|
|
850
949
|
'dev:shell': `pnpm --filter ${ultramodern_workspace_packageName(scope, shellApp.packageSuffix)} dev`,
|
|
@@ -853,13 +952,19 @@ function createRootPackageJson(scope, packageSource) {
|
|
|
853
952
|
'dev:design-system': `pnpm --filter ${ultramodern_workspace_packageName(scope, 'remote-design-system')} dev`,
|
|
854
953
|
'dev:recommendations': `pnpm --filter ${ultramodern_workspace_packageName(scope, effectService.packageSuffix)} dev`,
|
|
855
954
|
build: 'pnpm -r --filter ./apps/** --filter ./services/** build',
|
|
955
|
+
format: 'oxfmt .',
|
|
956
|
+
'format:check': 'oxfmt --check .',
|
|
957
|
+
lint: 'oxlint .',
|
|
958
|
+
'lint:fix': 'oxlint . --fix',
|
|
856
959
|
typecheck: 'pnpm -r --filter ./apps/** --filter ./services/** --filter ./packages/** typecheck',
|
|
960
|
+
'skills:install': "node ./scripts/bootstrap-agent-skills.mjs",
|
|
961
|
+
'skills:check': "node ./scripts/bootstrap-agent-skills.mjs --check",
|
|
857
962
|
'ultramodern:check': "node ./scripts/validate-ultramodern-workspace.mjs",
|
|
858
|
-
check: 'pnpm ultramodern:check'
|
|
963
|
+
check: 'pnpm format:check && pnpm lint && pnpm typecheck && pnpm skills:check && pnpm ultramodern:check'
|
|
859
964
|
},
|
|
860
965
|
engines: {
|
|
861
966
|
node: '>=20',
|
|
862
|
-
pnpm: '>=
|
|
967
|
+
pnpm: '>=11.0.0'
|
|
863
968
|
},
|
|
864
969
|
workspaces: [
|
|
865
970
|
'apps/*',
|
|
@@ -878,35 +983,62 @@ function createRootPackageJson(scope, packageSource) {
|
|
|
878
983
|
}
|
|
879
984
|
},
|
|
880
985
|
devDependencies: {
|
|
881
|
-
'@
|
|
882
|
-
typescript:
|
|
986
|
+
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
987
|
+
"@typescript/native-preview": TYPESCRIPT_NATIVE_PREVIEW_VERSION,
|
|
988
|
+
oxlint: OXLINT_VERSION,
|
|
989
|
+
oxfmt: OXFMT_VERSION,
|
|
990
|
+
ultracite: ULTRACITE_VERSION
|
|
883
991
|
}
|
|
884
992
|
};
|
|
885
993
|
}
|
|
886
994
|
function createTsConfigBase(scope) {
|
|
887
995
|
return {
|
|
888
996
|
compilerOptions: {
|
|
889
|
-
target: '
|
|
997
|
+
target: 'ESNext',
|
|
890
998
|
lib: [
|
|
999
|
+
'ESNext',
|
|
891
1000
|
'DOM',
|
|
892
|
-
'DOM.Iterable'
|
|
893
|
-
'ES2022'
|
|
1001
|
+
'DOM.Iterable'
|
|
894
1002
|
],
|
|
895
|
-
module: '
|
|
1003
|
+
module: 'preserve',
|
|
896
1004
|
moduleResolution: 'Bundler',
|
|
1005
|
+
moduleDetection: 'force',
|
|
897
1006
|
jsx: 'preserve',
|
|
1007
|
+
isolatedModules: true,
|
|
1008
|
+
verbatimModuleSyntax: true,
|
|
898
1009
|
strict: true,
|
|
899
1010
|
noEmit: true,
|
|
1011
|
+
allowJs: true,
|
|
900
1012
|
esModuleInterop: true,
|
|
1013
|
+
noUncheckedIndexedAccess: true,
|
|
1014
|
+
exactOptionalPropertyTypes: true,
|
|
1015
|
+
noImplicitOverride: true,
|
|
1016
|
+
noFallthroughCasesInSwitch: true,
|
|
1017
|
+
noPropertyAccessFromIndexSignature: true,
|
|
1018
|
+
noImplicitReturns: true,
|
|
901
1019
|
skipLibCheck: true,
|
|
902
1020
|
resolveJsonModule: true,
|
|
903
|
-
baseUrl: '.',
|
|
904
1021
|
paths: Object.fromEntries(sharedPackages.map((sharedPackage)=>[
|
|
905
1022
|
ultramodern_workspace_packageName(scope, sharedPackage.id),
|
|
906
1023
|
[
|
|
907
1024
|
`${sharedPackage.directory}/src/index.ts`
|
|
908
1025
|
]
|
|
909
|
-
]))
|
|
1026
|
+
])),
|
|
1027
|
+
plugins: [
|
|
1028
|
+
{
|
|
1029
|
+
name: '@effect/language-service',
|
|
1030
|
+
diagnostics: true,
|
|
1031
|
+
includeSuggestionsInTsc: true,
|
|
1032
|
+
ignoreEffectSuggestionsInTscExitCode: false,
|
|
1033
|
+
ignoreEffectWarningsInTscExitCode: false,
|
|
1034
|
+
ignoreEffectErrorsInTscExitCode: false,
|
|
1035
|
+
skipDisabledOptimization: true,
|
|
1036
|
+
diagnosticSeverity: Object.fromEntries(effectDiagnostics.map((name)=>[
|
|
1037
|
+
name,
|
|
1038
|
+
'error'
|
|
1039
|
+
]))
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
910
1042
|
}
|
|
911
1043
|
};
|
|
912
1044
|
}
|
|
@@ -945,7 +1077,7 @@ function createAppPackage(scope, app, packageSource) {
|
|
|
945
1077
|
dev: 'modern dev',
|
|
946
1078
|
build: 'modern build',
|
|
947
1079
|
serve: 'modern serve',
|
|
948
|
-
typecheck:
|
|
1080
|
+
typecheck: effectTsgoTypecheckCommand
|
|
949
1081
|
},
|
|
950
1082
|
modernjs: {
|
|
951
1083
|
preset: 'presetUltramodern',
|
|
@@ -966,7 +1098,7 @@ function createServicePackage(scope, packageSource) {
|
|
|
966
1098
|
dev: 'modern dev',
|
|
967
1099
|
build: 'modern build',
|
|
968
1100
|
serve: 'modern serve',
|
|
969
|
-
typecheck:
|
|
1101
|
+
typecheck: effectTsgoTypecheckCommand
|
|
970
1102
|
},
|
|
971
1103
|
modernjs: {
|
|
972
1104
|
preset: 'presetUltramodern',
|
|
@@ -983,10 +1115,11 @@ function createServicePackage(scope, packageSource) {
|
|
|
983
1115
|
devDependencies: {
|
|
984
1116
|
'@modern-js/app-tools': modernPackageSpecifier('@modern-js/app-tools', packageSource),
|
|
985
1117
|
'@modern-js/plugin-bff': modernPackageSpecifier('@modern-js/plugin-bff', packageSource),
|
|
1118
|
+
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
1119
|
+
"@typescript/native-preview": TYPESCRIPT_NATIVE_PREVIEW_VERSION,
|
|
986
1120
|
'@types/node': '^20',
|
|
987
1121
|
'@types/react': '^19.1.8',
|
|
988
|
-
'@types/react-dom': '^19.1.6'
|
|
989
|
-
typescript: TYPESCRIPT_VERSION
|
|
1122
|
+
'@types/react-dom': '^19.1.6'
|
|
990
1123
|
}
|
|
991
1124
|
};
|
|
992
1125
|
}
|
|
@@ -1001,20 +1134,22 @@ function createSharedPackage(scope, id, description) {
|
|
|
1001
1134
|
'.': './src/index.ts'
|
|
1002
1135
|
},
|
|
1003
1136
|
scripts: {
|
|
1004
|
-
typecheck:
|
|
1137
|
+
typecheck: effectTsgoTypecheckCommand
|
|
1005
1138
|
},
|
|
1006
1139
|
devDependencies: {
|
|
1007
|
-
|
|
1140
|
+
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
1141
|
+
"@typescript/native-preview": TYPESCRIPT_NATIVE_PREVIEW_VERSION
|
|
1008
1142
|
}
|
|
1009
1143
|
};
|
|
1010
1144
|
}
|
|
1011
1145
|
function createAppModernConfig(app) {
|
|
1012
|
-
return
|
|
1146
|
+
return `// @effect-diagnostics processEnv:off
|
|
1147
|
+
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
1013
1148
|
import { tanstackRouterPlugin } from '@modern-js/plugin-tanstack';
|
|
1014
1149
|
import { moduleFederationPlugin } from '@module-federation/modern-js-v3';
|
|
1015
1150
|
|
|
1016
1151
|
const appId = '${app.id}';
|
|
1017
|
-
const port = Number(process.env
|
|
1152
|
+
const port = Number(process.env['${app.portEnv}'] ?? ${app.port});
|
|
1018
1153
|
|
|
1019
1154
|
export default defineConfig(
|
|
1020
1155
|
presetUltramodern(
|
|
@@ -1049,7 +1184,8 @@ export default defineConfig(
|
|
|
1049
1184
|
`;
|
|
1050
1185
|
}
|
|
1051
1186
|
function createShellModuleFederationConfig() {
|
|
1052
|
-
return
|
|
1187
|
+
return `// @effect-diagnostics nodeBuiltinImport:off processEnv:off
|
|
1188
|
+
import { createRequire } from 'node:module';
|
|
1053
1189
|
import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
|
|
1054
1190
|
import { dependencies } from './package.json';
|
|
1055
1191
|
|
|
@@ -1068,13 +1204,13 @@ export default createModuleFederationConfig({
|
|
|
1068
1204
|
dts: false,
|
|
1069
1205
|
remotes: {
|
|
1070
1206
|
commerce:
|
|
1071
|
-
process.env
|
|
1207
|
+
process.env['REMOTE_COMMERCE_MF_MANIFEST'] ??
|
|
1072
1208
|
'remoteCommerce@http://localhost:3021/mf-manifest.json',
|
|
1073
1209
|
identity:
|
|
1074
|
-
process.env
|
|
1210
|
+
process.env['REMOTE_IDENTITY_MF_MANIFEST'] ??
|
|
1075
1211
|
'remoteIdentity@http://localhost:3022/mf-manifest.json',
|
|
1076
1212
|
designSystem:
|
|
1077
|
-
process.env
|
|
1213
|
+
process.env['REMOTE_DESIGN_SYSTEM_MF_MANIFEST'] ??
|
|
1078
1214
|
'remoteDesignSystem@http://localhost:3023/mf-manifest.json',
|
|
1079
1215
|
},
|
|
1080
1216
|
shared: {
|
|
@@ -1104,7 +1240,8 @@ export default createModuleFederationConfig({
|
|
|
1104
1240
|
}
|
|
1105
1241
|
function createRemoteModuleFederationConfig(app) {
|
|
1106
1242
|
const exposes = JSON.stringify(app.exposes ?? {}, null, 4).replace(/^/gm, ' ');
|
|
1107
|
-
return
|
|
1243
|
+
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
1244
|
+
import { createRequire } from 'node:module';
|
|
1108
1245
|
import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
|
|
1109
1246
|
import { dependencies } from './package.json';
|
|
1110
1247
|
|
|
@@ -1149,11 +1286,12 @@ export default createModuleFederationConfig({
|
|
|
1149
1286
|
`;
|
|
1150
1287
|
}
|
|
1151
1288
|
function createServiceModernConfig() {
|
|
1152
|
-
return
|
|
1289
|
+
return `// @effect-diagnostics processEnv:off
|
|
1290
|
+
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
1153
1291
|
import { bffPlugin } from '@modern-js/plugin-bff';
|
|
1154
1292
|
|
|
1155
1293
|
const appId = '${effectService.id}';
|
|
1156
|
-
const port = Number(process.env
|
|
1294
|
+
const port = Number(process.env['${effectService.portEnv}'] ?? ${effectService.port});
|
|
1157
1295
|
|
|
1158
1296
|
export default defineConfig(
|
|
1159
1297
|
presetUltramodern(
|
|
@@ -1308,7 +1446,7 @@ import { recommendationsEffectApi } from '../../shared/effect/api';
|
|
|
1308
1446
|
const recommendationsLayer = HttpApiBuilder.group(
|
|
1309
1447
|
recommendationsEffectApi,
|
|
1310
1448
|
'recommendations',
|
|
1311
|
-
|
|
1449
|
+
handlers =>
|
|
1312
1450
|
handlers.handle('list', () =>
|
|
1313
1451
|
Effect.succeed({
|
|
1314
1452
|
items: [
|
|
@@ -1532,11 +1670,15 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1532
1670
|
materialization: {
|
|
1533
1671
|
targetRoot: 'generated-project-root',
|
|
1534
1672
|
allowedPaths: [
|
|
1673
|
+
'.agents/**',
|
|
1535
1674
|
'.modernjs/**',
|
|
1675
|
+
'AGENTS.md',
|
|
1536
1676
|
'README.md',
|
|
1537
1677
|
'apps/**',
|
|
1538
1678
|
'packages/**',
|
|
1539
1679
|
'package.json',
|
|
1680
|
+
'oxfmt.config.ts',
|
|
1681
|
+
'oxlint.config.ts',
|
|
1540
1682
|
'pnpm-workspace.yaml',
|
|
1541
1683
|
"scripts/**",
|
|
1542
1684
|
'services/**',
|
|
@@ -1561,6 +1703,22 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1561
1703
|
modernPackageSpecifier: modernPackageVersion(packageSource),
|
|
1562
1704
|
generatedWorkspacePackageSpecifier: WORKSPACE_PACKAGE_VERSION
|
|
1563
1705
|
},
|
|
1706
|
+
agentSkills: {
|
|
1707
|
+
installDir: '.agents/skills',
|
|
1708
|
+
source: {
|
|
1709
|
+
repository: 'https://github.com/rstackjs/agent-skills',
|
|
1710
|
+
commit: RSTACK_AGENT_SKILLS_COMMIT,
|
|
1711
|
+
license: 'MIT',
|
|
1712
|
+
licensePath: '.agents/rstackjs-agent-skills-LICENSE'
|
|
1713
|
+
},
|
|
1714
|
+
baseline: baselineAgentSkills,
|
|
1715
|
+
privateSource: {
|
|
1716
|
+
repository: 'https://github.com/TechsioCZ/skills',
|
|
1717
|
+
install: 'clone-if-authorized',
|
|
1718
|
+
baseline: privateAgentSkills
|
|
1719
|
+
},
|
|
1720
|
+
lockFile: '.agents/skills-lock.json'
|
|
1721
|
+
},
|
|
1564
1722
|
validation: {
|
|
1565
1723
|
schemaValidation: true,
|
|
1566
1724
|
sourceValidation: [
|
|
@@ -1580,7 +1738,7 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1580
1738
|
'template-manifest-retained'
|
|
1581
1739
|
],
|
|
1582
1740
|
expectedCommands: [
|
|
1583
|
-
|
|
1741
|
+
'pnpm install',
|
|
1584
1742
|
'pnpm run ultramodern:check'
|
|
1585
1743
|
]
|
|
1586
1744
|
}
|
|
@@ -1857,14 +2015,17 @@ function createBuiltinTemplateManifest(version) {
|
|
|
1857
2015
|
materialization: {
|
|
1858
2016
|
targetRoot: 'generated-project-root',
|
|
1859
2017
|
allowedPaths: [
|
|
2018
|
+
'.agents/**',
|
|
1860
2019
|
'.browserslistrc',
|
|
1861
2020
|
'.gitignore',
|
|
1862
2021
|
'.modernjs/**',
|
|
1863
2022
|
'.nvmrc',
|
|
2023
|
+
'AGENTS.md',
|
|
1864
2024
|
'README.md',
|
|
1865
2025
|
'api/**',
|
|
1866
|
-
'biome.json',
|
|
1867
2026
|
'modern.config.ts',
|
|
2027
|
+
'oxfmt.config.ts',
|
|
2028
|
+
'oxlint.config.ts',
|
|
1868
2029
|
'package.json',
|
|
1869
2030
|
'postcss.config.mjs',
|
|
1870
2031
|
"scripts/**",
|
|
@@ -2008,9 +2169,19 @@ function writeTemplateManifestEvidence(targetDir, manifest) {
|
|
|
2008
2169
|
});
|
|
2009
2170
|
node_fs.writeFileSync(evidencePath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
2010
2171
|
}
|
|
2011
|
-
function
|
|
2172
|
+
function readCreatePackageJson() {
|
|
2012
2173
|
const createPackageJson = node_path.resolve(src_dirname, '..', 'package.json');
|
|
2013
|
-
|
|
2174
|
+
return JSON.parse(node_fs.readFileSync(createPackageJson, 'utf-8'));
|
|
2175
|
+
}
|
|
2176
|
+
function isBleedingDevCreatePackage(createPackage) {
|
|
2177
|
+
return '@bleedingdev/modern-js-create' === createPackage.name;
|
|
2178
|
+
}
|
|
2179
|
+
function getBleedingDevFrameworkVersion(createPackage, fallbackVersion) {
|
|
2180
|
+
const frameworkVersion = createPackage.ultramodern?.frameworkVersion;
|
|
2181
|
+
return 'string' == typeof frameworkVersion && frameworkVersion.length > 0 ? frameworkVersion : fallbackVersion;
|
|
2182
|
+
}
|
|
2183
|
+
function showVersion() {
|
|
2184
|
+
const createPackage = readCreatePackageJson();
|
|
2014
2185
|
const version = createPackage.version || 'unknown';
|
|
2015
2186
|
console.log(i18n.t(localeKeys.version.message, {
|
|
2016
2187
|
version
|
|
@@ -2081,14 +2252,15 @@ function detectWorkspaceProtocolFlag() {
|
|
|
2081
2252
|
const args = process.argv.slice(2);
|
|
2082
2253
|
return args.includes('--workspace');
|
|
2083
2254
|
}
|
|
2084
|
-
function detectUltramodernWorkspaceFlag() {
|
|
2255
|
+
function detectUltramodernWorkspaceFlag(createPackage) {
|
|
2085
2256
|
const args = process.argv.slice(2);
|
|
2086
|
-
return args.includes(ULTRAMODERN_WORKSPACE_FLAG);
|
|
2257
|
+
return args.includes(ULTRAMODERN_WORKSPACE_FLAG) || isBleedingDevCreatePackage(createPackage);
|
|
2087
2258
|
}
|
|
2088
|
-
function detectUltramodernPackageSource(args,
|
|
2259
|
+
function detectUltramodernPackageSource(args, defaultPackageVersion, createPackage) {
|
|
2260
|
+
const bleedingDevDefaults = isBleedingDevCreatePackage(createPackage);
|
|
2089
2261
|
const strategy = getOptionValue(args, [
|
|
2090
2262
|
'--ultramodern-package-source'
|
|
2091
|
-
]) ?? 'workspace';
|
|
2263
|
+
]) ?? (bleedingDevDefaults ? 'install' : 'workspace');
|
|
2092
2264
|
if ('workspace' !== strategy && 'install' !== strategy) {
|
|
2093
2265
|
console.error('--ultramodern-package-source must be "workspace" or "install"');
|
|
2094
2266
|
process.exit(1);
|
|
@@ -2097,18 +2269,29 @@ function detectUltramodernPackageSource(args, modernVersion) {
|
|
|
2097
2269
|
strategy,
|
|
2098
2270
|
modernPackageVersion: getOptionValue(args, [
|
|
2099
2271
|
'--ultramodern-package-version'
|
|
2100
|
-
]) ??
|
|
2272
|
+
]) ?? defaultPackageVersion,
|
|
2101
2273
|
registry: getOptionValue(args, [
|
|
2102
2274
|
'--ultramodern-package-registry'
|
|
2103
2275
|
]),
|
|
2104
2276
|
aliasScope: getOptionValue(args, [
|
|
2105
2277
|
'--ultramodern-package-scope'
|
|
2106
|
-
]),
|
|
2278
|
+
]) ?? (bleedingDevDefaults && 'install' === strategy ? 'bleedingdev' : void 0),
|
|
2107
2279
|
aliasPackageNamePrefix: getOptionValue(args, [
|
|
2108
2280
|
'--ultramodern-package-name-prefix'
|
|
2109
2281
|
]) ?? 'modern-js-'
|
|
2110
2282
|
};
|
|
2111
2283
|
}
|
|
2284
|
+
function src_modernAliasPackageName(packageName, packageSource) {
|
|
2285
|
+
if (!packageSource.aliasScope) return packageName;
|
|
2286
|
+
const scope = packageSource.aliasScope.replace(/^@/, '');
|
|
2287
|
+
const unscopedName = packageName.split('/').at(-1);
|
|
2288
|
+
return `@${scope}/${packageSource.aliasPackageNamePrefix ?? ''}${unscopedName}`;
|
|
2289
|
+
}
|
|
2290
|
+
function singleAppModernPackageSpecifier(packageName, packageSource, useWorkspaceProtocol) {
|
|
2291
|
+
if (useWorkspaceProtocol) return 'workspace:*';
|
|
2292
|
+
if ('install' !== packageSource.strategy || !packageSource.aliasScope) return packageSource.modernPackageVersion;
|
|
2293
|
+
return `npm:${src_modernAliasPackageName(packageName, packageSource)}@${packageSource.modernPackageVersion}`;
|
|
2294
|
+
}
|
|
2112
2295
|
function isDirectoryEmpty(dirPath) {
|
|
2113
2296
|
if (!node_fs.existsSync(dirPath)) return false;
|
|
2114
2297
|
try {
|
|
@@ -2194,16 +2377,16 @@ async function main() {
|
|
|
2194
2377
|
process.exit(1);
|
|
2195
2378
|
}
|
|
2196
2379
|
}
|
|
2197
|
-
const
|
|
2198
|
-
const createPackage = JSON.parse(node_fs.readFileSync(createPackageJson, 'utf-8'));
|
|
2380
|
+
const createPackage = readCreatePackageJson();
|
|
2199
2381
|
const version = createPackage.version || 'latest';
|
|
2200
|
-
const
|
|
2382
|
+
const ultramodernPackageVersion = isBleedingDevCreatePackage(createPackage) ? getBleedingDevFrameworkVersion(createPackage, version) : version;
|
|
2383
|
+
const generateWorkspace = detectUltramodernWorkspaceFlag(createPackage);
|
|
2201
2384
|
if (generateWorkspace) {
|
|
2202
2385
|
generateUltramodernWorkspace({
|
|
2203
2386
|
targetDir,
|
|
2204
2387
|
packageName: generatedPackageName,
|
|
2205
2388
|
modernVersion: version,
|
|
2206
|
-
packageSource: detectUltramodernPackageSource(args,
|
|
2389
|
+
packageSource: detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage)
|
|
2207
2390
|
});
|
|
2208
2391
|
const dim = '\x1b[2m\x1b[3m';
|
|
2209
2392
|
const reset = '\x1b[0m';
|
|
@@ -2223,12 +2406,17 @@ async function main() {
|
|
|
2223
2406
|
const bffRuntime = detectBffRuntime();
|
|
2224
2407
|
const enableTailwind = detectTailwindFlag();
|
|
2225
2408
|
const useWorkspaceProtocol = detectWorkspaceProtocolFlag();
|
|
2226
|
-
const
|
|
2409
|
+
const packageSource = detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage);
|
|
2227
2410
|
const templateManifest = createBuiltinTemplateManifest(version);
|
|
2228
2411
|
validateTemplateManifest(templateManifest);
|
|
2229
2412
|
copyTemplate(templateDir, targetDir, {
|
|
2230
2413
|
packageName: generatedPackageName,
|
|
2231
|
-
version:
|
|
2414
|
+
version: useWorkspaceProtocol ? 'workspace:*' : packageSource.modernPackageVersion,
|
|
2415
|
+
runtimeVersion: singleAppModernPackageSpecifier('@modern-js/runtime', packageSource, useWorkspaceProtocol),
|
|
2416
|
+
appToolsVersion: singleAppModernPackageSpecifier('@modern-js/app-tools', packageSource, useWorkspaceProtocol),
|
|
2417
|
+
tsconfigVersion: singleAppModernPackageSpecifier('@modern-js/tsconfig', packageSource, useWorkspaceProtocol),
|
|
2418
|
+
pluginTanstackVersion: singleAppModernPackageSpecifier('@modern-js/plugin-tanstack', packageSource, useWorkspaceProtocol),
|
|
2419
|
+
pluginBffVersion: singleAppModernPackageSpecifier('@modern-js/plugin-bff', packageSource, useWorkspaceProtocol),
|
|
2232
2420
|
isSubproject,
|
|
2233
2421
|
routerFramework,
|
|
2234
2422
|
bffRuntime,
|
|
@@ -2243,12 +2431,19 @@ async function main() {
|
|
|
2243
2431
|
delete packageJson['simple-git-hooks'];
|
|
2244
2432
|
if (packageJson.scripts) {
|
|
2245
2433
|
delete packageJson.scripts.prepare;
|
|
2434
|
+
delete packageJson.scripts.format;
|
|
2435
|
+
delete packageJson.scripts['format:check'];
|
|
2246
2436
|
delete packageJson.scripts.lint;
|
|
2437
|
+
delete packageJson.scripts['lint:fix'];
|
|
2438
|
+
delete packageJson.scripts['skills:install'];
|
|
2439
|
+
delete packageJson.scripts['skills:check'];
|
|
2247
2440
|
}
|
|
2248
2441
|
if (packageJson.devDependencies) {
|
|
2249
2442
|
delete packageJson.devDependencies['lint-staged'];
|
|
2250
2443
|
delete packageJson.devDependencies['simple-git-hooks'];
|
|
2251
|
-
delete packageJson.devDependencies
|
|
2444
|
+
delete packageJson.devDependencies.oxlint;
|
|
2445
|
+
delete packageJson.devDependencies.oxfmt;
|
|
2446
|
+
delete packageJson.devDependencies.ultracite;
|
|
2252
2447
|
}
|
|
2253
2448
|
}
|
|
2254
2449
|
node_fs.writeFileSync(targetPackageJson, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
@@ -2268,10 +2463,13 @@ function copyTemplate(src, dest, options) {
|
|
|
2268
2463
|
recursive: true
|
|
2269
2464
|
});
|
|
2270
2465
|
const excludeInSubproject = [
|
|
2466
|
+
'.agents',
|
|
2271
2467
|
'.gitignore.handlebars',
|
|
2272
|
-
'
|
|
2468
|
+
'AGENTS.md',
|
|
2273
2469
|
'.npmrc',
|
|
2274
|
-
'.nvmrc'
|
|
2470
|
+
'.nvmrc',
|
|
2471
|
+
'oxfmt.config.ts',
|
|
2472
|
+
'oxlint.config.ts'
|
|
2275
2473
|
];
|
|
2276
2474
|
function copyRecursive(srcDir, destDir) {
|
|
2277
2475
|
const entries = node_fs.readdirSync(srcDir, {
|
|
@@ -2293,6 +2491,11 @@ function copyTemplate(src, dest, options) {
|
|
|
2293
2491
|
const rendered = src_renderTemplate(templateContent, {
|
|
2294
2492
|
packageName: options.packageName,
|
|
2295
2493
|
version: options.version,
|
|
2494
|
+
runtimeVersion: options.runtimeVersion,
|
|
2495
|
+
appToolsVersion: options.appToolsVersion,
|
|
2496
|
+
tsconfigVersion: options.tsconfigVersion,
|
|
2497
|
+
pluginTanstackVersion: options.pluginTanstackVersion,
|
|
2498
|
+
pluginBffVersion: options.pluginBffVersion,
|
|
2296
2499
|
isSubproject: options.isSubproject,
|
|
2297
2500
|
isTanstackRouter: 'tanstack' === options.routerFramework,
|
|
2298
2501
|
enableBff: 'none' !== options.bffRuntime,
|