mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
fix: dev stages local plugin builds on paths with spaces and builds them with the local SDK
This commit is contained in:
1 parent
878f1ebaa3
commit
4511cc0a42
4 files changed
+76
-8
No files matched your search
@@ -299,14 +299,37 @@ function newestMtime(target) {
|
||||
}
|
||||
|
||||
/** True when a plugin repo has never been built or its sources changed since. */
|
||||
function isLocalBuildStale(repo) {
|
||||
/** The SDK CLI in this checkout, which dev builds local plugins with. */
|
||||
const LOCAL_SDK_CLI = path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
"packages",
|
||||
"plugin-sdk",
|
||||
"cli",
|
||||
);
|
||||
|
||||
/**
|
||||
* True when the build is missing, a source is newer than it, or the SDK CLI
|
||||
* that builds it changed since (sdkCli, when given).
|
||||
*/
|
||||
function isLocalBuildStale(repo, sdkCli) {
|
||||
const built = newestMtime(path.join(repo, "dist"));
|
||||
if (!built) return true;
|
||||
if (sdkCli && newestMtime(sdkCli) > built) return true;
|
||||
return BUILD_INPUTS.some(
|
||||
(entry) => newestMtime(path.join(repo, entry)) > built,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The command that builds a plugin repo with this checkout's SDK instead of
|
||||
* the published one in its node_modules, so SDK edits apply right away.
|
||||
*/
|
||||
function localSdkBuildCommand() {
|
||||
return [process.execPath, [path.join(LOCAL_SDK_CLI, "index.mjs"), "build"]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds each plugin repo whose build is missing or out of date. ids limits
|
||||
* it to those plugins; null builds every one.
|
||||
@@ -325,7 +348,8 @@ function rebuildLocalPlugins(dir, ids, run) {
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
if ((ids && !ids.has(id)) || !isLocalBuildStale(repo)) continue;
|
||||
if ((ids && !ids.has(id)) || !isLocalBuildStale(repo, LOCAL_SDK_CLI))
|
||||
continue;
|
||||
run(repo, id);
|
||||
rebuilt.push(id);
|
||||
}
|
||||
@@ -346,6 +370,7 @@ function copyLocalBuild(repo, destination) {
|
||||
module.exports = {
|
||||
findLocalPluginBuilds,
|
||||
isLocalBuildStale,
|
||||
localSdkBuildCommand,
|
||||
rebuildLocalPlugins,
|
||||
copyLocalBuild,
|
||||
parseBundledPlugins,
|
||||
|
||||
Reference in new issue
Block a user