@foliwake/cli 0.0.0-stage → 0.7.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 +56 -0
- package/LICENSE +202 -0
- package/README.md +654 -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 +32 -0
- package/dist/commands/create.js +171 -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 +30 -0
- package/dist/commands/dev.js +144 -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 +61 -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 +22 -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 +99 -0
- package/dist/core-command.js +332 -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 +19 -0
- package/dist/dev/flags.js +54 -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 +6 -0
- package/dist/index.js +8 -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/local-runtime.d.ts +78 -0
- package/dist/local-runtime.js +11 -0
- package/dist/local-target.d.ts +6 -0
- package/dist/local-target.js +23 -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 +112 -3
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// `foliwake site create <id>`: create this project's site on the signed-in server (connect.ts).
|
|
2
|
+
// Not a CoreCommand: it never runs against a local configuration, the folder's included.
|
|
3
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
4
|
+
export default class SiteCreate extends Command {
|
|
5
|
+
static summary = "Create this project's site on your Foliwake server (core sites.create; admin)";
|
|
6
|
+
static description = `In a project folder (as \`foliwake create\` makes it), signed in with \`foliwake login\` to ` +
|
|
7
|
+
`any Foliwake server: creates the site in your organisation (you must be its admin), with release 1 from the ` +
|
|
8
|
+
`folder's last commit (its code and pages, sent as a Git bundle), links the folder to it and prints what to ` +
|
|
9
|
+
`set up next (GitHub, workflows, content sources). Nothing on GitHub is changed. To use a site that exists ` +
|
|
10
|
+
`already: \`foliwake site link <id>\`.`;
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> site create mytest',
|
|
13
|
+
'<%= config.bin %> site create mytest --repository https://github.com/acme/mytest',
|
|
14
|
+
'<%= config.bin %> site create mytest --server foliwake.example --no-code',
|
|
15
|
+
];
|
|
16
|
+
static enableJsonFlag = true;
|
|
17
|
+
static args = {
|
|
18
|
+
id: Args.string({
|
|
19
|
+
required: true,
|
|
20
|
+
description: 'the new site id: at most 12 lowercase letters, digits and single inner hyphens, starting with a letter',
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static flags = {
|
|
24
|
+
server: Flags.string({
|
|
25
|
+
description: 'the Foliwake server (origin, host, or `cloud` for Foliwake Cloud; default: $FOLIWAKE_SERVER, else the only ' +
|
|
26
|
+
'server you are signed in to; several: asked in a terminal, refused without one)',
|
|
27
|
+
}),
|
|
28
|
+
relink: Flags.boolean({
|
|
29
|
+
description: 'replace the link of this folder (.foliwake/connection.json) to another server or site without asking',
|
|
30
|
+
}),
|
|
31
|
+
org: Flags.string({ description: 'the organisation (default: your only one where you are admin)' }),
|
|
32
|
+
repository: Flags.string({
|
|
33
|
+
description: "where the code will live, e.g. https://github.com/acme/mytest (the server checkout's origin)",
|
|
34
|
+
}),
|
|
35
|
+
code: Flags.boolean({
|
|
36
|
+
allowNo: true,
|
|
37
|
+
default: true,
|
|
38
|
+
description: 'send the last commit for release 1 (--no-code: release 1 waits for the first code prepare)',
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
async run() {
|
|
42
|
+
const { args, flags } = await this.parse(SiteCreate);
|
|
43
|
+
const { createSite } = await import('../../connect.js');
|
|
44
|
+
const json = this.jsonEnabled();
|
|
45
|
+
const { terminalQuestions } = await import('../../connect-prompts.js');
|
|
46
|
+
const questions = terminalQuestions({ input: process.stdin, output: process.stdout }, { ask: !json });
|
|
47
|
+
const outcome = await createSite({
|
|
48
|
+
cwd: process.cwd(),
|
|
49
|
+
server: flags.server,
|
|
50
|
+
site: args.id,
|
|
51
|
+
org: flags.org,
|
|
52
|
+
repository: flags.repository ?? null,
|
|
53
|
+
code: flags.code,
|
|
54
|
+
env: process.env,
|
|
55
|
+
relink: flags.relink,
|
|
56
|
+
...questions,
|
|
57
|
+
}, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
58
|
+
process.exitCode = outcome.exit;
|
|
59
|
+
return { server: outcome.server, operation: outcome.operation, result: outcome.result };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteEdit extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
expect: import("@oclif/core/interfaces").OptionFlag<number | 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,56 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
export default class SiteEdit extends CoreCommand {
|
|
4
|
+
static description = "Edit a stored site's settings in $VISUAL or $EDITOR; saved only if nobody changed the site meanwhile (core " +
|
|
5
|
+
'sites.update)';
|
|
6
|
+
static examples = ['<%= config.bin %> site edit --site my-site'];
|
|
7
|
+
static flags = {
|
|
8
|
+
...CoreCommand.siteFlags,
|
|
9
|
+
expect: Flags.integer({
|
|
10
|
+
min: 1,
|
|
11
|
+
description: 'the revision you saw (`site show`); default: the one opened in the editor',
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { flags } = await this.parse(SiteEdit);
|
|
16
|
+
const { mkdtemp, readFile, rm, writeFile } = await import('node:fs/promises');
|
|
17
|
+
const { spawnSync } = await import('node:child_process');
|
|
18
|
+
const os = await import('node:os');
|
|
19
|
+
const path = await import('node:path');
|
|
20
|
+
const { isDeepStrictEqual } = await import('node:util');
|
|
21
|
+
const { site } = await this.siteInput(flags.site);
|
|
22
|
+
const current = await this.core.sites.get({ site });
|
|
23
|
+
const editor = process.env.VISUAL || process.env.EDITOR;
|
|
24
|
+
if (!editor)
|
|
25
|
+
this.error('Set $VISUAL or $EDITOR, or change one setting with `foliwake site set`.', { exit: 2 });
|
|
26
|
+
const dir = await mkdtemp(path.join(os.tmpdir(), 'foliwake-site-'));
|
|
27
|
+
try {
|
|
28
|
+
const file = path.join(dir, `${site}.json`);
|
|
29
|
+
await writeFile(file, `${JSON.stringify(current.entry, null, 2)}\n`, { mode: 0o600 });
|
|
30
|
+
const run = spawnSync(editor, [file], { stdio: 'inherit', shell: true });
|
|
31
|
+
if (run.status !== 0)
|
|
32
|
+
this.error(`The editor ended with status ${run.status}; nothing was saved.`);
|
|
33
|
+
let entry;
|
|
34
|
+
try {
|
|
35
|
+
entry = JSON.parse(await readFile(file, 'utf8'));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.error(`Not saved: the edited file is not valid JSON (${error.message}).`);
|
|
39
|
+
}
|
|
40
|
+
if (isDeepStrictEqual(entry, current.entry)) {
|
|
41
|
+
this.log('No change; nothing was saved.');
|
|
42
|
+
return { site, revision: current.revision };
|
|
43
|
+
}
|
|
44
|
+
const answer = await this.core.sites.update({
|
|
45
|
+
site,
|
|
46
|
+
expect: { revision: flags.expect ?? current.revision },
|
|
47
|
+
entry,
|
|
48
|
+
});
|
|
49
|
+
this.log(`${site}: saved as revision ${answer.revision}. Running services pick it up without a restart.`);
|
|
50
|
+
return answer;
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
await rm(dir, { recursive: true, force: true });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteHistory extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number | 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,25 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
export default class SiteHistory extends CoreCommand {
|
|
4
|
+
static description = "Who changed a stored site's settings, when, and which settings (core sites.history)";
|
|
5
|
+
static examples = [
|
|
6
|
+
'<%= config.bin %> site history --site my-site',
|
|
7
|
+
'<%= config.bin %> site history --site my-site --limit 50 --json',
|
|
8
|
+
];
|
|
9
|
+
static flags = {
|
|
10
|
+
...CoreCommand.siteFlags,
|
|
11
|
+
limit: Flags.integer({ min: 1, max: 100, description: 'how many changes, newest first (default 20)' }),
|
|
12
|
+
};
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(SiteHistory);
|
|
15
|
+
const { site } = await this.siteInput(flags.site);
|
|
16
|
+
const answer = await this.core.sites.history({
|
|
17
|
+
site,
|
|
18
|
+
...(flags.limit === undefined ? {} : { limit: flags.limit }),
|
|
19
|
+
});
|
|
20
|
+
for (const each of answer.revisions)
|
|
21
|
+
this.log(`${String(each.revision).padStart(4)} ${each.at} ${each.action.padEnd(6)} ${each.actor} ` +
|
|
22
|
+
`${each.changed.join(', ') || '-'}`);
|
|
23
|
+
return answer;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SiteLink 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
|
+
};
|
|
14
|
+
run(): Promise<unknown>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// `foliwake site link <id>`: link this project folder to an existing site (connect.ts).
|
|
2
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
+
export default class SiteLink extends Command {
|
|
4
|
+
static summary = 'Link this project folder to an existing site on your Foliwake server (developer or admin)';
|
|
5
|
+
static description = `Signed in with \`foliwake login\` to any Foliwake server: checks that the site exists and ` +
|
|
6
|
+
`that you are a developer or admin of its organisation, and writes .foliwake/connection.json in this folder. ` +
|
|
7
|
+
`Nothing changes on the server. A second developer who cloned the repository only links.`;
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> site link mytest',
|
|
10
|
+
'<%= config.bin %> site link mytest --server foliwake.example',
|
|
11
|
+
];
|
|
12
|
+
static enableJsonFlag = true;
|
|
13
|
+
static args = {
|
|
14
|
+
id: Args.string({ required: true, description: 'the site id on the server' }),
|
|
15
|
+
};
|
|
16
|
+
static flags = {
|
|
17
|
+
server: Flags.string({
|
|
18
|
+
description: 'the Foliwake server (origin, host, or `cloud` for Foliwake Cloud; default: $FOLIWAKE_SERVER, else the only ' +
|
|
19
|
+
'server you are signed in to; several: asked in a terminal, refused without one)',
|
|
20
|
+
}),
|
|
21
|
+
relink: Flags.boolean({
|
|
22
|
+
description: 'replace the link of this folder (.foliwake/connection.json) to another server or site without asking',
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { args, flags } = await this.parse(SiteLink);
|
|
27
|
+
const { linkSite } = await import('../../connect.js');
|
|
28
|
+
const json = this.jsonEnabled();
|
|
29
|
+
const { terminalQuestions } = await import('../../connect-prompts.js');
|
|
30
|
+
const questions = terminalQuestions({ input: process.stdin, output: process.stdout }, { ask: !json });
|
|
31
|
+
const outcome = await linkSite({ cwd: process.cwd(), server: flags.server, site: args.id, env: process.env, relink: flags.relink, ...questions }, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
32
|
+
process.exitCode = outcome.exit;
|
|
33
|
+
return { server: outcome.server, site: outcome.site };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteList extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteList extends CoreCommand {
|
|
3
|
+
static description = 'Configured sites with hosts, repositories and bindings (core sites.list)';
|
|
4
|
+
static examples = ['<%= config.bin %> site list --config foliwake.config.json', '<%= config.bin %> site list --json'];
|
|
5
|
+
static flags = { ...CoreCommand.configFlag };
|
|
6
|
+
async run() {
|
|
7
|
+
const answer = await this.core.sites.list();
|
|
8
|
+
answer.sites.forEach((site, i) => {
|
|
9
|
+
if (i > 0)
|
|
10
|
+
this.log('');
|
|
11
|
+
this.log(site.id);
|
|
12
|
+
for (const key of [
|
|
13
|
+
'org',
|
|
14
|
+
'liveHosts',
|
|
15
|
+
'previewBaseHost',
|
|
16
|
+
'liveUrl',
|
|
17
|
+
'previewUrl',
|
|
18
|
+
'branchUrls',
|
|
19
|
+
'addresses',
|
|
20
|
+
'binding',
|
|
21
|
+
'repository',
|
|
22
|
+
]) {
|
|
23
|
+
const value = site[key];
|
|
24
|
+
this.log(` ${key.padEnd(16)}${Array.isArray(value) ? value.join(', ') : value}`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return answer;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteResetStorage extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
confirm: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
rev: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
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
|
+
/** The site id typed in a terminal; without one, --confirm is needed. */
|
|
14
|
+
private askSiteId;
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
import { resetPlanLines, resetResultLines } from '../../render/reset-storage.js';
|
|
4
|
+
export default class SiteResetStorage extends CoreCommand {
|
|
5
|
+
static description = "Recreate a site's storage in one action: archive its state, delete its objects in its own bucket, bind both " +
|
|
6
|
+
'again, prepare its code (release 1) and sync its sources. Publishes nothing: live is EMPTY (no pages) until ' +
|
|
7
|
+
"you publish again. Prints the plan first and asks for the site id (the installation's owner only; core " +
|
|
8
|
+
'sites.resetStorage)';
|
|
9
|
+
static examples = [
|
|
10
|
+
'<%= config.bin %> site reset-storage --site my-site --dry-run',
|
|
11
|
+
'<%= config.bin %> site reset-storage --site my-site',
|
|
12
|
+
'<%= config.bin %> site reset-storage --site my-site --confirm my-site --json',
|
|
13
|
+
];
|
|
14
|
+
static flags = {
|
|
15
|
+
...CoreCommand.siteFlags,
|
|
16
|
+
confirm: Flags.string({
|
|
17
|
+
description: 'the site id, typed again: confirms the reset without a question (needed without a terminal)',
|
|
18
|
+
}),
|
|
19
|
+
'dry-run': Flags.boolean({ description: 'print the plan (what is lost, what is done) and change nothing' }),
|
|
20
|
+
rev: Flags.string({
|
|
21
|
+
description: 'the commit to prepare again (default: the commit live code came from, else HEAD)',
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
async run() {
|
|
25
|
+
const { flags } = await this.parse(SiteResetStorage);
|
|
26
|
+
const { site } = await this.siteInput(flags.site);
|
|
27
|
+
const plan = await this.core.sites.resetStoragePlan({ site });
|
|
28
|
+
if (!this.jsonEnabled())
|
|
29
|
+
for (const line of resetPlanLines(plan))
|
|
30
|
+
this.log(line);
|
|
31
|
+
if (flags['dry-run'])
|
|
32
|
+
return plan;
|
|
33
|
+
const confirm = flags.confirm ?? (await this.askSiteId(site));
|
|
34
|
+
// Working-folder sources are synced as `source sync` syncs them.
|
|
35
|
+
const accepted = await this.core.sites.resetStorage({
|
|
36
|
+
site,
|
|
37
|
+
confirm,
|
|
38
|
+
allowWorkingFolder: true,
|
|
39
|
+
...(flags.rev === undefined ? {} : { rev: flags.rev }),
|
|
40
|
+
});
|
|
41
|
+
const operation = await this.follow(accepted, { wait: false, waitTimeout: undefined });
|
|
42
|
+
if (!this.jsonEnabled())
|
|
43
|
+
for (const line of resetResultLines(operation))
|
|
44
|
+
this.log(line);
|
|
45
|
+
process.exitCode = operation.state === 'succeeded' ? 0 : 1;
|
|
46
|
+
return operation;
|
|
47
|
+
}
|
|
48
|
+
/** The site id typed in a terminal; without one, --confirm is needed. */
|
|
49
|
+
async askSiteId(site) {
|
|
50
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
51
|
+
this.error('Not a terminal: pass --confirm <site-id> to reset without being asked.', { exit: 2 });
|
|
52
|
+
const { isCancel, text } = await import('@clack/prompts');
|
|
53
|
+
const answer = await text({
|
|
54
|
+
message: `Type the site id (${site}) to delete its storage and archive its state`,
|
|
55
|
+
placeholder: site,
|
|
56
|
+
});
|
|
57
|
+
if (isCancel(answer))
|
|
58
|
+
this.error('Cancelled; nothing was changed.', { exit: 1 });
|
|
59
|
+
return String(answer).trim();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteSet extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
value: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
expect: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
unset: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<unknown>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { CoreCommand } from '../../core-command.js';
|
|
3
|
+
export default class SiteSet extends CoreCommand {
|
|
4
|
+
static description = 'Change one setting of a stored site, only if nobody changed the site since it was read (core sites.update)';
|
|
5
|
+
static examples = [
|
|
6
|
+
'<%= config.bin %> site set --site my-site media.resize engine',
|
|
7
|
+
'<%= config.bin %> site set --site my-site branchHostDomain preview.foliwake.example --expect 3',
|
|
8
|
+
'<%= config.bin %> site set --site my-site liveAliases --unset',
|
|
9
|
+
];
|
|
10
|
+
static args = {
|
|
11
|
+
path: Args.string({
|
|
12
|
+
required: true,
|
|
13
|
+
description: 'dotted settings path, e.g. media.resize or sources.0.settings.folderId',
|
|
14
|
+
}),
|
|
15
|
+
value: Args.string({ description: 'the new value: JSON when it parses (true, 3, ["a"], null), else a string' }),
|
|
16
|
+
};
|
|
17
|
+
static flags = {
|
|
18
|
+
...CoreCommand.siteFlags,
|
|
19
|
+
expect: Flags.integer({
|
|
20
|
+
min: 1,
|
|
21
|
+
description: 'the revision you saw (`site show`); default: the one read just before the change',
|
|
22
|
+
}),
|
|
23
|
+
unset: Flags.boolean({ description: 'remove the setting instead of setting it' }),
|
|
24
|
+
};
|
|
25
|
+
async run() {
|
|
26
|
+
const { args, flags } = await this.parse(SiteSet);
|
|
27
|
+
if (flags.unset === (args.value !== undefined))
|
|
28
|
+
this.error('Give a value, or --unset (not both).', { exit: 2 });
|
|
29
|
+
const { parseValue, withPath } = await import('../../site-entry-edit.js');
|
|
30
|
+
const { site } = await this.siteInput(flags.site);
|
|
31
|
+
const current = await this.core.sites.get({ site });
|
|
32
|
+
const revision = flags.expect ?? current.revision;
|
|
33
|
+
let entry;
|
|
34
|
+
try {
|
|
35
|
+
entry = withPath(current.entry, args.path, flags.unset ? undefined : parseValue(args.value));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.error(error.message, { exit: 2 });
|
|
39
|
+
}
|
|
40
|
+
const answer = await this.core.sites.update({ site, expect: { revision }, entry });
|
|
41
|
+
this.log(`${site}: ${args.path} ${flags.unset ? 'removed' : 'set'}; revision ${answer.revision}. Running services pick ` +
|
|
42
|
+
`it up without a restart.`);
|
|
43
|
+
return answer;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteShow extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteShow extends CoreCommand {
|
|
3
|
+
static description = "A site's stored settings and their revision, on a server that keeps its sites in a database (core sites.get)";
|
|
4
|
+
static examples = ['<%= config.bin %> site show --site my-site', '<%= config.bin %> site show --site my-site --json'];
|
|
5
|
+
static flags = { ...CoreCommand.siteFlags };
|
|
6
|
+
async run() {
|
|
7
|
+
const { flags } = await this.parse(SiteShow);
|
|
8
|
+
const answer = await this.core.sites.get(await this.siteInput(flags.site));
|
|
9
|
+
this.log(`${answer.site} (organisation ${answer.org}) · revision ${answer.revision} · changed ` +
|
|
10
|
+
`${answer.updatedAt}${answer.serverFields === 'hidden' ? " · the installation's fields are not shown" : ''}`);
|
|
11
|
+
this.log(JSON.stringify(answer.entry, null, 2));
|
|
12
|
+
// `codeRelease` absent = auto.
|
|
13
|
+
const mode = answer.entry.codeRelease === 'manual' ? 'manual' : 'auto';
|
|
14
|
+
this.log(`New frontend code: ` +
|
|
15
|
+
`${mode === 'auto' ? 'released automatically when its checks pass' : 'waits in preview for Release'} ` +
|
|
16
|
+
`(codeRelease: ${mode}${answer.entry.codeRelease === undefined ? ', the default' : ''}).`);
|
|
17
|
+
return answer;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SiteStatus 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,15 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
import { siteStatusLines } from '../../render/site-status.js';
|
|
3
|
+
export default class SiteStatus extends CoreCommand {
|
|
4
|
+
static description = 'Live, preview, code and pending work at a glance (core sites.status)';
|
|
5
|
+
static examples = ['<%= config.bin %> site status', '<%= config.bin %> site status --site my-site --json'];
|
|
6
|
+
static flags = { ...CoreCommand.siteFlags, ...CoreCommand.inputFlag };
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(SiteStatus);
|
|
9
|
+
const input = await this.resolveInput(flags.input, () => this.siteInput(flags.site));
|
|
10
|
+
const status = await this.core.sites.status(input);
|
|
11
|
+
for (const line of siteStatusLines(status))
|
|
12
|
+
this.log(line);
|
|
13
|
+
return status;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SiteUnlink extends Command {
|
|
3
|
+
static summary: string;
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static flags: {
|
|
8
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// `foliwake site unlink`: forget this folder's link to a site (connect.ts). No network call.
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
|
+
export default class SiteUnlink extends Command {
|
|
4
|
+
static summary = "Remove this project folder's link to its site (.foliwake/connection.json); the server is not changed";
|
|
5
|
+
static description = `Removes .foliwake/connection.json from this folder, so \`foliwake preview\` and \`publish\` ` +
|
|
6
|
+
`no longer go to that site. Nothing is sent to the server: the site, its releases and its pages stay there. ` +
|
|
7
|
+
`Prints the server and site it unlinked. A folder that is not linked is not an error: it says so and exits 0. ` +
|
|
8
|
+
`A connection file this version cannot read is left as it is unless --force. To move a project to another ` +
|
|
9
|
+
`server: \`foliwake site unlink\`, then \`foliwake site create <id> --server <server>\` (or \`site link ` +
|
|
10
|
+
`<id> --server <server>\`).`;
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> site unlink',
|
|
13
|
+
'<%= config.bin %> site unlink --json',
|
|
14
|
+
'<%= config.bin %> site unlink --force',
|
|
15
|
+
];
|
|
16
|
+
static enableJsonFlag = true;
|
|
17
|
+
static flags = {
|
|
18
|
+
force: Flags.boolean({ description: 'also remove a .foliwake/connection.json this version cannot read' }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
const { flags } = await this.parse(SiteUnlink);
|
|
22
|
+
const { unlinkSite } = await import('../../connect.js');
|
|
23
|
+
const json = this.jsonEnabled();
|
|
24
|
+
const outcome = await unlinkSite({ cwd: process.cwd(), force: flags.force, env: process.env }, { out: (text = '') => (json ? undefined : this.log(text)), err: (text = '') => this.logToStderr(text) });
|
|
25
|
+
process.exitCode = outcome.exit;
|
|
26
|
+
return { unlinked: outcome.unlinked };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CoreCommand } from '../../core-command.js';
|
|
2
|
+
export default class SourceAdd extends CoreCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
plugin: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
'display-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
owns: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
mappings: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
folder: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
subfolder: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
identity: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
key: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
repository: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
language: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'basic-user': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
'basic-password': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
|
+
'check-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
site: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
};
|
|
27
|
+
run(): Promise<unknown>;
|
|
28
|
+
private print;
|
|
29
|
+
private finishCheck;
|
|
30
|
+
/** --yes, or a person who says yes in a terminal; a failed connection is said before the question. */
|
|
31
|
+
private confirmed;
|
|
32
|
+
}
|