cdktn-cli 0.0.1 → 0.22.0-pre.2

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.
Files changed (82) hide show
  1. package/README.md +1 -0
  2. package/ambient.d.ts +13 -0
  3. package/build.js +139 -0
  4. package/bundle/bin/cdktn +2 -0
  5. package/bundle/bin/cdktn.js +89 -0
  6. package/bundle/bin/cdktn.js.map +7 -0
  7. package/bundle/bin/cmds/handlers.js +739 -0
  8. package/bundle/bin/cmds/handlers.js.map +7 -0
  9. package/bundle/templates/csharp/.hooks.sscaff.js +63 -0
  10. package/bundle/templates/csharp/MainStack.cs +15 -0
  11. package/bundle/templates/csharp/MyTerraformStack.csproj +13 -0
  12. package/bundle/templates/csharp/Program.cs +17 -0
  13. package/bundle/templates/csharp/TestProgram.cs +42 -0
  14. package/bundle/templates/csharp/cdktf.json +11 -0
  15. package/bundle/templates/csharp/help +42 -0
  16. package/bundle/templates/csharp/{{}}.gitignore +345 -0
  17. package/bundle/templates/go/.hooks.sscaff.js +70 -0
  18. package/bundle/templates/go/cdktf.json +12 -0
  19. package/bundle/templates/go/go.mod +8 -0
  20. package/bundle/templates/go/help +32 -0
  21. package/bundle/templates/go/main.go +22 -0
  22. package/bundle/templates/go/main_test.go +42 -0
  23. package/bundle/templates/go/{{}}.gitignore +21 -0
  24. package/bundle/templates/java/.hooks.sscaff.js +64 -0
  25. package/bundle/templates/java/build.gradle +55 -0
  26. package/bundle/templates/java/cdktf.json +12 -0
  27. package/bundle/templates/java/gradle.properties +1 -0
  28. package/bundle/templates/java/gradlew +248 -0
  29. package/bundle/templates/java/gradlew.bat +92 -0
  30. package/bundle/templates/java/help +35 -0
  31. package/bundle/templates/java/settings.gradle +5 -0
  32. package/bundle/templates/java/src/main/java/com/mycompany/app/Main.java +16 -0
  33. package/bundle/templates/java/src/main/java/com/mycompany/app/MainStack.java +14 -0
  34. package/bundle/templates/java/src/test/java/com/company/app/MainTest.java +38 -0
  35. package/bundle/templates/java/{{}}.gitignore +14 -0
  36. package/bundle/templates/python/.hooks.sscaff.js +59 -0
  37. package/bundle/templates/python/Pipfile +7 -0
  38. package/bundle/templates/python/cdktf.json +12 -0
  39. package/bundle/templates/python/help +42 -0
  40. package/bundle/templates/python/main-test.py +26 -0
  41. package/bundle/templates/python/main.py +16 -0
  42. package/bundle/templates/python/{{}}.gitignore +7 -0
  43. package/bundle/templates/python-pip/.hooks.sscaff.js +63 -0
  44. package/bundle/templates/python-pip/cdktf.json +12 -0
  45. package/bundle/templates/python-pip/help +35 -0
  46. package/bundle/templates/python-pip/main-test.py +23 -0
  47. package/bundle/templates/python-pip/main.py +16 -0
  48. package/bundle/templates/python-pip/{{}}.gitignore +7 -0
  49. package/bundle/templates/typescript/.hooks.sscaff.js +78 -0
  50. package/bundle/templates/typescript/__tests__/main-test.ts +89 -0
  51. package/bundle/templates/typescript/cdktf.json +11 -0
  52. package/bundle/templates/typescript/help +51 -0
  53. package/bundle/templates/typescript/jest.config.js +187 -0
  54. package/bundle/templates/typescript/main.ts +14 -0
  55. package/bundle/templates/typescript/package.json +22 -0
  56. package/bundle/templates/typescript/setup.js +2 -0
  57. package/bundle/templates/typescript/tsconfig.json +35 -0
  58. package/bundle/templates/typescript/{{}}.gitignore +11 -0
  59. package/eslint.config.mjs +80 -0
  60. package/jest.config.js +19 -0
  61. package/package.json +133 -7
  62. package/src/bin/cdktn +2 -0
  63. package/src/bin/cmds/helper/__tests__/fixtures/foo.tfvars +4 -0
  64. package/src/bin/cmds/helper/__tests__/fixtures/hey-there.auto.tfvars +5 -0
  65. package/src/bin/cmds/helper/__tests__/fixtures/terraform.tfvars +4 -0
  66. package/src/bin/cmds/helper/render-ink.tsx +24 -0
  67. package/src/bin/cmds/ui/components/bottom-bars/approve.tsx +81 -0
  68. package/src/bin/cmds/ui/components/bottom-bars/outputs.tsx +30 -0
  69. package/src/bin/cmds/ui/components/bottom-bars/override.tsx +68 -0
  70. package/src/bin/cmds/ui/components/bottom-bars/status.tsx +183 -0
  71. package/src/bin/cmds/ui/components/outputs.tsx +103 -0
  72. package/src/bin/cmds/ui/components/stream-view.tsx +72 -0
  73. package/src/bin/cmds/ui/deploy.tsx +139 -0
  74. package/src/bin/cmds/ui/destroy.tsx +86 -0
  75. package/src/bin/cmds/ui/diff.tsx +59 -0
  76. package/src/bin/cmds/ui/get.tsx +134 -0
  77. package/src/bin/cmds/ui/list.tsx +59 -0
  78. package/src/bin/cmds/ui/output.tsx +52 -0
  79. package/src/bin/cmds/ui/provider-list.tsx +17 -0
  80. package/src/bin/cmds/ui/synth.tsx +51 -0
  81. package/src/bin/cmds/ui/watch.tsx +80 -0
  82. package/index.js +0 -2
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # cdktn-cli
package/ambient.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ // Copyright (c) HashiCorp, Inc
2
+ // Licensed under the Mozilla Public License 2.0
3
+ declare module '@skorfmann/ink-confirm-input';
4
+ declare module '@npmcli/ci-detect';
5
+
6
+ declare module 'child_process' {
7
+ interface SpawnOptions {
8
+ signal?: AbortSignal;
9
+ }
10
+ }
11
+
12
+ declare module 'tunnel-agent';
13
+ declare module "archiver";
package/build.js ADDED
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ // Copyright (c) HashiCorp, Inc
40
+ // SPDX-License-Identifier: MPL-2.0
41
+ var esbuild = require("esbuild");
42
+ var fs = require("fs-extra");
43
+ var enableWatch = process.argv.find(function (arg) { return arg === "--watch"; }) === "--watch";
44
+ // Taken from https://github.com/evanw/esbuild/issues/1051#issuecomment-806325487 to deal with `fsevents`
45
+ var nativeNodeModulesPlugin = {
46
+ name: "native-node-modules",
47
+ setup: function (build) {
48
+ // If a ".node" file is imported within a module in the "file" namespace, resolve
49
+ // it to an absolute path and put it into the "node-file" virtual namespace.
50
+ build.onResolve({ filter: /\.node$/, namespace: "file" }, function (args) { return ({
51
+ path: require.resolve(args.path, { paths: [args.resolveDir] }),
52
+ namespace: "node-file",
53
+ }); });
54
+ // Files in the "node-file" virtual namespace call "require()" on the
55
+ // path from esbuild of the ".node" file in the output directory.
56
+ build.onLoad({ filter: /.*/, namespace: "node-file" }, function (args) { return ({
57
+ contents: "\n import path from ".concat(JSON.stringify(args.path), "\n try { module.exports = require(path) }\n catch {}\n "),
58
+ }); });
59
+ // If a ".node" file is imported within a module in the "node-file" namespace, put
60
+ // it in the "file" namespace where esbuild's default loading behavior will handle
61
+ // it. It is already an absolute path since we resolved it to one above.
62
+ build.onResolve({ filter: /\.node$/, namespace: "node-file" }, function (args) { return ({
63
+ path: args.path,
64
+ namespace: "file",
65
+ }); });
66
+ // Tell esbuild's default loading behavior to use the "file" loader for
67
+ // these ".node" files.
68
+ var opts = build.initialOptions;
69
+ opts.loader = opts.loader || {};
70
+ opts.loader[".node"] = "file";
71
+ },
72
+ };
73
+ var config = {
74
+ entryPoints: ["src/bin/cdktn.ts", "src/bin/cmds/handlers.ts"],
75
+ outbase: "src",
76
+ bundle: true,
77
+ outdir: "./bundle",
78
+ format: "cjs",
79
+ target: "node14",
80
+ minify: enableWatch ? false : true,
81
+ sourcemap: enableWatch ? false : true,
82
+ platform: "node",
83
+ external: [
84
+ "jsii",
85
+ "jsii-pacmak",
86
+ "@cdktn/hcl2json",
87
+ "@cdktn/hcl-tools",
88
+ "yargs",
89
+ "cdktn",
90
+ "@cdktn/hcl2cdk",
91
+ "constructs",
92
+ "yoga-layout-prebuilt",
93
+ "@cdktf/node-pty-prebuilt-multiarch",
94
+ ],
95
+ plugins: [
96
+ nativeNodeModulesPlugin,
97
+ {
98
+ name: "rebuild-log",
99
+ setup: function (_a) {
100
+ var onStart = _a.onStart, onEnd = _a.onEnd;
101
+ var t;
102
+ onStart(function () {
103
+ t = Date.now();
104
+ });
105
+ onEnd(function () {
106
+ console.log("build finished in", Date.now() - t, "ms");
107
+ });
108
+ },
109
+ },
110
+ ],
111
+ define: {
112
+ "process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN || ""),
113
+ },
114
+ tsconfig: "tsconfig.json",
115
+ };
116
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
117
+ var ctx;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ console.log("Building…");
122
+ return [4 /*yield*/, esbuild.build(config)];
123
+ case 1:
124
+ _a.sent();
125
+ fs.copySync("src/bin/cdktn", "./bundle/bin/cdktn");
126
+ fs.copySync("../@cdktn/cli-core/templates", "./bundle/templates");
127
+ if (!enableWatch) return [3 /*break*/, 4];
128
+ return [4 /*yield*/, esbuild.context(config)];
129
+ case 2:
130
+ ctx = _a.sent();
131
+ console.log("Watching…");
132
+ return [4 /*yield*/, ctx.watch()];
133
+ case 3:
134
+ _a.sent();
135
+ _a.label = 4;
136
+ case 4: return [2 /*return*/];
137
+ }
138
+ });
139
+ }); })();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require("./cdktn.js");