terrafaker 0.0.0
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/README.md +171 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/generate/file.d.ts +13 -0
- package/dist/commands/generate/file.js +32 -0
- package/dist/commands/generate/index.d.ts +7 -0
- package/dist/commands/generate/index.js +9 -0
- package/dist/commands/generate/repo.d.ts +18 -0
- package/dist/commands/generate/repo.js +60 -0
- package/dist/commands/gh/clone-repos.d.ts +10 -0
- package/dist/commands/gh/clone-repos.js +46 -0
- package/dist/commands/gh/delete-repos.d.ts +9 -0
- package/dist/commands/gh/delete-repos.js +41 -0
- package/dist/commands/gh/index.d.ts +7 -0
- package/dist/commands/gh/index.js +10 -0
- package/dist/commands/util/format-psv.d.ts +10 -0
- package/dist/commands/util/format-psv.js +46 -0
- package/dist/commands/util/format-tsv.d.ts +13 -0
- package/dist/commands/util/format-tsv.js +33 -0
- package/dist/commands/util/index.d.ts +7 -0
- package/dist/commands/util/index.js +9 -0
- package/dist/constants/aws.d.ts +192 -0
- package/dist/constants/aws.js +201 -0
- package/dist/constants/gcp.d.ts +88 -0
- package/dist/constants/gcp.js +109 -0
- package/dist/constants/tags.d.ts +5 -0
- package/dist/constants/tags.js +17 -0
- package/dist/enums/help-messages.d.ts +4 -0
- package/dist/enums/help-messages.js +4 -0
- package/dist/enums/providers.d.ts +8 -0
- package/dist/enums/providers.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/object-values.d.ts +2 -0
- package/dist/types/object-values.js +1 -0
- package/dist/utilities/base-command.d.ts +5 -0
- package/dist/utilities/base-command.js +9 -0
- package/dist/utilities/flags.d.ts +5 -0
- package/dist/utilities/flags.js +21 -0
- package/dist/utilities/generators/aws-generators.d.ts +4 -0
- package/dist/utilities/generators/aws-generators.js +80 -0
- package/dist/utilities/generators/gcp-generators.d.ts +4 -0
- package/dist/utilities/generators/gcp-generators.js +69 -0
- package/dist/utilities/generators/generator-utils.d.ts +80 -0
- package/dist/utilities/generators/generator-utils.js +72 -0
- package/dist/utilities/github.d.ts +8 -0
- package/dist/utilities/github.js +4 -0
- package/dist/utilities/string-utils.d.ts +5 -0
- package/dist/utilities/string-utils.js +7 -0
- package/oclif.manifest.json +358 -0
- package/package.json +82 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { flatten } from "lodash-es";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://docs.cloud.google.com/compute/docs/regions-zones
|
|
4
|
+
*/
|
|
5
|
+
// prettier-ignore
|
|
6
|
+
const GCP_REGIONS = ["africa-south1-a", "africa-south1-b", "africa-south1-c", "asia-east1-a", "asia-east1-b", "asia-east1-c", "asia-east2-a", "asia-east2-b", "asia-east2-c", "asia-northeast1-a", "asia-northeast1-b", "asia-northeast1-c", "asia-northeast2-a", "asia-northeast2-b", "asia-northeast2-c", "asia-northeast3-a", "asia-northeast3-b", "asia-northeast3-c", "asia-south1-a", "asia-south1-b", "asia-south1-c", "asia-south2-a", "asia-south2-b", "asia-south2-c", "asia-southeast1-a", "asia-southeast1-b", "asia-southeast1-c", "asia-southeast2-a", "asia-southeast2-b", "asia-southeast2-c", "australia-southeast1-a", "australia-southeast1-b", "australia-southeast1-c", "australia-southeast2-a", "australia-southeast2-b", "australia-southeast2-c", "europe-central2-a", "europe-central2-b", "europe-central2-c", "europe-north1-a", "europe-north1-b", "europe-north1-c", "europe-north2-a", "europe-north2-b", "europe-north2-c", "europe-southwest1-a", "europe-southwest1-b", "europe-southwest1-c", "europe-west1-b", "europe-west1-c", "europe-west1-d", "europe-west2-a", "europe-west2-b", "europe-west2-c", "europe-west3-a", "europe-west3-b", "europe-west3-c", "europe-west4-a", "europe-west4-b", "europe-west4-c", "europe-west6-a", "europe-west6-b", "europe-west6-c", "europe-west8-a", "europe-west8-b", "europe-west8-c", "europe-west9-a", "europe-west9-b", "europe-west9-c", "europe-west10-a", "europe-west10-b", "europe-west10-c", "europe-west12-a", "europe-west12-b", "europe-west12-c", "me-central1-a", "me-central1-b", "me-central1-c", "me-central2-a", "me-central2-b", "me-central2-c", "me-west1-a", "me-west1-b", "me-west1-c", "northamerica-northeast1-a", "northamerica-northeast1-b", "northamerica-northeast1-c", "northamerica-northeast2-a", "northamerica-northeast2-b", "northamerica-northeast2-c", "northamerica-south1-a", "northamerica-south1-b", "northamerica-south1-c", "southamerica-east1-a", "southamerica-east1-b", "southamerica-east1-c", "southamerica-west1-a", "southamerica-west1-b", "southamerica-west1-c", "us-central1-a", "us-central1-b", "us-central1-c", "us-central1-f", "us-east1-b", "us-east1-c", "us-east1-d", "us-east4-a", "us-east4-b", "us-east4-c", "us-east5-a", "us-east5-b", "us-east5-c", "us-south1-a", "us-south1-b", "us-south1-c", "us-west1-a", "us-west1-b", "us-west1-c", "us-west2-a", "us-west2-b", "us-west2-c", "us-west3-a", "us-west3-b", "us-west3-c", "us-west4-a", "us-west4-b", "us-west4-c"];
|
|
7
|
+
/**
|
|
8
|
+
* @see https://docs.cloud.google.com/compute/docs/general-purpose-machines
|
|
9
|
+
*/
|
|
10
|
+
// prettier-ignore
|
|
11
|
+
const GCP_INSTANCE_TYPES_BY_FAMILY = {
|
|
12
|
+
"C4D standard": ["c4d-standard-2", "c4d-standard-4", "c4d-standard-8", "c4d-standard-16", "c4d-standard-32", "c4d-standard-48", "c4d-standard-64", "c4d-standard-96", "c4d-standard-192", "c4d-standard-384", "c4d-standard-384-metal2"],
|
|
13
|
+
"C4D highcpu": ["c4d-highcpu-2", "c4d-highcpu-4", "c4d-highcpu-8", "c4d-highcpu-16", "c4d-highcpu-32", "c4d-highcpu-48", "c4d-highcpu-64", "c4d-highcpu-96", "c4d-highcpu-192", "c4d-highcpu-384", "c4d-highcpu-384-metal2"],
|
|
14
|
+
"C4D highmem": ["c4d-highmem-2", "c4d-highmem-4", "c4d-highmem-8", "c4d-highmem-16", "c4d-highmem-32", "c4d-highmem-48", "c4d-highmem-64", "c4d-highmem-96", "c4d-highmem-192", "c4d-highmem-384", "c4d-highmem-384-metal2"],
|
|
15
|
+
"C4D standard SSD": ["c4d-standard-8-lssd", "c4d-standard-16-lssd", "c4d-standard-32-lssd", "c4d-standard-48-lssd", "c4d-standard-64-lssd", "c4d-standard-96-lssd", "c4d-standard-192-lssd", "c4d-standard-384-lssd"],
|
|
16
|
+
"C4D highmem SSD": ["c4d-highmem-8-lssd", "c4d-highmem-16-lssd", "c4d-highmem-32-lssd", "c4d-highmem-48-lssd", "c4d-highmem-64-lssd", "c4d-highmem-96-lssd", "c4d-highmem-192-lssd", "c4d-highmem-384-lssd"],
|
|
17
|
+
"C4A standard": ["c4a-standard-1", "c4a-standard-2", "c4a-standard-4", "c4a-standard-8", "c4a-standard-16", "c4a-standard-32", "c4a-standard-48", "c4a-standard-64", "c4a-standard-72"],
|
|
18
|
+
"C4A highcpu": ["c4a-highcpu-1", "c4a-highcpu-2", "c4a-highcpu-4", "c4a-highcpu-8", "c4a-highcpu-16", "c4a-highcpu-32", "c4a-highcpu-48", "c4a-highcpu-64", "c4a-highcpu-72"],
|
|
19
|
+
"C4A highmem": ["c4a-highmem-1", "c4a-highmem-2", "c4a-highmem-4", "c4a-highmem-8", "c4a-highmem-16", "c4a-highmem-32", "c4a-highmem-48", "c4a-highmem-64", "c4a-highmem-72"],
|
|
20
|
+
"C4A standard SSD": ["c4a-standard-4-lssd", "c4a-standard-8-lssd", "c4a-standard-16-lssd", "c4a-standard-32-lssd", "c4a-standard-48-lssd", "c4a-standard-64-lssd", "c4a-standard-72-lssd"],
|
|
21
|
+
"C4A highmem SSD": ["c4a-highmem-4-lssd", "c4a-highmem-8-lssd", "c4a-highmem-16-lssd", "c4a-highmem-32-lssd", "c4a-highmem-48-lssd", "c4a-highmem-64-lssd", "c4a-highmem-72-lssd"],
|
|
22
|
+
"C4 standard": ["c4-standard-2", "c4-standard-4", "c4-standard-8", "c4-standard-16", "c4-standard-24", "c4-standard-32", "c4-standard-48", "c4-standard-96", "c4-standard-144", "c4-standard-192", "c4-standard-288", "c4-standard-288-metal"],
|
|
23
|
+
"C4 highcpu": ["c4-highcpu-2", "c4-highcpu-4", "c4-highcpu-8", "c4-highcpu-16", "c4-highcpu-24", "c4-highcpu-32", "c4-highcpu-48", "c4-highcpu-96", "c4-highcpu-144", "c4-highcpu-192", "c4-highcpu-288"],
|
|
24
|
+
"C4 highmem": ["c4-highmem-2", "c4-highmem-4", "c4-highmem-8", "c4-highmem-16", "c4-highmem-24", "c4-highmem-32", "c4-highmem-48", "c4-highmem-96", "c4-highmem-144", "c4-highmem-192", "c4-highmem-288", "c4-highmem-288-metal"],
|
|
25
|
+
"C4 standard SSD": ["c4-standard-4-lssd", "c4-standard-8-lssd", "c4-standard-16-lssd", "c4-standard-24-lssd", "c4-standard-32-lssd", "c4-standard-48-lssd", "c4-standard-96-lssd", "c4-standard-144-lssd", "c4-standard-192-lssd", "c4-standard-288-lssd", "c4-standard-288-lssd-metal"],
|
|
26
|
+
"C4 highmem SSD": ["c4-highmem-4-lssd", "c4-highmem-8-lssd", "c4-highmem-16-lssd", "c4-highmem-24-lssd", "c4-highmem-32-lssd", "c4-highmem-48-lssd", "c4-highmem-96-lssd", "c4-highmem-144-lssd", "c4-highmem-192-lssd", "c4-highmem-288-lssd", "c4-highmem-288-lssd-metal"],
|
|
27
|
+
"N4D standard": ["n4d-standard-2", "n4d-standard-4", "n4d-standard-8", "n4d-standard-16", "n4d-standard-32", "n4d-standard-48", "n4d-standard-64", "n4d-standard-80", "n4d-standard-96"],
|
|
28
|
+
"N4D highcpu": ["n4d-highcpu-2", "n4d-highcpu-4", "n4d-highcpu-8", "n4d-highcpu-16", "n4d-highcpu-32", "n4d-highcpu-48", "n4d-highcpu-64", "n4d-highcpu-80", "n4d-highcpu-96"],
|
|
29
|
+
"N4D highmem": ["n4d-highmem-2", "n4d-highmem-4", "n4d-highmem-8", "n4d-highmem-16", "n4d-highmem-32", "n4d-highmem-48", "n4d-highmem-64", "n4d-highmem-80", "n4d-highmem-96"],
|
|
30
|
+
"N4A standard": ["n4a-standard-1", "n4a-standard-2", "n4a-standard-4", "n4a-standard-8", "n4a-standard-16", "n4a-standard-32", "n4a-standard-48", "n4a-standard-64"],
|
|
31
|
+
"N4A highcpu": ["n4a-highcpu-1", "n4a-highcpu-2", "n4a-highcpu-4", "n4a-highcpu-8", "n4a-highcpu-16", "n4a-highcpu-32", "n4a-highcpu-48", "n4a-highcpu-64"],
|
|
32
|
+
"N4A highmem": ["n4a-highmem-1", "n4a-highmem-2", "n4a-highmem-4", "n4a-highmem-8", "n4a-highmem-16", "n4a-highmem-32", "n4a-highmem-48", "n4a-highmem-64"],
|
|
33
|
+
"N4 standard": ["n4-standard-2", "n4-standard-4", "n4-standard-8", "n4-standard-16", "n4-standard-32", "n4-standard-48", "n4-standard-64", "n4-standard-80"],
|
|
34
|
+
"N4 highcpu": ["n4-highcpu-2", "n4-highcpu-4", "n4-highcpu-8", "n4-highcpu-16", "n4-highcpu-32", "n4-highcpu-48", "n4-highcpu-64", "n4-highcpu-80"],
|
|
35
|
+
"N4 highmem": ["n4-highmem-2", "n4-highmem-4", "n4-highmem-8", "n4-highmem-16", "n4-highmem-32", "n4-highmem-48", "n4-highmem-64", "n4-highmem-80"],
|
|
36
|
+
"C3D standard": ["c3d-standard-4", "c3d-standard-8", "c3d-standard-16", "c3d-standard-30", "c3d-standard-60", "c3d-standard-90", "c3d-standard-180", "c3d-standard-360"],
|
|
37
|
+
"C3D highcpu": ["c3d-highcpu-4", "c3d-highcpu-8", "c3d-highcpu-16", "c3d-highcpu-30", "c3d-highcpu-60", "c3d-highcpu-90", "c3d-highcpu-180", "c3d-highcpu-360"],
|
|
38
|
+
"C3D highmem": ["c3d-highmem-4", "c3d-highmem-8", "c3d-highmem-16", "c3d-highmem-30", "c3d-highmem-60", "c3d-highmem-90", "c3d-highmem-180", "c3d-highmem-360"],
|
|
39
|
+
"C3D standard SSD": ["c3d-standard-8-lssd", "c3d-standard-16-lssd", "c3d-standard-30-lssd", "c3d-standard-60-lssd", "c3d-standard-90-lssd", "c3d-standard-180-lssd", "c3d-standard-360-lssd"],
|
|
40
|
+
"C3D highmem SSD": ["c3d-highmem-8-lssd", "c3d-highmem-16-lssd", "c3d-highmem-30-lssd", "c3d-highmem-60-lssd", "c3d-highmem-90-lssd", "c3d-highmem-180-lssd", "c3d-highmem-360-lssd"],
|
|
41
|
+
"C3 standard": ["c3-standard-4", "c3-standard-8", "c3-standard-22", "c3-standard-44", "c3-standard-88", "c3-standard-176", "c3-standard-192-metal"],
|
|
42
|
+
"C3 highcpu": ["c3-highcpu-4", "c3-highcpu-8", "c3-highcpu-22", "c3-highcpu-44", "c3-highcpu-88", "c3-highcpu-176", "c3-highcpu-192-metal"],
|
|
43
|
+
"C3 highmem": ["c3-highmem-4", "c3-highmem-8", "c3-highmem-22", "c3-highmem-44", "c3-highmem-88", "c3-highmem-176", "c3-highmem-192-metal"],
|
|
44
|
+
"C3 standard SSD": ["c3-standard-4-lssd", "c3-standard-8-lssd", "c3-standard-22-lssd", "c3-standard-44-lssd", "c3-standard-88-lssd", "c3-standard-176-lssd"],
|
|
45
|
+
"N2D standard": ["n2d-standard-2", "n2d-standard-4", "n2d-standard-8", "n2d-standard-16", "n2d-standard-32", "n2d-standard-48", "n2d-standard-64", "n2d-standard-80", "n2d-standard-96", "n2d-standard-128", "n2d-standard-224"],
|
|
46
|
+
"N2D highcpu": ["n2d-highcpu-2", "n2d-highcpu-4", "n2d-highcpu-8", "n2d-highcpu-16", "n2d-highcpu-32", "n2d-highcpu-48", "n2d-highcpu-64", "n2d-highcpu-80", "n2d-highcpu-96", "n2d-highcpu-128", "n2d-highcpu-224"],
|
|
47
|
+
"N2D highmem": ["n2d-highmem-2", "n2d-highmem-4", "n2d-highmem-8", "n2d-highmem-16", "n2d-highmem-32", "n2d-highmem-48", "n2d-highmem-64", "n2d-highmem-80", "n2d-highmem-96"],
|
|
48
|
+
"N2 standard": ["n2-standard-2", "n2-standard-4", "n2-standard-8", "n2-standard-16", "n2-standard-32", "n2-standard-48", "n2-standard-64", "n2-standard-80", "n2-standard-96", "n2-standard-128"],
|
|
49
|
+
"N2 highcpu": ["n2-highcpu-2", "n2-highcpu-4", "n2-highcpu-8", "n2-highcpu-16", "n2-highcpu-32", "n2-highcpu-48", "n2-highcpu-64", "n2-highcpu-80", "n2-highcpu-96"],
|
|
50
|
+
"N2 highmem": ["n2-highmem-2", "n2-highmem-4", "n2-highmem-8", "n2-highmem-16", "n2-highmem-32", "n2-highmem-48", "n2-highmem-64", "n2-highmem-80", "n2-highmem-96", "n2-highmem-128"],
|
|
51
|
+
"E2 standard": ["e2-standard-2", "e2-standard-4", "e2-standard-8", "e2-standard-16", "e2-standard-32"],
|
|
52
|
+
"E2 highcpu": ["e2-highcpu-2", "e2-highcpu-4", "e2-highcpu-8", "e2-highcpu-16", "e2-highcpu-32"],
|
|
53
|
+
"E2 highmem": ["e2-highmem-2", "e2-highmem-4", "e2-highmem-8", "e2-highmem-16"],
|
|
54
|
+
"E2 sharedcore": ["e2-micro", "e2-small", "e2-medium"],
|
|
55
|
+
"N1 standard": ["n1-standard-1", "n1-standard-2", "n1-standard-4", "n1-standard-8", "n1-standard-16", "n1-standard-32", "n1-standard-64", "n1-standard-96"],
|
|
56
|
+
"N1 highcpu": ["n1-highcpu-2", "n1-highcpu-4", "n1-highcpu-8", "n1-highcpu-16", "n1-highcpu-32", "n1-highcpu-64", "n1-highcpu-96"],
|
|
57
|
+
"N1 highmem": ["n1-highmem-2", "n1-highmem-4", "n1-highmem-8", "n1-highmem-16", "n1-highmem-32", "n1-highmem-64", "n1-highmem-96"],
|
|
58
|
+
"N1 sharedcore": ["f1-micro", "g1-small"],
|
|
59
|
+
"T2A": ["t2a-standard-1", "t2a-standard-2", "t2a-standard-4", "t2a-standard-8", "t2a-standard-16", "t2a-standard-32", "t2a-standard-48"],
|
|
60
|
+
"T2D": ["t2d-standard-1", "t2d-standard-2", "t2d-standard-4", "t2d-standard-8", "t2d-standard-16", "t2d-standard-32", "t2d-standard-48", "t2d-standard-60"],
|
|
61
|
+
"Z3 standard SSD": ["z3-highmem-14-standardlssd", "z3-highmem-22-standardlssd", "z3-highmem-44-standardlssd", "z3-highmem-88-standardlssd", "z3-highmem-176-standardlssd"],
|
|
62
|
+
"Z3 high SSD": ["z3-highmem-8-highlssd", "z3-highmem-16-highlssd", "z3-highmem-22-highlssd", "z3-highmem-32-highlssd", "z3-highmem-44-highlssd", "z3-highmem-88-highlssd", "z3-highmem-192-highlssd-metal"],
|
|
63
|
+
"H4D": ["h4d-standard-192", "h4d-highmem-192", "h4d-highmem-192-lssd"],
|
|
64
|
+
"H3": ["h3-standard-88"],
|
|
65
|
+
"C2D standard": ["c2d-standard-2", "c2d-standard-4", "c2d-standard-8", "c2d-standard-16", "c2d-standard-32", "c2d-standard-56", "c2d-standard-112"],
|
|
66
|
+
"C2D highcpu": ["c2d-highcpu-2", "c2d-highcpu-4", "c2d-highcpu-8", "c2d-highcpu-16", "c2d-highcpu-32", "c2d-highcpu-56", "c2d-highcpu-112"],
|
|
67
|
+
"C2D highmem": ["c2d-highmem-2", "c2d-highmem-4", "c2d-highmem-8", "c2d-highmem-16", "c2d-highmem-32", "c2d-highmem-56", "c2d-highmem-112"],
|
|
68
|
+
"C2": ["c2-standard-4", "c2-standard-8", "c2-standard-16", "c2-standard-30", "c2-standard-60"],
|
|
69
|
+
"X4": ["x4-480-6t-metal", "x4-480-8t-metal", "x4-960-12t-metal", "x4-960-16t-metal", "x4-1440-24t-metal", "x4-1920-32t-metal"],
|
|
70
|
+
"M4": ["m4-hypermem-16", "m4-hypermem-32", "m4-hypermem-64", "m4-megamem-28", "m4-megamem-56", "m4-megamem-112", "m4-megamem-224", "m4-ultramem-56", "m4-ultramem-112", "m4-ultramem-224"],
|
|
71
|
+
"M3": ["m3-ultramem-32", "m3-ultramem-64", "m3-ultramem-128", "m3-megamem-64", "m3-megamem-128"],
|
|
72
|
+
"M2": ["m2-ultramem-208", "m2-ultramem-416", "m2-megamem-416", "m2-hypermem-416"],
|
|
73
|
+
"M1": ["m1-ultramem-40", "m1-ultramem-80", "m1-ultramem-160", "m1-megamem-96"],
|
|
74
|
+
"A4X": ["a4x-highgpu-4g"],
|
|
75
|
+
"A4": ["a4-highgpu-8g"],
|
|
76
|
+
"A3 ultra": ["a3-ultragpu-8g"],
|
|
77
|
+
"A3 mega": ["a3-megagpu-8g"],
|
|
78
|
+
"A3 high": ["a3-highgpu-1g", "a3-highgpu-2g", "a3-highgpu-4g", "a3-highgpu-8g"],
|
|
79
|
+
"A3 edge": ["a3-edgegpu-8g"],
|
|
80
|
+
"A2 ultra": ["a2-ultragpu-1g", "a2-ultragpu-2g", "a2-ultragpu-4g", "a2-ultragpu-8g"],
|
|
81
|
+
"A2 standard": ["a2-highgpu-1g", "a2-highgpu-2g", "a2-highgpu-4g", "a2-highgpu-8g", "a2-megagpu-16g"],
|
|
82
|
+
"G4": ["g4-standard-48", "g4-standard-96", "g4-standard-192", "g4-standard-384"],
|
|
83
|
+
"G2": ["g2-standard-4", "g2-standard-8", "g2-standard-12", "g2-standard-16", "g2-standard-24", "g2-standard-32", "g2-standard-48", "g2-standard-96"],
|
|
84
|
+
};
|
|
85
|
+
const GCP_INSTANCE_TYPES = flatten(Object.values(GCP_INSTANCE_TYPES_BY_FAMILY));
|
|
86
|
+
/**
|
|
87
|
+
* @see https://docs.cloud.google.com/compute/docs/gpus
|
|
88
|
+
*/
|
|
89
|
+
// prettier-ignore
|
|
90
|
+
const GCP_GPU_MACHINE_TYPES_BY_FAMILY = {
|
|
91
|
+
"NVIDIA T4": ["nvidia-tesla-t4", "nvidia-tesla-t4-vws"],
|
|
92
|
+
"NVIDIA P4": ["nvidia-tesla-p4", "nvidia-tesla-p4-vws"],
|
|
93
|
+
"NVIDIA V100": ["nvidia-tesla-v100"],
|
|
94
|
+
"NVIDIA P100": ["nvidia-tesla-p100", "nvidia-tesla-p100-vws"],
|
|
95
|
+
"NVIDIA RTX PRO 6000": ["nvidia-rtx-pro-6000", "nvidia-rtx-pro-6000-vws"],
|
|
96
|
+
"NVIDIA L4": ["nvidia-l4", "nvidia-l4-vws"],
|
|
97
|
+
"NVIDIA GB200 Superchips": ["nvidia-gb200"],
|
|
98
|
+
"NVIDIA B200": ["nvidia-b200"],
|
|
99
|
+
"NVIDIA H200": ["nvidia-h200-141gb"],
|
|
100
|
+
"NVIDIA H100": ["nvidia-h100-mega-80gb", "nvidia-h100-80gb"],
|
|
101
|
+
"NVIDIA A100": ["nvidia-a100-80gb", "nvidia-a100-40gb"],
|
|
102
|
+
};
|
|
103
|
+
const GCP_GPU_MACHINE_TYPES = flatten(Object.values(GCP_GPU_MACHINE_TYPES_BY_FAMILY));
|
|
104
|
+
/**
|
|
105
|
+
* @see https://docs.cloud.google.com/run/docs/runtimes/function-runtimes
|
|
106
|
+
*/
|
|
107
|
+
// prettier-ignore
|
|
108
|
+
const GCP_LAMBDA_RUNTIMES = ["nodejs24", "nodejs22", "nodejs20", "nodejs18", "nodejs16", "nodejs14", "nodejs12", "nodejs10", "nodejs8", "nodejs6", "python314", "python313", "python312", "python311", "python310", "python39", "python38", "python37", "go125", "go124", "go122", "go121", "go120", "go119", "go118", "go116", "go113", "go111", "java25", "java21", "java17", "java11", "ruby34", "ruby33", "ruby32", "ruby30", "ruby27", "ruby26", "php84", "php83", "php82", "php81", "php74", "dotnet8", "dotnet6", "dotnet3"];
|
|
109
|
+
export { GCP_GPU_MACHINE_TYPES, GCP_INSTANCE_TYPES, GCP_INSTANCE_TYPES_BY_FAMILY, GCP_LAMBDA_RUNTIMES, GCP_REGIONS, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const SHORT_ENVIRONMENT_TAGS: string[];
|
|
2
|
+
declare const LONG_ENVIRONMENT_TAGS: string[];
|
|
3
|
+
declare const ENVIRONMENT_TAGS: string[];
|
|
4
|
+
declare const SERVICE_TAGS: string[];
|
|
5
|
+
export { ENVIRONMENT_TAGS, LONG_ENVIRONMENT_TAGS, SERVICE_TAGS, SHORT_ENVIRONMENT_TAGS, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { upperFirst } from "lodash-es";
|
|
2
|
+
const SHORT_ENVIRONMENT_TAGS = ["dev", "stage", "prod"];
|
|
3
|
+
const LONG_ENVIRONMENT_TAGS = ["development", "staging", "production"];
|
|
4
|
+
const ENVIRONMENT_TAGS = [
|
|
5
|
+
...SHORT_ENVIRONMENT_TAGS,
|
|
6
|
+
...LONG_ENVIRONMENT_TAGS,
|
|
7
|
+
].flatMap((tag) => [tag, upperFirst(tag)]);
|
|
8
|
+
const SERVICE_TAGS = [
|
|
9
|
+
"web-app",
|
|
10
|
+
"api",
|
|
11
|
+
"queue",
|
|
12
|
+
"load-balancer",
|
|
13
|
+
"cdn",
|
|
14
|
+
"cache",
|
|
15
|
+
"database",
|
|
16
|
+
];
|
|
17
|
+
export { ENVIRONMENT_TAGS, LONG_ENVIRONMENT_TAGS, SERVICE_TAGS, SHORT_ENVIRONMENT_TAGS, };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from "@oclif/core";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from "@oclif/core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command, loadHelpClass } from "@oclif/core";
|
|
2
|
+
class BaseCommand extends Command {
|
|
3
|
+
async showHelp() {
|
|
4
|
+
const HelpClass = await loadHelpClass(this.config);
|
|
5
|
+
const help = new HelpClass(this.config);
|
|
6
|
+
await help.showHelp([this.id ?? ""]);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { BaseCommand };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const formatFlag: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
2
|
+
declare const quietFlag: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
3
|
+
declare const resourceCountFlag: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
4
|
+
declare const providerFlag: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
5
|
+
export { formatFlag, providerFlag, quietFlag, resourceCountFlag };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { Providers } from "../enums/providers.js";
|
|
3
|
+
const formatFlag = Flags.boolean({
|
|
4
|
+
char: "f",
|
|
5
|
+
description: "Format the output terraform files. Requires `terraform` to be in your $PATH.",
|
|
6
|
+
default: true,
|
|
7
|
+
allowNo: true,
|
|
8
|
+
});
|
|
9
|
+
const quietFlag = Flags.boolean({
|
|
10
|
+
char: "q",
|
|
11
|
+
description: "Suppress the logging output.",
|
|
12
|
+
});
|
|
13
|
+
const resourceCountFlag = Flags.integer({
|
|
14
|
+
description: "Number of resources per file to generate",
|
|
15
|
+
default: 3,
|
|
16
|
+
});
|
|
17
|
+
const providerFlag = Flags.string({
|
|
18
|
+
description: "Cloud provider to generate resources for",
|
|
19
|
+
options: Object.values(Providers),
|
|
20
|
+
});
|
|
21
|
+
export { formatFlag, providerFlag, quietFlag, resourceCountFlag };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TerraformGenerator } from "terraform-generator";
|
|
2
|
+
import { maybe, randomEnvironmentTag, randomId, randomItem, randomMemorableSlug, randomMemorySize, randomServiceTag, unique, } from "./generator-utils.js";
|
|
3
|
+
import { AWS_EBS_VOLUME_TYPES, AWS_INSTANCE_TYPES, AWS_LAMBDA_RUNTIMES, AWS_REGIONS, } from "../../constants/aws.js";
|
|
4
|
+
const AwsResourceType = {
|
|
5
|
+
Instance: "aws_instance",
|
|
6
|
+
LambdaFunction: "aws_lambda_function",
|
|
7
|
+
};
|
|
8
|
+
const randomRegion = () => randomItem(AWS_REGIONS);
|
|
9
|
+
const randomAmi = unique(() => `ami-${randomId()}`);
|
|
10
|
+
const randomRole = unique(() => `arn:aws:iam::${randomId()}:mfa/${randomMemorableSlug()}`);
|
|
11
|
+
const randomResourceType = () => randomItem(Object.values(AwsResourceType));
|
|
12
|
+
const generateAwsInstance = (options) => {
|
|
13
|
+
const { tfg, environment = randomEnvironmentTag(), service = randomServiceTag(), } = options;
|
|
14
|
+
const ami = randomAmi();
|
|
15
|
+
const instanceType = randomItem(AWS_INSTANCE_TYPES);
|
|
16
|
+
const name = randomMemorableSlug();
|
|
17
|
+
const rootBlockDevice = maybe(0.5)
|
|
18
|
+
? {
|
|
19
|
+
root_block_device: {
|
|
20
|
+
volume_size: randomMemorySize({
|
|
21
|
+
min: 1024,
|
|
22
|
+
max: 64 * 1024 * 1024,
|
|
23
|
+
step: 1024,
|
|
24
|
+
}),
|
|
25
|
+
volume_type: randomItem(AWS_EBS_VOLUME_TYPES),
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
: {};
|
|
29
|
+
tfg.resource(AwsResourceType.Instance, name, {
|
|
30
|
+
ami,
|
|
31
|
+
instance_type: instanceType,
|
|
32
|
+
...rootBlockDevice,
|
|
33
|
+
tags: { name, environment, service },
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const generateAwsLambdaFunction = (options) => {
|
|
37
|
+
const { tfg, environment = randomEnvironmentTag(), service = randomServiceTag(), } = options;
|
|
38
|
+
const ami = randomAmi();
|
|
39
|
+
const name = randomMemorableSlug();
|
|
40
|
+
const runtime = randomItem(AWS_LAMBDA_RUNTIMES);
|
|
41
|
+
const functionName = randomItem(["run", "test", "handler"]);
|
|
42
|
+
const handler = `${randomItem(["exports", "index"])}.${functionName}`;
|
|
43
|
+
/** @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html */
|
|
44
|
+
const memorySize = randomMemorySize({ min: 128, max: 10240, step: 128 });
|
|
45
|
+
const role = randomRole();
|
|
46
|
+
tfg.resource(AwsResourceType.LambdaFunction, name, {
|
|
47
|
+
ami,
|
|
48
|
+
runtime,
|
|
49
|
+
handler,
|
|
50
|
+
function_name: functionName,
|
|
51
|
+
memory_size: memorySize,
|
|
52
|
+
role,
|
|
53
|
+
tags: { name, environment, service },
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const generateResourceByType = (options) => {
|
|
57
|
+
const { type, ...rest } = options;
|
|
58
|
+
switch (type) {
|
|
59
|
+
case AwsResourceType.LambdaFunction:
|
|
60
|
+
return generateAwsLambdaFunction(rest);
|
|
61
|
+
default:
|
|
62
|
+
case AwsResourceType.Instance: {
|
|
63
|
+
return generateAwsInstance(rest);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const generateAwsFile = (options) => {
|
|
68
|
+
const { resourceCount = 3, environment = randomEnvironmentTag() } = options ?? {};
|
|
69
|
+
const tfg = new TerraformGenerator();
|
|
70
|
+
const region = randomRegion();
|
|
71
|
+
tfg.provider("aws", {
|
|
72
|
+
region,
|
|
73
|
+
});
|
|
74
|
+
for (let i = 0; i < resourceCount; i++) {
|
|
75
|
+
const type = randomResourceType();
|
|
76
|
+
generateResourceByType({ type, tfg, environment });
|
|
77
|
+
}
|
|
78
|
+
return tfg;
|
|
79
|
+
};
|
|
80
|
+
export { generateAwsFile };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TerraformGenerator } from "terraform-generator";
|
|
2
|
+
import { GCP_GPU_MACHINE_TYPES, GCP_INSTANCE_TYPES, GCP_LAMBDA_RUNTIMES, GCP_REGIONS, } from "../../constants/gcp.js";
|
|
3
|
+
import { maybe, randomEnvironmentTag, randomInt, randomItem, randomMemorableSlug, randomMemorySize, randomServiceTag, } from "./generator-utils.js";
|
|
4
|
+
const GcpResourceType = {
|
|
5
|
+
Instance: "google_compute_instance",
|
|
6
|
+
LambdaFunction: "google_cloudfunctions_function",
|
|
7
|
+
};
|
|
8
|
+
const randomRegion = () => randomItem(GCP_REGIONS);
|
|
9
|
+
const randomResourceType = () => randomItem(Object.values(GcpResourceType));
|
|
10
|
+
const generateGcpInstance = (options) => {
|
|
11
|
+
const { tfg, environment = randomEnvironmentTag(), service = randomServiceTag(), } = options;
|
|
12
|
+
const machineType = randomItem(GCP_INSTANCE_TYPES);
|
|
13
|
+
const name = randomMemorableSlug();
|
|
14
|
+
const guestAccelerator = maybe(0.5)
|
|
15
|
+
? {
|
|
16
|
+
guest_accelerator: {
|
|
17
|
+
type: randomItem(GCP_GPU_MACHINE_TYPES),
|
|
18
|
+
count: randomInt({ min: 1, max: 4 }),
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
: {};
|
|
22
|
+
tfg.resource(GcpResourceType.Instance, name, {
|
|
23
|
+
machine_type: machineType,
|
|
24
|
+
...guestAccelerator,
|
|
25
|
+
labels: { name, environment, service },
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const generateGcpLambdaFunction = (options) => {
|
|
29
|
+
const { tfg, environment = randomEnvironmentTag(), service = randomServiceTag(), } = options;
|
|
30
|
+
const runtime = randomItem(GCP_LAMBDA_RUNTIMES);
|
|
31
|
+
const name = randomMemorableSlug();
|
|
32
|
+
/** @see https://docs.cloud.google.com/run/docs/configuring/services/memory-limits */
|
|
33
|
+
const availableMemoryMb = randomMemorySize({
|
|
34
|
+
min: 128,
|
|
35
|
+
max: 32 * 1024,
|
|
36
|
+
step: 128,
|
|
37
|
+
});
|
|
38
|
+
tfg.resource(GcpResourceType.LambdaFunction, name, {
|
|
39
|
+
runtime,
|
|
40
|
+
name,
|
|
41
|
+
available_memory_mb: availableMemoryMb,
|
|
42
|
+
labels: { name, environment, service },
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const generateResourceByType = (options) => {
|
|
46
|
+
const { type, ...rest } = options;
|
|
47
|
+
switch (type) {
|
|
48
|
+
case GcpResourceType.LambdaFunction:
|
|
49
|
+
return generateGcpLambdaFunction(rest);
|
|
50
|
+
default:
|
|
51
|
+
case GcpResourceType.Instance: {
|
|
52
|
+
return generateGcpInstance(rest);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const generateGcpFile = (options) => {
|
|
57
|
+
const { resourceCount = 3, environment = randomEnvironmentTag() } = options ?? {};
|
|
58
|
+
const tfg = new TerraformGenerator();
|
|
59
|
+
const region = randomRegion();
|
|
60
|
+
tfg.provider("google", {
|
|
61
|
+
region,
|
|
62
|
+
});
|
|
63
|
+
for (let i = 0; i < resourceCount; i++) {
|
|
64
|
+
const type = randomResourceType();
|
|
65
|
+
generateResourceByType({ type, tfg, environment });
|
|
66
|
+
}
|
|
67
|
+
return tfg;
|
|
68
|
+
};
|
|
69
|
+
export { generateGcpFile };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { TerraformGenerator } from "terraform-generator";
|
|
2
|
+
import type { Provider } from "../../enums/providers.js";
|
|
3
|
+
type StringGenerator = () => string;
|
|
4
|
+
interface ResourceGeneratorOptions {
|
|
5
|
+
tfg: TerraformGenerator;
|
|
6
|
+
environment?: string;
|
|
7
|
+
service?: string;
|
|
8
|
+
}
|
|
9
|
+
interface FileGeneratorOptions {
|
|
10
|
+
resourceCount?: number;
|
|
11
|
+
environment?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Wraps a generator function to ensure the values it returns are not reused within the program runtime
|
|
15
|
+
*/
|
|
16
|
+
declare function unique(generator: StringGenerator): StringGenerator;
|
|
17
|
+
declare const randomMemorableSlug: StringGenerator;
|
|
18
|
+
declare const randomItem: <T>(values: T[]) => T;
|
|
19
|
+
declare const randomProvider: () => "aws" | "gcp";
|
|
20
|
+
declare const randomId: StringGenerator;
|
|
21
|
+
declare const randomEnvironmentTag: () => string;
|
|
22
|
+
declare const randomServiceTag: () => string;
|
|
23
|
+
interface RandomMemorySizeOptions extends Required<RandomIntOptions> {
|
|
24
|
+
step: number;
|
|
25
|
+
}
|
|
26
|
+
declare const randomMemorySize: (options: RandomMemorySizeOptions) => number;
|
|
27
|
+
interface RandomIntOptions {
|
|
28
|
+
min?: number;
|
|
29
|
+
max?: number;
|
|
30
|
+
}
|
|
31
|
+
declare const randomInt: (options: RandomIntOptions) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true/false depending on the provided probability (0 to 1)
|
|
34
|
+
*/
|
|
35
|
+
declare const maybe: (probability: number) => boolean;
|
|
36
|
+
interface GenerateFileByProviderOptions extends FileGeneratorOptions {
|
|
37
|
+
provider: Provider;
|
|
38
|
+
}
|
|
39
|
+
declare const generateFileByProvider: (options: GenerateFileByProviderOptions) => TerraformGenerator;
|
|
40
|
+
interface GenerateRepoOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Provider to generate a terraform file for.
|
|
43
|
+
*/
|
|
44
|
+
provider: Provider;
|
|
45
|
+
/**
|
|
46
|
+
* Environment to use for tags, etc.
|
|
47
|
+
*/
|
|
48
|
+
environment?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the terraform files should be formatted. Requires `terraform` to be installed.
|
|
51
|
+
*/
|
|
52
|
+
format: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Prefix for the repo
|
|
55
|
+
*/
|
|
56
|
+
prefix: string;
|
|
57
|
+
/**
|
|
58
|
+
* Directory to generate the repo in
|
|
59
|
+
*/
|
|
60
|
+
directory: string;
|
|
61
|
+
/**
|
|
62
|
+
* Number of files to generate
|
|
63
|
+
*/
|
|
64
|
+
fileCount: number;
|
|
65
|
+
/**
|
|
66
|
+
* Number of resources per file to generate
|
|
67
|
+
*/
|
|
68
|
+
resourceCount: number;
|
|
69
|
+
/**
|
|
70
|
+
* Whether output from the commands should be silenced
|
|
71
|
+
*/
|
|
72
|
+
quiet?: boolean;
|
|
73
|
+
}
|
|
74
|
+
interface GenerateRepoResult {
|
|
75
|
+
name: string;
|
|
76
|
+
path: string;
|
|
77
|
+
}
|
|
78
|
+
declare const generateRepo: (options: GenerateRepoOptions) => Promise<GenerateRepoResult>;
|
|
79
|
+
export type { FileGeneratorOptions, ResourceGeneratorOptions, StringGenerator };
|
|
80
|
+
export { generateFileByProvider, generateRepo, maybe, randomEnvironmentTag, randomId, randomInt, randomItem, randomMemorableSlug, randomMemorySize, randomProvider, randomServiceTag, unique, };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { faker } from "@faker-js/faker";
|
|
2
|
+
import { snakeSlugify } from "../string-utils.js";
|
|
3
|
+
import { ENVIRONMENT_TAGS, SERVICE_TAGS } from "../../constants/tags.js";
|
|
4
|
+
import { mkdir } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { generateAwsFile } from "./aws-generators.js";
|
|
7
|
+
import { $ } from "zx";
|
|
8
|
+
import { generateGcpFile } from "./gcp-generators.js";
|
|
9
|
+
import { Providers } from "../../enums/providers.js";
|
|
10
|
+
import { range } from "lodash-es";
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a generator function to ensure the values it returns are not reused within the program runtime
|
|
13
|
+
*/
|
|
14
|
+
function unique(generator) {
|
|
15
|
+
const used = new Set();
|
|
16
|
+
return () => {
|
|
17
|
+
let value = generator();
|
|
18
|
+
while (used.has(value)) {
|
|
19
|
+
value = generator();
|
|
20
|
+
}
|
|
21
|
+
used.add(value);
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const randomMemorableSlug = unique(() => snakeSlugify(`${faker.word.adjective()}_${faker.color.human()}_${faker.animal.type()}`));
|
|
26
|
+
const randomItem = (values) => faker.helpers.arrayElement(values);
|
|
27
|
+
const randomProvider = () => randomItem(Object.values(Providers));
|
|
28
|
+
const randomId = unique(() => faker.internet.mac({ separator: "" }));
|
|
29
|
+
const randomEnvironmentTag = () => randomItem(ENVIRONMENT_TAGS);
|
|
30
|
+
const randomServiceTag = () => randomItem(SERVICE_TAGS);
|
|
31
|
+
const randomMemorySize = (options) => {
|
|
32
|
+
const { min, max, step } = options;
|
|
33
|
+
const values = range(min, max, step);
|
|
34
|
+
return randomItem(values);
|
|
35
|
+
};
|
|
36
|
+
const randomInt = (options) => {
|
|
37
|
+
let { min = 0, max = 100 } = options;
|
|
38
|
+
min = Math.ceil(min);
|
|
39
|
+
max = Math.floor(max);
|
|
40
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Returns true/false depending on the provided probability (0 to 1)
|
|
44
|
+
*/
|
|
45
|
+
const maybe = (probability) => Math.random() < probability;
|
|
46
|
+
const generateFileByProvider = (options) => {
|
|
47
|
+
const { provider, ...rest } = options;
|
|
48
|
+
switch (provider) {
|
|
49
|
+
case Providers.GCP:
|
|
50
|
+
return generateGcpFile(rest);
|
|
51
|
+
default:
|
|
52
|
+
case Providers.AWS:
|
|
53
|
+
return generateAwsFile(rest);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const generateRepo = async (options) => {
|
|
57
|
+
const { provider, format, prefix, fileCount, resourceCount, quiet } = options;
|
|
58
|
+
const directory = path.resolve(process.cwd(), options.directory);
|
|
59
|
+
const repoName = `${prefix}${randomMemorableSlug()}`;
|
|
60
|
+
const repoPath = path.join(directory, repoName);
|
|
61
|
+
const sh = $({ cwd: repoPath, stdio: quiet ? "ignore" : "inherit" });
|
|
62
|
+
await mkdir(repoPath);
|
|
63
|
+
await sh `git init`;
|
|
64
|
+
for (let i = 0; i < fileCount; i++) {
|
|
65
|
+
const tfFilename = `${randomMemorableSlug()}.tf`;
|
|
66
|
+
const tfg = generateFileByProvider({ provider, resourceCount });
|
|
67
|
+
tfg.write({ format, dir: repoPath, tfFilename });
|
|
68
|
+
}
|
|
69
|
+
await sh `git add . && git commit -m "initial commit"`;
|
|
70
|
+
return { name: repoName, path: repoPath };
|
|
71
|
+
};
|
|
72
|
+
export { generateFileByProvider, generateRepo, maybe, randomEnvironmentTag, randomId, randomInt, randomItem, randomMemorableSlug, randomMemorySize, randomProvider, randomServiceTag, unique, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
const listRepos = () => JSON.parse(execSync(`gh repo list --json name,nameWithOwner`).toString());
|
|
3
|
+
const stringifyRepos = (repos) => repos.map((repo) => `- ${repo.nameWithOwner}`).join("\n");
|
|
4
|
+
export { listRepos, stringifyRepos };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const slugify: (value: string) => string;
|
|
2
|
+
declare const snakeSlugify: (value: string) => string;
|
|
3
|
+
declare const success: (message: string) => string;
|
|
4
|
+
declare const stringifySingleLineArray: (values: string[]) => string;
|
|
5
|
+
export { slugify, snakeSlugify, stringifySingleLineArray, success };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { faker } from "@faker-js/faker";
|
|
2
|
+
import { ux } from "@oclif/core";
|
|
3
|
+
const slugify = (value) => faker.helpers.slugify(value).toLowerCase();
|
|
4
|
+
const snakeSlugify = (value) => slugify(value).replaceAll("-", "_");
|
|
5
|
+
const success = (message) => `${ux.colorize("green", "✓")} ${message}`;
|
|
6
|
+
const stringifySingleLineArray = (values) => `[${values.map((value) => `"${value}"`).join(", ")}]`;
|
|
7
|
+
export { slugify, snakeSlugify, stringifySingleLineArray, success };
|