@getxflow/cli 0.26.0 → 0.27.0

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.
@@ -64,7 +64,7 @@ async function pagesList(args) {
64
64
  }
65
65
  if (pages.length === 0) {
66
66
  (0, ui_1.note)('The organization has no pages yet');
67
- (0, ui_1.note)((0, ui_1.dim)(' A new one: xflow pages create "Price list"'));
67
+ (0, ui_1.note)((0, ui_1.dim)(' A new one: xflow pages create "Price list" ./dist'));
68
68
  }
69
69
  else {
70
70
  (0, ui_1.table)(pages.map((page) => [
@@ -83,18 +83,24 @@ async function pagesList(args) {
83
83
  }
84
84
  }
85
85
  async function pagesCreate(args) {
86
- const title = args.words.slice(1).join(' ').trim();
87
- if (!title) {
88
- throw new errors_1.CliError('A title is required', 'For example: xflow pages create "Price list" --slug price-list');
86
+ const source = args.words.length > 2 ? args.words[args.words.length - 1] : undefined;
87
+ const title = args.words.slice(1, -1).join(' ').trim();
88
+ if (!source || !title) {
89
+ throw new errors_1.CliError('A title and what to put on the page are required', 'A page is born with its first version: xflow pages create "Price list" ./dist --slug price-list');
89
90
  }
91
+ const upload = readUpload(source);
90
92
  const slug = (0, args_1.flagString)(args, 'slug');
91
- const { page } = await (0, api_1.apiJson)(pagesClient(), '/api/v1/pages', {
92
- method: 'POST',
93
- body: slug ? { title, slug } : { title },
93
+ const query = new URLSearchParams(slug ? { title, slug } : { title });
94
+ (0, ui_1.step)(`Uploading ${upload.label}`);
95
+ const result = await (0, api_1.apiUpload)(pagesClient(), `/api/v1/pages?${query}`, upload.body, {
96
+ 'Content-Type': contentTypeOf(upload),
94
97
  });
95
- (0, ui_1.ok)(`Page "${page.title}" created`);
96
- (0, ui_1.out)(page.url);
97
- (0, ui_1.note)((0, ui_1.dim)(` Nothing is on it yet: xflow pages deploy ${page.slug} <folder, .zip or .html>`));
98
+ (0, ui_1.ok)(`Page "${result.page.title}" is live: ${result.file_count} file(s), ${(0, ui_1.formatBytes)(result.size_bytes)}`);
99
+ (0, ui_1.out)(result.page.url);
100
+ (0, ui_1.note)((0, ui_1.dim)(` Anyone with the address sees it within seconds. The next version: xflow pages deploy ${result.page.slug} <path>`));
101
+ }
102
+ function contentTypeOf(upload) {
103
+ return upload.kind === 'zip' ? 'application/zip' : 'text/html';
98
104
  }
99
105
  function assertUploadSize(bytes) {
100
106
  if (bytes <= MAX_UPLOAD_BYTES)
@@ -161,7 +167,7 @@ async function pagesDeploy(args) {
161
167
  (0, ui_1.step)(`Uploading ${upload.label}`);
162
168
  const query = comment ? `?comment=${encodeURIComponent(comment)}` : '';
163
169
  const result = await (0, api_1.apiUpload)(client, `${pagePath(ref)}/deploy${query}`, upload.body, {
164
- 'Content-Type': upload.kind === 'zip' ? 'application/zip' : 'text/html',
170
+ 'Content-Type': contentTypeOf(upload),
165
171
  });
166
172
  if (result.status === 'unchanged') {
167
173
  (0, ui_1.ok)(`Nothing changed: version ${result.revision} is already on the address`);
package/dist/help.js CHANGED
@@ -91,8 +91,8 @@ ${(0, ui_1.bold)('Database')}
91
91
 
92
92
  ${(0, ui_1.bold)('Pages')}
93
93
  xflow pages public sites of the organization at <name>.xflowpage.ru
94
- xflow pages create <title> [--slug name]
95
- a new page, empty until the first upload
94
+ xflow pages create <title> <folder|.zip|.html> [--slug name]
95
+ a new page with the site on it, live at once
96
96
  xflow pages deploy <page> <folder|.zip|.html> [-m "what changed"]
97
97
  upload the site: live at once, there is no publish step
98
98
  xflow pages status <page> the page and its versions
@@ -232,15 +232,16 @@ signing in and outside the platform. A project is the opposite: it opens only in
232
232
  platform, for the members of the organization.
233
233
 
234
234
  xflow pages the pages, their state and address
235
- xflow pages create <title> a new page, empty until the first upload
235
+ xflow pages create <title> <path> a new page with its first version: there are no
236
+ empty pages
236
237
  --slug <name> the name in the address; without it the name is made
237
238
  from the title, with a random tail
238
- xflow pages deploy <page> <path> upload a folder with index.html at the top, its .zip,
239
- or one .html file
239
+ xflow pages deploy <page> <path> upload a new version
240
240
  -m <text> what changed, one short line: it names the version
241
241
  xflow pages status <page> the page and its versions
242
242
  xflow pages rollback <page> <N> put version N back on the address
243
243
 
244
+ ${(0, ui_1.bold)('<path>')} is a folder with index.html at the top, its .zip, or one .html file.
244
245
  ${(0, ui_1.bold)('<page>')} is the name from the address or the id. ${(0, ui_1.bold)('--json')} on list and status
245
246
  prints the answer as JSON. A page belongs to the organization, not to a project, so there is
246
247
  no ${(0, ui_1.bold)('--project')}: the key is picked as for every other command (${(0, ui_1.bold)('xflow help org')}).
@@ -255,7 +256,9 @@ build it and upload what the build writes. Dot entries are skipped. At most 5 MB
255
256
  unpacked and 1000 files.
256
257
 
257
258
  The page is public, so a file holding a secret key is refused whole: every visitor would read
258
- it. Search engines are asked not to index pages, so do not promise SEO.
259
+ it. A function key is the exception: it opens that one function to every visitor, which is
260
+ what a form on a landing page needs. Search engines are asked not to index pages, so do not
261
+ promise SEO.
259
262
 
260
263
  A page takes the key of the whole organization, the one ${(0, ui_1.bold)('xflow login')} issues. The
261
264
  section is in beta: XFlow support switches it on for an organization. Switching a page off
package/dist/version.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_API_URL = exports.CLI_VERSION = void 0;
4
4
  /** Keep in sync with cli/package.json. */
5
- exports.CLI_VERSION = '0.26.0';
5
+ exports.CLI_VERSION = '0.27.0';
6
6
  /** Overridden by XFLOW_API_URL or the `api` field in xflow.json. */
7
7
  exports.DEFAULT_API_URL = 'https://app.getxflow.com';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getxflow/cli",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "CLI for the XFlow platform: source sync, deployment and publishing of applications",
5
5
  "license": "UNLICENSED",
6
6
  "engines": {
@@ -22,7 +22,7 @@ contains the fix.
22
22
 
23
23
  ## Keeping these instructions current
24
24
 
25
- These instructions ship with xflow CLI 0.26.0, so the copy you are reading can be older than
25
+ These instructions ship with xflow CLI 0.27.0, so the copy you are reading can be older than
26
26
  the CLI answering your commands.
27
27
 
28
28
  When the CLI says this file does not match it, run `xflow skills --refresh` and then **read
@@ -527,10 +527,11 @@ presentation, an invoice for people outside the organization. Anyone with the ad
527
527
  without signing in and outside the platform. A project is the opposite, it opens only inside the
528
528
  platform: pick a page when the audience is outside the organization.
529
529
 
530
- - `xflow pages create "Price list"` makes an empty page and prints its address. `--slug
531
- price-list` picks the name, otherwise it comes from the title with a random tail.
532
- - `xflow pages deploy <page> <folder|.zip|.html> -m "what changed"` uploads the built site.
533
- **It is public the moment the command finishes**: no draft, no publish step. Upload when the
530
+ - `xflow pages create "Price list" ./dist` makes a page with the built site on it and prints its
531
+ address: there are no empty pages. `--slug price-list` picks the name, otherwise it comes from
532
+ the title with a random tail.
533
+ - `xflow pages deploy <page> <folder|.zip|.html> -m "what changed"` uploads a new version.
534
+ - **Both are public the moment the command finishes**: no draft, no publish step. Upload when the
534
535
  user wants the page out, and give them the address the CLI printed.
535
536
  - `xflow pages status <page>` lists the versions, `xflow pages rollback <page> <N>` puts one back
536
537
  in seconds; the files of the last 5 are kept.
@@ -538,7 +539,9 @@ platform: pick a page when the audience is outside the organization.
538
539
  or functions on a page. Upload what the build writes (`dist`), never a folder with
539
540
  `package.json`. At most 5 MB zipped, 25 MB unpacked, 1000 files.
540
541
  - Everything in a page is readable by every visitor. Never put a key, token or password into
541
- it: a known key format gets the upload refused, anything else simply leaks.
542
+ it: a known key format gets the upload refused, anything else simply leaks. A function key is
543
+ the exception: a person issues it in the settings of the function, and a form on a page may
544
+ call that function with it. So can every visitor.
542
545
  - Search engines are asked not to index pages: do not promise SEO.
543
546
  - The MCP `pages` tool uploads one self-contained HTML document up to 150 KB.
544
547
  - Pages take the key of the whole organization, the one `xflow login` issues. The section is in