///
///
///
///
///
import { BaseConfig, CommandInstanceInfo as FrameworkCommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMetadata as FrameworkCommandMetadata, CommandMetadataInput as FrameworkCommandMetadataInput, CommandMetadataOption as FrameworkCommandMetadataOption, HydratedCommandMetadata as FrameworkHydratedCommandMetadata, ICommand as FrameworkCommand, INamespace as FrameworkNamespace, NamespaceLocateResult as FrameworkNamespaceLocateResult, PackageJson } from '@familyjs/cli-framework';
import { Logger } from '@familyjs/cli-framework-output';
import { PromptModule } from '@familyjs/cli-framework-prompts';
import { NetworkInterface } from '@familyjs/utils-network';
import { Subprocess, SubprocessOptions, WhichOptions } from '@familyjs/utils-subprocess';
import { ChildProcess, SpawnOptions } from 'child_process';
import * as fs from 'fs';
import type { Integration as JigraIntegration } from './lib/integrations/jigra';
import type { JigraConfig } from './lib/integrations/jigra/config';
import type { Integration as CordovaIntegration } from './lib/integrations/cordova';
export { CommandLineInputs, CommandLineOptions, NamespaceMetadata, } from '@familyjs/cli-framework';
export declare type SuperAgentRequest = import('superagent').SuperAgentRequest;
export interface SuperAgentError extends Error {
response: import('superagent').Response;
}
export declare type LogFn = (msg: string) => void;
export interface ILogger extends Logger {
ok: LogFn;
rawmsg: LogFn;
}
export interface StarterManifest {
name: string;
baseref: string;
welcome?: string;
}
export interface CordovaPackageJson extends PackageJson {
cordova: {
platforms: string[];
plugins: {
[key: string]: unknown;
};
};
}
export interface LegacyAndroidBuildOutputEntry {
outputType: {
type: string;
};
path: string;
}
export interface AndroidBuildOutput {
artifactType: {
type: string;
};
elements: {
outputFile: string;
}[];
}
export interface Runner {
run(options: T): Promise;
}
export declare type ProjectType = 'angular' | 'angular-standalone' | 'custom' | 'bare' | 'react' | 'kdu' | 'react-lahm' | 'kdu-lahm';
export declare type HookName = 'build:before' | 'build:after' | 'serve:before' | 'serve:after' | 'jigra:run:before' | 'jigra:build:before' | 'jigra:sync:after';
export declare type JigraRunHookName = 'jigra:run:before';
export declare type JigraBuildHookName = 'jigra:build:before';
export declare type JigraSyncHookName = 'jigra:sync:after';
export interface BaseHookContext {
project: {
type: ProjectType;
dir: string;
srcDir: string;
};
argv: string[];
env: NodeJS.ProcessEnv;
}
export declare type AnyServeOptions = ReactServeOptions | AngularServeOptions;
export declare type AnyBuildOptions = ReactBuildOptions | AngularBuildOptions;
export interface JigraSyncHookInput {
readonly name: JigraSyncHookName;
readonly build?: AnyBuildOptions;
readonly jigra: FamilyJigraOptions;
}
export interface JigraRunHookInput {
readonly name: JigraRunHookName;
readonly serve?: AnyServeOptions;
readonly build?: AnyBuildOptions;
readonly jigra: FamilyJigraOptions;
}
export interface JigraBuildHookInput {
readonly name: JigraBuildHookName;
readonly build: AnyBuildOptions;
readonly jigra: FamilyJigraOptions;
}
export interface BuildHookInput {
readonly name: 'build:before' | 'build:after';
readonly build: AngularBuildOptions;
}
export interface ServeBeforeHookInput {
readonly name: 'serve:before';
readonly serve: AngularServeOptions;
}
export interface ServeAfterHookInput {
readonly name: 'serve:after';
readonly serve: (AngularServeOptions) & ServeDetails;
}
export declare type HookInput = BuildHookInput | ServeBeforeHookInput | ServeAfterHookInput | JigraRunHookInput | JigraBuildHookInput | JigraSyncHookInput;
export declare type HookContext = BaseHookContext & HookInput;
export declare type HookFn = (ctx: HookContext) => Promise;
export declare type IntegrationName = 'jigra' | 'cordova';
export interface ProjectIntegration {
enabled?: boolean;
root?: string;
}
export interface ProjectIntegrations {
cordova?: ProjectIntegration;
jigra?: ProjectIntegration;
}
export interface Response extends APIResponseSuccess {
data: T;
}
export interface ResourceClientLoad {
load(id: string | number, modifiers: ResourceClientRequestModifiers): Promise;
}
export interface ResourceClientDelete {
delete(id: string | number): Promise;
}
export interface ResourceClientCreate {
create(details: U): Promise;
}
export interface ResourceClientPaginate {
paginate(args?: Partial>>): IPaginator, PaginatorState>;
}
export interface ResourceClientRequestModifiers {
fields?: string[];
}
export interface Org {
name: string;
}
export interface GithubRepo {
full_name: string;
id: number;
}
export interface GithubBranch {
name: string;
}
export interface AppAssociation {
repository: RepoAssociation;
}
export interface RepoAssociationBase {
html_url: string;
clone_url: string;
full_name: string;
}
export interface GithubRepoAssociation extends RepoAssociationBase {
type: 'github';
id: number;
}
export interface GitlabRepoAssociation extends RepoAssociationBase {
type: 'gitlab';
id: number;
}
export interface GitlabEnterpriseRepoAssociation extends RepoAssociationBase {
type: 'gitlab_enterprise';
id: number;
}
export interface BitbucketCloudRepoAssociation extends RepoAssociationBase {
type: 'bitbucket_cloud';
id: string;
}
export interface BitbucketServerRepoAssociation extends RepoAssociationBase {
type: 'bitbucket_server';
id: number;
}
export interface AzureDevopsRepoAssociation extends RepoAssociationBase {
type: 'azure_devops';
id: string;
}
export declare type RepoAssociation = GithubRepoAssociation | BitbucketCloudRepoAssociation | BitbucketServerRepoAssociation;
export declare type AssociationType = 'github' | 'bitbucket_cloud' | 'bitbucket_server';
export interface App {
id: string;
name: string;
slug: string;
org: null | Org;
repo_url?: string;
association?: null | AppAssociation;
}
export interface IConfig extends BaseConfig {
getHTTPConfig(): CreateRequestOptions;
}
export interface ProjectPersonalizationDetails {
name: string;
projectId: string;
packageId?: string;
version?: string;
description?: string;
themeColor?: string;
appIcon?: Buffer;
splash?: Buffer;
}
export interface IProjectConfig {
name: string;
type?: ProjectType;
id?: string;
root?: string;
readonly integrations: ProjectIntegrations;
readonly hooks?: Record;
}
export interface IMultiProjectConfig {
defaultProject?: string;
projects: {
[key: string]: IProjectConfig | undefined;
};
}
export declare type ProjectFile = IProjectConfig | IMultiProjectConfig;
export interface IProject {
readonly rootDirectory: string;
readonly directory: string;
readonly filePath: string;
readonly pathPrefix: readonly string[];
readonly type: ProjectType;
readonly config: BaseConfig;
readonly details: import('./lib/project').ProjectDetailsResult;
getSourceDir(sourceRoot?: string): Promise;
getDefaultDistDir(): Promise;
getDistDir(): Promise;
getInfo(): Promise;
detected(): Promise;
createIntegration(name: 'jigra'): Promise;
createIntegration(name: 'cordova'): Promise;
createIntegration(name: IntegrationName): Promise>;
getIntegration(name: IntegrationName): Required | undefined;
requireIntegration(name: IntegrationName): Required;
getPackageJson(pkgName?: string, options?: {
logErrors?: boolean;
}): Promise<[PackageJson | undefined, string | undefined]>;
requirePackageJson(pkgName?: string): Promise;
personalize(details: ProjectPersonalizationDetails): Promise;
getBuildRunner(): Promise | undefined>;
getServeRunner(): Promise | undefined>;
getGenerateRunner(): Promise | undefined>;
requireBuildRunner(): Promise>;
requireServeRunner(): Promise>;
requireGenerateRunner(): Promise>;
}
export interface IntegrationAddDetails {
quiet?: boolean;
root: string;
enableArgs?: string[];
}
export interface IntegrationAddHandlers {
conflictHandler?: (f: string, stats: fs.Stats) => Promise;
onFileCreate?: (f: string) => void;
}
export interface IIntegration {
readonly name: IntegrationName;
readonly summary: string;
readonly archiveUrl?: string;
readonly config: BaseConfig;
add(details: IntegrationAddDetails): Promise;
isAdded(): boolean;
enable(config?: T): Promise;
isEnabled(): boolean;
disable(): Promise;
getInfo(): Promise;
personalize(details: ProjectPersonalizationDetails): Promise;
}
export interface PackageVersions {
[key: string]: string;
}
export interface CommandMetadataInput extends FrameworkCommandMetadataInput {
private?: boolean;
}
export interface CommandMetadataOption extends FrameworkCommandMetadataOption {
private?: boolean;
hint?: string;
}
export interface ExitCodeException extends Error {
exitCode: number;
}
export interface CommandMetadata extends FrameworkCommandMetadata {
type: 'global' | 'project';
}
export declare type HydratedCommandMetadata = CommandMetadata & FrameworkHydratedCommandMetadata;
export declare type CommandInstanceInfo = FrameworkCommandInstanceInfo;
export declare type NamespaceLocateResult = FrameworkNamespaceLocateResult;
export interface IShellSpawnOptions extends SpawnOptions {
showCommand?: boolean;
}
export interface IShellOutputOptions extends IShellSpawnOptions {
fatalOnError?: boolean;
fatalOnNotFound?: boolean;
showError?: boolean;
}
export interface IShellRunOptions extends IShellOutputOptions {
stream?: NodeJS.WritableStream;
killOnExit?: boolean;
truncateErrorOutput?: number;
}
export interface IShell {
alterPath: (path: string) => string;
run(command: string, args: readonly string[], options: IShellRunOptions): Promise;
output(command: string, args: readonly string[], options: IShellOutputOptions): Promise;
spawn(command: string, args: readonly string[], options: IShellSpawnOptions): Promise;
cmdinfo(cmd: string, args?: readonly string[], options?: SubprocessOptions): Promise;
which(command: string, options?: WhichOptions): Promise;
createSubprocess(command: string, args: readonly string[], options?: SubprocessOptions): Promise;
}
export interface ITelemetry {
sendCommand(command: string, args: string[]): Promise;
}
export declare type NpmClient = 'yarn' | 'npm' | 'pnpm';
export declare type FeatureId = 'ssl-commands';
export interface ConfigFile {
'version': string;
'telemetry': boolean;
'npmClient': NpmClient;
'interactive'?: boolean;
'proxy'?: string;
'ssl.cafile'?: string | string[];
'ssl.certfile'?: string | string[];
'ssl.keyfile'?: string | string[];
'tokens.telemetry'?: string;
'features.ssl-commands'?: boolean;
}
export interface SSLConfig {
cafile?: string | string[];
certfile?: string | string[];
keyfile?: string | string[];
}
export interface CreateRequestOptions {
userAgent: string;
ssl?: SSLConfig;
proxy?: string;
}
export declare type APIResponse = APIResponseSuccess | APIResponseError;
export interface APIResponseMeta {
status: number;
version: string;
request_id: string;
}
export declare type APIResponseData = object | object[] | string;
export interface APIResponseErrorDetails {
error_type: string;
parameter: string;
errors: string[];
}
export interface APIResponseError {
error: APIResponseErrorError;
meta: APIResponseMeta;
}
export interface APIResponseErrorError {
message: string;
link: string | null;
type: string;
details?: APIResponseErrorDetails[];
}
export interface APIResponseSuccess {
data: APIResponseData;
meta: APIResponseMeta;
}
export interface APIResponsePageTokenMeta extends APIResponseMeta {
prev_page_token?: string;
next_page_token?: string;
}
export declare type HttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'PURGE' | 'HEAD' | 'OPTIONS';
export declare const enum ContentType {
JSON = "application/json",
FORM_URLENCODED = "application/x-www-form-urlencoded",
HTML = "text/html"
}
export interface IClient {
config: IConfig;
make(method: HttpMethod, path: string, contentType?: ContentType): Promise<{
req: SuperAgentRequest;
}>;
do(req: SuperAgentRequest): Promise;
paginate>(args: PaginateArgs): IPaginator;
}
export declare type PaginateArgs> = Pick, 'reqgen' | 'guard' | 'state' | 'max'>;
export interface IPaginator, S = PaginatorState> extends IterableIterator> {
readonly state: S;
}
export declare type PaginatorRequestGenerator = () => Promise<{
req: SuperAgentRequest;
}>;
export declare type PaginatorGuard> = (res: APIResponseSuccess) => res is T;
export interface PaginatorState {
done: boolean;
loaded: number;
}
export interface PagePaginatorState extends PaginatorState {
page: number;
page_size?: number;
}
export interface TokenPaginatorState extends PaginatorState {
page_token?: string;
}
export interface PaginatorDeps, S = PaginatorState> {
readonly client: IClient;
readonly reqgen: PaginatorRequestGenerator;
readonly guard: PaginatorGuard;
readonly state?: Partial;
readonly max?: number;
}
export declare type InfoItemGroup = 'family' | 'jigra' | 'cordova' | 'utility' | 'system' | 'environment';
export interface InfoItem {
group: InfoItemGroup;
name: string;
value: string;
key?: string;
flair?: string;
path?: string;
hidden?: boolean;
}
export interface BaseBuildOptions {
engine: string;
platform?: string;
project?: string;
verbose?: boolean;
'--': string[];
}
export interface BuildOptions extends BaseBuildOptions {
type: T;
}
export interface AngularBuildOptions extends BuildOptions<'angular'> {
/**
* The Angular architect configuration to use for builds.
*
* The `--prod` command line flag is a shortcut which translates to the
* 'production' configuration.
*/
configuration?: string;
sourcemaps?: boolean;
cordovaAssets?: boolean;
watch?: boolean;
}
export interface ReactBuildOptions extends BuildOptions<'react'> {
publicUrl?: string;
ci?: boolean;
sourceMap?: boolean;
inlineRuntimeChunk?: boolean;
}
export interface KduBuildOptions extends BuildOptions<'kdu'> {
configuration?: string;
sourcemaps?: boolean;
}
export interface FamilyJigraOptions extends JigraConfig {
'--': string[];
verbose?: boolean;
}
export interface CustomBuildOptions extends BuildOptions<'custom'> {
}
export interface GenerateOptions {
name: string;
}
export interface AngularGenerateOptions extends GenerateOptions {
[key: string]: any;
schematic: string;
}
export interface FamilyAngularGenerateOptions extends GenerateOptions {
type: string;
module: boolean;
constants: boolean;
}
export interface ServeOptions {
host: string;
port: number;
publicHost?: string;
livereload: boolean;
proxy: boolean;
open: boolean;
browser?: string;
browserOption?: string;
platform?: string;
project?: string;
verbose?: boolean;
'--': string[];
externalAddressRequired?: boolean;
engine: string;
}
export interface AngularServeOptions extends ServeOptions {
consolelogs?: boolean;
consolelogsPort?: number;
ssl?: boolean;
configuration?: string;
sourcemaps?: boolean;
}
export interface ReactServeOptions extends ServeOptions {
https?: boolean;
ci?: boolean;
reactEditor?: string;
}
export interface KduServeOptions extends ServeOptions {
https: boolean;
mode: string;
configuration?: string;
sourcemaps?: boolean;
}
export interface CustomServeOptions extends ServeOptions {
}
export interface LabServeDetails {
projectType: ProjectType;
host: string;
port: number;
}
export interface ServeDetails {
custom: boolean;
protocol: string;
localAddress: string;
externalAddress: string;
port: number;
externalNetworkInterfaces: NetworkInterface[];
externallyAccessible: boolean;
}
export interface FamilyContext {
readonly binPath: string;
readonly libPath: string;
readonly execPath: string;
readonly version: string;
}
export interface FamilyEnvironment {
readonly flags: FamilyEnvironmentFlags;
readonly client: IClient;
readonly config: IConfig;
readonly log: ILogger;
readonly prompt: PromptModule;
readonly ctx: FamilyContext;
readonly shell: IShell;
getInfo(): Promise;
}
export interface FamilyEnvironmentFlags {
readonly interactive: boolean;
readonly confirm: boolean;
}
export declare type DistTag = 'testing' | 'canary' | 'latest';
export interface ICommand extends FrameworkCommand {
readonly env: FamilyEnvironment;
readonly project?: IProject;
execute(inputs: CommandLineInputs, options: CommandLineOptions, metadata: CommandInstanceInfo): Promise;
}
export interface CommandPreRun extends ICommand {
preRun(inputs: CommandLineInputs, options: CommandLineOptions, metadata: CommandInstanceInfo): Promise;
}
export interface INamespace extends FrameworkNamespace {
env: FamilyEnvironment;
project?: IProject;
}
export interface StarterList {
starters: {
name: string;
id: string;
type: ProjectType;
}[];
integrations: {
name: IntegrationName;
id: string;
}[];
}
export interface BaseStarterTemplate {
name: string;
projectType: ProjectType;
description?: string;
}
export interface RepoStarterTemplate extends BaseStarterTemplate {
type: 'repo';
repo: string;
}
export interface ManagedStarterTemplate extends BaseStarterTemplate {
type: 'managed';
id: string;
}
export declare type StarterTemplate = RepoStarterTemplate | ManagedStarterTemplate;
export interface ResolvedStarterTemplate extends BaseStarterTemplate {
archive: string;
}
export interface TelemetryIPCMessage {
type: 'telemetry';
data: {
command: string;
args: string[];
};
}
export interface UpdateCheckIPCMessage {
type: 'update-check';
}
export declare type IPCMessage = TelemetryIPCMessage | UpdateCheckIPCMessage;