@qinghuangniao/heron-connect 1.1.50 → 1.2.0
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/package.json +1 -1
- package/release-assets.js +26 -0
package/package.json
CHANGED
package/release-assets.js
CHANGED
|
@@ -57,10 +57,36 @@ function buildReleaseAssets() {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// The archives embed web/dist (web/embed.go), which is gitignored — so a stale
|
|
61
|
+
// bundle in the working tree is invisible to git and would ship silently. The
|
|
62
|
+
// normal path never takes the shortcut across versions (archives are named by
|
|
63
|
+
// version), but re-running a publish for the SAME version does, and there the
|
|
64
|
+
// bundle could be newer than the archives. Refuse rather than ship stale UI.
|
|
65
|
+
function assertBundleNotNewerThanArchives() {
|
|
66
|
+
const bundle = path.join(ROOT_DIR, "web", "dist", "index.html");
|
|
67
|
+
if (!fs.existsSync(bundle)) {
|
|
68
|
+
console.log("[release-assets] web/dist missing — frontend will be rebuilt");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const archive = path.join(DIST_DIR, expectedArchives()[0]);
|
|
72
|
+
if (!fs.existsSync(archive)) return;
|
|
73
|
+
|
|
74
|
+
const bundleTime = fs.statSync(bundle).mtimeMs;
|
|
75
|
+
const archiveTime = fs.statSync(archive).mtimeMs;
|
|
76
|
+
if (bundleTime > archiveTime) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`web/dist (${new Date(bundleTime).toISOString()}) is newer than the release archives ` +
|
|
79
|
+
`(${new Date(archiveTime).toISOString()}). The archives embed the OLD frontend. ` +
|
|
80
|
+
`Remove dist/ and re-run so the bundle is rebuilt into the binaries, e.g.: rm -rf dist && make publish`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
60
85
|
function ensureLocalAssets() {
|
|
61
86
|
const missing = missingFiles(DIST_DIR, expectedDistFiles());
|
|
62
87
|
if (missing.length === 0) {
|
|
63
88
|
console.log(`[release-assets] Local release assets already exist in ${DIST_DIR}`);
|
|
89
|
+
if (process.argv[3] !== "--skip-bundle-check") assertBundleNotNewerThanArchives();
|
|
64
90
|
return;
|
|
65
91
|
}
|
|
66
92
|
|