@bleedingdev/modern-js-create 3.2.0-ultramodern.99 → 3.4.0-ultramodern.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +281 -106
- package/bin/run.js +1 -0
- package/dist/cjs/create-package-root.cjs +63 -0
- package/dist/cjs/index.cjs +658 -0
- package/dist/cjs/locale/en.cjs +101 -0
- package/dist/cjs/locale/index.cjs +50 -0
- package/dist/cjs/locale/zh.cjs +101 -0
- package/dist/cjs/ultramodern-package-source.cjs +135 -0
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +603 -0
- package/dist/cjs/ultramodern-workspace/app-files.cjs +223 -0
- package/dist/cjs/ultramodern-workspace/codesmith.cjs +134 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +837 -0
- package/dist/cjs/ultramodern-workspace/demo-components.cjs +422 -0
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +222 -0
- package/dist/cjs/ultramodern-workspace/effect-api.cjs +952 -0
- package/dist/cjs/ultramodern-workspace/fs-io.cjs +191 -0
- package/dist/cjs/ultramodern-workspace/generation-result.cjs +158 -0
- package/dist/cjs/ultramodern-workspace/index.cjs +51 -0
- package/dist/cjs/ultramodern-workspace/locales.cjs +173 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +487 -0
- package/dist/cjs/ultramodern-workspace/naming.cjs +161 -0
- package/dist/cjs/ultramodern-workspace/overlays.cjs +120 -0
- package/dist/cjs/ultramodern-workspace/package-json.cjs +406 -0
- package/dist/cjs/ultramodern-workspace/package-source.cjs +59 -0
- package/dist/cjs/ultramodern-workspace/policy.cjs +248 -0
- package/dist/cjs/ultramodern-workspace/public-api.cjs +47 -0
- package/dist/cjs/ultramodern-workspace/public-surface.cjs +268 -0
- package/dist/cjs/ultramodern-workspace/routes.cjs +375 -0
- package/dist/cjs/ultramodern-workspace/types.cjs +61 -0
- package/dist/cjs/ultramodern-workspace/versions.cjs +161 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +154 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +197 -0
- package/dist/esm/create-package-root.js +14 -0
- package/dist/esm/index.js +621 -0
- package/dist/esm/locale/en.js +63 -0
- package/dist/esm/locale/index.js +9 -0
- package/dist/esm/locale/zh.js +63 -0
- package/dist/esm/ultramodern-package-source.js +63 -0
- package/dist/esm/ultramodern-workspace/add-vertical.js +511 -0
- package/dist/esm/ultramodern-workspace/app-files.js +149 -0
- package/dist/esm/ultramodern-workspace/codesmith.js +86 -0
- package/dist/esm/ultramodern-workspace/contracts.js +742 -0
- package/dist/esm/ultramodern-workspace/demo-components.js +363 -0
- package/dist/esm/ultramodern-workspace/descriptors.js +133 -0
- package/dist/esm/ultramodern-workspace/effect-api.js +854 -0
- package/dist/esm/ultramodern-workspace/fs-io.js +90 -0
- package/dist/esm/ultramodern-workspace/generation-result.js +102 -0
- package/dist/esm/ultramodern-workspace/index.js +3 -0
- package/dist/esm/ultramodern-workspace/locales.js +122 -0
- package/dist/esm/ultramodern-workspace/module-federation.js +415 -0
- package/dist/esm/ultramodern-workspace/naming.js +71 -0
- package/dist/esm/ultramodern-workspace/overlays.js +79 -0
- package/dist/esm/ultramodern-workspace/package-json.js +338 -0
- package/dist/esm/ultramodern-workspace/package-source.js +21 -0
- package/dist/esm/ultramodern-workspace/policy.js +183 -0
- package/dist/esm/ultramodern-workspace/public-api.js +2 -0
- package/dist/esm/ultramodern-workspace/public-surface.js +183 -0
- package/dist/esm/ultramodern-workspace/routes.js +280 -0
- package/dist/esm/ultramodern-workspace/types.js +16 -0
- package/dist/esm/ultramodern-workspace/versions.js +36 -0
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +92 -0
- package/dist/esm/ultramodern-workspace/write-workspace.js +143 -0
- package/dist/esm-node/create-package-root.js +15 -0
- package/dist/esm-node/index.js +622 -0
- package/dist/esm-node/locale/en.js +64 -0
- package/dist/esm-node/locale/index.js +10 -0
- package/dist/esm-node/locale/zh.js +64 -0
- package/dist/esm-node/ultramodern-package-source.js +64 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +512 -0
- package/dist/esm-node/ultramodern-workspace/app-files.js +150 -0
- package/dist/esm-node/ultramodern-workspace/codesmith.js +87 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +743 -0
- package/dist/esm-node/ultramodern-workspace/demo-components.js +364 -0
- package/dist/esm-node/ultramodern-workspace/descriptors.js +134 -0
- package/dist/esm-node/ultramodern-workspace/effect-api.js +855 -0
- package/dist/esm-node/ultramodern-workspace/fs-io.js +91 -0
- package/dist/esm-node/ultramodern-workspace/generation-result.js +103 -0
- package/dist/esm-node/ultramodern-workspace/index.js +4 -0
- package/dist/esm-node/ultramodern-workspace/locales.js +123 -0
- package/dist/esm-node/ultramodern-workspace/module-federation.js +416 -0
- package/dist/esm-node/ultramodern-workspace/naming.js +72 -0
- package/dist/esm-node/ultramodern-workspace/overlays.js +80 -0
- package/dist/esm-node/ultramodern-workspace/package-json.js +339 -0
- package/dist/esm-node/ultramodern-workspace/package-source.js +22 -0
- package/dist/esm-node/ultramodern-workspace/policy.js +184 -0
- package/dist/esm-node/ultramodern-workspace/public-api.js +3 -0
- package/dist/esm-node/ultramodern-workspace/public-surface.js +184 -0
- package/dist/esm-node/ultramodern-workspace/routes.js +281 -0
- package/dist/esm-node/ultramodern-workspace/types.js +17 -0
- package/dist/esm-node/ultramodern-workspace/versions.js +37 -0
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +93 -0
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +144 -0
- package/dist/types/create-package-root.d.ts +1 -0
- package/dist/types/locale/en.d.ts +12 -8
- package/dist/types/locale/index.d.ts +125 -2
- package/dist/types/locale/zh.d.ts +12 -8
- package/dist/types/ultramodern-package-source.d.ts +28 -0
- package/dist/types/ultramodern-workspace/add-vertical.d.ts +36 -0
- package/dist/types/ultramodern-workspace/app-files.d.ts +14 -0
- package/dist/types/ultramodern-workspace/codesmith.d.ts +53 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +21 -0
- package/dist/types/ultramodern-workspace/demo-components.d.ts +9 -0
- package/dist/types/ultramodern-workspace/descriptors.d.ts +39 -0
- package/dist/types/ultramodern-workspace/effect-api.d.ts +73 -0
- package/dist/types/ultramodern-workspace/fs-io.d.ts +18 -0
- package/dist/types/ultramodern-workspace/generation-result.d.ts +14 -0
- package/dist/types/ultramodern-workspace/index.d.ts +4 -0
- package/dist/types/ultramodern-workspace/locales.d.ts +183 -0
- package/dist/types/ultramodern-workspace/module-federation.d.ts +16 -0
- package/dist/types/ultramodern-workspace/naming.d.ts +16 -0
- package/dist/types/ultramodern-workspace/overlays.d.ts +6 -0
- package/dist/types/ultramodern-workspace/package-json.d.ts +12 -0
- package/dist/types/ultramodern-workspace/package-source.d.ts +2 -0
- package/dist/types/ultramodern-workspace/policy.d.ts +60 -0
- package/dist/types/ultramodern-workspace/public-api.d.ts +3 -0
- package/dist/types/ultramodern-workspace/public-surface.d.ts +37 -0
- package/dist/types/ultramodern-workspace/routes.d.ts +25 -0
- package/dist/types/ultramodern-workspace/types.d.ts +197 -0
- package/dist/types/ultramodern-workspace/versions.d.ts +40 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +10 -0
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +4 -0
- package/package.json +58 -15
- package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +23 -10
- package/template-workspace/.mise.toml.handlebars +1 -0
- package/template-workspace/{AGENTS.md → AGENTS.md.handlebars} +20 -9
- package/template-workspace/README.md.handlebars +85 -14
- package/template-workspace/lefthook.yml +18 -4
- package/template-workspace/pnpm-workspace.yaml.handlebars +45 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +69 -75
- package/template-workspace/scripts/setup-agent-reference-repos.mjs +8 -6
- package/templates/app/shell-frame.tsx +49 -0
- package/templates/app/ultramodern-route-head.tsx.handlebars +142 -0
- package/templates/packages/shared-contracts-index.ts +466 -0
- package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +69 -0
- package/templates/workspace-scripts/check-ultramodern-i18n-boundaries.mjs +9 -0
- package/templates/workspace-scripts/generate-public-surface-assets.mjs +529 -0
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +125 -0
- package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +851 -0
- package/templates/workspace-scripts/ultramodern-performance-readiness.config.mjs +7 -0
- package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +223 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +986 -0
- package/dist/index.js +0 -6625
- package/dist/types/ultramodern-workspace.d.ts +0 -31
- package/template/.agents/skills-lock.json +0 -34
- package/template/.browserslistrc +0 -4
- package/template/.codex/hooks.json +0 -16
- package/template/.github/renovate.json +0 -53
- package/template/.github/workflows/ultramodern-gates.yml.handlebars +0 -54
- package/template/.gitignore.handlebars +0 -30
- package/template/.mise.toml.handlebars +0 -2
- package/template/.nvmrc +0 -2
- package/template/AGENTS.md +0 -23
- package/template/README.md +0 -105
- package/template/api/effect/index.ts.handlebars +0 -34
- package/template/api/lambda/hello.ts.handlebars +0 -6
- package/template/config/public/locales/cs/translation.json +0 -39
- package/template/config/public/locales/en/translation.json +0 -39
- package/template/lefthook.yml +0 -10
- package/template/modern.config.ts.handlebars +0 -71
- package/template/oxfmt.config.ts +0 -15
- package/template/oxlint.config.ts +0 -19
- package/template/package.json.handlebars +0 -66
- package/template/pnpm-workspace.yaml +0 -29
- package/template/postcss.config.mjs.handlebars +0 -6
- package/template/rstest.config.mts +0 -5
- package/template/scripts/bootstrap-agent-skills.mjs +0 -228
- package/template/scripts/check-i18n-strings.mjs +0 -94
- package/template/scripts/validate-ultramodern.mjs.handlebars +0 -538
- package/template/shared/effect/api.ts.handlebars +0 -17
- package/template/src/modern-app-env.d.ts +0 -3
- package/template/src/modern.runtime.ts.handlebars +0 -23
- package/template/src/routes/[lang]/page.tsx.handlebars +0 -211
- package/template/src/routes/index.css.handlebars +0 -129
- package/template/src/routes/layout.tsx.handlebars +0 -10
- package/template/tailwind.config.ts.handlebars +0 -10
- package/template/tests/tsconfig.json +0 -7
- package/template/tests/ultramodern.contract.test.ts.handlebars +0 -78
- package/template/tsconfig.json +0 -120
- package/template-workspace/pnpm-workspace.yaml +0 -35
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
+
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
|
+
}();
|
|
5
|
+
var __webpack_require__ = {};
|
|
6
|
+
(()=>{
|
|
7
|
+
__webpack_require__.n = (module)=>{
|
|
8
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
9
|
+
__webpack_require__.d(getter, {
|
|
10
|
+
a: getter
|
|
11
|
+
});
|
|
12
|
+
return getter;
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
17
|
+
var define = (defs, kind)=>{
|
|
18
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
[kind]: defs[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
define(getters, "get");
|
|
24
|
+
define(values, "value");
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
29
|
+
})();
|
|
30
|
+
var __webpack_exports__ = {};
|
|
31
|
+
const external_node_child_process_namespaceObject = require("node:child_process");
|
|
32
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
33
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
34
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
35
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
36
|
+
const external_node_readline_namespaceObject = require("node:readline");
|
|
37
|
+
var external_node_readline_default = /*#__PURE__*/ __webpack_require__.n(external_node_readline_namespaceObject);
|
|
38
|
+
const external_node_url_namespaceObject = require("node:url");
|
|
39
|
+
const external_create_package_root_cjs_namespaceObject = require("./create-package-root.cjs");
|
|
40
|
+
const index_cjs_namespaceObject = require("./locale/index.cjs");
|
|
41
|
+
const external_ultramodern_package_source_cjs_namespaceObject = require("./ultramodern-package-source.cjs");
|
|
42
|
+
const external_ultramodern_workspace_index_cjs_namespaceObject = require("./ultramodern-workspace/index.cjs");
|
|
43
|
+
const src_dirname = external_node_path_default().dirname((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__));
|
|
44
|
+
const createPackageRoot = (0, external_create_package_root_cjs_namespaceObject.resolveCreatePackageRoot)(src_dirname);
|
|
45
|
+
const semverPattern = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
46
|
+
const LEGACY_MODERN_JS_FLAG = '--legacy-modern-js';
|
|
47
|
+
const LEGACY_MODERN_JS_CONFIRMATION = 'USE LEGACY MODERN.JS';
|
|
48
|
+
const WORKSPACE_PROTOCOL_FLAG = '--workspace';
|
|
49
|
+
const DRY_RUN_FLAG = '--dry-run';
|
|
50
|
+
const VERTICAL_FLAG = '--vertical';
|
|
51
|
+
const VERTICAL_NAME_FLAG = '--vertical-name';
|
|
52
|
+
const CODESMITH_OVERLAY_FLAG = '--codesmith-overlay';
|
|
53
|
+
const BFF_FLAG = '--bff';
|
|
54
|
+
const BFF_RUNTIME_OPTION = '--bff-runtime';
|
|
55
|
+
const SUPPORTED_BFF_RUNTIMES = [
|
|
56
|
+
'effect'
|
|
57
|
+
];
|
|
58
|
+
const REGISTRY_LOOKUP_TIMEOUT_MS = 15000;
|
|
59
|
+
function getOptionValue(args, names) {
|
|
60
|
+
for (const name of names){
|
|
61
|
+
const prefix = `${name}=`;
|
|
62
|
+
const byEquals = args.find((arg)=>arg.startsWith(prefix));
|
|
63
|
+
if (byEquals) return byEquals.slice(prefix.length);
|
|
64
|
+
const index = args.findIndex((arg)=>arg === name);
|
|
65
|
+
if (-1 !== index && args[index + 1] && !args[index + 1].startsWith('-')) return args[index + 1];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const detectLanguage = ()=>{
|
|
69
|
+
const lang = getOptionValue(process.argv.slice(2), [
|
|
70
|
+
'--lang',
|
|
71
|
+
'-l'
|
|
72
|
+
]);
|
|
73
|
+
if ('zh' === lang) return 'zh';
|
|
74
|
+
return 'en';
|
|
75
|
+
};
|
|
76
|
+
index_cjs_namespaceObject.i18n.changeLanguage({
|
|
77
|
+
locale: detectLanguage()
|
|
78
|
+
});
|
|
79
|
+
function readCreatePackageJson() {
|
|
80
|
+
const createPackageJson = external_node_path_default().join(createPackageRoot, 'package.json');
|
|
81
|
+
return JSON.parse(external_node_fs_default().readFileSync(createPackageJson, 'utf-8'));
|
|
82
|
+
}
|
|
83
|
+
function isBleedingDevCreatePackage(createPackage) {
|
|
84
|
+
return createPackage.name === external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_CREATE_PACKAGE;
|
|
85
|
+
}
|
|
86
|
+
function getBleedingDevFrameworkVersion(createPackage, fallbackVersion) {
|
|
87
|
+
const frameworkVersion = createPackage.ultramodern?.frameworkVersion;
|
|
88
|
+
return 'string' == typeof frameworkVersion && frameworkVersion.length > 0 ? frameworkVersion : fallbackVersion;
|
|
89
|
+
}
|
|
90
|
+
function showVersion() {
|
|
91
|
+
const createPackage = readCreatePackageJson();
|
|
92
|
+
const name = createPackage.name || '@modern-js/create';
|
|
93
|
+
const version = createPackage.version || 'unknown';
|
|
94
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.version.message, {
|
|
95
|
+
name,
|
|
96
|
+
version
|
|
97
|
+
}));
|
|
98
|
+
process.exit(0);
|
|
99
|
+
}
|
|
100
|
+
function showHelp() {
|
|
101
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.title));
|
|
102
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.description));
|
|
103
|
+
console.log('');
|
|
104
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.usage));
|
|
105
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.usageExample));
|
|
106
|
+
console.log('');
|
|
107
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.options));
|
|
108
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionHelp));
|
|
109
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionVersion));
|
|
110
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionLang));
|
|
111
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionTailwind));
|
|
112
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionBff));
|
|
113
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionBffRuntime));
|
|
114
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionWorkspace));
|
|
115
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageSource));
|
|
116
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageVersion));
|
|
117
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageRegistry));
|
|
118
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageScope));
|
|
119
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionUltramodernPackageNamePrefix));
|
|
120
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionVertical));
|
|
121
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionVerticalName));
|
|
122
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionDryRun));
|
|
123
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionCodeSmithOverlay));
|
|
124
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.optionLegacyModernJs));
|
|
125
|
+
console.log('');
|
|
126
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.examples));
|
|
127
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example1));
|
|
128
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example2));
|
|
129
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example3));
|
|
130
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example4));
|
|
131
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example5));
|
|
132
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example6));
|
|
133
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example7));
|
|
134
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example8));
|
|
135
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example9));
|
|
136
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.example10));
|
|
137
|
+
console.log('');
|
|
138
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.help.moreInfo));
|
|
139
|
+
console.log('');
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
function promptInput(question) {
|
|
143
|
+
const rl = external_node_readline_default().createInterface({
|
|
144
|
+
input: process.stdin,
|
|
145
|
+
output: process.stdout
|
|
146
|
+
});
|
|
147
|
+
return new Promise((resolve)=>{
|
|
148
|
+
rl.question(question, (answer)=>{
|
|
149
|
+
rl.close();
|
|
150
|
+
resolve(answer.trim());
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function detectLegacyModernJsFlag(args) {
|
|
155
|
+
if (args.some((arg)=>arg.startsWith(`${LEGACY_MODERN_JS_FLAG}=`))) {
|
|
156
|
+
console.error(`${LEGACY_MODERN_JS_FLAG} does not accept a value.`);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
return args.includes(LEGACY_MODERN_JS_FLAG);
|
|
160
|
+
}
|
|
161
|
+
function stripLegacyModernJsArgs(args) {
|
|
162
|
+
return args.filter((arg)=>arg !== LEGACY_MODERN_JS_FLAG);
|
|
163
|
+
}
|
|
164
|
+
async function confirmLegacyModernJsSetup() {
|
|
165
|
+
console.error('');
|
|
166
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.legacyModernJsWarning));
|
|
167
|
+
console.error('');
|
|
168
|
+
const answer = await promptInput(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.prompt.legacyModernJsConfirmation, {
|
|
169
|
+
confirmation: LEGACY_MODERN_JS_CONFIRMATION
|
|
170
|
+
}));
|
|
171
|
+
if (answer !== LEGACY_MODERN_JS_CONFIRMATION) {
|
|
172
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.legacyModernJsNotConfirmed));
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function delegateLegacyModernJsSetup(args) {
|
|
177
|
+
const forwardedArgs = stripLegacyModernJsArgs(args);
|
|
178
|
+
if (commandExists('pnpm')) return void runSetupCommand('pnpm', [
|
|
179
|
+
'dlx',
|
|
180
|
+
'@modern-js/create',
|
|
181
|
+
...forwardedArgs
|
|
182
|
+
], {
|
|
183
|
+
stdio: 'inherit'
|
|
184
|
+
});
|
|
185
|
+
if (commandExists('npx')) return void runSetupCommand('npx', [
|
|
186
|
+
'@modern-js/create',
|
|
187
|
+
...forwardedArgs
|
|
188
|
+
], {
|
|
189
|
+
stdio: 'inherit'
|
|
190
|
+
});
|
|
191
|
+
throw new Error('Legacy Modern.js setup requires pnpm or npx to run @modern-js/create.');
|
|
192
|
+
}
|
|
193
|
+
function detectBffRuntime(args) {
|
|
194
|
+
if (args.some((arg)=>arg.startsWith(`${BFF_FLAG}=`))) {
|
|
195
|
+
console.error(`${BFF_FLAG} does not accept a value. Use: ${BFF_RUNTIME_OPTION} <runtime>`);
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
const runtimeRequested = args.some((arg)=>arg === BFF_RUNTIME_OPTION || arg.startsWith(`${BFF_RUNTIME_OPTION}=`));
|
|
199
|
+
if (!runtimeRequested) return 'effect';
|
|
200
|
+
const runtime = getOptionValue(args, [
|
|
201
|
+
BFF_RUNTIME_OPTION
|
|
202
|
+
]);
|
|
203
|
+
if (!runtime) {
|
|
204
|
+
console.error(`${BFF_RUNTIME_OPTION} requires a value (supported: ${SUPPORTED_BFF_RUNTIMES.join(', ')})`);
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
if (!SUPPORTED_BFF_RUNTIMES.includes(runtime)) {
|
|
208
|
+
console.error(`Unsupported BFF runtime "${runtime}". UltraModern workspaces scaffold an Effect BFF for every MicroVertical (supported: ${SUPPORTED_BFF_RUNTIMES.join(', ')}).`);
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
return runtime;
|
|
212
|
+
}
|
|
213
|
+
function detectTailwindFlag() {
|
|
214
|
+
const args = process.argv.slice(2);
|
|
215
|
+
return !args.includes('--no-tailwind');
|
|
216
|
+
}
|
|
217
|
+
function detectExplicitTailwindFlag() {
|
|
218
|
+
const args = process.argv.slice(2);
|
|
219
|
+
if (args.includes('--no-tailwind')) return false;
|
|
220
|
+
if (args.includes('--tailwind')) return true;
|
|
221
|
+
}
|
|
222
|
+
function collectPositionalArgs(args) {
|
|
223
|
+
const optionWithValue = new Set([
|
|
224
|
+
'--lang',
|
|
225
|
+
'-l',
|
|
226
|
+
BFF_RUNTIME_OPTION,
|
|
227
|
+
'--ultramodern-package-source',
|
|
228
|
+
'--ultramodern-package-version',
|
|
229
|
+
'--ultramodern-package-registry',
|
|
230
|
+
'--ultramodern-package-scope',
|
|
231
|
+
'--ultramodern-package-name-prefix',
|
|
232
|
+
VERTICAL_NAME_FLAG,
|
|
233
|
+
CODESMITH_OVERLAY_FLAG
|
|
234
|
+
]);
|
|
235
|
+
const optionWithoutValue = new Set([
|
|
236
|
+
'--help',
|
|
237
|
+
'-h',
|
|
238
|
+
'--version',
|
|
239
|
+
'-v',
|
|
240
|
+
'--tailwind',
|
|
241
|
+
'--no-tailwind',
|
|
242
|
+
BFF_FLAG,
|
|
243
|
+
WORKSPACE_PROTOCOL_FLAG,
|
|
244
|
+
DRY_RUN_FLAG,
|
|
245
|
+
VERTICAL_FLAG,
|
|
246
|
+
LEGACY_MODERN_JS_FLAG
|
|
247
|
+
]);
|
|
248
|
+
const positionalArgs = [];
|
|
249
|
+
for(let i = 0; i < args.length; i++){
|
|
250
|
+
const arg = args[i];
|
|
251
|
+
if (!optionWithoutValue.has(arg)) {
|
|
252
|
+
if (optionWithValue.has(arg)) {
|
|
253
|
+
i += 1;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (!(arg.startsWith('--lang=') || arg.startsWith(`${BFF_RUNTIME_OPTION}=`) || arg.startsWith('--ultramodern-package-source=') || arg.startsWith('--ultramodern-package-version=') || arg.startsWith('--ultramodern-package-registry=') || arg.startsWith('--ultramodern-package-scope=') || arg.startsWith('--ultramodern-package-name-prefix=') || arg.startsWith(`${VERTICAL_FLAG}=`) || arg.startsWith(`${VERTICAL_NAME_FLAG}=`) || arg.startsWith(`${CODESMITH_OVERLAY_FLAG}=`))) positionalArgs.push(arg);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return positionalArgs;
|
|
260
|
+
}
|
|
261
|
+
function readRequiredVerticalNameValue(args, index) {
|
|
262
|
+
const value = args[index + 1];
|
|
263
|
+
if (!value || value.startsWith('-')) {
|
|
264
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.verticalNameMissing));
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
return value;
|
|
268
|
+
}
|
|
269
|
+
function resolveVerticalCliInput(args) {
|
|
270
|
+
const candidates = [];
|
|
271
|
+
let addVertical = false;
|
|
272
|
+
for(let i = 0; i < args.length; i++){
|
|
273
|
+
const arg = args[i];
|
|
274
|
+
if (arg === VERTICAL_FLAG) {
|
|
275
|
+
addVertical = true;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (arg.startsWith(`${VERTICAL_FLAG}=`)) {
|
|
279
|
+
addVertical = true;
|
|
280
|
+
candidates.push({
|
|
281
|
+
value: arg.slice(`${VERTICAL_FLAG}=`.length),
|
|
282
|
+
source: `${VERTICAL_FLAG}=<name>`
|
|
283
|
+
});
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (arg === VERTICAL_NAME_FLAG) {
|
|
287
|
+
addVertical = true;
|
|
288
|
+
candidates.push({
|
|
289
|
+
value: readRequiredVerticalNameValue(args, i),
|
|
290
|
+
source: VERTICAL_NAME_FLAG
|
|
291
|
+
});
|
|
292
|
+
i += 1;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (arg.startsWith(`${VERTICAL_NAME_FLAG}=`)) {
|
|
296
|
+
addVertical = true;
|
|
297
|
+
candidates.push({
|
|
298
|
+
value: arg.slice(`${VERTICAL_NAME_FLAG}=`.length),
|
|
299
|
+
source: `${VERTICAL_NAME_FLAG}=<name>`
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (!addVertical) return {
|
|
304
|
+
addVertical: false
|
|
305
|
+
};
|
|
306
|
+
const positionalArgs = collectPositionalArgs(args);
|
|
307
|
+
if (positionalArgs.length > 1) {
|
|
308
|
+
console.error(`Unexpected positional argument: ${positionalArgs[1]}`);
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
311
|
+
if (positionalArgs[0]) candidates.push({
|
|
312
|
+
value: positionalArgs[0],
|
|
313
|
+
source: 'positional argument'
|
|
314
|
+
});
|
|
315
|
+
const emptyCandidate = candidates.find((candidate)=>'' === candidate.value);
|
|
316
|
+
if (!candidates.length || emptyCandidate) {
|
|
317
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.verticalNameMissing));
|
|
318
|
+
process.exit(1);
|
|
319
|
+
}
|
|
320
|
+
const [firstCandidate] = candidates;
|
|
321
|
+
const disagreement = candidates.find((candidate)=>candidate.value !== firstCandidate.value);
|
|
322
|
+
if (disagreement) {
|
|
323
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.verticalNameAmbiguous, {
|
|
324
|
+
firstName: firstCandidate.value,
|
|
325
|
+
firstSource: firstCandidate.source,
|
|
326
|
+
secondName: disagreement.value,
|
|
327
|
+
secondSource: disagreement.source
|
|
328
|
+
}));
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
return {
|
|
332
|
+
addVertical: true,
|
|
333
|
+
name: firstCandidate.value
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function detectDryRunFlag(args) {
|
|
337
|
+
if (args.some((arg)=>arg.startsWith(`${DRY_RUN_FLAG}=`))) {
|
|
338
|
+
console.error(`${DRY_RUN_FLAG} does not accept a value.`);
|
|
339
|
+
process.exit(1);
|
|
340
|
+
}
|
|
341
|
+
return args.includes(DRY_RUN_FLAG);
|
|
342
|
+
}
|
|
343
|
+
function detectCodeSmithOverlays(args) {
|
|
344
|
+
const overlays = [];
|
|
345
|
+
for(let i = 0; i < args.length; i++){
|
|
346
|
+
const arg = args[i];
|
|
347
|
+
if (arg === CODESMITH_OVERLAY_FLAG) {
|
|
348
|
+
const generator = args[i + 1];
|
|
349
|
+
if (!generator || generator.startsWith('-')) {
|
|
350
|
+
console.error(`${CODESMITH_OVERLAY_FLAG} requires a package or path.`);
|
|
351
|
+
process.exit(1);
|
|
352
|
+
}
|
|
353
|
+
overlays.push({
|
|
354
|
+
generator
|
|
355
|
+
});
|
|
356
|
+
i += 1;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (arg.startsWith(`${CODESMITH_OVERLAY_FLAG}=`)) {
|
|
360
|
+
const generator = arg.slice(`${CODESMITH_OVERLAY_FLAG}=`.length);
|
|
361
|
+
if (!generator) {
|
|
362
|
+
console.error(`${CODESMITH_OVERLAY_FLAG} requires a package or path.`);
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
overlays.push({
|
|
366
|
+
generator
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return overlays.length > 0 ? overlays : void 0;
|
|
371
|
+
}
|
|
372
|
+
function detectUltramodernPackageSource(args, defaultPackageVersion, createPackage) {
|
|
373
|
+
const bleedingDevDefaults = isBleedingDevCreatePackage(createPackage);
|
|
374
|
+
const strategy = getOptionValue(args, [
|
|
375
|
+
'--ultramodern-package-source'
|
|
376
|
+
]) ?? (bleedingDevDefaults ? 'install' : 'workspace');
|
|
377
|
+
if ('workspace' !== strategy && 'install' !== strategy) {
|
|
378
|
+
console.error('--ultramodern-package-source must be "workspace" or "install"');
|
|
379
|
+
process.exit(1);
|
|
380
|
+
}
|
|
381
|
+
const packageSourceStrategy = strategy;
|
|
382
|
+
const explicitRegistry = getOptionValue(args, [
|
|
383
|
+
'--ultramodern-package-registry'
|
|
384
|
+
]);
|
|
385
|
+
const aliasScope = getOptionValue(args, [
|
|
386
|
+
'--ultramodern-package-scope'
|
|
387
|
+
]) ?? (bleedingDevDefaults && 'install' === packageSourceStrategy && !explicitRegistry ? external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_SCOPE : void 0);
|
|
388
|
+
return {
|
|
389
|
+
strategy: packageSourceStrategy,
|
|
390
|
+
modernPackageVersion: getOptionValue(args, [
|
|
391
|
+
'--ultramodern-package-version'
|
|
392
|
+
]) ?? defaultPackageVersion,
|
|
393
|
+
registry: explicitRegistry,
|
|
394
|
+
aliasScope,
|
|
395
|
+
aliasPackageNamePrefix: getOptionValue(args, [
|
|
396
|
+
'--ultramodern-package-name-prefix'
|
|
397
|
+
]) ?? (aliasScope ? external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_NAME_PREFIX : void 0)
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function hasExplicitUltramodernPackageSource(args, value) {
|
|
401
|
+
const configuredValue = getOptionValue(args, [
|
|
402
|
+
'--ultramodern-package-source'
|
|
403
|
+
]);
|
|
404
|
+
return value ? configuredValue === value : void 0 !== configuredValue;
|
|
405
|
+
}
|
|
406
|
+
function readBleedingDevFrameworkVersionFromRegistry(fallbackVersion) {
|
|
407
|
+
const envVersion = process.env[external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_FRAMEWORK_VERSION_ENV]?.trim();
|
|
408
|
+
if (envVersion) {
|
|
409
|
+
if (!semverPattern.test(envVersion)) {
|
|
410
|
+
console.error(`${external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_FRAMEWORK_VERSION_ENV} must be a valid semver version`);
|
|
411
|
+
process.exit(1);
|
|
412
|
+
}
|
|
413
|
+
return envVersion;
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
const rawVersion = runSetupCommand('npm', [
|
|
417
|
+
'view',
|
|
418
|
+
`${external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_CREATE_PACKAGE}@latest`,
|
|
419
|
+
'ultramodern.frameworkVersion',
|
|
420
|
+
'--json'
|
|
421
|
+
], {
|
|
422
|
+
timeoutMs: REGISTRY_LOOKUP_TIMEOUT_MS
|
|
423
|
+
}).trim();
|
|
424
|
+
const version = JSON.parse(rawVersion);
|
|
425
|
+
if ('string' == typeof version && semverPattern.test(version)) return version;
|
|
426
|
+
} catch {}
|
|
427
|
+
console.warn([
|
|
428
|
+
`Could not resolve ${external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_CREATE_PACKAGE}@latest ultramodern.frameworkVersion from the npm registry.`,
|
|
429
|
+
`Falling back to the packaged framework version ${fallbackVersion}.`,
|
|
430
|
+
`Pass ${WORKSPACE_PROTOCOL_FLAG} to use local workspace protocol dependencies,`,
|
|
431
|
+
'or pass --ultramodern-package-version with the exact BleedingDev framework cohort.'
|
|
432
|
+
].join(' '));
|
|
433
|
+
return fallbackVersion;
|
|
434
|
+
}
|
|
435
|
+
function resolveInstallBackedPackageSource(args, createPackage, packageSource) {
|
|
436
|
+
const explicitVersion = getOptionValue(args, [
|
|
437
|
+
'--ultramodern-package-version'
|
|
438
|
+
]);
|
|
439
|
+
const explicitRegistry = getOptionValue(args, [
|
|
440
|
+
'--ultramodern-package-registry'
|
|
441
|
+
]);
|
|
442
|
+
const aliasScope = getOptionValue(args, [
|
|
443
|
+
'--ultramodern-package-scope'
|
|
444
|
+
]) ?? packageSource.aliasScope ?? (explicitRegistry ? void 0 : external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_SCOPE);
|
|
445
|
+
return {
|
|
446
|
+
...packageSource,
|
|
447
|
+
strategy: 'install',
|
|
448
|
+
modernPackageVersion: explicitVersion ?? (isBleedingDevCreatePackage(createPackage) ? packageSource.modernPackageVersion : readBleedingDevFrameworkVersionFromRegistry(packageSource.modernPackageVersion)),
|
|
449
|
+
aliasScope,
|
|
450
|
+
aliasPackageNamePrefix: getOptionValue(args, [
|
|
451
|
+
'--ultramodern-package-name-prefix'
|
|
452
|
+
]) ?? packageSource.aliasPackageNamePrefix ?? (aliasScope ? external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_NAME_PREFIX : void 0)
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function resolveWorkspacePackageSource(args, createPackage, packageSource) {
|
|
456
|
+
const workspaceProtocolRequested = args.includes(WORKSPACE_PROTOCOL_FLAG);
|
|
457
|
+
if (workspaceProtocolRequested && hasExplicitUltramodernPackageSource(args, 'install')) {
|
|
458
|
+
console.error(`${WORKSPACE_PROTOCOL_FLAG} conflicts with --ultramodern-package-source=install`);
|
|
459
|
+
process.exit(1);
|
|
460
|
+
}
|
|
461
|
+
if (workspaceProtocolRequested || hasExplicitUltramodernPackageSource(args, 'workspace')) return {
|
|
462
|
+
...packageSource,
|
|
463
|
+
strategy: 'workspace',
|
|
464
|
+
modernPackageVersion: external_ultramodern_package_source_cjs_namespaceObject.WORKSPACE_PACKAGE_VERSION
|
|
465
|
+
};
|
|
466
|
+
return resolveInstallBackedPackageSource(args, createPackage, packageSource);
|
|
467
|
+
}
|
|
468
|
+
function runSetupCommand(command, args, options = {}) {
|
|
469
|
+
return (0, external_node_child_process_namespaceObject.execFileSync)(command, args, {
|
|
470
|
+
cwd: options.cwd,
|
|
471
|
+
encoding: 'utf-8',
|
|
472
|
+
stdio: options.stdio ?? [
|
|
473
|
+
'ignore',
|
|
474
|
+
'pipe',
|
|
475
|
+
'pipe'
|
|
476
|
+
],
|
|
477
|
+
timeout: options.timeoutMs
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function commandExists(command) {
|
|
481
|
+
try {
|
|
482
|
+
runSetupCommand(command, [
|
|
483
|
+
'--version'
|
|
484
|
+
], {
|
|
485
|
+
stdio: 'ignore'
|
|
486
|
+
});
|
|
487
|
+
return true;
|
|
488
|
+
} catch {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function assertGitAvailableForGeneratedProject() {
|
|
493
|
+
if (commandExists('git')) return;
|
|
494
|
+
throw new Error('Git is required for UltraModern setup. Install git yourself (for example "brew install git" or "sudo apt-get install git") and rerun create. This tool never installs system packages on your behalf.');
|
|
495
|
+
}
|
|
496
|
+
function isInsideGitWorkTree(targetDir) {
|
|
497
|
+
try {
|
|
498
|
+
return 'true' === runSetupCommand('git', [
|
|
499
|
+
'rev-parse',
|
|
500
|
+
'--is-inside-work-tree'
|
|
501
|
+
], {
|
|
502
|
+
cwd: targetDir
|
|
503
|
+
}).trim();
|
|
504
|
+
} catch {
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function initializeGeneratedGitRepository(targetDir) {
|
|
509
|
+
assertGitAvailableForGeneratedProject();
|
|
510
|
+
if (isInsideGitWorkTree(targetDir)) return;
|
|
511
|
+
try {
|
|
512
|
+
runSetupCommand('git', [
|
|
513
|
+
'init',
|
|
514
|
+
'-b',
|
|
515
|
+
'main'
|
|
516
|
+
], {
|
|
517
|
+
cwd: targetDir,
|
|
518
|
+
stdio: 'inherit'
|
|
519
|
+
});
|
|
520
|
+
} catch {
|
|
521
|
+
runSetupCommand('git', [
|
|
522
|
+
'init'
|
|
523
|
+
], {
|
|
524
|
+
cwd: targetDir,
|
|
525
|
+
stdio: 'inherit'
|
|
526
|
+
});
|
|
527
|
+
runSetupCommand('git', [
|
|
528
|
+
'branch',
|
|
529
|
+
'-M',
|
|
530
|
+
'main'
|
|
531
|
+
], {
|
|
532
|
+
cwd: targetDir,
|
|
533
|
+
stdio: 'inherit'
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function isDirectoryEmpty(dirPath) {
|
|
538
|
+
if (!external_node_fs_default().existsSync(dirPath)) return false;
|
|
539
|
+
try {
|
|
540
|
+
const files = external_node_fs_default().readdirSync(dirPath);
|
|
541
|
+
return 0 === files.length;
|
|
542
|
+
} catch {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
async function getProjectName() {
|
|
547
|
+
const args = process.argv.slice(2);
|
|
548
|
+
const positionalArgs = collectPositionalArgs(args);
|
|
549
|
+
if (positionalArgs.length > 1) {
|
|
550
|
+
console.error(`Unexpected positional argument: ${positionalArgs[1]}`);
|
|
551
|
+
process.exit(1);
|
|
552
|
+
}
|
|
553
|
+
const projectNameArg = positionalArgs[0];
|
|
554
|
+
if (projectNameArg) {
|
|
555
|
+
if ('.' === projectNameArg) return {
|
|
556
|
+
name: external_node_path_default().basename(process.cwd()),
|
|
557
|
+
useCurrentDir: true
|
|
558
|
+
};
|
|
559
|
+
return {
|
|
560
|
+
name: projectNameArg,
|
|
561
|
+
useCurrentDir: false
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
const currentDir = process.cwd();
|
|
565
|
+
if (isDirectoryEmpty(currentDir)) return {
|
|
566
|
+
name: external_node_path_default().basename(currentDir),
|
|
567
|
+
useCurrentDir: true
|
|
568
|
+
};
|
|
569
|
+
const projectName = await promptInput(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.prompt.projectName));
|
|
570
|
+
if (!projectName) {
|
|
571
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.projectNameEmpty));
|
|
572
|
+
process.exit(1);
|
|
573
|
+
}
|
|
574
|
+
return {
|
|
575
|
+
name: projectName,
|
|
576
|
+
useCurrentDir: false
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
async function main() {
|
|
580
|
+
const args = process.argv.slice(2);
|
|
581
|
+
if (args.includes('--help') || args.includes('-h')) return void showHelp();
|
|
582
|
+
if (args.includes('--version') || args.includes('-v')) return void showVersion();
|
|
583
|
+
if (detectLegacyModernJsFlag(args)) {
|
|
584
|
+
await confirmLegacyModernJsSetup();
|
|
585
|
+
delegateLegacyModernJsSetup(args);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
detectBffRuntime(args);
|
|
589
|
+
const dryRun = detectDryRunFlag(args);
|
|
590
|
+
const verticalInput = resolveVerticalCliInput(args);
|
|
591
|
+
const overlays = detectCodeSmithOverlays(args);
|
|
592
|
+
if (dryRun && !verticalInput.addVertical) {
|
|
593
|
+
console.error(`${DRY_RUN_FLAG} is currently supported only with ${VERTICAL_FLAG}`);
|
|
594
|
+
process.exit(1);
|
|
595
|
+
}
|
|
596
|
+
if (!dryRun) console.log(`\n${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.welcome)}\n`);
|
|
597
|
+
const createPackage = readCreatePackageJson();
|
|
598
|
+
const version = createPackage.version || 'latest';
|
|
599
|
+
const ultramodernPackageVersion = isBleedingDevCreatePackage(createPackage) ? getBleedingDevFrameworkVersion(createPackage, version) : version;
|
|
600
|
+
if (verticalInput.addVertical) {
|
|
601
|
+
const overridePackageSource = args.some((arg)=>arg.startsWith('--ultramodern-package-')) ? detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage) : void 0;
|
|
602
|
+
const verticalOptions = {
|
|
603
|
+
workspaceRoot: process.cwd(),
|
|
604
|
+
name: verticalInput.name,
|
|
605
|
+
modernVersion: version,
|
|
606
|
+
enableTailwind: detectExplicitTailwindFlag(),
|
|
607
|
+
overlays,
|
|
608
|
+
packageSource: overridePackageSource
|
|
609
|
+
};
|
|
610
|
+
if (dryRun) return void console.log(JSON.stringify((0, external_ultramodern_workspace_index_cjs_namespaceObject.planUltramodernVertical)(verticalOptions), null, 2));
|
|
611
|
+
(0, external_ultramodern_workspace_index_cjs_namespaceObject.addUltramodernVertical)(verticalOptions);
|
|
612
|
+
const dim = '\x1b[2m\x1b[3m';
|
|
613
|
+
const reset = '\x1b[0m';
|
|
614
|
+
console.log(`${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.success)}\n`);
|
|
615
|
+
console.log(`${dim} pnpm check${reset}\n`);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
const { name: projectName, useCurrentDir } = await getProjectName();
|
|
619
|
+
const targetDir = useCurrentDir ? process.cwd() : external_node_path_default().isAbsolute(projectName) ? projectName : external_node_path_default().resolve(process.cwd(), projectName);
|
|
620
|
+
const generatedPackageName = useCurrentDir || external_node_path_default().isAbsolute(projectName) ? external_node_path_default().basename(targetDir) : projectName;
|
|
621
|
+
if (external_node_fs_default().existsSync(targetDir)) {
|
|
622
|
+
const files = external_node_fs_default().readdirSync(targetDir);
|
|
623
|
+
if (files.length > 0) {
|
|
624
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.directoryExists, {
|
|
625
|
+
projectName
|
|
626
|
+
}));
|
|
627
|
+
process.exit(1);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
const packageSource = resolveWorkspacePackageSource(args, createPackage, detectUltramodernPackageSource(args, ultramodernPackageVersion, createPackage));
|
|
631
|
+
(0, external_ultramodern_workspace_index_cjs_namespaceObject.generateUltramodernWorkspace)({
|
|
632
|
+
targetDir,
|
|
633
|
+
packageName: generatedPackageName,
|
|
634
|
+
modernVersion: version,
|
|
635
|
+
enableTailwind: detectTailwindFlag(),
|
|
636
|
+
overlays,
|
|
637
|
+
packageSource
|
|
638
|
+
});
|
|
639
|
+
initializeGeneratedGitRepository(targetDir);
|
|
640
|
+
const dim = '\x1b[2m\x1b[3m';
|
|
641
|
+
const reset = '\x1b[0m';
|
|
642
|
+
console.log(`${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.success)}\n`);
|
|
643
|
+
console.log(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.nextSteps));
|
|
644
|
+
if (!useCurrentDir) console.log(`${dim} ${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.step1, {
|
|
645
|
+
projectName
|
|
646
|
+
})}${reset}`);
|
|
647
|
+
console.log(`${dim} ${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.step2)}${reset}`);
|
|
648
|
+
console.log(`${dim} pnpm check${reset}`);
|
|
649
|
+
console.log(`${dim} ${index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.message.step3)}${reset}\n`);
|
|
650
|
+
}
|
|
651
|
+
main().catch((error)=>{
|
|
652
|
+
console.error(index_cjs_namespaceObject.i18n.t(index_cjs_namespaceObject.localeKeys.error.createFailed), error);
|
|
653
|
+
process.exit(1);
|
|
654
|
+
});
|
|
655
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
656
|
+
Object.defineProperty(exports, '__esModule', {
|
|
657
|
+
value: true
|
|
658
|
+
});
|