Publish a site, page, report, dashboard, slide deck, document, portfolio or small web app at a ShipStatic link anyone can open, with no account needed and optional built-in password protection...
Publish when the user has asked for something to be online. If they want to see a draft first, show it and publish when they say so.
Publishing needs no account. Don't ask the user to sign in, connect anything, create an account or give a key before publishing. Most sites are published with no account, and that is the normal way, not a fallback.
Many people who publish with ShipStatic aren't developers. They made something, often with your help, and they want a link they can share.
npx -y @shipstatic/ship@3 <folder> --json, for a folder on
disk.deployments_upload tool,
for files you send in the call.index.html at the
top, such as dist/, build/ or out/. Publish that folder. If the user
names a folder, publish that one as it is.index.html at the top of the
folder, with the files it uses beside it. It's the page visitors see first,
and a site without one is refused. If a build makes a server app
instead (no index.html), don't publish it: say ShipStatic publishes sites
that run in the browser, not apps that need their own server, and offer to
change the project so it can be published that way. Don't change the
project's settings without asking.index.html that shows it or links to it, and publish
that folder.index.html at the top. Never write them into an existing folder
such as dist/ or the project's own files: that overwrites the user's work
and publishes files that don't belong to the new site.index.html at the top of what you publish: it's the page visitors
see first. Link pages and files to each other with relative paths.index.html with its CSS and
JavaScript inside it, unless the user wants separate files. Charts and
tables can be drawn with inline SVG, HTML and CSS.Choose the way:
encoding: "base64".Then:
whoami or any other
ShipStatic tool, don't run ship whoami or ship config, don't add
--token, and don't start a sign-in.ttl) or a domain unless the user asks for one. Both
need an account.--password <password> on the CLI, or password on
the upload. It works with no account, and it is checked before any file is
served. Don't build a password page or script into the site. Make up a new
password that is hard to guess, unless the user chose one. Never ask for a
password the user already uses somewhere else.authentication_failed, the key it used was refused.
Tell the user their saved ShipStatic key didn't work, and how to replace it
with a new key from
https://my.shipstatic.com/api-key, where it is set: in SHIP_TOKEN if that
is set (it comes first), otherwise by running
npx -y @shipstatic/ship@3 config. Then stop: don't publish another way,
with no account or through the upload, unless the user asks. Another way can
put the site in another account, or in none.Both ways return the same fields for a published site. Read them; never
decide from whether you are connected, or from which way you used. (A domain
request returns the domain instead: report its status as it is.)
The claim link says who owns the site, and expires says whether it
expires.
The result has a claim link (the usual case): the site has no account.
Give the link (url), say it stays up for 3 days, and give the claim link:
opening it and signing in keeps the site for good. For example:
Your site is live: https://example-site-abc1234.shipstatic.com It stays up for 3 days. To keep it, open https://my.shipstatic.com/claim/… and sign in.
The result has no claim link: the site is already in the user's
ShipStatic account. Give the link. If expires is not null, say when it
expires; if it is null, it stays until they delete it. The result doesn't
say which account, so don't guess.
The result has password: true: the site asks for a password before
showing anything. Say so, and give the password if you set one: a password
the user never sees locks them out.
Keep the reply short. The links matter more than a summary of the files.
Something published doesn't change. To change it, publish again: the user gets a new link, and the earlier one keeps working until it expires. Say which link is the new one, and that the claim link of the version they want to keep is the one to open.
If the request needs a server (an API, a database, sign-in for the people who open the link), say that ShipStatic publishes sites that run in the browser, and that this part needs a server it doesn't run. Offer a version that works without one, if one would do the job.
Bring up an account only when the user asks to see or manage what they have published, to use their own domain, or to publish into their account. The two ways are set up separately:
npx -y @shipstatic/ship@3 config, with an API key from
https://my.shipstatic.com/api-key.