@bleedingdev/modern-js-create 3.2.0-ultramodern.112 → 3.2.0-ultramodern.113

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.
@@ -85,6 +85,8 @@ const requiredLifecycleDeniedScripts = [
85
85
  const requiredLifecycleAllowedScripts = [
86
86
  'postinstall'
87
87
  ];
88
+ const LEGACY_MODERN_JS_FLAG = '--legacy-modern-js';
89
+ const LEGACY_MODERN_JS_CONFIRMATION = 'USE LEGACY MODERN.JS';
88
90
  function getOptionValue(args, names) {
89
91
  for (const name of names){
90
92
  const prefix = `${name}=`;
@@ -460,6 +462,7 @@ function showHelp() {
460
462
  if (index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageScope) console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageScope));
461
463
  if (index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageNamePrefix) console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageNamePrefix));
462
464
  if (index_cjs_namespaceObject.localeKeys.help.optionVertical) console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionVertical));
465
+ if (index_cjs_namespaceObject.localeKeys.help.optionLegacyModernJs) console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionLegacyModernJs));
463
466
  console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionSub));
464
467
  console.log('');
465
468
  console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.examples));
@@ -492,6 +495,45 @@ function promptInput(question) {
492
495
  });
493
496
  });
494
497
  }
498
+ function detectLegacyModernJsFlag(args) {
499
+ if (args.some((arg)=>arg.startsWith(`${LEGACY_MODERN_JS_FLAG}=`))) {
500
+ console.error(`${LEGACY_MODERN_JS_FLAG} does not accept a value.`);
501
+ process.exit(1);
502
+ }
503
+ return args.includes(LEGACY_MODERN_JS_FLAG);
504
+ }
505
+ function stripLegacyModernJsArgs(args) {
506
+ return args.filter((arg)=>arg !== LEGACY_MODERN_JS_FLAG);
507
+ }
508
+ async function confirmLegacyModernJsSetup() {
509
+ console.error('');
510
+ console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.legacyModernJsWarning));
511
+ console.error('');
512
+ const answer = await promptInput(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.prompt.legacyModernJsConfirmation, {
513
+ confirmation: LEGACY_MODERN_JS_CONFIRMATION
514
+ }));
515
+ if (answer !== LEGACY_MODERN_JS_CONFIRMATION) {
516
+ console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.legacyModernJsNotConfirmed));
517
+ process.exit(1);
518
+ }
519
+ }
520
+ function delegateLegacyModernJsSetup(args) {
521
+ const forwardedArgs = stripLegacyModernJsArgs(args);
522
+ if (commandExists('pnpm')) return void runSetupCommand('pnpm', [
523
+ 'dlx',
524
+ '@modern-js/create',
525
+ ...forwardedArgs
526
+ ], {
527
+ stdio: 'inherit'
528
+ });
529
+ if (commandExists('npx')) return void runSetupCommand('npx', [
530
+ '@modern-js/create',
531
+ ...forwardedArgs
532
+ ], {
533
+ stdio: 'inherit'
534
+ });
535
+ throw new Error('Legacy Modern.js setup requires pnpm or npx to run @modern-js/create.');
536
+ }
495
537
  function detectSubprojectFlag() {
496
538
  const args = process.argv.slice(2);
497
539
  if (args.includes('--sub') || args.includes('-s')) return true;
@@ -758,6 +800,7 @@ async function getProjectName() {
758
800
  '--no-tailwind',
759
801
  '--workspace',
760
802
  '--vertical',
803
+ LEGACY_MODERN_JS_FLAG,
761
804
  external_ultramodern_workspace_cjs_namespaceObject.ULTRAMODERN_WORKSPACE_FLAG
762
805
  ]);
763
806
  const positionalArgs = [];
@@ -805,6 +848,11 @@ async function main() {
805
848
  const args = process.argv.slice(2);
806
849
  if (args.includes('--help') || args.includes('-h')) return void showHelp();
807
850
  if (args.includes('--version') || args.includes('-v')) return void showVersion();
851
+ if (detectLegacyModernJsFlag(args)) {
852
+ await confirmLegacyModernJsSetup();
853
+ delegateLegacyModernJsSetup(args);
854
+ return;
855
+ }
808
856
  console.log(`\n${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.welcome)}\n`);
809
857
  const { name: projectName, useCurrentDir } = await getProjectName();
810
858
  const targetDir = useCurrentDir ? process.cwd() : external_node_path_default().isAbsolute(projectName) ? projectName : external_node_path_default().resolve(process.cwd(), projectName);
@@ -29,13 +29,15 @@ var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  const EN_LOCALE = {
31
31
  prompt: {
32
- projectName: 'Please enter project name: '
32
+ projectName: 'Please enter project name: ',
33
+ legacyModernJsConfirmation: 'Type "{confirmation}" to continue with the original Modern.js setup: '
33
34
  },
34
35
  error: {
35
36
  projectNameEmpty: 'Error: Project name cannot be empty',
36
37
  directoryExists: 'Error: Directory "{projectName}" already exists and is not empty',
37
38
  invalidRouter: 'Error: Unsupported router "{router}". Use "react-router" or "tanstack".',
38
39
  invalidBffRuntime: 'Error: Unsupported BFF runtime "{runtime}". Use "hono" or "effect".',
40
+ legacyModernJsNotConfirmed: 'Aborted. UltraModern.js remains the default unattended setup.',
39
41
  createFailed: 'Error creating project:'
40
42
  },
41
43
  message: {
@@ -44,7 +46,8 @@ const EN_LOCALE = {
44
46
  nextSteps: '📋 Next steps:',
45
47
  step1: 'cd {projectName}',
46
48
  step2: 'pnpm install',
47
- step3: 'pnpm dev'
49
+ step3: 'pnpm dev',
50
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nBRUTAL WARNING: YOU ARE OPTING OUT OF ULTRAMODERN.JS DEFAULTS.\nThe unattended default is the best UltraModern.js configuration:\npresetUltramodern, TanStack Router, Effect BFF, Tailwind CSS v4,\nand the BleedingDev package cohort.\nThe original Modern.js setup is legacy compatibility only.\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
48
51
  },
49
52
  help: {
50
53
  title: '🚀 UltraModern.js Project Creator',
@@ -65,6 +68,7 @@ const EN_LOCALE = {
65
68
  optionUltramodernPackageScope: ' --ultramodern-package-scope Publish scope for npm alias installs (for example bleedingdev)',
66
69
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix Prefix for npm alias package names (default: modern-js-)',
67
70
  optionVertical: ' --vertical Mutate the current existing UltraModern workspace and wire a MicroVertical named <project-name>',
71
+ optionLegacyModernJs: ' --legacy-modern-js Opt into the original Modern.js setup after a large warning and typed confirmation',
68
72
  optionSub: ' -s, --sub Mark as a subproject (package in monorepo)',
69
73
  examples: '💡 Examples:',
70
74
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
@@ -29,13 +29,15 @@ var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  const ZH_LOCALE = {
31
31
  prompt: {
32
- projectName: '请输入项目名称: '
32
+ projectName: '请输入项目名称: ',
33
+ legacyModernJsConfirmation: '输入 "{confirmation}" 以继续使用原始 Modern.js 初始化: '
33
34
  },
34
35
  error: {
35
36
  projectNameEmpty: '错误: 项目名称不能为空',
36
37
  directoryExists: '错误: 目录 "{projectName}" 已存在且不为空',
37
38
  invalidRouter: '错误: 不支持的路由器 "{router}",请使用 "react-router" 或 "tanstack"',
38
39
  invalidBffRuntime: '错误: 不支持的 BFF 运行时 "{runtime}",请使用 "hono" 或 "effect"',
40
+ legacyModernJsNotConfirmed: '已中止。UltraModern.js 仍是默认的免交互初始化方案。',
39
41
  createFailed: '创建项目时出错:'
40
42
  },
41
43
  message: {
@@ -44,7 +46,8 @@ const ZH_LOCALE = {
44
46
  nextSteps: '📋 下一步:',
45
47
  step1: 'cd {projectName}',
46
48
  step2: 'pnpm install',
47
- step3: 'pnpm dev'
49
+ step3: 'pnpm dev',
50
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n严重警告:你正在退出 ULTRAMODERN.JS 默认配置。\n免交互默认值是最佳 UltraModern.js 配置:\npresetUltramodern、TanStack Router、Effect BFF、Tailwind CSS v4,\n以及 BleedingDev 包版本队列。\n原始 Modern.js 初始化仅用于遗留兼容。\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
48
51
  },
49
52
  help: {
50
53
  title: '🚀 UltraModern.js 项目创建工具',
@@ -65,6 +68,7 @@ const ZH_LOCALE = {
65
68
  optionUltramodernPackageScope: ' --ultramodern-package-scope npm alias 安装使用的发布 scope(例如 bleedingdev)',
66
69
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix npm alias 包名前缀(默认:modern-js-)',
67
70
  optionVertical: ' --vertical 修改当前已有的 UltraModern 工作区,并接入名为 <项目名称> 的 MicroVertical',
71
+ optionLegacyModernJs: ' --legacy-modern-js 在大型警告和输入确认后,选择原始 Modern.js 初始化',
68
72
  optionSub: ' -s, --sub 标记为子项目(monorepo 中的子包)',
69
73
  examples: '💡 示例:',
70
74
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
package/dist/esm/index.js CHANGED
@@ -51,6 +51,8 @@ const requiredLifecycleDeniedScripts = [
51
51
  const requiredLifecycleAllowedScripts = [
52
52
  'postinstall'
53
53
  ];
54
+ const LEGACY_MODERN_JS_FLAG = '--legacy-modern-js';
55
+ const LEGACY_MODERN_JS_CONFIRMATION = 'USE LEGACY MODERN.JS';
54
56
  function getOptionValue(args, names) {
55
57
  for (const name of names){
56
58
  const prefix = `${name}=`;
@@ -426,6 +428,7 @@ function showHelp() {
426
428
  if (localeKeys.help.optionUltramodernPackageScope) console.log(i18n.t(localeKeys.help.optionUltramodernPackageScope));
427
429
  if (localeKeys.help.optionUltramodernPackageNamePrefix) console.log(i18n.t(localeKeys.help.optionUltramodernPackageNamePrefix));
428
430
  if (localeKeys.help.optionVertical) console.log(i18n.t(localeKeys.help.optionVertical));
431
+ if (localeKeys.help.optionLegacyModernJs) console.log(i18n.t(localeKeys.help.optionLegacyModernJs));
429
432
  console.log(i18n.t(localeKeys.help.optionSub));
430
433
  console.log('');
431
434
  console.log(i18n.t(localeKeys.help.examples));
@@ -458,6 +461,45 @@ function promptInput(question) {
458
461
  });
459
462
  });
460
463
  }
464
+ function detectLegacyModernJsFlag(args) {
465
+ if (args.some((arg)=>arg.startsWith(`${LEGACY_MODERN_JS_FLAG}=`))) {
466
+ console.error(`${LEGACY_MODERN_JS_FLAG} does not accept a value.`);
467
+ process.exit(1);
468
+ }
469
+ return args.includes(LEGACY_MODERN_JS_FLAG);
470
+ }
471
+ function stripLegacyModernJsArgs(args) {
472
+ return args.filter((arg)=>arg !== LEGACY_MODERN_JS_FLAG);
473
+ }
474
+ async function confirmLegacyModernJsSetup() {
475
+ console.error('');
476
+ console.error(i18n.t(localeKeys.message.legacyModernJsWarning));
477
+ console.error('');
478
+ const answer = await promptInput(i18n.t(localeKeys.prompt.legacyModernJsConfirmation, {
479
+ confirmation: LEGACY_MODERN_JS_CONFIRMATION
480
+ }));
481
+ if (answer !== LEGACY_MODERN_JS_CONFIRMATION) {
482
+ console.error(i18n.t(localeKeys.error.legacyModernJsNotConfirmed));
483
+ process.exit(1);
484
+ }
485
+ }
486
+ function delegateLegacyModernJsSetup(args) {
487
+ const forwardedArgs = stripLegacyModernJsArgs(args);
488
+ if (commandExists('pnpm')) return void runSetupCommand('pnpm', [
489
+ 'dlx',
490
+ '@modern-js/create',
491
+ ...forwardedArgs
492
+ ], {
493
+ stdio: 'inherit'
494
+ });
495
+ if (commandExists('npx')) return void runSetupCommand('npx', [
496
+ '@modern-js/create',
497
+ ...forwardedArgs
498
+ ], {
499
+ stdio: 'inherit'
500
+ });
501
+ throw new Error('Legacy Modern.js setup requires pnpm or npx to run @modern-js/create.');
502
+ }
461
503
  function detectSubprojectFlag() {
462
504
  const args = process.argv.slice(2);
463
505
  if (args.includes('--sub') || args.includes('-s')) return true;
@@ -724,6 +766,7 @@ async function getProjectName() {
724
766
  '--no-tailwind',
725
767
  '--workspace',
726
768
  '--vertical',
769
+ LEGACY_MODERN_JS_FLAG,
727
770
  ULTRAMODERN_WORKSPACE_FLAG
728
771
  ]);
729
772
  const positionalArgs = [];
@@ -771,6 +814,11 @@ async function main() {
771
814
  const args = process.argv.slice(2);
772
815
  if (args.includes('--help') || args.includes('-h')) return void showHelp();
773
816
  if (args.includes('--version') || args.includes('-v')) return void showVersion();
817
+ if (detectLegacyModernJsFlag(args)) {
818
+ await confirmLegacyModernJsSetup();
819
+ delegateLegacyModernJsSetup(args);
820
+ return;
821
+ }
774
822
  console.log(`\n${i18n.t(localeKeys.message.welcome)}\n`);
775
823
  const { name: projectName, useCurrentDir } = await getProjectName();
776
824
  const targetDir = useCurrentDir ? process.cwd() : node_path.isAbsolute(projectName) ? projectName : node_path.resolve(process.cwd(), projectName);
@@ -1,12 +1,14 @@
1
1
  const EN_LOCALE = {
2
2
  prompt: {
3
- projectName: 'Please enter project name: '
3
+ projectName: 'Please enter project name: ',
4
+ legacyModernJsConfirmation: 'Type "{confirmation}" to continue with the original Modern.js setup: '
4
5
  },
5
6
  error: {
6
7
  projectNameEmpty: 'Error: Project name cannot be empty',
7
8
  directoryExists: 'Error: Directory "{projectName}" already exists and is not empty',
8
9
  invalidRouter: 'Error: Unsupported router "{router}". Use "react-router" or "tanstack".',
9
10
  invalidBffRuntime: 'Error: Unsupported BFF runtime "{runtime}". Use "hono" or "effect".',
11
+ legacyModernJsNotConfirmed: 'Aborted. UltraModern.js remains the default unattended setup.',
10
12
  createFailed: 'Error creating project:'
11
13
  },
12
14
  message: {
@@ -15,7 +17,8 @@ const EN_LOCALE = {
15
17
  nextSteps: '📋 Next steps:',
16
18
  step1: 'cd {projectName}',
17
19
  step2: 'pnpm install',
18
- step3: 'pnpm dev'
20
+ step3: 'pnpm dev',
21
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nBRUTAL WARNING: YOU ARE OPTING OUT OF ULTRAMODERN.JS DEFAULTS.\nThe unattended default is the best UltraModern.js configuration:\npresetUltramodern, TanStack Router, Effect BFF, Tailwind CSS v4,\nand the BleedingDev package cohort.\nThe original Modern.js setup is legacy compatibility only.\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
22
  },
20
23
  help: {
21
24
  title: '🚀 UltraModern.js Project Creator',
@@ -36,6 +39,7 @@ const EN_LOCALE = {
36
39
  optionUltramodernPackageScope: ' --ultramodern-package-scope Publish scope for npm alias installs (for example bleedingdev)',
37
40
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix Prefix for npm alias package names (default: modern-js-)',
38
41
  optionVertical: ' --vertical Mutate the current existing UltraModern workspace and wire a MicroVertical named <project-name>',
42
+ optionLegacyModernJs: ' --legacy-modern-js Opt into the original Modern.js setup after a large warning and typed confirmation',
39
43
  optionSub: ' -s, --sub Mark as a subproject (package in monorepo)',
40
44
  examples: '💡 Examples:',
41
45
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
@@ -1,12 +1,14 @@
1
1
  const ZH_LOCALE = {
2
2
  prompt: {
3
- projectName: '请输入项目名称: '
3
+ projectName: '请输入项目名称: ',
4
+ legacyModernJsConfirmation: '输入 "{confirmation}" 以继续使用原始 Modern.js 初始化: '
4
5
  },
5
6
  error: {
6
7
  projectNameEmpty: '错误: 项目名称不能为空',
7
8
  directoryExists: '错误: 目录 "{projectName}" 已存在且不为空',
8
9
  invalidRouter: '错误: 不支持的路由器 "{router}",请使用 "react-router" 或 "tanstack"',
9
10
  invalidBffRuntime: '错误: 不支持的 BFF 运行时 "{runtime}",请使用 "hono" 或 "effect"',
11
+ legacyModernJsNotConfirmed: '已中止。UltraModern.js 仍是默认的免交互初始化方案。',
10
12
  createFailed: '创建项目时出错:'
11
13
  },
12
14
  message: {
@@ -15,7 +17,8 @@ const ZH_LOCALE = {
15
17
  nextSteps: '📋 下一步:',
16
18
  step1: 'cd {projectName}',
17
19
  step2: 'pnpm install',
18
- step3: 'pnpm dev'
20
+ step3: 'pnpm dev',
21
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n严重警告:你正在退出 ULTRAMODERN.JS 默认配置。\n免交互默认值是最佳 UltraModern.js 配置:\npresetUltramodern、TanStack Router、Effect BFF、Tailwind CSS v4,\n以及 BleedingDev 包版本队列。\n原始 Modern.js 初始化仅用于遗留兼容。\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
22
  },
20
23
  help: {
21
24
  title: '🚀 UltraModern.js 项目创建工具',
@@ -36,6 +39,7 @@ const ZH_LOCALE = {
36
39
  optionUltramodernPackageScope: ' --ultramodern-package-scope npm alias 安装使用的发布 scope(例如 bleedingdev)',
37
40
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix npm alias 包名前缀(默认:modern-js-)',
38
41
  optionVertical: ' --vertical 修改当前已有的 UltraModern 工作区,并接入名为 <项目名称> 的 MicroVertical',
42
+ optionLegacyModernJs: ' --legacy-modern-js 在大型警告和输入确认后,选择原始 Modern.js 初始化',
39
43
  optionSub: ' -s, --sub 标记为子项目(monorepo 中的子包)',
40
44
  examples: '💡 示例:',
41
45
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
@@ -52,6 +52,8 @@ const requiredLifecycleDeniedScripts = [
52
52
  const requiredLifecycleAllowedScripts = [
53
53
  'postinstall'
54
54
  ];
55
+ const LEGACY_MODERN_JS_FLAG = '--legacy-modern-js';
56
+ const LEGACY_MODERN_JS_CONFIRMATION = 'USE LEGACY MODERN.JS';
55
57
  function getOptionValue(args, names) {
56
58
  for (const name of names){
57
59
  const prefix = `${name}=`;
@@ -427,6 +429,7 @@ function showHelp() {
427
429
  if (localeKeys.help.optionUltramodernPackageScope) console.log(i18n.t(localeKeys.help.optionUltramodernPackageScope));
428
430
  if (localeKeys.help.optionUltramodernPackageNamePrefix) console.log(i18n.t(localeKeys.help.optionUltramodernPackageNamePrefix));
429
431
  if (localeKeys.help.optionVertical) console.log(i18n.t(localeKeys.help.optionVertical));
432
+ if (localeKeys.help.optionLegacyModernJs) console.log(i18n.t(localeKeys.help.optionLegacyModernJs));
430
433
  console.log(i18n.t(localeKeys.help.optionSub));
431
434
  console.log('');
432
435
  console.log(i18n.t(localeKeys.help.examples));
@@ -459,6 +462,45 @@ function promptInput(question) {
459
462
  });
460
463
  });
461
464
  }
465
+ function detectLegacyModernJsFlag(args) {
466
+ if (args.some((arg)=>arg.startsWith(`${LEGACY_MODERN_JS_FLAG}=`))) {
467
+ console.error(`${LEGACY_MODERN_JS_FLAG} does not accept a value.`);
468
+ process.exit(1);
469
+ }
470
+ return args.includes(LEGACY_MODERN_JS_FLAG);
471
+ }
472
+ function stripLegacyModernJsArgs(args) {
473
+ return args.filter((arg)=>arg !== LEGACY_MODERN_JS_FLAG);
474
+ }
475
+ async function confirmLegacyModernJsSetup() {
476
+ console.error('');
477
+ console.error(i18n.t(localeKeys.message.legacyModernJsWarning));
478
+ console.error('');
479
+ const answer = await promptInput(i18n.t(localeKeys.prompt.legacyModernJsConfirmation, {
480
+ confirmation: LEGACY_MODERN_JS_CONFIRMATION
481
+ }));
482
+ if (answer !== LEGACY_MODERN_JS_CONFIRMATION) {
483
+ console.error(i18n.t(localeKeys.error.legacyModernJsNotConfirmed));
484
+ process.exit(1);
485
+ }
486
+ }
487
+ function delegateLegacyModernJsSetup(args) {
488
+ const forwardedArgs = stripLegacyModernJsArgs(args);
489
+ if (commandExists('pnpm')) return void runSetupCommand('pnpm', [
490
+ 'dlx',
491
+ '@modern-js/create',
492
+ ...forwardedArgs
493
+ ], {
494
+ stdio: 'inherit'
495
+ });
496
+ if (commandExists('npx')) return void runSetupCommand('npx', [
497
+ '@modern-js/create',
498
+ ...forwardedArgs
499
+ ], {
500
+ stdio: 'inherit'
501
+ });
502
+ throw new Error('Legacy Modern.js setup requires pnpm or npx to run @modern-js/create.');
503
+ }
462
504
  function detectSubprojectFlag() {
463
505
  const args = process.argv.slice(2);
464
506
  if (args.includes('--sub') || args.includes('-s')) return true;
@@ -725,6 +767,7 @@ async function getProjectName() {
725
767
  '--no-tailwind',
726
768
  '--workspace',
727
769
  '--vertical',
770
+ LEGACY_MODERN_JS_FLAG,
728
771
  ULTRAMODERN_WORKSPACE_FLAG
729
772
  ]);
730
773
  const positionalArgs = [];
@@ -772,6 +815,11 @@ async function main() {
772
815
  const args = process.argv.slice(2);
773
816
  if (args.includes('--help') || args.includes('-h')) return void showHelp();
774
817
  if (args.includes('--version') || args.includes('-v')) return void showVersion();
818
+ if (detectLegacyModernJsFlag(args)) {
819
+ await confirmLegacyModernJsSetup();
820
+ delegateLegacyModernJsSetup(args);
821
+ return;
822
+ }
775
823
  console.log(`\n${i18n.t(localeKeys.message.welcome)}\n`);
776
824
  const { name: projectName, useCurrentDir } = await getProjectName();
777
825
  const targetDir = useCurrentDir ? process.cwd() : node_path.isAbsolute(projectName) ? projectName : node_path.resolve(process.cwd(), projectName);
@@ -1,13 +1,15 @@
1
1
  import "node:module";
2
2
  const EN_LOCALE = {
3
3
  prompt: {
4
- projectName: 'Please enter project name: '
4
+ projectName: 'Please enter project name: ',
5
+ legacyModernJsConfirmation: 'Type "{confirmation}" to continue with the original Modern.js setup: '
5
6
  },
6
7
  error: {
7
8
  projectNameEmpty: 'Error: Project name cannot be empty',
8
9
  directoryExists: 'Error: Directory "{projectName}" already exists and is not empty',
9
10
  invalidRouter: 'Error: Unsupported router "{router}". Use "react-router" or "tanstack".',
10
11
  invalidBffRuntime: 'Error: Unsupported BFF runtime "{runtime}". Use "hono" or "effect".',
12
+ legacyModernJsNotConfirmed: 'Aborted. UltraModern.js remains the default unattended setup.',
11
13
  createFailed: 'Error creating project:'
12
14
  },
13
15
  message: {
@@ -16,7 +18,8 @@ const EN_LOCALE = {
16
18
  nextSteps: '📋 Next steps:',
17
19
  step1: 'cd {projectName}',
18
20
  step2: 'pnpm install',
19
- step3: 'pnpm dev'
21
+ step3: 'pnpm dev',
22
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nBRUTAL WARNING: YOU ARE OPTING OUT OF ULTRAMODERN.JS DEFAULTS.\nThe unattended default is the best UltraModern.js configuration:\npresetUltramodern, TanStack Router, Effect BFF, Tailwind CSS v4,\nand the BleedingDev package cohort.\nThe original Modern.js setup is legacy compatibility only.\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
20
23
  },
21
24
  help: {
22
25
  title: '🚀 UltraModern.js Project Creator',
@@ -37,6 +40,7 @@ const EN_LOCALE = {
37
40
  optionUltramodernPackageScope: ' --ultramodern-package-scope Publish scope for npm alias installs (for example bleedingdev)',
38
41
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix Prefix for npm alias package names (default: modern-js-)',
39
42
  optionVertical: ' --vertical Mutate the current existing UltraModern workspace and wire a MicroVertical named <project-name>',
43
+ optionLegacyModernJs: ' --legacy-modern-js Opt into the original Modern.js setup after a large warning and typed confirmation',
40
44
  optionSub: ' -s, --sub Mark as a subproject (package in monorepo)',
41
45
  examples: '💡 Examples:',
42
46
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
@@ -1,13 +1,15 @@
1
1
  import "node:module";
2
2
  const ZH_LOCALE = {
3
3
  prompt: {
4
- projectName: '请输入项目名称: '
4
+ projectName: '请输入项目名称: ',
5
+ legacyModernJsConfirmation: '输入 "{confirmation}" 以继续使用原始 Modern.js 初始化: '
5
6
  },
6
7
  error: {
7
8
  projectNameEmpty: '错误: 项目名称不能为空',
8
9
  directoryExists: '错误: 目录 "{projectName}" 已存在且不为空',
9
10
  invalidRouter: '错误: 不支持的路由器 "{router}",请使用 "react-router" 或 "tanstack"',
10
11
  invalidBffRuntime: '错误: 不支持的 BFF 运行时 "{runtime}",请使用 "hono" 或 "effect"',
12
+ legacyModernJsNotConfirmed: '已中止。UltraModern.js 仍是默认的免交互初始化方案。',
11
13
  createFailed: '创建项目时出错:'
12
14
  },
13
15
  message: {
@@ -16,7 +18,8 @@ const ZH_LOCALE = {
16
18
  nextSteps: '📋 下一步:',
17
19
  step1: 'cd {projectName}',
18
20
  step2: 'pnpm install',
19
- step3: 'pnpm dev'
21
+ step3: 'pnpm dev',
22
+ legacyModernJsWarning: "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n严重警告:你正在退出 ULTRAMODERN.JS 默认配置。\n免交互默认值是最佳 UltraModern.js 配置:\npresetUltramodern、TanStack Router、Effect BFF、Tailwind CSS v4,\n以及 BleedingDev 包版本队列。\n原始 Modern.js 初始化仅用于遗留兼容。\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
20
23
  },
21
24
  help: {
22
25
  title: '🚀 UltraModern.js 项目创建工具',
@@ -37,6 +40,7 @@ const ZH_LOCALE = {
37
40
  optionUltramodernPackageScope: ' --ultramodern-package-scope npm alias 安装使用的发布 scope(例如 bleedingdev)',
38
41
  optionUltramodernPackageNamePrefix: ' --ultramodern-package-name-prefix npm alias 包名前缀(默认:modern-js-)',
39
42
  optionVertical: ' --vertical 修改当前已有的 UltraModern 工作区,并接入名为 <项目名称> 的 MicroVertical',
43
+ optionLegacyModernJs: ' --legacy-modern-js 在大型警告和输入确认后,选择原始 Modern.js 初始化',
40
44
  optionSub: ' -s, --sub 标记为子项目(monorepo 中的子包)',
41
45
  examples: '💡 示例:',
42
46
  example1: ' pnpm dlx @bleedingdev/modern-js-create my-app',
@@ -1,12 +1,14 @@
1
1
  export declare const EN_LOCALE: {
2
2
  prompt: {
3
3
  projectName: string;
4
+ legacyModernJsConfirmation: string;
4
5
  };
5
6
  error: {
6
7
  projectNameEmpty: string;
7
8
  directoryExists: string;
8
9
  invalidRouter: string;
9
10
  invalidBffRuntime: string;
11
+ legacyModernJsNotConfirmed: string;
10
12
  createFailed: string;
11
13
  };
12
14
  message: {
@@ -16,6 +18,7 @@ export declare const EN_LOCALE: {
16
18
  step1: string;
17
19
  step2: string;
18
20
  step3: string;
21
+ legacyModernJsWarning: string;
19
22
  };
20
23
  help: {
21
24
  title: string;
@@ -36,6 +39,7 @@ export declare const EN_LOCALE: {
36
39
  optionUltramodernPackageScope: string;
37
40
  optionUltramodernPackageNamePrefix: string;
38
41
  optionVertical: string;
42
+ optionLegacyModernJs: string;
39
43
  optionSub: string;
40
44
  examples: string;
41
45
  example1: string;
@@ -3,12 +3,14 @@ declare const i18n: I18n;
3
3
  declare const localeKeys: {
4
4
  prompt: {
5
5
  projectName: string;
6
+ legacyModernJsConfirmation: string;
6
7
  };
7
8
  error: {
8
9
  projectNameEmpty: string;
9
10
  directoryExists: string;
10
11
  invalidRouter: string;
11
12
  invalidBffRuntime: string;
13
+ legacyModernJsNotConfirmed: string;
12
14
  createFailed: string;
13
15
  };
14
16
  message: {
@@ -18,6 +20,7 @@ declare const localeKeys: {
18
20
  step1: string;
19
21
  step2: string;
20
22
  step3: string;
23
+ legacyModernJsWarning: string;
21
24
  };
22
25
  help: {
23
26
  title: string;
@@ -38,6 +41,7 @@ declare const localeKeys: {
38
41
  optionUltramodernPackageScope: string;
39
42
  optionUltramodernPackageNamePrefix: string;
40
43
  optionVertical: string;
44
+ optionLegacyModernJs: string;
41
45
  optionSub: string;
42
46
  examples: string;
43
47
  example1: string;
@@ -60,12 +64,14 @@ declare const localeKeys: {
60
64
  } | {
61
65
  prompt: {
62
66
  projectName: string;
67
+ legacyModernJsConfirmation: string;
63
68
  };
64
69
  error: {
65
70
  projectNameEmpty: string;
66
71
  directoryExists: string;
67
72
  invalidRouter: string;
68
73
  invalidBffRuntime: string;
74
+ legacyModernJsNotConfirmed: string;
69
75
  createFailed: string;
70
76
  };
71
77
  message: {
@@ -75,6 +81,7 @@ declare const localeKeys: {
75
81
  step1: string;
76
82
  step2: string;
77
83
  step3: string;
84
+ legacyModernJsWarning: string;
78
85
  };
79
86
  help: {
80
87
  title: string;
@@ -95,6 +102,7 @@ declare const localeKeys: {
95
102
  optionUltramodernPackageScope: string;
96
103
  optionUltramodernPackageNamePrefix: string;
97
104
  optionVertical: string;
105
+ optionLegacyModernJs: string;
98
106
  optionSub: string;
99
107
  examples: string;
100
108
  example1: string;
@@ -1,12 +1,14 @@
1
1
  export declare const ZH_LOCALE: {
2
2
  prompt: {
3
3
  projectName: string;
4
+ legacyModernJsConfirmation: string;
4
5
  };
5
6
  error: {
6
7
  projectNameEmpty: string;
7
8
  directoryExists: string;
8
9
  invalidRouter: string;
9
10
  invalidBffRuntime: string;
11
+ legacyModernJsNotConfirmed: string;
10
12
  createFailed: string;
11
13
  };
12
14
  message: {
@@ -16,6 +18,7 @@ export declare const ZH_LOCALE: {
16
18
  step1: string;
17
19
  step2: string;
18
20
  step3: string;
21
+ legacyModernJsWarning: string;
19
22
  };
20
23
  help: {
21
24
  title: string;
@@ -36,6 +39,7 @@ export declare const ZH_LOCALE: {
36
39
  optionUltramodernPackageScope: string;
37
40
  optionUltramodernPackageNamePrefix: string;
38
41
  optionVertical: string;
42
+ optionLegacyModernJs: string;
39
43
  optionSub: string;
40
44
  examples: string;
41
45
  example1: string;
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
24
- "version": "3.2.0-ultramodern.112",
24
+ "version": "3.2.0-ultramodern.113",
25
25
  "types": "./dist/types/index.d.ts",
26
26
  "main": "./dist/esm-node/index.js",
27
27
  "bin": {
@@ -50,12 +50,14 @@
50
50
  "dist",
51
51
  "bin.js"
52
52
  ],
53
+ "dependencies": {
54
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.113"
55
+ },
53
56
  "devDependencies": {
54
57
  "@rslib/core": "0.21.5",
55
58
  "@types/node": "^25.9.1",
56
59
  "@typescript/native-preview": "7.0.0-dev.20260606.1",
57
60
  "tsx": "^4.22.3",
58
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.112",
59
61
  "@scripts/rstest-config": "2.66.0"
60
62
  },
61
63
  "publishConfig": {
@@ -70,6 +72,6 @@
70
72
  "test": "rm -rf dist && rslib build -c rslibconfig.mts && rstest --passWithNoTests"
71
73
  },
72
74
  "ultramodern": {
73
- "frameworkVersion": "3.2.0-ultramodern.112"
75
+ "frameworkVersion": "3.2.0-ultramodern.113"
74
76
  }
75
77
  }