UNPKG

2.52 kBTypeScriptView Raw
1import { Context } from '../api/context';
2import { Settings } from '../api/settings';
3export declare const PROJECT_CONFIG = "cdk.json";
4export { PROJECT_CONTEXT } from '../api/context';
5export declare const USER_DEFAULTS = "~/.cdk.json";
6export declare enum Command {
7 LS = "ls",
8 LIST = "list",
9 DIFF = "diff",
10 BOOTSTRAP = "bootstrap",
11 DEPLOY = "deploy",
12 DESTROY = "destroy",
13 SYNTHESIZE = "synthesize",
14 SYNTH = "synth",
15 METADATA = "metadata",
16 INIT = "init",
17 VERSION = "version",
18 WATCH = "watch",
19 GC = "gc",
20 ROLLBACK = "rollback",
21 IMPORT = "import",
22 ACKNOWLEDGE = "acknowledge",
23 ACK = "ack",
24 NOTICES = "notices",
25 MIGRATE = "migrate",
26 CONTEXT = "context",
27 DOCS = "docs",
28 DOC = "doc",
29 DOCTOR = "doctor"
30}
31export type Arguments = {
32 readonly _: [Command, ...string[]];
33 readonly exclusively?: boolean;
34 readonly STACKS?: string[];
35 readonly lookups?: boolean;
36 readonly [name: string]: unknown;
37};
38export interface ConfigurationProps {
39 /**
40 * Configuration passed via command line arguments
41 *
42 * @default - Nothing passed
43 */
44 readonly commandLineArguments?: Arguments;
45 /**
46 * Whether or not to use context from `.cdk.json` in user home directory
47 *
48 * @default true
49 */
50 readonly readUserContext?: boolean;
51}
52/**
53 * All sources of settings combined
54 */
55export declare class Configuration {
56 private readonly props;
57 settings: Settings;
58 context: Context;
59 readonly defaultConfig: Settings;
60 private readonly commandLineArguments;
61 private readonly commandLineContext;
62 private _projectConfig?;
63 private _projectContext?;
64 private loaded;
65 constructor(props?: ConfigurationProps);
66 private get projectConfig();
67 get projectContext(): Settings;
68 /**
69 * Load all config
70 */
71 load(): Promise<this>;
72 /**
73 * Save the project context
74 */
75 saveContext(): Promise<this>;
76}
77/**
78 * Parse CLI arguments into Settings
79 *
80 * CLI arguments in must be accessed in the CLI code via
81 * `configuration.settings.get(['argName'])` instead of via `args.argName`.
82 *
83 * The advantage is that they can be configured via `cdk.json` and
84 * `$HOME/.cdk.json`. Arguments not listed below and accessed via this object
85 * can only be specified on the command line.
86 *
87 * @param argv the received CLI arguments.
88 * @returns a new Settings object.
89 */
90export declare function commandLineArgumentsToSettings(argv: Arguments): Settings;