Skip to content

Commit 65f4650

Browse files
fix: seed pod files skip-if-exists so user edits survive restarts
seedPodFiles() copied welcome.html (as index.html), signin, account and docs pages into the pod root unconditionally on every start, silently clobbering any edits the pod owner had made to those files. Seed them only when the destination does not exist, the same skip-if-exists behaviour JSS uses for its root landing page (and the same rule this function already applied to links.jsonld and apps/).
1 parent b217774 commit 65f4650

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/start.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,22 +131,23 @@ function shouldAutoOpen() {
131131
}
132132

133133
// Seed jspod-owned pages into the running pod's root once JSS has
134-
// finished its init. Same overwrite/skip-if-exists matrix as the
135-
// pre-refactor CLI implementation — unchanged behaviour.
134+
// finished its init. All seeding is skip-if-exists, matching JSS's own
135+
// root-landing-page seeding: a pod owner who edits index.html (or any
136+
// other seeded page) must not have it clobbered on the next start.
136137
function seedPodFiles(root) {
137138
try {
138-
const overwrite = [
139+
const seed = [
139140
'welcome.html', // becomes pod-data/index.html
140141
'signin.html', 'signin.html.acl',
141142
'account.html', 'account.html.acl',
142143
'docs.html', 'docs.html.acl'
143144
];
144-
for (const name of overwrite) {
145+
for (const name of seed) {
145146
const src = join(PACKAGE_ROOT, name);
146147
// welcome.html maps onto index.html; everything else is a passthrough
147148
const destName = name === 'welcome.html' ? 'index.html' : name;
148149
const dst = join(root, destName);
149-
if (existsSync(src)) copyFileSync(src, dst);
150+
if (existsSync(src) && !existsSync(dst)) copyFileSync(src, dst);
150151
}
151152

152153
const linksSrc = join(PACKAGE_ROOT, 'links.jsonld');

0 commit comments

Comments
 (0)