Initial commit
This commit is contained in:
21
node_modules/astro/dist/cli/docs/core/open-docs.d.ts
generated
vendored
Normal file
21
node_modules/astro/dist/cli/docs/core/open-docs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { Logger } from '../../../core/logger/core.js';
|
||||
import type { CommandExecutor, OperatingSystemProvider } from '../../definitions.js';
|
||||
import type { CloudIdeProvider } from '../definitions.js';
|
||||
interface Options {
|
||||
url: string;
|
||||
operatingSystemProvider: OperatingSystemProvider;
|
||||
logger: Logger;
|
||||
commandExecutor: CommandExecutor;
|
||||
cloudIdeProvider: CloudIdeProvider;
|
||||
}
|
||||
export declare const openDocsCommand: {
|
||||
help: {
|
||||
commandName: string;
|
||||
tables: {
|
||||
Flags: [string, string][];
|
||||
};
|
||||
description: string;
|
||||
};
|
||||
run({ url, operatingSystemProvider, logger, commandExecutor, cloudIdeProvider }: Options): Promise<void>;
|
||||
};
|
||||
export {};
|
||||
42
node_modules/astro/dist/cli/docs/core/open-docs.js
generated
vendored
Normal file
42
node_modules/astro/dist/cli/docs/core/open-docs.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import { defineCommand } from "../../domain/command.js";
|
||||
function getExecInputForPlatform(platform) {
|
||||
switch (platform) {
|
||||
case "android":
|
||||
case "linux":
|
||||
return ["xdg-open"];
|
||||
case "darwin":
|
||||
return ["open"];
|
||||
case "win32":
|
||||
return ["cmd", ["/c", "start"]];
|
||||
case "gitpod":
|
||||
return ["/ide/bin/remote-cli/gitpod-code", ["--openExternal"]];
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const openDocsCommand = defineCommand({
|
||||
help: {
|
||||
commandName: "astro docs",
|
||||
tables: {
|
||||
Flags: [["--help (-h)", "See all available flags."]]
|
||||
},
|
||||
description: `Launches the Astro Docs website directly from the terminal.`
|
||||
},
|
||||
async run({ url, operatingSystemProvider, logger, commandExecutor, cloudIdeProvider }) {
|
||||
const platform = cloudIdeProvider.name ?? operatingSystemProvider.name;
|
||||
const input = getExecInputForPlatform(platform);
|
||||
if (!input) {
|
||||
logger.error(
|
||||
"SKIP_FORMAT",
|
||||
`It looks like your platform ("${platform}") isn't supported!
|
||||
To view Astro's docs, please visit ${url}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
const [command, args = []] = input;
|
||||
await commandExecutor.execute(command, [...args, encodeURI(url)]);
|
||||
}
|
||||
});
|
||||
export {
|
||||
openDocsCommand
|
||||
};
|
||||
4
node_modules/astro/dist/cli/docs/definitions.d.ts
generated
vendored
Normal file
4
node_modules/astro/dist/cli/docs/definitions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { CloudIde } from './domain/cloud-ide.js';
|
||||
export interface CloudIdeProvider {
|
||||
readonly name: CloudIde | null;
|
||||
}
|
||||
0
node_modules/astro/dist/cli/docs/definitions.js
generated
vendored
Normal file
0
node_modules/astro/dist/cli/docs/definitions.js
generated
vendored
Normal file
1
node_modules/astro/dist/cli/docs/domain/cloud-ide.d.ts
generated
vendored
Normal file
1
node_modules/astro/dist/cli/docs/domain/cloud-ide.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export type CloudIde = 'gitpod';
|
||||
0
node_modules/astro/dist/cli/docs/domain/cloud-ide.js
generated
vendored
Normal file
0
node_modules/astro/dist/cli/docs/domain/cloud-ide.js
generated
vendored
Normal file
5
node_modules/astro/dist/cli/docs/infra/process-cloud-ide-provider.d.ts
generated
vendored
Normal file
5
node_modules/astro/dist/cli/docs/infra/process-cloud-ide-provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { CloudIdeProvider } from '../definitions.js';
|
||||
import type { CloudIde } from '../domain/cloud-ide.js';
|
||||
export declare class ProcessCloudIdeProvider implements CloudIdeProvider {
|
||||
readonly name: CloudIde | null;
|
||||
}
|
||||
6
node_modules/astro/dist/cli/docs/infra/process-cloud-ide-provider.js
generated
vendored
Normal file
6
node_modules/astro/dist/cli/docs/infra/process-cloud-ide-provider.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
class ProcessCloudIdeProvider {
|
||||
name = Boolean(process.env.GITPOD_REPO_ROOT) ? "gitpod" : null;
|
||||
}
|
||||
export {
|
||||
ProcessCloudIdeProvider
|
||||
};
|
||||
Reference in New Issue
Block a user