@fluid-app/fluid-cli-portal 0.1.51 → 0.1.52
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/dist/index.mjs +30 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -95,9 +95,9 @@ async function promptProjectConfig(projectName, options) {
|
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/utils/file-system.ts
|
|
97
97
|
const _currentDir$1 = dirname(fileURLToPath(import.meta.url));
|
|
98
|
-
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.
|
|
98
|
+
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.461";
|
|
99
99
|
const EMBEDDED_CLI_CORE_VERSION = "0.1.14";
|
|
100
|
-
const EMBEDDED_CLI_PORTAL_VERSION = "0.1.
|
|
100
|
+
const EMBEDDED_CLI_PORTAL_VERSION = "0.1.52";
|
|
101
101
|
/**
|
|
102
102
|
* Find the package root by walking up from the current directory to the nearest package.json.
|
|
103
103
|
* Works whether running from dist/ (bundled) or src/utils/ (tsx dev mode).
|
|
@@ -1172,6 +1172,29 @@ function hasPortalContent(cwd) {
|
|
|
1172
1172
|
return existsSync(join(cwd, PORTAL_DIR$1, "definition.json"));
|
|
1173
1173
|
}
|
|
1174
1174
|
/**
|
|
1175
|
+
* Preflight check: does `<cwd>/node_modules` actually contain what this
|
|
1176
|
+
* command is about to `import()` (`vite`) and inject into the config
|
|
1177
|
+
* (`@fluid-app/portal-sdk`, pulled in transitively by the vite plugins)?
|
|
1178
|
+
*
|
|
1179
|
+
* Without this, a project whose install failed or was never run (no
|
|
1180
|
+
* `node_modules` at all) produces a cascade of confusing failures instead
|
|
1181
|
+
* of one clear message: `createServer()` below throws "failed to load
|
|
1182
|
+
* config from .../vite.config.ts", we catch that and warn "falling back to
|
|
1183
|
+
* `vite`", and the fallback then dies with a raw
|
|
1184
|
+
* `ERR_MODULE_NOT_FOUND: Cannot find package 'vite'` — never once saying
|
|
1185
|
+
* the actual problem is a missing `pnpm install`.
|
|
1186
|
+
*/
|
|
1187
|
+
function checkDependenciesInstalled(cwd) {
|
|
1188
|
+
const nodeModulesPath = join(cwd, "node_modules");
|
|
1189
|
+
const hasVite = existsSync(join(nodeModulesPath, "vite"));
|
|
1190
|
+
const hasPortalSdk = existsSync(join(nodeModulesPath, "@fluid-app", "portal-sdk"));
|
|
1191
|
+
if (existsSync(nodeModulesPath) && hasVite && hasPortalSdk) return { ok: true };
|
|
1192
|
+
return {
|
|
1193
|
+
ok: false,
|
|
1194
|
+
message: `Dependencies aren't installed in ${cwd} — run \`pnpm install\` (or reopen the project in Mist Desktop, which installs automatically), then retry.`
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1175
1198
|
* Attempt to auto-pull portal content by invoking the pull command's action.
|
|
1176
1199
|
* Falls back to a helpful error message if pull is not possible.
|
|
1177
1200
|
*/
|
|
@@ -1205,6 +1228,11 @@ const devCommand = new Command("dev").description("Start the development server
|
|
|
1205
1228
|
console.error(chalk.yellow("This command must be run from a Fluid project directory"));
|
|
1206
1229
|
process.exit(1);
|
|
1207
1230
|
}
|
|
1231
|
+
const depsCheck = checkDependenciesInstalled(cwd);
|
|
1232
|
+
if (!depsCheck.ok) {
|
|
1233
|
+
console.error(chalk.red(`Error: ${depsCheck.message}`));
|
|
1234
|
+
process.exit(1);
|
|
1235
|
+
}
|
|
1208
1236
|
if (!hasPortalContent(cwd) && !options.skipPull) {
|
|
1209
1237
|
if (!await autoPull(cwd)) {
|
|
1210
1238
|
console.error(chalk.red("Cannot start dev server without portal content."));
|