@foliwake/cli 0.0.0-stage → 0.6.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.
- package/CHANGELOG.md +35 -0
- package/LICENSE +202 -0
- package/README.md +643 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +9 -0
- package/dist/command-words.d.ts +13 -0
- package/dist/command-words.js +53 -0
- package/dist/commands/account/keys/create.d.ts +12 -0
- package/dist/commands/account/keys/create.js +36 -0
- package/dist/commands/account/keys/list.d.ts +9 -0
- package/dist/commands/account/keys/list.js +23 -0
- package/dist/commands/account/keys/revoke.d.ts +12 -0
- package/dist/commands/account/keys/revoke.js +15 -0
- package/dist/commands/branch/bootstrap.d.ts +11 -0
- package/dist/commands/branch/bootstrap.js +23 -0
- package/dist/commands/branch/delete.d.ts +17 -0
- package/dist/commands/branch/delete.js +38 -0
- package/dist/commands/branch/history.d.ts +14 -0
- package/dist/commands/branch/history.js +24 -0
- package/dist/commands/branch/list.d.ts +11 -0
- package/dist/commands/branch/list.js +15 -0
- package/dist/commands/branch/update.d.ts +19 -0
- package/dist/commands/branch/update.js +49 -0
- package/dist/commands/code/deploy.d.ts +15 -0
- package/dist/commands/code/deploy.js +78 -0
- package/dist/commands/code/prepare.d.ts +13 -0
- package/dist/commands/code/prepare.js +54 -0
- package/dist/commands/code/release.d.ts +19 -0
- package/dist/commands/code/release.js +51 -0
- package/dist/commands/code/rollback.d.ts +17 -0
- package/dist/commands/code/rollback.js +38 -0
- package/dist/commands/connect.d.ts +19 -0
- package/dist/commands/connect.js +100 -0
- package/dist/commands/create.d.ts +30 -0
- package/dist/commands/create.js +163 -0
- package/dist/commands/credential/list.d.ts +10 -0
- package/dist/commands/credential/list.js +21 -0
- package/dist/commands/credential/rm.d.ts +12 -0
- package/dist/commands/credential/rm.js +18 -0
- package/dist/commands/credential/set.d.ts +15 -0
- package/dist/commands/credential/set.js +58 -0
- package/dist/commands/dev.d.ts +25 -0
- package/dist/commands/dev.js +89 -0
- package/dist/commands/login.d.ts +20 -0
- package/dist/commands/login.js +94 -0
- package/dist/commands/logout.d.ts +14 -0
- package/dist/commands/logout.js +61 -0
- package/dist/commands/migration/commit.d.ts +13 -0
- package/dist/commands/migration/commit.js +42 -0
- package/dist/commands/migration/prepare.d.ts +18 -0
- package/dist/commands/migration/prepare.js +53 -0
- package/dist/commands/operation/cancel.d.ts +14 -0
- package/dist/commands/operation/cancel.js +21 -0
- package/dist/commands/operation/get.d.ts +14 -0
- package/dist/commands/operation/get.js +26 -0
- package/dist/commands/operation/list.d.ts +12 -0
- package/dist/commands/operation/list.js +25 -0
- package/dist/commands/operation/recover.d.ts +20 -0
- package/dist/commands/operation/recover.js +49 -0
- package/dist/commands/page/changes.d.ts +13 -0
- package/dist/commands/page/changes.js +26 -0
- package/dist/commands/page/check.d.ts +12 -0
- package/dist/commands/page/check.js +25 -0
- package/dist/commands/page/replace.d.ts +13 -0
- package/dist/commands/page/replace.js +59 -0
- package/dist/commands/page/unpreview.d.ts +17 -0
- package/dist/commands/page/unpreview.js +54 -0
- package/dist/commands/page/unpublish.d.ts +18 -0
- package/dist/commands/page/unpublish.js +36 -0
- package/dist/commands/project/preview.d.ts +8 -0
- package/dist/commands/project/preview.js +20 -0
- package/dist/commands/project/publish.d.ts +16 -0
- package/dist/commands/project/publish.js +40 -0
- package/dist/commands/project/unpublish.d.ts +16 -0
- package/dist/commands/project/unpublish.js +33 -0
- package/dist/commands/release/rollback.d.ts +17 -0
- package/dist/commands/release/rollback.js +38 -0
- package/dist/commands/servers/index.d.ts +20 -0
- package/dist/commands/servers/index.js +36 -0
- package/dist/commands/servers/use.d.ts +11 -0
- package/dist/commands/servers/use.js +30 -0
- package/dist/commands/site/adopt.d.ts +11 -0
- package/dist/commands/site/adopt.js +21 -0
- package/dist/commands/site/create.d.ts +18 -0
- package/dist/commands/site/create.js +61 -0
- package/dist/commands/site/edit.d.ts +11 -0
- package/dist/commands/site/edit.js +56 -0
- package/dist/commands/site/history.d.ts +11 -0
- package/dist/commands/site/history.js +25 -0
- package/dist/commands/site/link.d.ts +15 -0
- package/dist/commands/site/link.js +35 -0
- package/dist/commands/site/list.d.ts +9 -0
- package/dist/commands/site/list.js +29 -0
- package/dist/commands/site/reset-storage.d.ts +15 -0
- package/dist/commands/site/reset-storage.js +61 -0
- package/dist/commands/site/set.d.ts +16 -0
- package/dist/commands/site/set.js +45 -0
- package/dist/commands/site/show.d.ts +10 -0
- package/dist/commands/site/show.js +19 -0
- package/dist/commands/site/status.d.ts +11 -0
- package/dist/commands/site/status.js +15 -0
- package/dist/commands/site/unlink.d.ts +11 -0
- package/dist/commands/site/unlink.js +28 -0
- package/dist/commands/source/add.d.ts +32 -0
- package/dist/commands/source/add.js +103 -0
- package/dist/commands/source/adopt-pages.d.ts +14 -0
- package/dist/commands/source/adopt-pages.js +30 -0
- package/dist/commands/source/check.d.ts +17 -0
- package/dist/commands/source/check.js +52 -0
- package/dist/commands/source/list.d.ts +11 -0
- package/dist/commands/source/list.js +15 -0
- package/dist/commands/source/mappings/check.d.ts +13 -0
- package/dist/commands/source/mappings/check.js +69 -0
- package/dist/commands/source/pending.d.ts +12 -0
- package/dist/commands/source/pending.js +25 -0
- package/dist/commands/source/plugins.d.ts +6 -0
- package/dist/commands/source/plugins.js +17 -0
- package/dist/commands/source/sync.d.ts +16 -0
- package/dist/commands/source/sync.js +58 -0
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.js +21 -0
- package/dist/connect-prompts.d.ts +16 -0
- package/dist/connect-prompts.js +24 -0
- package/dist/connect.d.ts +133 -0
- package/dist/connect.js +416 -0
- package/dist/core-command.d.ts +91 -0
- package/dist/core-command.js +262 -0
- package/dist/core-types.d.ts +21 -0
- package/dist/core-types.js +1 -0
- package/dist/create-connect.d.ts +26 -0
- package/dist/create-connect.js +93 -0
- package/dist/dev/code-watcher.d.ts +66 -0
- package/dist/dev/code-watcher.js +254 -0
- package/dist/dev/dev-checks.d.ts +14 -0
- package/dist/dev/dev-checks.js +138 -0
- package/dist/dev/dev-reload.d.ts +51 -0
- package/dist/dev/dev-reload.js +345 -0
- package/dist/dev/flags.d.ts +15 -0
- package/dist/dev/flags.js +43 -0
- package/dist/dev/html.d.ts +30 -0
- package/dist/dev/html.js +106 -0
- package/dist/dev/kit-files.d.ts +7 -0
- package/dist/dev/kit-files.js +33 -0
- package/dist/dev/local-code.d.ts +22 -0
- package/dist/dev/local-code.js +101 -0
- package/dist/dev/remote-config.d.ts +57 -0
- package/dist/dev/remote-config.js +100 -0
- package/dist/dev/remote-dev.d.ts +41 -0
- package/dist/dev/remote-dev.js +527 -0
- package/dist/dev/remote-fetch.d.ts +5 -0
- package/dist/dev/remote-fetch.js +36 -0
- package/dist/dev/remote-html.d.ts +10 -0
- package/dist/dev/remote-html.js +60 -0
- package/dist/dev/remote-page.d.ts +34 -0
- package/dist/dev/remote-page.js +183 -0
- package/dist/dev/remote-routes.d.ts +63 -0
- package/dist/dev/remote-routes.js +114 -0
- package/dist/dev/signal-stop.d.ts +17 -0
- package/dist/dev/signal-stop.js +46 -0
- package/dist/dev/start.d.ts +18 -0
- package/dist/dev/start.js +80 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +7 -0
- package/dist/lib/diagnostics.d.ts +15 -0
- package/dist/lib/diagnostics.js +12 -0
- package/dist/lib/front-matter.d.ts +6 -0
- package/dist/lib/front-matter.js +59 -0
- package/dist/lib/operation-result.d.ts +3 -0
- package/dist/lib/operation-result.js +16 -0
- package/dist/lib/problem-groups.d.ts +27 -0
- package/dist/lib/problem-groups.js +49 -0
- package/dist/lib/problems.d.ts +50 -0
- package/dist/lib/problems.js +94 -0
- package/dist/lib/prompts.d.ts +38 -0
- package/dist/lib/prompts.js +77 -0
- package/dist/lib/result-types.d.ts +198 -0
- package/dist/lib/result-types.js +3 -0
- package/dist/lib/rules.d.ts +15 -0
- package/dist/lib/rules.js +26 -0
- package/dist/lib/summaries.d.ts +19 -0
- package/dist/lib/summaries.js +22 -0
- package/dist/lib/sync-problems.d.ts +21 -0
- package/dist/lib/sync-problems.js +19 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +40 -0
- package/dist/project-preview.d.ts +35 -0
- package/dist/project-preview.js +156 -0
- package/dist/project-publish.d.ts +28 -0
- package/dist/project-publish.js +173 -0
- package/dist/remote/connection.d.ts +8 -0
- package/dist/remote/connection.js +19 -0
- package/dist/remote/core-failure.d.ts +8 -0
- package/dist/remote/core-failure.js +15 -0
- package/dist/remote/credentials.d.ts +15 -0
- package/dist/remote/credentials.js +112 -0
- package/dist/remote/device-login.d.ts +33 -0
- package/dist/remote/device-login.js +161 -0
- package/dist/remote/remote-caller.d.ts +14 -0
- package/dist/remote/remote-caller.js +52 -0
- package/dist/remote/rpc-wire.d.ts +18 -0
- package/dist/remote/rpc-wire.js +57 -0
- package/dist/remote/servers.d.ts +80 -0
- package/dist/remote/servers.js +162 -0
- package/dist/remote/session.d.ts +53 -0
- package/dist/remote/session.js +132 -0
- package/dist/remote/sign-in-here.d.ts +5 -0
- package/dist/remote/sign-in-here.js +33 -0
- package/dist/remote/sign-in.d.ts +25 -0
- package/dist/remote/sign-in.js +55 -0
- package/dist/remote/wait-slices.d.ts +16 -0
- package/dist/remote/wait-slices.js +21 -0
- package/dist/render/add.d.ts +3 -0
- package/dist/render/add.js +9 -0
- package/dist/render/branch-write.d.ts +9 -0
- package/dist/render/branch-write.js +28 -0
- package/dist/render/branches.d.ts +5 -0
- package/dist/render/branches.js +28 -0
- package/dist/render/credentials.d.ts +5 -0
- package/dist/render/credentials.js +39 -0
- package/dist/render/operation-result.d.ts +16 -0
- package/dist/render/operation-result.js +65 -0
- package/dist/render/operation.d.ts +7 -0
- package/dist/render/operation.js +15 -0
- package/dist/render/page-changes.d.ts +3 -0
- package/dist/render/page-changes.js +36 -0
- package/dist/render/pending.d.ts +3 -0
- package/dist/render/pending.js +46 -0
- package/dist/render/plugin-list.d.ts +3 -0
- package/dist/render/plugin-list.js +30 -0
- package/dist/render/probe.d.ts +3 -0
- package/dist/render/probe.js +61 -0
- package/dist/render/problems.d.ts +35 -0
- package/dist/render/problems.js +64 -0
- package/dist/render/recovery.d.ts +2 -0
- package/dist/render/recovery.js +36 -0
- package/dist/render/reset-storage.d.ts +4 -0
- package/dist/render/reset-storage.js +70 -0
- package/dist/render/site-status.d.ts +2 -0
- package/dist/render/site-status.js +81 -0
- package/dist/render/source-list.d.ts +2 -0
- package/dist/render/source-list.js +37 -0
- package/dist/render/sync.d.ts +5 -0
- package/dist/render/sync.js +66 -0
- package/dist/settings.d.ts +10 -0
- package/dist/settings.js +45 -0
- package/dist/site-entry-edit.d.ts +5 -0
- package/dist/site-entry-edit.js +44 -0
- package/dist/source-entry.d.ts +32 -0
- package/dist/source-entry.js +89 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.js +10 -0
- package/package.json +108 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { pageChangesLines } from '../../render/page-changes.js';
|
|
4
|
+
export default class PageChanges extends CoreCommand {
|
|
5
|
+
static description = 'Compare working pages (text and images) with the live site (core content.changes)';
|
|
6
|
+
static examples = ['<%= config.bin %> page changes', '<%= config.bin %> page changes --changed --json'];
|
|
7
|
+
static flags = {
|
|
8
|
+
...CoreCommand.siteFlags,
|
|
9
|
+
...CoreCommand.contentFlag,
|
|
10
|
+
changed: Flags.boolean({ description: 'list only pages that differ from the live site' }),
|
|
11
|
+
...CoreCommand.inputFlag,
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(PageChanges);
|
|
15
|
+
const input = await this.resolveInput(flags.input, async () => ({
|
|
16
|
+
...(await this.siteInput(flags.site)),
|
|
17
|
+
input: { kind: 'workspace' },
|
|
18
|
+
changedOnly: flags.changed,
|
|
19
|
+
}));
|
|
20
|
+
const changes = await this.core.content.changes(input);
|
|
21
|
+
this.noteProvisional(changes.provisional);
|
|
22
|
+
for (const line of pageChangesLines(changes))
|
|
23
|
+
this.log(line);
|
|
24
|
+
return changes;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class PageCheck extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
content: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { formatDiagnostic } from '../../lib/diagnostics.js';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
export default class PageCheck extends CoreCommand {
|
|
4
|
+
static description = 'Validate all pages and components/components.json (core content.validate)';
|
|
5
|
+
static examples = [
|
|
6
|
+
'<%= config.bin %> page check',
|
|
7
|
+
'<%= config.bin %> page check --site a --content ./sample-content',
|
|
8
|
+
];
|
|
9
|
+
static flags = { ...CoreCommand.siteFlags, ...CoreCommand.contentFlag, ...CoreCommand.inputFlag };
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(PageCheck);
|
|
12
|
+
const input = await this.resolveInput(flags.input, async () => ({
|
|
13
|
+
...(await this.siteInput(flags.site)),
|
|
14
|
+
input: { kind: 'workspace' },
|
|
15
|
+
}));
|
|
16
|
+
const result = await this.core.content.validate(input);
|
|
17
|
+
this.noteProvisional(result.provisional);
|
|
18
|
+
for (const diagnostic of result.diagnostics)
|
|
19
|
+
this.log(formatDiagnostic(diagnostic));
|
|
20
|
+
this.log(`${result.pages} page(s) checked: ${result.errors} error(s), ${result.warnings} warning(s).`);
|
|
21
|
+
if (result.errors > 0)
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class PageReplace extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
path: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
with: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<unknown>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { terminalConfirm } from '../../project-publish.js';
|
|
4
|
+
export default class PageReplace extends CoreCommand {
|
|
5
|
+
static description = 'Let another item of its source feed a published page (e.g. a Drive file deleted and uploaded again): the page ' +
|
|
6
|
+
'keeps its ID, address, live version and history. Shows the plan and asks first; preview and live are ' +
|
|
7
|
+
'unchanged until the next sync and preview/publish (core sources.replacePage)';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> page replace --path /lessons/signs/ru --with 1AbCdEfGhIjK',
|
|
10
|
+
'<%= config.bin %> page replace --site my-site --path /lessons/signs/ru --with 1AbCdEfGhIjK --yes',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...CoreCommand.siteFlags,
|
|
14
|
+
path: Flags.string({ description: 'the path of the page that is live or in preview', required: true }),
|
|
15
|
+
with: Flags.string({
|
|
16
|
+
description: 'the native ID of the source item that should feed it (a Drive file ID; `source sync --json` lists the ' +
|
|
17
|
+
"items' native_id)",
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
yes: Flags.boolean({ description: 'apply the plan without asking (required when not in a terminal)' }),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(PageReplace);
|
|
24
|
+
const input = { ...(await this.siteInput(flags.site)), path: flags.path, with: flags.with };
|
|
25
|
+
const planned = await this.core.sources.replacePage({ ...input, confirm: false });
|
|
26
|
+
const { plan } = planned;
|
|
27
|
+
const show = (document, nativeId) => document === null ? nativeId : `${document} (${nativeId})`;
|
|
28
|
+
if (!this.jsonEnabled()) {
|
|
29
|
+
this.log(`Page ${plan.pageId} at ${plan.path} (${plan.channels.join(' and ')}), source ${plan.source}:`);
|
|
30
|
+
this.log(` fed now by: ` +
|
|
31
|
+
`${show(plan.from.document, plan.from.nativeId)}${plan.from.present ? '' : ' (no longer in the source)'}`);
|
|
32
|
+
this.log(` will be fed: ${show(plan.to.document, plan.to.nativeId)}, which reads as ${plan.to.path}`);
|
|
33
|
+
if (plan.drops !== null)
|
|
34
|
+
this.log(` the unpublished page ${plan.drops} loses this item`);
|
|
35
|
+
for (const warning of planned.warnings)
|
|
36
|
+
this.log(` ${warning.code}: ${warning.message}`);
|
|
37
|
+
}
|
|
38
|
+
if (!flags.yes) {
|
|
39
|
+
const confirm = terminalConfirm(process.stdin, process.stdout);
|
|
40
|
+
if (!confirm)
|
|
41
|
+
this.error('Not in a terminal: add --yes to apply this plan.', { exit: 2 });
|
|
42
|
+
if (!(await confirm(`Replace the item that feeds ${plan.pageId}?`))) {
|
|
43
|
+
if (!this.jsonEnabled())
|
|
44
|
+
this.log('Nothing was changed.');
|
|
45
|
+
return planned;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const applied = await this.core.sources.replacePage({
|
|
49
|
+
...input,
|
|
50
|
+
confirm: true,
|
|
51
|
+
expect: { pageId: plan.pageId, from: plan.from.nativeId },
|
|
52
|
+
});
|
|
53
|
+
if (!this.jsonEnabled())
|
|
54
|
+
this.log(`Done: ${show(applied.plan.to.document, applied.plan.to.nativeId)} now feeds page ${applied.plan.pageId}. ` +
|
|
55
|
+
`Sync source ${applied.plan.source} next; the page then previews and publishes from it (live is unchanged ` +
|
|
56
|
+
`until you publish).`);
|
|
57
|
+
return applied;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class PageUnpreview extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'wait-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
path: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
expect: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'latest-preview': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<unknown>;
|
|
15
|
+
/** `expect.preview`: `--expect`, or with `--latest-preview` the preview release read now (not again later). */
|
|
16
|
+
private expectedPreview;
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { longWriteReport } from '../../render/operation-result.js';
|
|
4
|
+
export default class PageUnpreview extends CoreCommand {
|
|
5
|
+
static description = 'Remove a page from the preview, live untouched: a page that is not live leaves the preview, a live page shows ' +
|
|
6
|
+
'its live version there again. Refused when the preview is not the one you expected (core channels.unpreview)';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> page unpreview --path /lessons/signs/ru --expect sr_… # the preview release `site status` ' +
|
|
9
|
+
'shows',
|
|
10
|
+
'<%= config.bin %> page unpreview --path /old-draft --latest-preview',
|
|
11
|
+
];
|
|
12
|
+
static flags = {
|
|
13
|
+
...CoreCommand.siteFlags,
|
|
14
|
+
path: Flags.string({ description: 'the path of the page in the preview', required: true }),
|
|
15
|
+
expect: Flags.string({
|
|
16
|
+
description: 'the preview site release you saw (sr_…, as `site status` shows it); refused when the preview is another one',
|
|
17
|
+
exclusive: ['latest-preview'],
|
|
18
|
+
}),
|
|
19
|
+
'latest-preview': Flags.boolean({
|
|
20
|
+
description: 'expect the preview as it is now (read once, before the request)',
|
|
21
|
+
exclusive: ['expect'],
|
|
22
|
+
}),
|
|
23
|
+
...CoreCommand.refreshWaitFlag,
|
|
24
|
+
...CoreCommand.inputFlag,
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(PageUnpreview);
|
|
28
|
+
const input = await this.resolveInput(flags.input, async () => {
|
|
29
|
+
const { site } = await this.siteInput(flags.site);
|
|
30
|
+
return { site, path: flags.path, expect: { preview: await this.expectedPreview(site, flags) } };
|
|
31
|
+
});
|
|
32
|
+
const operation = await this.follow(await this.core.channels.unpreview(input), {
|
|
33
|
+
wait: true,
|
|
34
|
+
waitTimeout: flags['wait-timeout'],
|
|
35
|
+
});
|
|
36
|
+
const report = longWriteReport(operation, `Removed ${flags.path} from the preview`);
|
|
37
|
+
if (!this.jsonEnabled())
|
|
38
|
+
for (const line of report.lines)
|
|
39
|
+
this.log(line);
|
|
40
|
+
process.exitCode = report.exitCode;
|
|
41
|
+
return operation;
|
|
42
|
+
}
|
|
43
|
+
/** `expect.preview`: `--expect`, or with `--latest-preview` the preview release read now (not again later). */
|
|
44
|
+
async expectedPreview(site, flags) {
|
|
45
|
+
if (flags.expect !== undefined)
|
|
46
|
+
return flags.expect;
|
|
47
|
+
if (!flags['latest-preview'])
|
|
48
|
+
this.error('Name the preview release you expect: --expect <sr_…> (as `site status` shows it), or --latest-preview.', { exit: 2 });
|
|
49
|
+
const { preview } = await this.core.sites.status({ site });
|
|
50
|
+
if (!preview)
|
|
51
|
+
this.error('This site has no preview yet; nothing to remove.');
|
|
52
|
+
return preview.site_release;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class PageUnpublish extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static strict: boolean;
|
|
6
|
+
static args: {
|
|
7
|
+
pages: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'wait-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
expect: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'latest-live': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<unknown>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { longWriteReport } from '../../render/operation-result.js';
|
|
4
|
+
export default class PageUnpublish extends CoreCommand {
|
|
5
|
+
static description = 'Remove pages from the live site; refused when live is not the release you expected (core channels.unpublish)';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> page unpublish help --expect sr_… # the live release `site status` shows',
|
|
8
|
+
'<%= config.bin %> page unpublish old-page other --latest-live',
|
|
9
|
+
];
|
|
10
|
+
static strict = false;
|
|
11
|
+
static args = { pages: Args.string({ description: 'page IDs to take off live', required: true }) };
|
|
12
|
+
static flags = {
|
|
13
|
+
...CoreCommand.siteFlags,
|
|
14
|
+
...CoreCommand.expectLiveFlags,
|
|
15
|
+
...CoreCommand.refreshWaitFlag,
|
|
16
|
+
...CoreCommand.inputFlag,
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { flags, argv } = await this.parse(PageUnpublish);
|
|
20
|
+
const pages = argv.map(String);
|
|
21
|
+
const input = await this.resolveInput(flags.input, async () => {
|
|
22
|
+
const { site } = await this.siteInput(flags.site);
|
|
23
|
+
return { site, pages, expect: { live: await this.expectedLive(site, flags) } };
|
|
24
|
+
});
|
|
25
|
+
const operation = await this.follow(await this.core.channels.unpublish(input), {
|
|
26
|
+
wait: true,
|
|
27
|
+
waitTimeout: flags['wait-timeout'],
|
|
28
|
+
});
|
|
29
|
+
const report = longWriteReport(operation, `Unpublished ${pages.join(', ')}`);
|
|
30
|
+
if (!this.jsonEnabled())
|
|
31
|
+
for (const line of report.lines)
|
|
32
|
+
this.log(line);
|
|
33
|
+
process.exitCode = report.exitCode;
|
|
34
|
+
return operation;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// `foliwake project preview`, and `foliwake preview` in a folder linked to a site
|
|
2
|
+
// (command-words.ts routes it here; project-preview.ts).
|
|
3
|
+
import { Command } from '@oclif/core';
|
|
4
|
+
export default class ProjectPreview extends Command {
|
|
5
|
+
static summary = "Preview this project's pages on its site's server (a folder linked with site create / site link)";
|
|
6
|
+
static description = `Sends the pages and images of content/ (committed or not) and the code of the last commit ` +
|
|
7
|
+
`(components/, scripts/ and styles/ must be committed) to the site this folder is linked to, rebuilds the ` +
|
|
8
|
+
`site's preview there and prints its address. In a linked folder, \`foliwake preview\` runs this command. ` +
|
|
9
|
+
`Remembers the preview in .foliwake/last-preview.json.`;
|
|
10
|
+
static examples = ['<%= config.bin %> preview', '<%= config.bin %> project preview --json'];
|
|
11
|
+
static enableJsonFlag = true;
|
|
12
|
+
async run() {
|
|
13
|
+
await this.parse(ProjectPreview);
|
|
14
|
+
const { previewProject } = await import('../../project-preview.js');
|
|
15
|
+
const json = this.jsonEnabled();
|
|
16
|
+
const outcome = await previewProject({ cwd: process.cwd(), env: process.env }, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
17
|
+
process.exitCode = outcome.exit;
|
|
18
|
+
return { siteRelease: outcome.siteRelease, previewUrl: outcome.previewUrl };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ProjectPublish extends Command {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static strict: boolean;
|
|
8
|
+
static args: {
|
|
9
|
+
paths: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
expect: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// `foliwake project publish` (project-publish.ts), and `foliwake publish` in a linked folder.
|
|
2
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
+
export default class ProjectPublish extends Command {
|
|
4
|
+
static summary = 'Publish the pages your last preview changed (or the pages of the given files and folders) to live';
|
|
5
|
+
static description = `In a folder linked to a site: with no paths, the pages the last \`foliwake preview\` of ` +
|
|
6
|
+
`this folder changed, refused when the preview changed since; with paths (files or folders under content/), ` +
|
|
7
|
+
`their pages. Lists them and asks in a terminal; --yes for scripts. --expect sr_… publishes a preview you ` +
|
|
8
|
+
`reviewed elsewhere. In a linked folder, \`foliwake publish\` runs this command.`;
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> publish',
|
|
11
|
+
'<%= config.bin %> publish content/index.md',
|
|
12
|
+
'<%= config.bin %> publish content/lessons/ --yes',
|
|
13
|
+
];
|
|
14
|
+
static enableJsonFlag = true;
|
|
15
|
+
static strict = false;
|
|
16
|
+
static args = {
|
|
17
|
+
paths: Args.string({ description: 'files or folders under content/', required: false }),
|
|
18
|
+
};
|
|
19
|
+
static flags = {
|
|
20
|
+
expect: Flags.string({
|
|
21
|
+
description: 'the preview release you reviewed (sr_…); default: the one the last `foliwake preview` here made',
|
|
22
|
+
}),
|
|
23
|
+
yes: Flags.boolean({ description: 'do not ask (scripts)' }),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { argv, flags } = await this.parse(ProjectPublish);
|
|
27
|
+
const { publishProject, terminalConfirm } = await import('../../project-publish.js');
|
|
28
|
+
const json = this.jsonEnabled();
|
|
29
|
+
const outcome = await publishProject({
|
|
30
|
+
cwd: process.cwd(),
|
|
31
|
+
env: process.env,
|
|
32
|
+
paths: argv,
|
|
33
|
+
expect: flags.expect,
|
|
34
|
+
yes: flags.yes,
|
|
35
|
+
confirm: json ? null : terminalConfirm(process.stdin, process.stdout),
|
|
36
|
+
}, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
37
|
+
process.exitCode = outcome.exit;
|
|
38
|
+
return { pages: outcome.pages, operation: outcome.operation };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ProjectUnpublish extends Command {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static strict: boolean;
|
|
8
|
+
static args: {
|
|
9
|
+
paths: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
expect: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// `foliwake project unpublish` (project-publish.ts).
|
|
2
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
+
export default class ProjectUnpublish extends Command {
|
|
4
|
+
static summary = 'Take the pages of the given files and folders off live';
|
|
5
|
+
static description = `In a folder linked to a site: the pages of the given files or folders under content/ go off ` +
|
|
6
|
+
`live, if live is still the release read just before (or --expect). Lists them and asks in a terminal; --yes ` +
|
|
7
|
+
`for scripts.`;
|
|
8
|
+
static examples = ['<%= config.bin %> project unpublish content/old.md'];
|
|
9
|
+
static enableJsonFlag = true;
|
|
10
|
+
static strict = false;
|
|
11
|
+
static args = {
|
|
12
|
+
paths: Args.string({ description: 'files or folders under content/', required: true }),
|
|
13
|
+
};
|
|
14
|
+
static flags = {
|
|
15
|
+
expect: Flags.string({ description: 'the live release you saw (sr_…); default: live as it is now' }),
|
|
16
|
+
yes: Flags.boolean({ description: 'do not ask (scripts)' }),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { argv, flags } = await this.parse(ProjectUnpublish);
|
|
20
|
+
const { unpublishProject, terminalConfirm } = await import('../../project-publish.js');
|
|
21
|
+
const json = this.jsonEnabled();
|
|
22
|
+
const outcome = await unpublishProject({
|
|
23
|
+
cwd: process.cwd(),
|
|
24
|
+
env: process.env,
|
|
25
|
+
paths: argv,
|
|
26
|
+
expect: flags.expect,
|
|
27
|
+
yes: flags.yes,
|
|
28
|
+
confirm: json ? null : terminalConfirm(process.stdin, process.stdout),
|
|
29
|
+
}, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
30
|
+
process.exitCode = outcome.exit;
|
|
31
|
+
return { pages: outcome.pages, operation: outcome.operation };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class ReleaseRollback extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
to: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'wait-timeout': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
expect: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'latest-live': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<unknown>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { longWriteReport } from '../../render/operation-result.js';
|
|
4
|
+
export default class ReleaseRollback extends CoreCommand {
|
|
5
|
+
static description = 'Make an earlier site release live again, code and pages as they were, as a new release; refused when live is ' +
|
|
6
|
+
'not the release you expected (core channels.rollback)';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> release rollback sr_… --expect sr_…',
|
|
9
|
+
'<%= config.bin %> site status --json # codeRollout.rollbackTo is one step back',
|
|
10
|
+
'<%= config.bin %> release rollback sr_… --latest-live',
|
|
11
|
+
];
|
|
12
|
+
static args = { to: Args.string({ description: 'the site release to go back to (sr_…)' }) };
|
|
13
|
+
static flags = {
|
|
14
|
+
...CoreCommand.siteFlags,
|
|
15
|
+
...CoreCommand.expectLiveFlags,
|
|
16
|
+
...CoreCommand.refreshWaitFlag,
|
|
17
|
+
...CoreCommand.inputFlag,
|
|
18
|
+
};
|
|
19
|
+
async run() {
|
|
20
|
+
const { args, flags } = await this.parse(ReleaseRollback);
|
|
21
|
+
const input = await this.resolveInput(flags.input, async () => {
|
|
22
|
+
if (args.to == null)
|
|
23
|
+
this.error('Name the site release to go back to (sr_…).', { exit: 2 });
|
|
24
|
+
const { site } = await this.siteInput(flags.site);
|
|
25
|
+
return { site, to: args.to, expect: { live: await this.expectedLive(site, flags) } };
|
|
26
|
+
});
|
|
27
|
+
const operation = await this.follow(await this.core.channels.rollback(input), {
|
|
28
|
+
wait: true,
|
|
29
|
+
waitTimeout: flags['wait-timeout'],
|
|
30
|
+
});
|
|
31
|
+
const report = longWriteReport(operation, `Rolled back to ${input.to}`);
|
|
32
|
+
if (!this.jsonEnabled())
|
|
33
|
+
for (const line of report.lines)
|
|
34
|
+
this.log(line);
|
|
35
|
+
process.exitCode = report.exitCode;
|
|
36
|
+
return operation;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { type ServerProfile } from '../../remote/servers.js';
|
|
3
|
+
/** One signed-in server as `servers` shows it; never a token. */
|
|
4
|
+
export interface ServerRow {
|
|
5
|
+
name: string;
|
|
6
|
+
origin: string | null;
|
|
7
|
+
default: boolean;
|
|
8
|
+
email: string | null;
|
|
9
|
+
principal: string;
|
|
10
|
+
organisations: string[];
|
|
11
|
+
installation: boolean;
|
|
12
|
+
store: ServerProfile['store'];
|
|
13
|
+
signedInAt: string;
|
|
14
|
+
}
|
|
15
|
+
export default class Servers extends Command {
|
|
16
|
+
static description: string;
|
|
17
|
+
static examples: string[];
|
|
18
|
+
static enableJsonFlag: boolean;
|
|
19
|
+
run(): Promise<unknown>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { nameOrigin, readProfiles, serverDisplay } from '../../remote/servers.js';
|
|
3
|
+
import { COMMAND } from '../../settings.js';
|
|
4
|
+
function rowOf(name, profile, profiles) {
|
|
5
|
+
return {
|
|
6
|
+
name,
|
|
7
|
+
origin: profile.origin ?? nameOrigin(name),
|
|
8
|
+
default: profiles.default === name,
|
|
9
|
+
email: profile.email ?? null,
|
|
10
|
+
principal: profile.principal,
|
|
11
|
+
organisations: profile.memberships.map((m) => `${m.org} (${m.role})`),
|
|
12
|
+
installation: profile.installation,
|
|
13
|
+
store: profile.store,
|
|
14
|
+
signedInAt: profile.signedInAt,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function lineOf(row) {
|
|
18
|
+
const shown = row.origin ? serverDisplay(row.origin) : row.name;
|
|
19
|
+
const who = row.email ?? row.principal;
|
|
20
|
+
const orgs = row.organisations.join(', ') || (row.installation ? 'installation' : 'no organisation');
|
|
21
|
+
return `${row.default ? '*' : ' '} ${shown} ${who} ${orgs} (${row.store})`;
|
|
22
|
+
}
|
|
23
|
+
export default class Servers extends Command {
|
|
24
|
+
static description = 'List the Foliwake servers this computer is signed in to; * marks the default';
|
|
25
|
+
static examples = ['<%= config.bin %> servers', '<%= config.bin %> servers --json'];
|
|
26
|
+
static enableJsonFlag = true;
|
|
27
|
+
async run() {
|
|
28
|
+
const profiles = readProfiles();
|
|
29
|
+
const rows = Object.entries(profiles.servers).map(([name, profile]) => rowOf(name, profile, profiles));
|
|
30
|
+
if (rows.length === 0)
|
|
31
|
+
this.log(`Not signed in to any server; \`${COMMAND} login <server>\` signs in.`);
|
|
32
|
+
for (const row of rows)
|
|
33
|
+
this.log(lineOf(row));
|
|
34
|
+
return { default: profiles.default, servers: rows };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class ServersUse extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static enableJsonFlag: boolean;
|
|
6
|
+
static args: {
|
|
7
|
+
server: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<unknown>;
|
|
10
|
+
private originOf;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { ServerAddressError, serverDisplay, serverOrigin, useServer } from '../../remote/servers.js';
|
|
3
|
+
import { COMMAND } from '../../settings.js';
|
|
4
|
+
export default class ServersUse extends Command {
|
|
5
|
+
static description = 'Make a signed-in server the default of commands that name no server';
|
|
6
|
+
static examples = ['<%= config.bin %> servers use https://foliwake.example'];
|
|
7
|
+
static enableJsonFlag = true;
|
|
8
|
+
static args = { server: Args.string({ description: 'server origin or host', required: true }) };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args } = await this.parse(ServersUse);
|
|
11
|
+
const origin = this.originOf(args.server);
|
|
12
|
+
if (!useServer(origin)) {
|
|
13
|
+
this.error(`This computer is not signed in to ${origin}; sign in first: \`${COMMAND} login ${origin}\`.`, {
|
|
14
|
+
exit: 1,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
this.log(`Commands that name no server now call ${serverDisplay(origin)}.`);
|
|
18
|
+
return { default: origin };
|
|
19
|
+
}
|
|
20
|
+
originOf(typed) {
|
|
21
|
+
try {
|
|
22
|
+
return serverOrigin(typed);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (error instanceof ServerAddressError)
|
|
26
|
+
this.error(error.message, { exit: 2 });
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteAdopt extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
input: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteAdopt extends CoreCommand {
|
|
3
|
+
static description = 'Bind an existing bucket and its state to a configured site; publishes nothing (core sites.adopt)';
|
|
4
|
+
static examples = ['<%= config.bin %> site adopt --config foliwake.config.json --site my-site'];
|
|
5
|
+
static flags = { ...CoreCommand.siteFlags, ...CoreCommand.inputFlag };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(SiteAdopt);
|
|
8
|
+
const input = await this.resolveInput(flags.input, () => this.siteInput(flags.site));
|
|
9
|
+
const result = await this.core.sites.adopt(input);
|
|
10
|
+
this.log(result.state === 'noop'
|
|
11
|
+
? `Site ${result.site} is already bound to its bucket and state; nothing changed.`
|
|
12
|
+
: `Site ${result.site} adopted its ` +
|
|
13
|
+
`bucket${result.state === 'state_attached' ? ' (state directory attached)' : ''}; nothing was published.`);
|
|
14
|
+
if (result.message)
|
|
15
|
+
this.log(` ${result.message}`);
|
|
16
|
+
for (const [field, ids] of Object.entries(result.missingProvenance ?? {}))
|
|
17
|
+
if (ids.length)
|
|
18
|
+
this.log(` Unknown ${field} for code release(s): ${ids.join(', ')} (recorded as unknown, not invented).`);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SiteCreate extends Command {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static args: {
|
|
8
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
relink: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
repository: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
code: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<unknown>;
|
|
18
|
+
}
|