Skip to content

--public mode seeds the server-root landing page into the served directory (namespace pollution for servejss / serve use case) #578

Description

@melvincarvalho

Problem

Since the #433/#435 landing-page work, startup seeds /index.html, /.acl, and /index.html.acl into DATA_ROOT (skip-if-exists). This also happens in --public mode, where:

For the serve-a-directory use case that --public was created for (#107 explicitly lists the jsserve wrapper as a primary motivation: "use JSS as a simple 'just serve this folder' tool like npx serve"), this writes three files into the user's project directory.

Reproduced with jss start --root <dir> --public on 0.0.210: the served tree gains index.html, .acl, index.html.acl. This regressed servejss's "like serve" behaviour — early JSS versions left the served directory untouched.

Fix

Skip seedServerRoot when options.public is set, alongside the existing read-only skip (src/server.js). Operators who want a landing page in public mode can still create /index.html by hand — skip-if-exists already honours it. Regression tests in test/server-root.test.js (public mode seeds nothing; container listing + file reads still work).

The two features were built for disjoint audiences — the landing page for pod providers (#276 / #303: "new pod providers had to build a landing page from scratch"), --public for serve-style file serving (#107) — and no point in the #276#435 design history considered the --public case, so the collision is an oversight rather than a decision.

Considered alternatives

  • Explicit --no-root-page flag — leaves bare jss --public polluted by default (the exact complaint) and adds plumbing; explicitness only helps when the default is right.
  • servejss deletes seeded files post-start — racy, churns file watchers, risks deleting a legitimate user-owned index.html unless it fingerprints the template.
  • Virtual (never-written) landing page — the deeper Default index.html for server root #276 redesign; orthogonal and can layer on later, at which point the public-mode skip becomes redundant rather than wrong.

Refs #107, #276, #433, #435, #459, #108.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions