tfts 0.3.2 → 0.3.3
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/dist/cli/commands/diff.d.ts +56 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +32 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/get.d.ts +52 -0
- package/dist/cli/commands/get.d.ts.map +1 -0
- package/dist/cli/commands/get.js +29 -0
- package/dist/cli/commands/get.js.map +1 -0
- package/dist/cli/commands/synth.d.ts +45 -0
- package/dist/cli/commands/synth.d.ts.map +1 -0
- package/dist/cli/commands/synth.js +25 -0
- package/dist/cli/commands/synth.js.map +1 -0
- package/dist/cli/diff.d.ts +9 -0
- package/dist/cli/diff.d.ts.map +1 -0
- package/dist/cli/diff.js +67 -0
- package/dist/cli/diff.js.map +1 -0
- package/dist/cli/main.js +16 -82
- package/dist/cli/main.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const diffCommand: import("cleye").Command<{
|
|
2
|
+
name: "diff";
|
|
3
|
+
alias: "plan";
|
|
4
|
+
help: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
parameters: "[stack]"[];
|
|
8
|
+
flags: {
|
|
9
|
+
app: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
output: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
skipSynth: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
command: "diff";
|
|
24
|
+
} & import("cleye").TypeFlag<{
|
|
25
|
+
app: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
output: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
skipSynth: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
} & {
|
|
38
|
+
help: BooleanConstructor;
|
|
39
|
+
}> & {
|
|
40
|
+
_: {
|
|
41
|
+
stack: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
showHelp: (options?: {
|
|
44
|
+
version?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
usage?: false | string | string[];
|
|
47
|
+
examples?: string | string[];
|
|
48
|
+
render?: (nodes: {
|
|
49
|
+
id?: string;
|
|
50
|
+
type: keyof import("cleye").Renderers;
|
|
51
|
+
data: any;
|
|
52
|
+
}[], renderers: import("cleye").Renderers) => string;
|
|
53
|
+
}) => void;
|
|
54
|
+
showVersion: () => void;
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/diff.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAgCy7M,CAAC;;;;;;;;;;;;EADj9M,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { command } from "cleye";
|
|
2
|
+
import { diff } from "../diff.js";
|
|
3
|
+
export const diffCommand = command({
|
|
4
|
+
name: "diff",
|
|
5
|
+
alias: "plan",
|
|
6
|
+
help: {
|
|
7
|
+
description: "Perform a diff (terraform plan) for the given stack",
|
|
8
|
+
},
|
|
9
|
+
parameters: ["[stack]"],
|
|
10
|
+
flags: {
|
|
11
|
+
app: {
|
|
12
|
+
type: String,
|
|
13
|
+
description: "Command to run the app",
|
|
14
|
+
},
|
|
15
|
+
output: {
|
|
16
|
+
type: String,
|
|
17
|
+
description: "Output directory (default: cdktf.out)",
|
|
18
|
+
},
|
|
19
|
+
skipSynth: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
description: "Skip synthesis before diff",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}, async (argv) => {
|
|
25
|
+
await diff({
|
|
26
|
+
stack: argv._.stack,
|
|
27
|
+
app: argv.flags.app,
|
|
28
|
+
output: argv.flags.output,
|
|
29
|
+
skipSynth: argv.flags.skipSynth,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/cli/commands/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAChC;IACE,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE;QACJ,WAAW,EAAE,qDAAqD;KACnE;IACD,UAAU,EAAE,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE;QACL,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wBAAwB;SACtC;QACD,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,uCAAuC;SACrD;QACD,SAAS,EAAE;YACT,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4BAA4B;SAC1C;KACF;CACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,IAAI,CAAC;QACT,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK;QACnB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;QACnB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;QACzB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;KAChC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const getCommand: import("cleye").Command<{
|
|
2
|
+
name: "get";
|
|
3
|
+
help: {
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
flags: {
|
|
7
|
+
output: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
providers: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
modules: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
command: "get";
|
|
22
|
+
} & import("cleye").TypeFlag<{
|
|
23
|
+
output: {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
providers: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
modules: {
|
|
32
|
+
type: StringConstructor;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
} & {
|
|
36
|
+
help: BooleanConstructor;
|
|
37
|
+
}> & {
|
|
38
|
+
_: {};
|
|
39
|
+
showHelp: (options?: {
|
|
40
|
+
version?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
usage?: false | string | string[];
|
|
43
|
+
examples?: string | string[];
|
|
44
|
+
render?: (nodes: {
|
|
45
|
+
id?: string;
|
|
46
|
+
type: keyof import("cleye").Renderers;
|
|
47
|
+
data: any;
|
|
48
|
+
}[], renderers: import("cleye").Renderers) => string;
|
|
49
|
+
}) => void;
|
|
50
|
+
showVersion: () => void;
|
|
51
|
+
}>;
|
|
52
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/get.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA6Bs/M,CAAC;;;;;;;;;;;;EAD7gN,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { command } from "cleye";
|
|
2
|
+
import { get } from "../get.js";
|
|
3
|
+
export const getCommand = command({
|
|
4
|
+
name: "get",
|
|
5
|
+
help: {
|
|
6
|
+
description: "Generate provider/module bindings",
|
|
7
|
+
},
|
|
8
|
+
flags: {
|
|
9
|
+
output: {
|
|
10
|
+
type: String,
|
|
11
|
+
description: "Output directory (default: .gen)",
|
|
12
|
+
},
|
|
13
|
+
providers: {
|
|
14
|
+
type: String,
|
|
15
|
+
description: "Comma-separated provider list",
|
|
16
|
+
},
|
|
17
|
+
modules: {
|
|
18
|
+
type: String,
|
|
19
|
+
description: "Comma-separated module list",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}, async (argv) => {
|
|
23
|
+
await get({
|
|
24
|
+
output: argv.flags.output,
|
|
25
|
+
providers: argv.flags.providers?.split(","),
|
|
26
|
+
modules: argv.flags.modules?.split(","),
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/cli/commands/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAC/B;IACE,IAAI,EAAE,KAAK;IACX,IAAI,EAAE;QACJ,WAAW,EAAE,mCAAmC;KACjD;IACD,KAAK,EAAE;QACL,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,kCAAkC;SAChD;QACD,SAAS,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,+BAA+B;SAC7C;QACD,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,6BAA6B;SAC3C;KACF;CACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,GAAG,CAAC;QACR,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;QACzB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC;QAC3C,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const synthCommand: import("cleye").Command<{
|
|
2
|
+
name: "synth";
|
|
3
|
+
alias: "synthesize";
|
|
4
|
+
help: {
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
flags: {
|
|
8
|
+
app: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
output: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}, {
|
|
18
|
+
command: "synth";
|
|
19
|
+
} & import("cleye").TypeFlag<{
|
|
20
|
+
app: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
output: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
} & {
|
|
29
|
+
help: BooleanConstructor;
|
|
30
|
+
}> & {
|
|
31
|
+
_: {};
|
|
32
|
+
showHelp: (options?: {
|
|
33
|
+
version?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
usage?: false | string | string[];
|
|
36
|
+
examples?: string | string[];
|
|
37
|
+
render?: (nodes: {
|
|
38
|
+
id?: string;
|
|
39
|
+
type: keyof import("cleye").Renderers;
|
|
40
|
+
data: any;
|
|
41
|
+
}[], renderers: import("cleye").Renderers) => string;
|
|
42
|
+
}) => void;
|
|
43
|
+
showVersion: () => void;
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=synth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/synth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAyBmoN,CAAC;;;;;;;;;;;;EAD5pN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { command } from "cleye";
|
|
2
|
+
import { synth } from "../synth.js";
|
|
3
|
+
export const synthCommand = command({
|
|
4
|
+
name: "synth",
|
|
5
|
+
alias: "synthesize",
|
|
6
|
+
help: {
|
|
7
|
+
description: "Synthesize Terraform configuration",
|
|
8
|
+
},
|
|
9
|
+
flags: {
|
|
10
|
+
app: {
|
|
11
|
+
type: String,
|
|
12
|
+
description: "Command to run the app",
|
|
13
|
+
},
|
|
14
|
+
output: {
|
|
15
|
+
type: String,
|
|
16
|
+
description: "Output directory (default: cdktf.out)",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
}, async (argv) => {
|
|
20
|
+
await synth({
|
|
21
|
+
app: argv.flags.app,
|
|
22
|
+
output: argv.flags.output,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=synth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synth.js","sourceRoot":"","sources":["../../../src/cli/commands/synth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CACjC;IACE,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE;QACJ,WAAW,EAAE,oCAAoC;KAClD;IACD,KAAK,EAAE;QACL,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wBAAwB;SACtC;QACD,MAAM,EAAE;YACN,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,uCAAuC;SACrD;KACF;CACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,KAAK,CAAC;QACV,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;QACnB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;KAC1B,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/cli/diff.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAuBF,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDnE"}
|
package/dist/cli/diff.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
3
|
+
import { synth } from "./synth.js";
|
|
4
|
+
async function runCommand(command, args, cwd) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const proc = spawn(command, args, {
|
|
7
|
+
cwd,
|
|
8
|
+
stdio: "inherit",
|
|
9
|
+
});
|
|
10
|
+
proc.on("close", (code) => resolve(code ?? 1));
|
|
11
|
+
proc.on("error", reject);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function getStacks(outputDir) {
|
|
15
|
+
const stacksDir = `${outputDir}/stacks`;
|
|
16
|
+
if (!existsSync(stacksDir)) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
return readdirSync(stacksDir, { withFileTypes: true })
|
|
20
|
+
.filter((entry) => entry.isDirectory())
|
|
21
|
+
.map((entry) => entry.name);
|
|
22
|
+
}
|
|
23
|
+
export async function diff(options = {}) {
|
|
24
|
+
const cwd = options.cwd ?? process.cwd();
|
|
25
|
+
const outputDir = options.output ?? "cdktf.out";
|
|
26
|
+
const outputPath = `${cwd}/${outputDir}`;
|
|
27
|
+
if (options.skipSynth !== true) {
|
|
28
|
+
await synth({
|
|
29
|
+
app: options.app,
|
|
30
|
+
output: outputDir,
|
|
31
|
+
cwd,
|
|
32
|
+
});
|
|
33
|
+
console.log();
|
|
34
|
+
}
|
|
35
|
+
const stacks = getStacks(outputPath);
|
|
36
|
+
if (stacks.length === 0) {
|
|
37
|
+
throw new Error(`No stacks found in ${outputDir}/stacks`);
|
|
38
|
+
}
|
|
39
|
+
let targetStack;
|
|
40
|
+
if (options.stack !== undefined) {
|
|
41
|
+
if (!stacks.includes(options.stack)) {
|
|
42
|
+
throw new Error(`Stack "${options.stack}" not found. Available stacks: ${stacks.join(", ")}`);
|
|
43
|
+
}
|
|
44
|
+
targetStack = options.stack;
|
|
45
|
+
}
|
|
46
|
+
else if (stacks.length === 1 && stacks[0] !== undefined) {
|
|
47
|
+
targetStack = stacks[0];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new Error(`Found more than one stack, please specify a target stack. Run tfts diff <stack> with one of these stacks: ${stacks.join(", ")}`);
|
|
51
|
+
}
|
|
52
|
+
const stackDir = `${outputPath}/stacks/${targetStack}`;
|
|
53
|
+
const needsInit = !existsSync(`${stackDir}/.terraform`);
|
|
54
|
+
if (needsInit) {
|
|
55
|
+
console.log("Running terraform init...\n");
|
|
56
|
+
const initCode = await runCommand("terraform", ["init"], stackDir);
|
|
57
|
+
if (initCode !== 0) {
|
|
58
|
+
throw new Error(`terraform init failed for stack ${targetStack}`);
|
|
59
|
+
}
|
|
60
|
+
console.log();
|
|
61
|
+
}
|
|
62
|
+
const planCode = await runCommand("terraform", ["plan"], stackDir);
|
|
63
|
+
if (planCode !== 0) {
|
|
64
|
+
throw new Error(`terraform plan failed for stack ${targetStack}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/cli/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAUnC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,IAAuB,EAAE,GAAW;IAC7E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAChC,GAAG;YACH,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,SAAiB;IAClC,MAAM,SAAS,GAAG,GAAG,SAAS,SAAS,CAAC;IACxC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,WAAW,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACnD,MAAM,CAAC,CA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
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return flags;
|
|
25
|
-
}
|
|
26
|
-
function getStringFlag(flags, key) {
|
|
27
|
-
const value = flags[key];
|
|
28
|
-
return typeof value === "string" ? value : undefined;
|
|
29
|
-
}
|
|
30
|
-
async function main() {
|
|
31
|
-
const flags = parseFlags(cliArgs.slice(1));
|
|
32
|
-
switch (command) {
|
|
33
|
-
case "synth":
|
|
34
|
-
case "synthesize":
|
|
35
|
-
await synth({
|
|
36
|
-
app: getStringFlag(flags, "app"),
|
|
37
|
-
output: getStringFlag(flags, "output"),
|
|
38
|
-
});
|
|
39
|
-
break;
|
|
40
|
-
case "get": {
|
|
41
|
-
const providersStr = getStringFlag(flags, "providers");
|
|
42
|
-
const modulesStr = getStringFlag(flags, "modules");
|
|
43
|
-
await get({
|
|
44
|
-
output: getStringFlag(flags, "output"),
|
|
45
|
-
providers: providersStr !== undefined ? providersStr.split(",") : undefined,
|
|
46
|
-
modules: modulesStr !== undefined ? modulesStr.split(",") : undefined,
|
|
47
|
-
});
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case "help":
|
|
51
|
-
case "--help":
|
|
52
|
-
case "-h":
|
|
53
|
-
case undefined:
|
|
54
|
-
printHelp();
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
console.error(`Unknown command: ${String(command)}`);
|
|
58
|
-
printHelp();
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function printHelp() {
|
|
63
|
-
console.log(`
|
|
64
|
-
tfts - Terraform CDK TypeScript
|
|
65
|
-
|
|
66
|
-
Commands:
|
|
67
|
-
synth, synthesize Synthesize Terraform configuration
|
|
68
|
-
get Generate provider/module bindings
|
|
69
|
-
|
|
70
|
-
Options:
|
|
71
|
-
--app <command> Command to run the app (synth)
|
|
72
|
-
--output <dir> Output directory (synth: cdktf.out, get: .gen)
|
|
73
|
-
--providers <list> Comma-separated provider list (get)
|
|
74
|
-
--modules <list> Comma-separated module list (get)
|
|
75
|
-
--help, -h Show this help
|
|
76
|
-
|
|
77
|
-
Examples:
|
|
78
|
-
tfts synth --app "bun run main.ts"
|
|
79
|
-
tfts get --providers "hashicorp/aws@~>5.0"
|
|
80
|
-
`);
|
|
81
|
-
}
|
|
82
|
-
main().catch((err) => {
|
|
83
|
-
console.error("Error:", err.message);
|
|
2
|
+
import { cli } from "cleye";
|
|
3
|
+
import { diffCommand } from "./commands/diff.js";
|
|
4
|
+
import { getCommand } from "./commands/get.js";
|
|
5
|
+
import { synthCommand } from "./commands/synth.js";
|
|
6
|
+
const parsed = cli({
|
|
7
|
+
name: "tfts",
|
|
8
|
+
version: "0.3.2",
|
|
9
|
+
help: {
|
|
10
|
+
description: "Terraform TypeScript SDK",
|
|
11
|
+
},
|
|
12
|
+
commands: [synthCommand, getCommand, diffCommand],
|
|
13
|
+
}, () => {
|
|
14
|
+
console.log('Run "tfts --help" for usage information.');
|
|
15
|
+
});
|
|
16
|
+
parsed.catch((error) => {
|
|
17
|
+
console.error("Error:", error.message);
|
|
84
18
|
process.exit(1);
|
|
85
19
|
});
|
|
86
20
|
//# sourceMappingURL=main.js.map
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,GAAG,GAAG,CAChB;IACE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE;QACJ,WAAW,EAAE,0BAA0B;KACxC;IACD,QAAQ,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,WAAW,CAAC;CAClD,EACD,GAAG,EAAE;IACH,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;AAC1D,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tfts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "TypeScript-first infrastructure as code for Terraform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"workspaces": [
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"typescript": "^5.9.2"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"cleye": "^2.2.1",
|
|
62
63
|
"neverthrow": "^8.2.0",
|
|
63
64
|
"zod": "^4.3.6"
|
|
64
65
|
}
|