@somewhere-cloud/cli 0.38.131 → 0.38.133

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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.38.133
2
+
3
+ - `somewhere deploy` no longer checks types again when no file changed since the folder's last deploy; it says so and the platform reports that nothing changed. A no-change deploy no longer waits on a TypeScript download.
4
+ - New starters list `typescript` 5.9.3 as a devDependency, so `somewhere init` installs it and deploys check types without fetching TypeScript with npx. In an older app, `npm install -D typescript@5.9.3` does the same; the npx notice now says so.
5
+ - The starter's `tests/app-check.mjs` finds the notes form and list by `data-testid` (`note-title`, `note-save`, `note-item`), which the starter's notes view now carries, so renaming a button or label no longer breaks the check.
6
+ - After a live deploy whose answer includes `checks`, the CLI reads the deploy log every 3 s for up to 45 s and prints the access check's sentence as `Checks: ...` (with `--json`, the result includes `access_check`). It never changes the exit code.
7
+
8
+ ## 0.38.132
9
+
10
+ - `somewhere open --dashboard` opens the dashboard at https://somewhere.cloud/app, and the sign-up link the CLI prints is https://somewhere.cloud/app/sign-in?intent=signup.
11
+
1
12
  ## 0.38.131
2
13
 
3
14
  - The claim link is called a claim link everywhere the CLI prints it (`somewhere claim` prints `Claim link:`). New claim links read `https://somewhere.cloud/claim/<code>`.
@@ -37601,7 +37601,7 @@ var init_auth2 = __esm({
37601
37601
  __name(readAuthToken, "readAuthToken");
37602
37602
  __name(readPasswordExportCode, "readPasswordExportCode");
37603
37603
  __name(createProtectedOutput, "createProtectedOutput");
37604
- SIGNUP_URL = "https://somewhere.cloud/auth?intent=signup";
37604
+ SIGNUP_URL = "https://somewhere.cloud/app/sign-in?intent=signup";
37605
37605
  SIGNUP_HINT = `New here? Create an account: ${SIGNUP_URL}`;
37606
37606
  __name(describeScope, "describeScope");
37607
37607
  __name(loginIntroLines, "loginIntroLines");
@@ -38595,6 +38595,7 @@ var init_init_green_template = __esm({
38595
38595
  "dist/lib/init-green-template.js"() {
38596
38596
  "use strict";
38597
38597
  init_version();
38598
+ init_typecheck_version();
38598
38599
  init_scaffold();
38599
38600
  init_init_scaffold();
38600
38601
  init_init_agent_guide();
@@ -38616,7 +38617,8 @@ var init_init_green_template = __esm({
38616
38617
  },
38617
38618
  "devDependencies": {
38618
38619
  "@types/react": "19.2.2",
38619
- "@types/react-dom": "19.2.2"
38620
+ "@types/react-dom": "19.2.2",
38621
+ "typescript": "${TYPECHECK_TYPESCRIPT_VERSION}"
38620
38622
  },
38621
38623
  "allowScripts": {
38622
38624
  "esbuild": true
@@ -41090,10 +41092,10 @@ try {
41090
41092
  }, { requires: needsSignup });
41091
41093
  ${privateData ? ` await app.check('a note stays private to its owner', async (at) => {
41092
41094
  const secret = 'private ' + crypto.randomUUID();
41093
- at('Create the first person\u2019s note');
41094
- await ana.page.getByLabel('Title').fill(secret);
41095
- await ana.page.getByRole('button', { name: 'Add note' }).click();
41096
- await ana.page.getByRole('heading', { name: secret }).waitFor();
41095
+ at('Create the first person\u2019s note'); // found by data-testid, not words: keep note-title, note-save and note-item when renaming
41096
+ await ana.page.getByTestId('note-title').fill(secret);
41097
+ await ana.page.getByTestId('note-save').click();
41098
+ await ana.page.getByTestId('note-item').filter({ hasText: secret }).waitFor();
41097
41099
  const seen = captureResponses(ben.page);
41098
41100
  try {
41099
41101
  await ben.page.reload();
@@ -42983,6 +42985,7 @@ var init_init_feature_template = __esm({
42983
42985
  init_init_test_template();
42984
42986
  init_scaffold();
42985
42987
  init_version();
42988
+ init_typecheck_version();
42986
42989
  init_init_asset_types();
42987
42990
  init_init_scaffold();
42988
42991
  init_init_agent_guide();
@@ -43004,7 +43007,8 @@ var init_init_feature_template = __esm({
43004
43007
  },
43005
43008
  "devDependencies": {
43006
43009
  "@types/react": "19.2.2",
43007
- "@types/react-dom": "19.2.2"
43010
+ "@types/react-dom": "19.2.2",
43011
+ "typescript": "${TYPECHECK_TYPESCRIPT_VERSION}"
43008
43012
  },
43009
43013
  "allowScripts": {
43010
43014
  "esbuild": true
@@ -44949,7 +44953,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
44949
44953
  <h1 id="note-form-title" className="panel__title">{editing ? 'Edit note' : 'New note'}</h1>
44950
44954
  <div className="field">
44951
44955
  <label htmlFor="note-title">Title</label>
44952
- <input id="note-title" name="title" required value={draft.title}
44956
+ <input id="note-title" name="title" required value={draft.title} data-testid="note-title"
44953
44957
  aria-invalid={draftErrors.title ? true : undefined}
44954
44958
  aria-describedby={draftErrors.title ? 'note-title-error' : undefined}
44955
44959
  onChange={(event) => notes.setDraft({ ...draft, title: event.target.value })} />
@@ -44964,7 +44968,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
44964
44968
  {draftErrors.body ? <p id="note-body-error" className="error">{draftErrors.body}</p> : null}
44965
44969
  </div>
44966
44970
  <div className="actions">
44967
- <button type="submit" className="button" disabled={!notes.canSave} aria-busy={notes.saving}>
44971
+ <button type="submit" className="button" disabled={!notes.canSave} aria-busy={notes.saving} data-testid="note-save">
44968
44972
  {notes.saving ? 'Saving\u2026' : notes.retryingCreate ? 'Retry original save' : editing ? 'Save changes' : 'Add note'}
44969
44973
  </button>
44970
44974
  {editing ? <button type="button" className="button button--quiet" onClick={notes.cancelEdit} disabled={notes.saving}>Cancel</button> : null}
@@ -44986,7 +44990,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
44986
44990
  {notes.status === 'ready' && notes.notes.length > 0 ? (
44987
44991
  <ul className="note-list">
44988
44992
  {notes.notes.map((note) => (
44989
- <li key={note.id} className="note" aria-current={note.id === notes.editingId ? 'true' : undefined}>
44993
+ <li key={note.id} className="note" aria-current={note.id === notes.editingId ? 'true' : undefined} data-testid="note-item">
44990
44994
  <div className="note__text">
44991
44995
  <h3 className="note__title"><a {...linkTo('/things/' + note.id)}>{note.title}</a></h3>
44992
44996
  {note.body ? <p className="note__body">{note.body}</p> : null}
@@ -45119,7 +45123,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
45119
45123
  <form onSubmit={onSubmit} noValidate>
45120
45124
  <p>
45121
45125
  <label htmlFor="note-title">Title</label><br />
45122
- <input id="note-title" name="title" required value={draft.title} aria-invalid={draftErrors.title ? true : undefined}
45126
+ <input id="note-title" name="title" required value={draft.title} data-testid="note-title" aria-invalid={draftErrors.title ? true : undefined}
45123
45127
  onChange={(event) => notes.setDraft({ ...draft, title: event.target.value })} />
45124
45128
  {draftErrors.title ? <span role="alert"> {draftErrors.title}</span> : null}
45125
45129
  </p>
@@ -45129,7 +45133,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
45129
45133
  onChange={(event) => notes.setDraft({ ...draft, body: event.target.value })} />
45130
45134
  {draftErrors.body ? <span role="alert"> {draftErrors.body}</span> : null}
45131
45135
  </p>
45132
- <button type="submit" disabled={!notes.canSave} aria-busy={notes.saving}>
45136
+ <button type="submit" disabled={!notes.canSave} aria-busy={notes.saving} data-testid="note-save">
45133
45137
  {notes.saving ? 'Saving\u2026' : notes.retryingCreate ? 'Retry original save' : editing ? 'Save changes' : 'Add note'}
45134
45138
  </button>{' '}
45135
45139
  {editing ? <button type="button" onClick={notes.cancelEdit}>Cancel</button> : null}
@@ -45141,7 +45145,7 @@ export function NotesBoard({ notes }: { notes: NotesController }) {
45141
45145
  {notes.status === 'ready' && notes.notes.length === 0 ? <EmptyState title="No notes yet." /> : null}
45142
45146
  <ul>
45143
45147
  {notes.notes.map((note) => (
45144
- <li key={note.id}>
45148
+ <li key={note.id} data-testid="note-item">
45145
45149
  <strong><a {...linkTo('/things/' + note.id)}>{note.title}</a></strong> {note.body}{' '}
45146
45150
  <button type="button" onClick={() => notes.startEdit(note)} aria-label={'Edit ' + note.title}>Edit</button>{' '}
45147
45151
  <button type="button" onClick={() => void notes.remove(note)} disabled={notes.removingId === note.id} aria-label={'Delete ' + note.title}>Delete</button>
@@ -73149,7 +73153,7 @@ function runTypecheck(projectDir, options2 = {}) {
73149
73153
  return runTypecheckWith(projectDir, command, args, via, declaredData).then(withContract);
73150
73154
  }
73151
73155
  function announceNpxTypeScriptFetch(version2) {
73152
- process.stderr.write(`TypeScript is not installed in this project; fetching typescript@${version2} with npx (needs the npm registry; npm keeps it in its cache). Nothing is installed into the project.
73156
+ process.stderr.write(`TypeScript is not installed in this project; fetching typescript@${version2} with npx (needs the npm registry; npm keeps it in its cache). Nothing is installed into the project. To skip this fetch on every check: npm install -D typescript@${version2}
73153
73157
  `);
73154
73158
  }
73155
73159
  function typecheckCompilerSource(projectDir) {
@@ -76249,6 +76253,56 @@ var init_typecheck2 = __esm({
76249
76253
  }
76250
76254
  });
76251
76255
 
76256
+ // dist/lib/deploy-checks.js
76257
+ function parseChecksRead(read) {
76258
+ const match = /^GET\s+(\/\S+)$/.exec(read.trim());
76259
+ if (!match)
76260
+ return null;
76261
+ const url3 = new URL(match[1], "https://api.invalid");
76262
+ return { path: url3.pathname.replace(/^\/v1(?=\/)/, ""), query: Object.fromEntries(url3.searchParams) };
76263
+ }
76264
+ async function awaitDeployChecks(client, checks, opts = {}) {
76265
+ const target = typeof checks.read === "string" ? parseChecksRead(checks.read) : null;
76266
+ if (!target)
76267
+ return null;
76268
+ const now2 = opts.now ?? Date.now;
76269
+ const sleep3 = opts.sleep ?? ((ms2) => new Promise((r) => setTimeout(r, ms2)));
76270
+ const pollMs = opts.pollMs ?? DEPLOY_CHECKS_POLL_MS;
76271
+ const deadline = now2() + (opts.waitMs ?? DEPLOY_CHECKS_WAIT_MS);
76272
+ let last = null;
76273
+ for (; ; ) {
76274
+ try {
76275
+ const read = await client.call("GET", target.path, void 0, target.query, { timeoutMs: Math.max(1e3, deadline - now2()) });
76276
+ if (read?.access_check)
76277
+ last = read.access_check;
76278
+ if (last && last.status !== "pending")
76279
+ return last;
76280
+ } catch {
76281
+ }
76282
+ if (now2() + pollMs > deadline)
76283
+ return last;
76284
+ await sleep3(pollMs);
76285
+ }
76286
+ }
76287
+ function formatDeployChecksLine(check2) {
76288
+ if (!check2 || check2.status === "pending")
76289
+ return DEPLOY_CHECKS_STILL_RUNNING;
76290
+ return check2.sentence ? `Checks: ${check2.sentence}` : null;
76291
+ }
76292
+ var DEPLOY_CHECKS_WAIT_MS, DEPLOY_CHECKS_POLL_MS, DEPLOY_CHECKS_STILL_RUNNING;
76293
+ var init_deploy_checks = __esm({
76294
+ "dist/lib/deploy-checks.js"() {
76295
+ "use strict";
76296
+ init_cli_invocation();
76297
+ DEPLOY_CHECKS_WAIT_MS = 45e3;
76298
+ DEPLOY_CHECKS_POLL_MS = 3e3;
76299
+ __name(parseChecksRead, "parseChecksRead");
76300
+ __name(awaitDeployChecks, "awaitDeployChecks");
76301
+ DEPLOY_CHECKS_STILL_RUNNING = `Checks: still running; \`${cliInvocation()} call project_deploy_log '{}'\` shows the result.`;
76302
+ __name(formatDeployChecksLine, "formatDeployChecksLine");
76303
+ }
76304
+ });
76305
+
76252
76306
  // dist/lib/base-files.js
76253
76307
  import { createHash as createHash4 } from "node:crypto";
76254
76308
  import { existsSync as existsSync17, mkdirSync as mkdirSync10, readFileSync as readFileSync18, rmSync as rmSync5, writeFileSync as writeFileSync13 } from "node:fs";
@@ -82141,6 +82195,16 @@ function findProjectConfigEntry(targetDir) {
82141
82195
  return null;
82142
82196
  return loadProjectConfigEntry();
82143
82197
  }
82198
+ function unchangedSinceLastPublish(entry, targetDir, hashes) {
82199
+ if (!entry || resolve15(entry.dir) !== resolve15(targetDir))
82200
+ return false;
82201
+ const projectId = entry.config.project_id;
82202
+ const base = loadBaseFiles(targetDir, projectId, readSourceBase(entry.config, projectId)?.releaseId);
82203
+ if (!base)
82204
+ return false;
82205
+ const paths = Object.keys(hashes);
82206
+ return paths.length === Object.keys(base.files).length && paths.every((path3) => base.files[path3] === hashes[path3]);
82207
+ }
82144
82208
  function temporarySessionExpired(session, nowMs = Date.now()) {
82145
82209
  if (!session?.temp_expires_at)
82146
82210
  return false;
@@ -82205,22 +82269,6 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82205
82269
  const runTestsAfter = Boolean(opts.test && !opts.dryRun);
82206
82270
  if (runTestsAfter)
82207
82271
  process.stderr.write("deploy --test: the documented form is `somewhere deploy && somewhere test`; --test still runs somewhere test once after a successful deploy.\n");
82208
- let typecheckMs = 0;
82209
- const typecheckStartedAt = performance.now();
82210
- const hasTsconfig = existsSync28(join33(targetDir, "tsconfig.json"));
82211
- const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
82212
- const checkingTypes = hasTsconfig && !missingDependencies;
82213
- if (checkingTypes && typecheckCompilerSource(targetDir) === "npx") {
82214
- announceNpxTypeScriptFetch(TYPECHECK_TYPESCRIPT_VERSION);
82215
- }
82216
- const typecheckHeartbeat = checkingTypes && !opts.json ? setInterval(() => {
82217
- process.stderr.write(`Still checking types before upload after ${formatDeployElapsed(performance.now() - typecheckStartedAt)}...
82218
- `);
82219
- }, deployHeartbeatMs()).unref() : void 0;
82220
- const typecheck = checkingTypes ? runTypecheck(targetDir).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
82221
- clearInterval(typecheckHeartbeat);
82222
- typecheckMs = performance.now() - typecheckStartedAt;
82223
- }) : Promise.resolve(null);
82224
82272
  const verifyFlow = opts.verify && !opts.dryRun ? loadVerifyFlow(typeof opts.verify === "string" ? opts.verify : void 0, targetDir) : void 0;
82225
82273
  const collectionStartedAt = performance.now();
82226
82274
  const collected = collectFiles(targetDir, {
@@ -82256,6 +82304,25 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82256
82304
  }
82257
82305
  const storedConfig = loadConfig();
82258
82306
  const foundProjectEntry = opts.new ? null : findProjectConfigEntry(targetDir);
82307
+ let typecheckMs = 0;
82308
+ const typecheckStartedAt = performance.now();
82309
+ const sourceUnchanged = !opts.project && !opts.temporary && unchangedSinceLastPublish(foundProjectEntry, targetDir, publishedHashes);
82310
+ if (sourceUnchanged)
82311
+ process.stderr.write("No file changed since this folder's last deploy; types were not checked again.\n");
82312
+ const hasTsconfig = !sourceUnchanged && existsSync28(join33(targetDir, "tsconfig.json"));
82313
+ const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
82314
+ const checkingTypes = hasTsconfig && !missingDependencies;
82315
+ if (checkingTypes && typecheckCompilerSource(targetDir) === "npx") {
82316
+ announceNpxTypeScriptFetch(TYPECHECK_TYPESCRIPT_VERSION);
82317
+ }
82318
+ const typecheckHeartbeat = checkingTypes && !opts.json ? setInterval(() => {
82319
+ process.stderr.write(`Still checking types before upload after ${formatDeployElapsed(performance.now() - typecheckStartedAt)}...
82320
+ `);
82321
+ }, deployHeartbeatMs()).unref() : void 0;
82322
+ const typecheck = checkingTypes ? runTypecheck(targetDir).then((value) => ({ value }), (error3) => ({ error: error3 })).finally(() => {
82323
+ clearInterval(typecheckHeartbeat);
82324
+ typecheckMs = performance.now() - typecheckStartedAt;
82325
+ }) : Promise.resolve(null);
82259
82326
  if (storedConfig?.temporary && storedConfig.temp_expires_at && temporarySessionExpired(storedConfig) && (opts.project || foundProjectEntry)) {
82260
82327
  const message3 = opts.project ? formatExpiredTemporaryProjectExplanation(storedConfig.temp_expires_at) : formatLinkedProjectAccessRefusal(false, dir);
82261
82328
  if (opts.json) {
@@ -82757,6 +82824,8 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
82757
82824
  if (postLive.kind === "timeout")
82758
82825
  output.post_live_render = { status: "pending", note: POST_LIVE_RENDER_STILL_RUNNING };
82759
82826
  const tests2 = await runReleaseTests();
82827
+ if (result.checks)
82828
+ output.access_check = await awaitDeployChecks(client, result.checks);
82760
82829
  printJson(verification || verificationError || tests2 ? {
82761
82830
  ...output,
82762
82831
  deployment_outcome: "live",
@@ -82904,6 +82973,11 @@ ${dim("Build")}`);
82904
82973
  info(`Open ${link} to save the app to your account, then run \`${cliInvocation()} login\` to connect this terminal.`);
82905
82974
  }
82906
82975
  }
82976
+ if (result.checks) {
82977
+ const checksLine = formatDeployChecksLine(await awaitDeployChecks(client, result.checks));
82978
+ if (checksLine)
82979
+ info(checksLine);
82980
+ }
82907
82981
  if (hasFunctionErrors) {
82908
82982
  process.exit(1);
82909
82983
  }
@@ -83324,6 +83398,7 @@ var init_deploy = __esm({
83324
83398
  init_typecheck();
83325
83399
  init_typecheck_version();
83326
83400
  init_typecheck2();
83401
+ init_deploy_checks();
83327
83402
  init_base_files();
83328
83403
  init_verify_progress();
83329
83404
  init_esm();
@@ -83404,6 +83479,7 @@ var init_deploy = __esm({
83404
83479
  __name(resolveExplicitProjectId, "resolveExplicitProjectId");
83405
83480
  __name(readExplicitProjectLiveBase, "readExplicitProjectLiveBase");
83406
83481
  __name(findProjectConfigEntry, "findProjectConfigEntry");
83482
+ __name(unchangedSinceLastPublish, "unchangedSinceLastPublish");
83407
83483
  __name(temporarySessionExpired, "temporarySessionExpired");
83408
83484
  __name(isTempSessionLive, "isTempSessionLive");
83409
83485
  __name(hasReusableTempCredential, "hasReusableTempCredential");
@@ -87272,8 +87348,8 @@ var init_status = __esm({
87272
87348
  function registerOpen(program2) {
87273
87349
  program2.command("open [project]").description("Open the project URL in your browser").option("--project <ref>", "Project ID, name, slug, or subdomain \u2014 the same flag every other command takes. The positional form still works.").option("--dashboard", "Open the dashboard instead").action(async (project, opts) => {
87274
87350
  if (opts.dashboard) {
87275
- info(`Opening ${dim("https://somewhere.cloud/dashboard")}...`);
87276
- await open("https://somewhere.cloud/dashboard");
87351
+ info(`Opening ${dim("https://somewhere.cloud/app")}...`);
87352
+ await open("https://somewhere.cloud/app");
87277
87353
  return;
87278
87354
  }
87279
87355
  const token = getToken();