@somewhere-cloud/cli 0.38.142 → 0.38.144
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 +11 -0
- package/README.md +1 -1
- package/dist/lib/bundle.js +25 -9
- package/dist/lib/bundle.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/runtime/DECLARED-DATA-VENDOR.json +5 -5
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +17 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.144
|
|
4
|
+
|
|
5
|
+
- Matches platform consumer contract 36, so deploys no longer warn that the CLI contract differs from the platform.
|
|
6
|
+
- `somewhere deploy` states the dotfile rule only when it leaves a dotfile out; `--json` with nothing left out keeps stderr quiet.
|
|
7
|
+
- `somewhere typecheck` no longer fails on `somewhere:api` imports; it says once that they are checked at deploy, where the client is generated.
|
|
8
|
+
|
|
9
|
+
## 0.38.143
|
|
10
|
+
|
|
11
|
+
- Include the project name in the CLI docs starter command.
|
|
12
|
+
- `somewhere deploy` says once which dotfiles it leaves out.
|
|
13
|
+
|
|
3
14
|
## 0.38.142
|
|
4
15
|
|
|
5
16
|
- Use `somewhere tasks list --label <label>` to match an exact task label.
|
package/README.md
CHANGED
|
@@ -165,7 +165,7 @@ Files under `functions/` (and root-level `api/` and `_lib/`) are deployed as ser
|
|
|
165
165
|
|
|
166
166
|
Files under `public/` deploy at the site root, matching Vite's convention: `public/images/logo.png` serves as `/images/logo.png`.
|
|
167
167
|
|
|
168
|
-
To exclude local-only files from deploy, add gitignore-style patterns to `.somewhereignore` in the project root. The CLI also respects the root `.gitignore`. `.somewhereignore` is applied after `.gitignore`, so it can add deploy-only excludes or `!` re-includes. Built-in
|
|
168
|
+
To exclude local-only files from deploy, add gitignore-style patterns to `.somewhereignore` in the project root. The CLI also respects the root `.gitignore`. `.somewhereignore` is applied after `.gitignore`, so it can add deploy-only excludes or `!` re-includes. Built-in excludes such as `node_modules` and `dist` still apply. Deploy always leaves dotfiles and dot-directories out, except `.well-known`.
|
|
169
169
|
|
|
170
170
|
After each successful linked deploy or pull, the CLI records the current deployed version in `.somewhere.json`. If the project changed elsewhere since that version, the next deploy refuses before overwriting anything and names the changed files. Run `somewhere pull` to bring remote source back locally, or `somewhere deploy --force --yes` to overwrite intentionally.
|
|
171
171
|
|
package/dist/lib/bundle.js
CHANGED
|
@@ -44647,8 +44647,8 @@ var init_skills_pack_generated = __esm({
|
|
|
44647
44647
|
BUNDLED_SKILLS_PACK = {
|
|
44648
44648
|
"schema": 1,
|
|
44649
44649
|
"name": "somewhere-skills",
|
|
44650
|
-
"version": "1+
|
|
44651
|
-
"sha256": "
|
|
44650
|
+
"version": "1+c727c92e8193",
|
|
44651
|
+
"sha256": "c727c92e81938d2e7cbf125de17c4d8a6feef4cf5bc4530f173f6dc04fe0da3e",
|
|
44652
44652
|
"files": [
|
|
44653
44653
|
{
|
|
44654
44654
|
"path": "adopt/SKILL.md",
|
|
@@ -44662,8 +44662,8 @@ var init_skills_pack_generated = __esm({
|
|
|
44662
44662
|
},
|
|
44663
44663
|
{
|
|
44664
44664
|
"path": "schema-changes/SKILL.md",
|
|
44665
|
-
"sha256": "
|
|
44666
|
-
"content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or
|
|
44665
|
+
"sha256": "ab5a21715672de983d2bb1ed19822563a8d94fad936b2424f3653c0c087642b2",
|
|
44666
|
+
"content": "---\nname: schema-changes\ndescription: Before adding, changing, or removing a table or column in db/schema.ts.\n---\n\n# Change the database schema safely\n\n## The file is the contract\n\nThe default `somewhere init` starter has no `db/schema.ts`: create it at the project root, or run `somewhere init --name my-app --features private-data` to start with a schema.\n\n```ts\n// db/schema.ts\nimport { id, owner, schema, table, text, timestamp } from 'somewhere/db';\n\nexport default schema({\n notes: table(\n {\n id: id(),\n title: text(),\n body: text({ default: '' }),\n created_at: timestamp({ default: 'now' }),\n },\n {\n scope: owner(),\n client: {\n read: ['id', 'title', 'body', 'created_at'],\n create: ['title', 'body'],\n update: ['title', 'body'],\n delete: true,\n },\n },\n ),\n});\n```\n\nA table without a `client` block can't be reached from the browser at all.\n\nBefore the first deploy, delete an unused starter table declaration outright: there is no deployed table to retire. After a table has been deployed, mark it `removedTable()` to retire it with 30-day data retention, including when the table is empty.\n\nRun `somewhere typecheck` before deploying schema changes.\n\n## What a deploy does with it\n\n- **Additive changes apply**: a new table, a new nullable-or-defaulted column, a new index, a new unique group. Unchanged schema is a no-op.\n- **Unmarked removals and shape changes refuse** with `409 SCHEMA_DEPLOY_REFUSED` and a message naming the change.\n- **Access-rule changes apply in place**: a later deploy can change an existing table's scope, and its rows stay.\n- a production deploy or a promotion that would remove or rename a column is refused before anything changes, so a running release never loses a column it uses. Keep the column declared and leave its data in place.\n\n## Failure: raw SQL refused after the schema file deploys\n\nOn an older shared database, ordinary `sw.db.query` / `sw.db.batch` fail before transport with `MANAGED_RAW_SQL_REQUIRES_SERVER_AUTHORITY`, including in job, queue, and cron handlers; with a separate SQL database they run there and never see declared tables. Fix: write with `sw.db.insert` / `sw.db.update` / `sw.db.remove` (the table needs a declared intent)\n\nSources (`somewhere docs <topic>`): declared-data, getting-started, sw.db, troubleshooting.\n"
|
|
44667
44667
|
},
|
|
44668
44668
|
{
|
|
44669
44669
|
"path": "sign-in-setup/SKILL.md",
|
|
@@ -74547,12 +74547,17 @@ import { spawn as spawn3, spawnSync } from "node:child_process";
|
|
|
74547
74547
|
import { existsSync as existsSync12, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
|
|
74548
74548
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
74549
74549
|
import { dirname as dirname4, join as join13, relative as relative3 } from "node:path";
|
|
74550
|
+
function isGeneratedApiImport(e) {
|
|
74551
|
+
return e.code === "TS2307" && /^Cannot find module ['"]somewhere:api['"]/.test(e.message);
|
|
74552
|
+
}
|
|
74550
74553
|
function isUnresolvedBareImport(e) {
|
|
74551
74554
|
if (!UNRESOLVED_DEP_CODES.has(e.code))
|
|
74552
74555
|
return false;
|
|
74553
74556
|
const specifier = /['"]([^'"]+)['"]/.exec(e.message)?.[1];
|
|
74554
74557
|
if (specifier === void 0)
|
|
74555
74558
|
return true;
|
|
74559
|
+
if (specifier === "somewhere:api")
|
|
74560
|
+
return isGeneratedApiImport(e);
|
|
74556
74561
|
if (/^somewhere(?::data|:files|\/db)$/.test(specifier))
|
|
74557
74562
|
return false;
|
|
74558
74563
|
return !/^(?:\.{1,2}(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/])/.test(specifier);
|
|
@@ -74895,6 +74900,9 @@ async function runTypecheckWith(projectDir, command, args, via, declaredData) {
|
|
|
74895
74900
|
if (run.error)
|
|
74896
74901
|
return { ok: false, errors: [], via, raw: run.out, spawnError: run.error.message };
|
|
74897
74902
|
const allErrors = parseTscOutput(run.out);
|
|
74903
|
+
if (allErrors.some(isGeneratedApiImport)) {
|
|
74904
|
+
process.stderr.write("The somewhere:api import is checked at deploy, where its client is generated.\n");
|
|
74905
|
+
}
|
|
74898
74906
|
const errors = allErrors.filter((e) => !isUnresolvedBareImport(e));
|
|
74899
74907
|
const unexplainedFailure = run.code !== 0 && allErrors.length === 0;
|
|
74900
74908
|
return { ok: errors.length === 0 && !unexplainedFailure, errors, via, raw: run.out };
|
|
@@ -74914,6 +74922,7 @@ var init_typecheck = __esm({
|
|
|
74914
74922
|
init_platform_contract();
|
|
74915
74923
|
init_declared_data();
|
|
74916
74924
|
UNRESOLVED_DEP_CODES = /* @__PURE__ */ new Set(["TS2307", "TS7016", "TS2306", "TS2875"]);
|
|
74925
|
+
__name(isGeneratedApiImport, "isGeneratedApiImport");
|
|
74917
74926
|
__name(isUnresolvedBareImport, "isUnresolvedBareImport");
|
|
74918
74927
|
__name(npxTscInvocation, "npxTscInvocation");
|
|
74919
74928
|
__name(typecheckArgs, "typecheckArgs");
|
|
@@ -76832,7 +76841,7 @@ function isBinaryPath2(p2) {
|
|
|
76832
76841
|
return BINARY_EXTS.has(extname3(p2).toLowerCase());
|
|
76833
76842
|
}
|
|
76834
76843
|
function collectFiles(baseDir, options2 = {}) {
|
|
76835
|
-
const out = { files: {}, binaryFiles: {}, functions: {}, skipped: [], oversize: [], notes: [], excluded: [], sensitive: [], published: [] };
|
|
76844
|
+
const out = { dotfilesLeftOut: false, files: {}, binaryFiles: {}, functions: {}, skipped: [], oversize: [], notes: [], excluded: [], sensitive: [], published: [] };
|
|
76836
76845
|
const ignore = loadDeployIgnore(baseDir);
|
|
76837
76846
|
const candidates = [];
|
|
76838
76847
|
const sizes = /* @__PURE__ */ new Map();
|
|
@@ -76923,6 +76932,8 @@ function walk(baseDir, currentDir, out, ignore, candidates, sizes) {
|
|
|
76923
76932
|
for (const entry of readdirSync3(currentDir, { withFileTypes: true })) {
|
|
76924
76933
|
const fullPath = join16(currentDir, entry.name);
|
|
76925
76934
|
const relPath = toDeployPath(relative6(baseDir, fullPath));
|
|
76935
|
+
if (!IGNORE.has(entry.name) && entry.name.startsWith(".") && entry.name !== ".well-known")
|
|
76936
|
+
out.dotfilesLeftOut = true;
|
|
76926
76937
|
if (IGNORE.has(entry.name) || entry.name.startsWith(".") && entry.name !== ".well-known" || ignore.ignores(relPath, entry.isDirectory())) {
|
|
76927
76938
|
continue;
|
|
76928
76939
|
}
|
|
@@ -84106,7 +84117,7 @@ Signed in, deploy never creates one on its own:
|
|
|
84106
84117
|
${cliInvocation()} init --bare --name <name> create a project in your account and link this folder
|
|
84107
84118
|
${cliInvocation()} deploy then deploy it
|
|
84108
84119
|
Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cliInvocation()} projects\`), or \`--project <ref>\` here.
|
|
84109
|
-
`).option("--project <ref>", `Existing project to deploy to \u2014 accepts the project UUID, slug, or subdomain (all three resolve server-side). To create one, run \`${cliInvocation()} init --bare --name <name>\``).option("--scope <scope>", "Partial deploy: 'functions' (backend only, leaves the site untouched) or 'static' (site only, leaves functions untouched). Default deploys both.").option("--dry-run", "Show what would change (added / modified / removed files) in an already deployed project, without deploying. The files a deploy would publish are sent to Somewhere to compute the change; nothing is published. Never creates a project or a temporary workspace.").option("--replace-functions", "Delete deployed functions that are not in this directory. A full deploy already does; use it with --scope functions, which otherwise keeps them.").option("--prebuilt", "Deploy pre-built / bundled output (e.g. a dist/ folder) instead of raw source. Raw source is the default and recommended path: the platform compiles your TSX/JSX/TS on deploy, which keeps the app editable end-to-end. Choosing --prebuilt trades that away \u2014 pull/export round-trips, find/replace patches, and visual (source-map) editing are disabled for the bundled files. Use it only when you need full control of your own build.").option("--allow-bundled", "Alias for --prebuilt.").option("--new", "Publish to a new project and replace this folder\u2019s .somewhere.json link").option("--temporary", "Deploy to a temporary workspace and show when it expires (automatic when logged out)").option("--force", "Overwrite remote changes even when this machine last deployed an older version").option("--include <paths>", 'Publish a file or folder the deploy would otherwise hold back, e.g. --include NOTES.md or --include tests (comma-separate several, or repeat the flag). A "!NOTES.md" or "!tests/" line in .somewhereignore does the same thing permanently.', (value, previous = []) => previous.concat(value.split(",").map((v2) => v2.trim()).filter(Boolean))).option("--yes", "Skip confirmation prompts (for --force)").option("--verify [flow.json]", "After the deploy is live, run one browser verification flow at desktop and phone size. Omit the file for the default health check.").addOption(new Option("--test", "After a successful deploy, run somewhere test once against the new release").hideHelp()).option("-m, --message <text>", "Add a note for this version").option("--json", "Print the deploy result and its uploaded file list as JSON on stdout. Stderr
|
|
84120
|
+
`).option("--project <ref>", `Existing project to deploy to \u2014 accepts the project UUID, slug, or subdomain (all three resolve server-side). To create one, run \`${cliInvocation()} init --bare --name <name>\``).option("--scope <scope>", "Partial deploy: 'functions' (backend only, leaves the site untouched) or 'static' (site only, leaves functions untouched). Default deploys both.").option("--dry-run", "Show what would change (added / modified / removed files) in an already deployed project, without deploying. The files a deploy would publish are sent to Somewhere to compute the change; nothing is published. Never creates a project or a temporary workspace.").option("--replace-functions", "Delete deployed functions that are not in this directory. A full deploy already does; use it with --scope functions, which otherwise keeps them.").option("--prebuilt", "Deploy pre-built / bundled output (e.g. a dist/ folder) instead of raw source. Raw source is the default and recommended path: the platform compiles your TSX/JSX/TS on deploy, which keeps the app editable end-to-end. Choosing --prebuilt trades that away \u2014 pull/export round-trips, find/replace patches, and visual (source-map) editing are disabled for the bundled files. Use it only when you need full control of your own build.").option("--allow-bundled", "Alias for --prebuilt.").option("--new", "Publish to a new project and replace this folder\u2019s .somewhere.json link").option("--temporary", "Deploy to a temporary workspace and show when it expires (automatic when logged out)").option("--force", "Overwrite remote changes even when this machine last deployed an older version").option("--include <paths>", 'Publish a file or folder the deploy would otherwise hold back, e.g. --include NOTES.md or --include tests (comma-separate several, or repeat the flag). A "!NOTES.md" or "!tests/" line in .somewhereignore does the same thing permanently.', (value, previous = []) => previous.concat(value.split(",").map((v2) => v2.trim()).filter(Boolean))).option("--yes", "Skip confirmation prompts (for --force)").option("--verify [flow.json]", "After the deploy is live, run one browser verification flow at desktop and phone size. Omit the file for the default health check.").addOption(new Option("--test", "After a successful deploy, run somewhere test once against the new release").hideHelp()).option("-m, --message <text>", "Add a note for this version").option("--json", "Print the deploy result and its uploaded file list as JSON on stdout. Stderr reports files left out locally and the dotfile rule.").option("--list-unpublished", "List the local files deploy would keep on your machine, then exit").option("--allow-type-errors", "Upload even when the local TypeScript check fails").option("--timing", "Print deploy details and timings").action(async (dir, opts) => {
|
|
84110
84121
|
const startupMs = performance.now();
|
|
84111
84122
|
const targetDir = resolveTargetDir(dir);
|
|
84112
84123
|
if (opts.new && (opts.project || opts.dryRun || opts.temporary)) {
|
|
@@ -84118,7 +84129,9 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
|
|
|
84118
84129
|
process.exit(1);
|
|
84119
84130
|
}
|
|
84120
84131
|
if (opts.listUnpublished) {
|
|
84121
|
-
const { excluded: excluded2, sensitive: sensitive2, skipped: skipped2 } = collectFiles(targetDir, { include: opts.include ?? [] });
|
|
84132
|
+
const { excluded: excluded2, sensitive: sensitive2, skipped: skipped2, dotfilesLeftOut } = collectFiles(targetDir, { include: opts.include ?? [] });
|
|
84133
|
+
if (dotfilesLeftOut)
|
|
84134
|
+
console.error(DOTFILE_NOTICE);
|
|
84122
84135
|
if (opts.json)
|
|
84123
84136
|
printJson({ excluded: excluded2, sensitive: sensitive2, skipped: skipped2 });
|
|
84124
84137
|
else {
|
|
@@ -84147,6 +84160,8 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
|
|
|
84147
84160
|
const collectionEndedAt = performance.now();
|
|
84148
84161
|
const collectionMs = collectionEndedAt - collectionStartedAt;
|
|
84149
84162
|
const { files, binaryFiles, functions, skipped, excluded, sensitive } = collected;
|
|
84163
|
+
if (collected.dotfilesLeftOut)
|
|
84164
|
+
console.error(DOTFILE_NOTICE);
|
|
84150
84165
|
const sensitiveRefusal = sensitiveReferenceRefusal(collected);
|
|
84151
84166
|
if (sensitiveRefusal) {
|
|
84152
84167
|
if (opts.json)
|
|
@@ -85249,7 +85264,7 @@ ${teal("Dry run")}${dim(scopeNote)} \u2014 nothing was deployed.
|
|
|
85249
85264
|
}
|
|
85250
85265
|
console.log("");
|
|
85251
85266
|
}
|
|
85252
|
-
var import_prompts4, SERVER_FRAMEWORK_DEPS, SERVER_CODE_PATTERN, NEXT_APP_SIGNAL_PREFIX, NEXT_CONFIG_PATTERN, NEXT_DEPENDENCY_SECTIONS, NEXT_APP_WARNING, DEPLOY_HEARTBEAT_MS, DEPLOY_MAX_ATTEMPTS, RETRYABLE_DEPLOY_CODES, DEPLOY_RETRY_MAX_WAIT_MS, POST_DEPLOY_HINT, SOURCE_WORDS, DEPLOY_PRESTART_TIMEOUT_MS, CANONICAL_PROJECT_ID, PROJECT_SITE_DOMAIN2, retriedAfterTransportFailure, INTERNAL_PREFIXES, isInternalPath;
|
|
85267
|
+
var import_prompts4, DOTFILE_NOTICE, SERVER_FRAMEWORK_DEPS, SERVER_CODE_PATTERN, NEXT_APP_SIGNAL_PREFIX, NEXT_CONFIG_PATTERN, NEXT_DEPENDENCY_SECTIONS, NEXT_APP_WARNING, DEPLOY_HEARTBEAT_MS, DEPLOY_MAX_ATTEMPTS, RETRYABLE_DEPLOY_CODES, DEPLOY_RETRY_MAX_WAIT_MS, POST_DEPLOY_HINT, SOURCE_WORDS, DEPLOY_PRESTART_TIMEOUT_MS, CANONICAL_PROJECT_ID, PROJECT_SITE_DOMAIN2, retriedAfterTransportFailure, INTERNAL_PREFIXES, isInternalPath;
|
|
85253
85268
|
var init_deploy = __esm({
|
|
85254
85269
|
"dist/commands/deploy.js"() {
|
|
85255
85270
|
"use strict";
|
|
@@ -85288,6 +85303,7 @@ var init_deploy = __esm({
|
|
|
85288
85303
|
init_surface_counts();
|
|
85289
85304
|
init_verify();
|
|
85290
85305
|
__name(resolveTargetDir, "resolveTargetDir");
|
|
85306
|
+
DOTFILE_NOTICE = "Deploy always leaves dotfiles and dot-directories out, except .well-known.";
|
|
85291
85307
|
__name(prebuiltOptIn, "prebuiltOptIn");
|
|
85292
85308
|
SERVER_FRAMEWORK_DEPS = ["express", "fastify", "koa", "@nestjs/core", "@hapi/hapi", "restify"];
|
|
85293
85309
|
SERVER_CODE_PATTERN = /\bapp\.listen\s*\(|\bhttp\.createServer\s*\(|\bfastify\s*\(\s*\)|new\s+Koa\s*\(/;
|
|
@@ -87573,7 +87589,7 @@ function renderDocsIndex(pages, groups) {
|
|
|
87573
87589
|
const width = Math.max(0, ...pages.map(({ id }) => id.length));
|
|
87574
87590
|
const lines = [
|
|
87575
87591
|
"Platform docs \u2014 no login needed.",
|
|
87576
|
-
`Run ${cliInvocation()} init
|
|
87592
|
+
`Run ${cliInvocation()} init --name my-app, then read generated AGENTS.md: call shapes and access patterns for a typical app; docs are for exceptions.`,
|
|
87577
87593
|
"",
|
|
87578
87594
|
"Requirement | Declaration (complete examples in generated AGENTS.md)",
|
|
87579
87595
|
"Own rows | owner()",
|