@bleedingdev/modern-js-create 3.2.0-ultramodern.1 → 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 -58
- package/package.json +5 -2
- package/template/.agents/skills-lock.json +34 -0
- package/template/AGENTS.md +20 -0
- package/template/api/effect/index.ts.handlebars +7 -45
- package/template/modern.config.ts.handlebars +20 -24
- 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 +28 -11
- 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/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/*',
|
|
@@ -867,15 +972,6 @@ function createRootPackageJson(scope, packageSource) {
|
|
|
867
972
|
'services/*',
|
|
868
973
|
'packages/*'
|
|
869
974
|
],
|
|
870
|
-
pnpm: {
|
|
871
|
-
onlyBuiltDependencies: [
|
|
872
|
-
'@biomejs/biome',
|
|
873
|
-
'@swc/core',
|
|
874
|
-
'core-js',
|
|
875
|
-
'esbuild',
|
|
876
|
-
'msgpackr-extract'
|
|
877
|
-
]
|
|
878
|
-
},
|
|
879
975
|
modernjs: {
|
|
880
976
|
preset: 'presetUltramodern',
|
|
881
977
|
workspace: 'ultramodern-superapp',
|
|
@@ -887,35 +983,62 @@ function createRootPackageJson(scope, packageSource) {
|
|
|
887
983
|
}
|
|
888
984
|
},
|
|
889
985
|
devDependencies: {
|
|
890
|
-
'@
|
|
891
|
-
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
|
|
892
991
|
}
|
|
893
992
|
};
|
|
894
993
|
}
|
|
895
994
|
function createTsConfigBase(scope) {
|
|
896
995
|
return {
|
|
897
996
|
compilerOptions: {
|
|
898
|
-
target: '
|
|
997
|
+
target: 'ESNext',
|
|
899
998
|
lib: [
|
|
999
|
+
'ESNext',
|
|
900
1000
|
'DOM',
|
|
901
|
-
'DOM.Iterable'
|
|
902
|
-
'ES2022'
|
|
1001
|
+
'DOM.Iterable'
|
|
903
1002
|
],
|
|
904
|
-
module: '
|
|
1003
|
+
module: 'preserve',
|
|
905
1004
|
moduleResolution: 'Bundler',
|
|
1005
|
+
moduleDetection: 'force',
|
|
906
1006
|
jsx: 'preserve',
|
|
1007
|
+
isolatedModules: true,
|
|
1008
|
+
verbatimModuleSyntax: true,
|
|
907
1009
|
strict: true,
|
|
908
1010
|
noEmit: true,
|
|
1011
|
+
allowJs: true,
|
|
909
1012
|
esModuleInterop: true,
|
|
1013
|
+
noUncheckedIndexedAccess: true,
|
|
1014
|
+
exactOptionalPropertyTypes: true,
|
|
1015
|
+
noImplicitOverride: true,
|
|
1016
|
+
noFallthroughCasesInSwitch: true,
|
|
1017
|
+
noPropertyAccessFromIndexSignature: true,
|
|
1018
|
+
noImplicitReturns: true,
|
|
910
1019
|
skipLibCheck: true,
|
|
911
1020
|
resolveJsonModule: true,
|
|
912
|
-
baseUrl: '.',
|
|
913
1021
|
paths: Object.fromEntries(sharedPackages.map((sharedPackage)=>[
|
|
914
1022
|
ultramodern_workspace_packageName(scope, sharedPackage.id),
|
|
915
1023
|
[
|
|
916
1024
|
`${sharedPackage.directory}/src/index.ts`
|
|
917
1025
|
]
|
|
918
|
-
]))
|
|
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
|
+
]
|
|
919
1042
|
}
|
|
920
1043
|
};
|
|
921
1044
|
}
|
|
@@ -954,7 +1077,7 @@ function createAppPackage(scope, app, packageSource) {
|
|
|
954
1077
|
dev: 'modern dev',
|
|
955
1078
|
build: 'modern build',
|
|
956
1079
|
serve: 'modern serve',
|
|
957
|
-
typecheck:
|
|
1080
|
+
typecheck: effectTsgoTypecheckCommand
|
|
958
1081
|
},
|
|
959
1082
|
modernjs: {
|
|
960
1083
|
preset: 'presetUltramodern',
|
|
@@ -975,7 +1098,7 @@ function createServicePackage(scope, packageSource) {
|
|
|
975
1098
|
dev: 'modern dev',
|
|
976
1099
|
build: 'modern build',
|
|
977
1100
|
serve: 'modern serve',
|
|
978
|
-
typecheck:
|
|
1101
|
+
typecheck: effectTsgoTypecheckCommand
|
|
979
1102
|
},
|
|
980
1103
|
modernjs: {
|
|
981
1104
|
preset: 'presetUltramodern',
|
|
@@ -992,10 +1115,11 @@ function createServicePackage(scope, packageSource) {
|
|
|
992
1115
|
devDependencies: {
|
|
993
1116
|
'@modern-js/app-tools': modernPackageSpecifier('@modern-js/app-tools', packageSource),
|
|
994
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,
|
|
995
1120
|
'@types/node': '^20',
|
|
996
1121
|
'@types/react': '^19.1.8',
|
|
997
|
-
'@types/react-dom': '^19.1.6'
|
|
998
|
-
typescript: TYPESCRIPT_VERSION
|
|
1122
|
+
'@types/react-dom': '^19.1.6'
|
|
999
1123
|
}
|
|
1000
1124
|
};
|
|
1001
1125
|
}
|
|
@@ -1010,20 +1134,22 @@ function createSharedPackage(scope, id, description) {
|
|
|
1010
1134
|
'.': './src/index.ts'
|
|
1011
1135
|
},
|
|
1012
1136
|
scripts: {
|
|
1013
|
-
typecheck:
|
|
1137
|
+
typecheck: effectTsgoTypecheckCommand
|
|
1014
1138
|
},
|
|
1015
1139
|
devDependencies: {
|
|
1016
|
-
|
|
1140
|
+
'@effect/tsgo': EFFECT_TSGO_VERSION,
|
|
1141
|
+
"@typescript/native-preview": TYPESCRIPT_NATIVE_PREVIEW_VERSION
|
|
1017
1142
|
}
|
|
1018
1143
|
};
|
|
1019
1144
|
}
|
|
1020
1145
|
function createAppModernConfig(app) {
|
|
1021
|
-
return
|
|
1146
|
+
return `// @effect-diagnostics processEnv:off
|
|
1147
|
+
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
1022
1148
|
import { tanstackRouterPlugin } from '@modern-js/plugin-tanstack';
|
|
1023
1149
|
import { moduleFederationPlugin } from '@module-federation/modern-js-v3';
|
|
1024
1150
|
|
|
1025
1151
|
const appId = '${app.id}';
|
|
1026
|
-
const port = Number(process.env
|
|
1152
|
+
const port = Number(process.env['${app.portEnv}'] ?? ${app.port});
|
|
1027
1153
|
|
|
1028
1154
|
export default defineConfig(
|
|
1029
1155
|
presetUltramodern(
|
|
@@ -1058,7 +1184,8 @@ export default defineConfig(
|
|
|
1058
1184
|
`;
|
|
1059
1185
|
}
|
|
1060
1186
|
function createShellModuleFederationConfig() {
|
|
1061
|
-
return
|
|
1187
|
+
return `// @effect-diagnostics nodeBuiltinImport:off processEnv:off
|
|
1188
|
+
import { createRequire } from 'node:module';
|
|
1062
1189
|
import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
|
|
1063
1190
|
import { dependencies } from './package.json';
|
|
1064
1191
|
|
|
@@ -1077,13 +1204,13 @@ export default createModuleFederationConfig({
|
|
|
1077
1204
|
dts: false,
|
|
1078
1205
|
remotes: {
|
|
1079
1206
|
commerce:
|
|
1080
|
-
process.env
|
|
1207
|
+
process.env['REMOTE_COMMERCE_MF_MANIFEST'] ??
|
|
1081
1208
|
'remoteCommerce@http://localhost:3021/mf-manifest.json',
|
|
1082
1209
|
identity:
|
|
1083
|
-
process.env
|
|
1210
|
+
process.env['REMOTE_IDENTITY_MF_MANIFEST'] ??
|
|
1084
1211
|
'remoteIdentity@http://localhost:3022/mf-manifest.json',
|
|
1085
1212
|
designSystem:
|
|
1086
|
-
process.env
|
|
1213
|
+
process.env['REMOTE_DESIGN_SYSTEM_MF_MANIFEST'] ??
|
|
1087
1214
|
'remoteDesignSystem@http://localhost:3023/mf-manifest.json',
|
|
1088
1215
|
},
|
|
1089
1216
|
shared: {
|
|
@@ -1113,7 +1240,8 @@ export default createModuleFederationConfig({
|
|
|
1113
1240
|
}
|
|
1114
1241
|
function createRemoteModuleFederationConfig(app) {
|
|
1115
1242
|
const exposes = JSON.stringify(app.exposes ?? {}, null, 4).replace(/^/gm, ' ');
|
|
1116
|
-
return
|
|
1243
|
+
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
1244
|
+
import { createRequire } from 'node:module';
|
|
1117
1245
|
import { createModuleFederationConfig } from '@module-federation/modern-js-v3';
|
|
1118
1246
|
import { dependencies } from './package.json';
|
|
1119
1247
|
|
|
@@ -1158,11 +1286,12 @@ export default createModuleFederationConfig({
|
|
|
1158
1286
|
`;
|
|
1159
1287
|
}
|
|
1160
1288
|
function createServiceModernConfig() {
|
|
1161
|
-
return
|
|
1289
|
+
return `// @effect-diagnostics processEnv:off
|
|
1290
|
+
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
1162
1291
|
import { bffPlugin } from '@modern-js/plugin-bff';
|
|
1163
1292
|
|
|
1164
1293
|
const appId = '${effectService.id}';
|
|
1165
|
-
const port = Number(process.env
|
|
1294
|
+
const port = Number(process.env['${effectService.portEnv}'] ?? ${effectService.port});
|
|
1166
1295
|
|
|
1167
1296
|
export default defineConfig(
|
|
1168
1297
|
presetUltramodern(
|
|
@@ -1317,7 +1446,7 @@ import { recommendationsEffectApi } from '../../shared/effect/api';
|
|
|
1317
1446
|
const recommendationsLayer = HttpApiBuilder.group(
|
|
1318
1447
|
recommendationsEffectApi,
|
|
1319
1448
|
'recommendations',
|
|
1320
|
-
|
|
1449
|
+
handlers =>
|
|
1321
1450
|
handlers.handle('list', () =>
|
|
1322
1451
|
Effect.succeed({
|
|
1323
1452
|
items: [
|
|
@@ -1541,11 +1670,15 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1541
1670
|
materialization: {
|
|
1542
1671
|
targetRoot: 'generated-project-root',
|
|
1543
1672
|
allowedPaths: [
|
|
1673
|
+
'.agents/**',
|
|
1544
1674
|
'.modernjs/**',
|
|
1675
|
+
'AGENTS.md',
|
|
1545
1676
|
'README.md',
|
|
1546
1677
|
'apps/**',
|
|
1547
1678
|
'packages/**',
|
|
1548
1679
|
'package.json',
|
|
1680
|
+
'oxfmt.config.ts',
|
|
1681
|
+
'oxlint.config.ts',
|
|
1549
1682
|
'pnpm-workspace.yaml',
|
|
1550
1683
|
"scripts/**",
|
|
1551
1684
|
'services/**',
|
|
@@ -1570,6 +1703,22 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1570
1703
|
modernPackageSpecifier: modernPackageVersion(packageSource),
|
|
1571
1704
|
generatedWorkspacePackageSpecifier: WORKSPACE_PACKAGE_VERSION
|
|
1572
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
|
+
},
|
|
1573
1722
|
validation: {
|
|
1574
1723
|
schemaValidation: true,
|
|
1575
1724
|
sourceValidation: [
|
|
@@ -1589,7 +1738,7 @@ function createTemplateManifest(modernVersion, packageSource) {
|
|
|
1589
1738
|
'template-manifest-retained'
|
|
1590
1739
|
],
|
|
1591
1740
|
expectedCommands: [
|
|
1592
|
-
|
|
1741
|
+
'pnpm install',
|
|
1593
1742
|
'pnpm run ultramodern:check'
|
|
1594
1743
|
]
|
|
1595
1744
|
}
|
|
@@ -1866,14 +2015,17 @@ function createBuiltinTemplateManifest(version) {
|
|
|
1866
2015
|
materialization: {
|
|
1867
2016
|
targetRoot: 'generated-project-root',
|
|
1868
2017
|
allowedPaths: [
|
|
2018
|
+
'.agents/**',
|
|
1869
2019
|
'.browserslistrc',
|
|
1870
2020
|
'.gitignore',
|
|
1871
2021
|
'.modernjs/**',
|
|
1872
2022
|
'.nvmrc',
|
|
2023
|
+
'AGENTS.md',
|
|
1873
2024
|
'README.md',
|
|
1874
2025
|
'api/**',
|
|
1875
|
-
'biome.json',
|
|
1876
2026
|
'modern.config.ts',
|
|
2027
|
+
'oxfmt.config.ts',
|
|
2028
|
+
'oxlint.config.ts',
|
|
1877
2029
|
'package.json',
|
|
1878
2030
|
'postcss.config.mjs',
|
|
1879
2031
|
"scripts/**",
|
|
@@ -2017,9 +2169,19 @@ function writeTemplateManifestEvidence(targetDir, manifest) {
|
|
|
2017
2169
|
});
|
|
2018
2170
|
node_fs.writeFileSync(evidencePath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
2019
2171
|
}
|
|
2020
|
-
function
|
|
2172
|
+
function readCreatePackageJson() {
|
|
2021
2173
|
const createPackageJson = node_path.resolve(src_dirname, '..', 'package.json');
|
|
2022
|
-
|
|
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();
|
|
2023
2185
|
const version = createPackage.version || 'unknown';
|
|
2024
2186
|
console.log(i18n.t(localeKeys.version.message, {
|
|
2025
2187
|
version
|
|
@@ -2090,14 +2252,15 @@ function detectWorkspaceProtocolFlag() {
|
|
|
2090
2252
|
const args = process.argv.slice(2);
|
|
2091
2253
|
return args.includes('--workspace');
|
|
2092
2254
|
}
|
|
2093
|
-
function detectUltramodernWorkspaceFlag() {
|
|
2255
|
+
function detectUltramodernWorkspaceFlag(createPackage) {
|
|
2094
2256
|
const args = process.argv.slice(2);
|
|
2095
|
-
return args.includes(ULTRAMODERN_WORKSPACE_FLAG);
|
|
2257
|
+
return args.includes(ULTRAMODERN_WORKSPACE_FLAG) || isBleedingDevCreatePackage(createPackage);
|
|
2096
2258
|
}
|
|
2097
|
-
function detectUltramodernPackageSource(args,
|
|
2259
|
+
function detectUltramodernPackageSource(args, defaultPackageVersion, createPackage) {
|
|
2260
|
+
const bleedingDevDefaults = isBleedingDevCreatePackage(createPackage);
|
|
2098
2261
|
const strategy = getOptionValue(args, [
|
|
2099
2262
|
'--ultramodern-package-source'
|
|
2100
|
-
]) ?? 'workspace';
|
|
2263
|
+
]) ?? (bleedingDevDefaults ? 'install' : 'workspace');
|
|
2101
2264
|
if ('workspace' !== strategy && 'install' !== strategy) {
|
|
2102
2265
|
console.error('--ultramodern-package-source must be "workspace" or "install"');
|
|
2103
2266
|
process.exit(1);
|
|
@@ -2106,18 +2269,29 @@ function detectUltramodernPackageSource(args, modernVersion) {
|
|
|
2106
2269
|
strategy,
|
|
2107
2270
|
modernPackageVersion: getOptionValue(args, [
|
|
2108
2271
|
'--ultramodern-package-version'
|
|
2109
|
-
]) ??
|
|
2272
|
+
]) ?? defaultPackageVersion,
|
|
2110
2273
|
registry: getOptionValue(args, [
|
|
2111
2274
|
'--ultramodern-package-registry'
|
|
2112
2275
|
]),
|
|
2113
2276
|
aliasScope: getOptionValue(args, [
|
|
2114
2277
|
'--ultramodern-package-scope'
|
|
2115
|
-
]),
|
|
2278
|
+
]) ?? (bleedingDevDefaults && 'install' === strategy ? 'bleedingdev' : void 0),
|
|
2116
2279
|
aliasPackageNamePrefix: getOptionValue(args, [
|
|
2117
2280
|
'--ultramodern-package-name-prefix'
|
|
2118
2281
|
]) ?? 'modern-js-'
|
|
2119
2282
|
};
|
|
2120
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
|
+
}
|
|
2121
2295
|
function isDirectoryEmpty(dirPath) {
|
|
2122
2296
|
if (!node_fs.existsSync(dirPath)) return false;
|
|
2123
2297
|
try {
|
|
@@ -2203,16 +2377,16 @@ async function main() {
|
|
|
2203
2377
|
process.exit(1);
|
|
2204
2378
|
}
|
|
2205
2379
|
}
|
|
2206
|
-
const
|
|
2207
|
-
const createPackage = JSON.parse(node_fs.readFileSync(createPackageJson, 'utf-8'));
|
|
2380
|
+
const createPackage = readCreatePackageJson();
|
|
2208
2381
|
const version = createPackage.version || 'latest';
|
|
2209
|
-
const
|
|
2382
|
+
const ultramodernPackageVersion = isBleedingDevCreatePackage(createPackage) ? getBleedingDevFrameworkVersion(createPackage, version) : version;
|
|
2383
|
+
const generateWorkspace = detectUltramodernWorkspaceFlag(createPackage);
|
|
2210
2384
|
if (generateWorkspace) {
|
|
2211
2385
|
generateUltramodernWorkspace({
|
|
2212
2386
|
targetDir,
|
|
2213
2387
|
packageName: generatedPackageName,
|
|
2214
2388
|
modernVersion: version,
|
|
2215
|
-
packageSource: detectUltramodernPackageSource(args,
|
|
2389
|
+
packageSource: detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage)
|
|
2216
2390
|
});
|
|
2217
2391
|
const dim = '\x1b[2m\x1b[3m';
|
|
2218
2392
|
const reset = '\x1b[0m';
|
|
@@ -2232,12 +2406,17 @@ async function main() {
|
|
|
2232
2406
|
const bffRuntime = detectBffRuntime();
|
|
2233
2407
|
const enableTailwind = detectTailwindFlag();
|
|
2234
2408
|
const useWorkspaceProtocol = detectWorkspaceProtocolFlag();
|
|
2235
|
-
const
|
|
2409
|
+
const packageSource = detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage);
|
|
2236
2410
|
const templateManifest = createBuiltinTemplateManifest(version);
|
|
2237
2411
|
validateTemplateManifest(templateManifest);
|
|
2238
2412
|
copyTemplate(templateDir, targetDir, {
|
|
2239
2413
|
packageName: generatedPackageName,
|
|
2240
|
-
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),
|
|
2241
2420
|
isSubproject,
|
|
2242
2421
|
routerFramework,
|
|
2243
2422
|
bffRuntime,
|
|
@@ -2252,12 +2431,19 @@ async function main() {
|
|
|
2252
2431
|
delete packageJson['simple-git-hooks'];
|
|
2253
2432
|
if (packageJson.scripts) {
|
|
2254
2433
|
delete packageJson.scripts.prepare;
|
|
2434
|
+
delete packageJson.scripts.format;
|
|
2435
|
+
delete packageJson.scripts['format:check'];
|
|
2255
2436
|
delete packageJson.scripts.lint;
|
|
2437
|
+
delete packageJson.scripts['lint:fix'];
|
|
2438
|
+
delete packageJson.scripts['skills:install'];
|
|
2439
|
+
delete packageJson.scripts['skills:check'];
|
|
2256
2440
|
}
|
|
2257
2441
|
if (packageJson.devDependencies) {
|
|
2258
2442
|
delete packageJson.devDependencies['lint-staged'];
|
|
2259
2443
|
delete packageJson.devDependencies['simple-git-hooks'];
|
|
2260
|
-
delete packageJson.devDependencies
|
|
2444
|
+
delete packageJson.devDependencies.oxlint;
|
|
2445
|
+
delete packageJson.devDependencies.oxfmt;
|
|
2446
|
+
delete packageJson.devDependencies.ultracite;
|
|
2261
2447
|
}
|
|
2262
2448
|
}
|
|
2263
2449
|
node_fs.writeFileSync(targetPackageJson, `${JSON.stringify(packageJson, null, 2)}\n`);
|
|
@@ -2277,10 +2463,13 @@ function copyTemplate(src, dest, options) {
|
|
|
2277
2463
|
recursive: true
|
|
2278
2464
|
});
|
|
2279
2465
|
const excludeInSubproject = [
|
|
2466
|
+
'.agents',
|
|
2280
2467
|
'.gitignore.handlebars',
|
|
2281
|
-
'
|
|
2468
|
+
'AGENTS.md',
|
|
2282
2469
|
'.npmrc',
|
|
2283
|
-
'.nvmrc'
|
|
2470
|
+
'.nvmrc',
|
|
2471
|
+
'oxfmt.config.ts',
|
|
2472
|
+
'oxlint.config.ts'
|
|
2284
2473
|
];
|
|
2285
2474
|
function copyRecursive(srcDir, destDir) {
|
|
2286
2475
|
const entries = node_fs.readdirSync(srcDir, {
|
|
@@ -2302,6 +2491,11 @@ function copyTemplate(src, dest, options) {
|
|
|
2302
2491
|
const rendered = src_renderTemplate(templateContent, {
|
|
2303
2492
|
packageName: options.packageName,
|
|
2304
2493
|
version: options.version,
|
|
2494
|
+
runtimeVersion: options.runtimeVersion,
|
|
2495
|
+
appToolsVersion: options.appToolsVersion,
|
|
2496
|
+
tsconfigVersion: options.tsconfigVersion,
|
|
2497
|
+
pluginTanstackVersion: options.pluginTanstackVersion,
|
|
2498
|
+
pluginBffVersion: options.pluginBffVersion,
|
|
2305
2499
|
isSubproject: options.isSubproject,
|
|
2306
2500
|
isTanstackRouter: 'tanstack' === options.routerFramework,
|
|
2307
2501
|
enableBff: 'none' !== options.bffRuntime,
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
24
|
-
"version": "3.2.0-ultramodern.
|
|
24
|
+
"version": "3.2.0-ultramodern.10",
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/node": "^25.8.0",
|
|
42
42
|
"@typescript/native-preview": "7.0.0-dev.20260516.1",
|
|
43
43
|
"tsx": "^4.22.0",
|
|
44
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.
|
|
44
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.10"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"build": "rslib build && pnpm -w tsgo:dts \"$PWD\"",
|
|
53
53
|
"dev": "rslib build -w",
|
|
54
54
|
"start": "node ./dist/index.js"
|
|
55
|
+
},
|
|
56
|
+
"ultramodern": {
|
|
57
|
+
"frameworkVersion": "3.2.0-ultramodern.10"
|
|
55
58
|
}
|
|
56
59
|
}
|