@trops/dash-core 0.1.881 → 0.1.882
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/electron/index.js +51 -3
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -101711,12 +101711,41 @@ function writeWidgetMetadataVersion(pkgJsonPath, dashJsonPath, version) {
|
|
|
101711
101711
|
function packageJsonFromDashJson(dashJson, scope, packageId, fallbackAuthor) {
|
|
101712
101712
|
const m = String(dashJson.name || "").match(/^@[^/]+\/(.+)$/);
|
|
101713
101713
|
const bareName = m ? m[1] : dashJson.name || "";
|
|
101714
|
-
|
|
101714
|
+
const pkg = {
|
|
101715
101715
|
name: bareName ? `@${scope}/${bareName}` : packageId,
|
|
101716
101716
|
version: dashJson.version || "1.0.0",
|
|
101717
101717
|
description: dashJson.description || "",
|
|
101718
101718
|
author: dashJson.author || fallbackAuthor || "",
|
|
101719
101719
|
};
|
|
101720
|
+
if (dashJson.displayName) pkg.displayName = dashJson.displayName;
|
|
101721
|
+
return pkg;
|
|
101722
|
+
}
|
|
101723
|
+
|
|
101724
|
+
/**
|
|
101725
|
+
* A package.json that lacks what publishing needs — e.g. one holding only
|
|
101726
|
+
* the `dash.permissions` block an earlier publish's permission scan wrote
|
|
101727
|
+
* where there was no package.json — gets the missing fields from dash.json.
|
|
101728
|
+
* Fields package.json has are kept.
|
|
101729
|
+
*/
|
|
101730
|
+
function fillFromDashJson(pkgJson, dashJson, scope, packageId, fallbackAuthor) {
|
|
101731
|
+
if (!dashJson) return pkgJson;
|
|
101732
|
+
const from = packageJsonFromDashJson(
|
|
101733
|
+
dashJson,
|
|
101734
|
+
scope,
|
|
101735
|
+
packageId,
|
|
101736
|
+
fallbackAuthor,
|
|
101737
|
+
);
|
|
101738
|
+
const out = { ...pkgJson };
|
|
101739
|
+
for (const key of [
|
|
101740
|
+
"name",
|
|
101741
|
+
"version",
|
|
101742
|
+
"description",
|
|
101743
|
+
"author",
|
|
101744
|
+
"displayName",
|
|
101745
|
+
]) {
|
|
101746
|
+
if (!out[key] && from[key]) out[key] = from[key];
|
|
101747
|
+
}
|
|
101748
|
+
return out;
|
|
101720
101749
|
}
|
|
101721
101750
|
|
|
101722
101751
|
// ─── Orchestration ───────────────────────────────────────────────────────────
|
|
@@ -101802,9 +101831,28 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
|
|
|
101802
101831
|
|
|
101803
101832
|
// 3. Read package.json (or fall back to dash.json for registry-installed widgets)
|
|
101804
101833
|
const pkgJsonPath = path$2.join(widget.path, "package.json");
|
|
101834
|
+
// package.json, with what it lacks taken from dash.json.
|
|
101835
|
+
const readPkgJson = () => {
|
|
101836
|
+
const own = JSON.parse(fs$2.readFileSync(pkgJsonPath, "utf8"));
|
|
101837
|
+
let dashJson = null;
|
|
101838
|
+
try {
|
|
101839
|
+
if (fs$2.existsSync(dashJsonPath)) {
|
|
101840
|
+
dashJson = JSON.parse(fs$2.readFileSync(dashJsonPath, "utf8"));
|
|
101841
|
+
}
|
|
101842
|
+
} catch (_e) {
|
|
101843
|
+
dashJson = null;
|
|
101844
|
+
}
|
|
101845
|
+
return fillFromDashJson(
|
|
101846
|
+
own,
|
|
101847
|
+
dashJson,
|
|
101848
|
+
callerScope,
|
|
101849
|
+
packageId,
|
|
101850
|
+
profile?.displayName,
|
|
101851
|
+
);
|
|
101852
|
+
};
|
|
101805
101853
|
let pkgJson;
|
|
101806
101854
|
if (fs$2.existsSync(pkgJsonPath)) {
|
|
101807
|
-
pkgJson =
|
|
101855
|
+
pkgJson = readPkgJson();
|
|
101808
101856
|
} else if (fs$2.existsSync(dashJsonPath)) {
|
|
101809
101857
|
// Registry-installed widgets only have dash.json — synthesize
|
|
101810
101858
|
// the fields the publish flow needs from it.
|
|
@@ -101843,7 +101891,7 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
|
|
|
101843
101891
|
// Re-read pkgJson so subsequent steps in this function see the
|
|
101844
101892
|
// updated manifest (the version bump below uses pkgJson too).
|
|
101845
101893
|
if (fs$2.existsSync(pkgJsonPath)) {
|
|
101846
|
-
pkgJson =
|
|
101894
|
+
pkgJson = readPkgJson();
|
|
101847
101895
|
}
|
|
101848
101896
|
}
|
|
101849
101897
|
} catch (e) {
|