@getxflow/cli 1.0.0 → 1.0.1
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/dist/bin.js +5 -1
- package/dist/commands/pages.js +25 -0
- package/dist/flags.js +2 -0
- package/dist/help.js +10 -2
- package/dist/template.js +23 -23
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/xflow/SKILL.md +698 -682
package/dist/bin.js
CHANGED
|
@@ -223,11 +223,15 @@ async function run(args) {
|
|
|
223
223
|
await (0, pages_1.pagesRollback)(rest);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
+
if (second === 'rm' || second === 'remove') {
|
|
227
|
+
await (0, pages_1.pagesRemove)(rest);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
226
230
|
if (second === undefined || second === 'list') {
|
|
227
231
|
await (0, pages_1.pagesList)(rest);
|
|
228
232
|
return;
|
|
229
233
|
}
|
|
230
|
-
throw new errors_1.CliError(`Unknown command: pages ${second}`, 'Available: list, create, deploy, status and
|
|
234
|
+
throw new errors_1.CliError(`Unknown command: pages ${second}`, 'Available: list, create, deploy, status, rollback and rm');
|
|
231
235
|
case 'status':
|
|
232
236
|
await (0, sources_1.status)();
|
|
233
237
|
return;
|
package/dist/commands/pages.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.pagesCreate = pagesCreate;
|
|
|
5
5
|
exports.pagesDeploy = pagesDeploy;
|
|
6
6
|
exports.pagesStatus = pagesStatus;
|
|
7
7
|
exports.pagesRollback = pagesRollback;
|
|
8
|
+
exports.pagesRemove = pagesRemove;
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
9
10
|
const node_path_1 = require("node:path");
|
|
10
11
|
const api_1 = require("../api");
|
|
@@ -231,3 +232,27 @@ async function pagesRollback(args) {
|
|
|
231
232
|
(0, ui_1.warn)(`The page is switched off: version ${revision} is current and goes live when it is switched on`);
|
|
232
233
|
(0, ui_1.out)(page.url);
|
|
233
234
|
}
|
|
235
|
+
async function pagesRemove(args) {
|
|
236
|
+
const ref = args.words[1];
|
|
237
|
+
if (!ref) {
|
|
238
|
+
throw new errors_1.CliError('A page is required', 'The name from its address, or its id. The pages: xflow pages');
|
|
239
|
+
}
|
|
240
|
+
// The page is read first: deleting is confirmed by the name in the address, and the
|
|
241
|
+
// page can be named here by its id.
|
|
242
|
+
const client = pagesClient();
|
|
243
|
+
const { page } = await (0, api_1.apiJson)(client, pagePath(ref));
|
|
244
|
+
const query = (0, args_1.flagBool)(args, 'yes') ? `?confirm=${encodeURIComponent(page.slug)}` : '';
|
|
245
|
+
try {
|
|
246
|
+
await (0, api_1.apiJson)(client, `${pagePath(page.id)}${query}`, { method: 'DELETE' });
|
|
247
|
+
}
|
|
248
|
+
catch (e) {
|
|
249
|
+
// The platform names what goes and refuses until the answer is seen. Said in the
|
|
250
|
+
// words of this command, not of the API.
|
|
251
|
+
if (e instanceof api_1.ApiError && e.code === 'confirm_required') {
|
|
252
|
+
throw new errors_1.CliError(e.message, `To delete it anyway: xflow pages rm ${page.slug} --yes`);
|
|
253
|
+
}
|
|
254
|
+
throw e;
|
|
255
|
+
}
|
|
256
|
+
(0, ui_1.ok)(`The page is deleted: ${page.url} shows nothing now`);
|
|
257
|
+
(0, ui_1.note)((0, ui_1.dim)(` Its versions are gone for good, the name ${page.slug} stays reserved for the organization`));
|
|
258
|
+
}
|
package/dist/flags.js
CHANGED
package/dist/help.js
CHANGED
|
@@ -108,6 +108,7 @@ ${(0, ui_1.bold)('Pages')}
|
|
|
108
108
|
upload the site: live at once, there is no publish step
|
|
109
109
|
xflow pages status <page> the page and its versions
|
|
110
110
|
xflow pages rollback <page> <N> put an earlier version back on the address
|
|
111
|
+
xflow pages rm <page> --yes delete the page for good: the address empties
|
|
111
112
|
|
|
112
113
|
${(0, ui_1.bold)('Reference')}
|
|
113
114
|
xflow logs [--limit N] browser errors of the published apps
|
|
@@ -282,6 +283,8 @@ the platform builds, with versions, access levels and a database through functio
|
|
|
282
283
|
-m <text> what changed, one short line: it names the version
|
|
283
284
|
xflow pages status <page> the page and its versions
|
|
284
285
|
xflow pages rollback <page> <N> put version N back on the address
|
|
286
|
+
xflow pages rm <page> delete the page
|
|
287
|
+
--yes without it the command names what goes and stops
|
|
285
288
|
|
|
286
289
|
${(0, ui_1.bold)('<path>')} is a folder with index.html at the top, its .zip, or one .html file.
|
|
287
290
|
${(0, ui_1.bold)('<page>')} is the name from the address or the id. ${(0, ui_1.bold)('--json')} on list and status
|
|
@@ -304,9 +307,14 @@ add the page name there and run ${(0, ui_1.bold)('xflow deploy functions')}. The
|
|
|
304
307
|
Such a function is open to the whole internet. Search engines are asked not to index pages,
|
|
305
308
|
so do not promise SEO.
|
|
306
309
|
|
|
310
|
+
${(0, ui_1.bold)('Deleting is final.')} The address goes empty and every version of the page is gone: there
|
|
311
|
+
is no undo and no copy on the platform side. The name stays reserved for the organization, so
|
|
312
|
+
the same ${(0, ui_1.bold)('--slug')} is free for the next page of yours and taken for everyone else. A
|
|
313
|
+
throwaway page put up to try something is worth deleting the same way it was made.
|
|
314
|
+
|
|
307
315
|
A page takes the key of the whole organization, the one ${(0, ui_1.bold)('xflow login')} issues: a key
|
|
308
|
-
scoped to projects is refused.
|
|
309
|
-
platform interface.`,
|
|
316
|
+
scoped to projects is refused. A page is deleted by whoever made it, or by the owner of the
|
|
317
|
+
organization. Switching a page off for a while is for a person, in the platform interface.`,
|
|
310
318
|
update: `${(0, ui_1.bold)('xflow update')}: bring the CLI up to date
|
|
311
319
|
|
|
312
320
|
Installs the published version and, if anything changed, rewrites the platform
|
package/dist/template.js
CHANGED
|
@@ -2,30 +2,30 @@
|
|
|
2
2
|
/** Files the CLI lays into a new project root: the app itself comes from the platform template. */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.projectScaffold = projectScaffold;
|
|
5
|
-
const GITIGNORE = `node_modules/
|
|
6
|
-
dist/
|
|
7
|
-
.xflow/
|
|
8
|
-
.env
|
|
9
|
-
.env.*
|
|
5
|
+
const GITIGNORE = `node_modules/
|
|
6
|
+
dist/
|
|
7
|
+
.xflow/
|
|
8
|
+
.env
|
|
9
|
+
.env.*
|
|
10
10
|
`;
|
|
11
|
-
const README = `# %NAME%
|
|
12
|
-
|
|
13
|
-
A project on XFlow: one database, cloud functions and the apps that use them.
|
|
14
|
-
|
|
15
|
-
\`\`\`
|
|
16
|
-
xflow.json projectId, and which apps and pages may call each function
|
|
17
|
-
package.json dependencies of the functions
|
|
18
|
-
functions/<name>/ cloud functions, shared by every app
|
|
19
|
-
migrations/ the database of the project
|
|
20
|
-
apps/<folder>/ an app: its own code, versions and address
|
|
21
|
-
\`\`\`
|
|
22
|
-
|
|
23
|
-
\`\`\`bash
|
|
24
|
-
xflow deploy functions -m "..." # ship the functions and their callers
|
|
25
|
-
xflow deploy apps/<folder> -m "..." # build one app
|
|
26
|
-
xflow publish # inside an app folder: show the newest build
|
|
27
|
-
xflow status # what is on the server
|
|
28
|
-
\`\`\`
|
|
11
|
+
const README = `# %NAME%
|
|
12
|
+
|
|
13
|
+
A project on XFlow: one database, cloud functions and the apps that use them.
|
|
14
|
+
|
|
15
|
+
\`\`\`
|
|
16
|
+
xflow.json projectId, and which apps and pages may call each function
|
|
17
|
+
package.json dependencies of the functions
|
|
18
|
+
functions/<name>/ cloud functions, shared by every app
|
|
19
|
+
migrations/ the database of the project
|
|
20
|
+
apps/<folder>/ an app: its own code, versions and address
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
xflow deploy functions -m "..." # ship the functions and their callers
|
|
25
|
+
xflow deploy apps/<folder> -m "..." # build one app
|
|
26
|
+
xflow publish # inside an app folder: show the newest build
|
|
27
|
+
xflow status # what is on the server
|
|
28
|
+
\`\`\`
|
|
29
29
|
`;
|
|
30
30
|
function projectScaffold(projectName) {
|
|
31
31
|
return [
|
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 = '1.0.
|
|
5
|
+
exports.CLI_VERSION = '1.0.1';
|
|
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