commet 0.8.0 → 1.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/dist/index.js +87 -69
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -27,6 +27,62 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var import_chalk11 = __toESM(require("chalk"));
|
|
28
28
|
var import_commander10 = require("commander");
|
|
29
29
|
|
|
30
|
+
// package.json
|
|
31
|
+
var package_default = {
|
|
32
|
+
name: "commet",
|
|
33
|
+
version: "1.0.0",
|
|
34
|
+
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
|
+
bin: {
|
|
36
|
+
commet: "./bin/commet"
|
|
37
|
+
},
|
|
38
|
+
files: [
|
|
39
|
+
"dist",
|
|
40
|
+
"bin",
|
|
41
|
+
"README.md"
|
|
42
|
+
],
|
|
43
|
+
scripts: {
|
|
44
|
+
build: "tsup",
|
|
45
|
+
dev: "tsup --watch",
|
|
46
|
+
lint: "biome lint src/",
|
|
47
|
+
"lint:fix": "biome lint --write src/",
|
|
48
|
+
typecheck: "tsc --noEmit"
|
|
49
|
+
},
|
|
50
|
+
keywords: [
|
|
51
|
+
"billing",
|
|
52
|
+
"cli",
|
|
53
|
+
"typescript",
|
|
54
|
+
"commet"
|
|
55
|
+
],
|
|
56
|
+
author: "Commet Team",
|
|
57
|
+
license: "MIT",
|
|
58
|
+
dependencies: {
|
|
59
|
+
"@inquirer/prompts": "8.0.1",
|
|
60
|
+
chalk: "5.6.2",
|
|
61
|
+
commander: "14.0.2",
|
|
62
|
+
"jsonc-parser": "3.3.1",
|
|
63
|
+
open: "11.0.0",
|
|
64
|
+
ora: "9.0.0"
|
|
65
|
+
},
|
|
66
|
+
devDependencies: {
|
|
67
|
+
"@types/node": "24.10.1",
|
|
68
|
+
tsup: "8.5.1",
|
|
69
|
+
typescript: "5.9.3"
|
|
70
|
+
},
|
|
71
|
+
engines: {
|
|
72
|
+
node: ">=18.0.0"
|
|
73
|
+
},
|
|
74
|
+
homepage: "https://commet.co",
|
|
75
|
+
repository: {
|
|
76
|
+
type: "git",
|
|
77
|
+
url: "https://github.com/commet-labs/commet.git",
|
|
78
|
+
directory: "packages/cli"
|
|
79
|
+
},
|
|
80
|
+
publishConfig: {
|
|
81
|
+
access: "public",
|
|
82
|
+
provenance: true
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
30
86
|
// src/commands/info.ts
|
|
31
87
|
var import_chalk = __toESM(require("chalk"));
|
|
32
88
|
var import_commander = require("commander");
|
|
@@ -588,25 +644,29 @@ function validateTypeScriptProject() {
|
|
|
588
644
|
}
|
|
589
645
|
|
|
590
646
|
// src/utils/generator.ts
|
|
591
|
-
function generateTypes(eventTypes, seatTypes,
|
|
647
|
+
function generateTypes(eventTypes, seatTypes, features, plans) {
|
|
592
648
|
const eventTypeUnion = eventTypes.length > 0 ? eventTypes.map((e) => `"${e.code}"`).join(" | ") : "string";
|
|
593
649
|
const seatTypeUnion = seatTypes.length > 0 ? seatTypes.map((s) => `"${s.code}"`).join(" | ") : "string";
|
|
594
|
-
const
|
|
650
|
+
const planCodeUnion = plans.length > 0 ? plans.map((p) => `"${p.code}"`).join(" | ") : "string";
|
|
651
|
+
const featureCodeUnion = features.length > 0 ? features.map((f) => `"${f.code}"`).join(" | ") : "string";
|
|
595
652
|
const eventComments = eventTypes.map(
|
|
596
653
|
(e) => ` * - "${e.code}": ${e.name}${e.description ? ` - ${e.description}` : ""}`
|
|
597
654
|
).join("\n");
|
|
598
655
|
const seatComments = seatTypes.map(
|
|
599
656
|
(s) => ` * - "${s.code}": ${s.name}${s.description ? ` - ${s.description}` : ""} ${s.isFree ? "(Free)" : ""}`
|
|
600
657
|
).join("\n");
|
|
601
|
-
const
|
|
602
|
-
(p) => ` * - "${p.
|
|
658
|
+
const planComments = plans.map(
|
|
659
|
+
(p) => ` * - "${p.code}": ${p.name}${p.description ? ` - ${p.description}` : ""}`
|
|
660
|
+
).join("\n");
|
|
661
|
+
const featureComments = features.map(
|
|
662
|
+
(f) => ` * - "${f.code}": ${f.name} (${f.type})${f.description ? ` - ${f.description}` : ""}`
|
|
603
663
|
).join("\n");
|
|
604
664
|
return `// Auto-generated by Commet CLI
|
|
605
665
|
// Do not edit this file manually - run 'commet pull' to update
|
|
606
666
|
|
|
607
667
|
/**
|
|
608
668
|
* This augments the Commet SDK to automatically use your organization's
|
|
609
|
-
* specific event types, seat types, and
|
|
669
|
+
* specific event types, seat types, plans, and features without requiring generic type parameters.
|
|
610
670
|
*
|
|
611
671
|
* Event types available in your organization:
|
|
612
672
|
${eventComments || " * (none)"}
|
|
@@ -614,15 +674,19 @@ ${eventComments || " * (none)"}
|
|
|
614
674
|
* Seat types available in your organization:
|
|
615
675
|
${seatComments || " * (none)"}
|
|
616
676
|
*
|
|
617
|
-
*
|
|
618
|
-
${
|
|
677
|
+
* Plans available in your organization:
|
|
678
|
+
${planComments || " * (none)"}
|
|
679
|
+
*
|
|
680
|
+
* Features available in your organization:
|
|
681
|
+
${featureComments || " * (none)"}
|
|
619
682
|
*
|
|
620
683
|
*/
|
|
621
684
|
declare module '@commet/node' {
|
|
622
685
|
interface CommetGeneratedTypes {
|
|
623
686
|
eventType: ${eventTypeUnion};
|
|
624
687
|
seatType: ${seatTypeUnion};
|
|
625
|
-
|
|
688
|
+
planCode: ${planCodeUnion};
|
|
689
|
+
featureCode: ${featureCodeUnion};
|
|
626
690
|
}
|
|
627
691
|
}
|
|
628
692
|
|
|
@@ -702,8 +766,13 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
|
|
|
702
766
|
console.error(import_chalk7.default.red("Error:"), result.error);
|
|
703
767
|
return;
|
|
704
768
|
}
|
|
705
|
-
const { eventTypes, seatTypes,
|
|
706
|
-
const typeDefinitions = generateTypes(
|
|
769
|
+
const { eventTypes, seatTypes, features, plans } = result.data;
|
|
770
|
+
const typeDefinitions = generateTypes(
|
|
771
|
+
eventTypes,
|
|
772
|
+
seatTypes,
|
|
773
|
+
features,
|
|
774
|
+
plans
|
|
775
|
+
);
|
|
707
776
|
const commetDir = path5.resolve(process.cwd(), ".commet");
|
|
708
777
|
const outputPath = path5.join(commetDir, "types.d.ts");
|
|
709
778
|
fs5.mkdirSync(commetDir, { recursive: true });
|
|
@@ -750,15 +819,20 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
|
|
|
750
819
|
);
|
|
751
820
|
console.log(
|
|
752
821
|
import_chalk7.default.dim(
|
|
753
|
-
`
|
|
822
|
+
` Plans: ${plans.length > 0 ? plans.map((p) => p.code).join(", ") : "none"}`
|
|
823
|
+
)
|
|
824
|
+
);
|
|
825
|
+
console.log(
|
|
826
|
+
import_chalk7.default.dim(
|
|
827
|
+
` Features: ${features.length > 0 ? features.map((f) => f.code).join(", ") : "none"}`
|
|
754
828
|
)
|
|
755
829
|
);
|
|
756
830
|
console.log(import_chalk7.default.dim(`
|
|
757
831
|
Output: ${outputPath}`));
|
|
758
|
-
if (eventTypes.length === 0 && seatTypes.length === 0 &&
|
|
832
|
+
if (eventTypes.length === 0 && seatTypes.length === 0 && plans.length === 0 && features.length === 0) {
|
|
759
833
|
console.log(
|
|
760
834
|
import_chalk7.default.yellow(
|
|
761
|
-
"\n\u26A0 No types found. Create event types, seat types, and
|
|
835
|
+
"\n\u26A0 No types found. Create event types, seat types, plans, and features in your Commet dashboard."
|
|
762
836
|
)
|
|
763
837
|
);
|
|
764
838
|
}
|
|
@@ -883,62 +957,6 @@ var whoamiCommand = new import_commander9.Command("whoami").description("Display
|
|
|
883
957
|
}
|
|
884
958
|
});
|
|
885
959
|
|
|
886
|
-
// package.json
|
|
887
|
-
var package_default = {
|
|
888
|
-
name: "commet",
|
|
889
|
-
version: "0.8.0",
|
|
890
|
-
description: "Commet CLI - Manage your billing platform from the command line",
|
|
891
|
-
bin: {
|
|
892
|
-
commet: "./bin/commet"
|
|
893
|
-
},
|
|
894
|
-
files: [
|
|
895
|
-
"dist",
|
|
896
|
-
"bin",
|
|
897
|
-
"README.md"
|
|
898
|
-
],
|
|
899
|
-
scripts: {
|
|
900
|
-
build: "tsup",
|
|
901
|
-
dev: "tsup --watch",
|
|
902
|
-
lint: "biome lint src/",
|
|
903
|
-
"lint:fix": "biome lint --write src/",
|
|
904
|
-
typecheck: "tsc --noEmit"
|
|
905
|
-
},
|
|
906
|
-
keywords: [
|
|
907
|
-
"billing",
|
|
908
|
-
"cli",
|
|
909
|
-
"typescript",
|
|
910
|
-
"commet"
|
|
911
|
-
],
|
|
912
|
-
author: "Commet Team",
|
|
913
|
-
license: "MIT",
|
|
914
|
-
dependencies: {
|
|
915
|
-
"@commet/node": "workspace:*",
|
|
916
|
-
"@inquirer/prompts": "^7.8.6",
|
|
917
|
-
chalk: "^5.3.0",
|
|
918
|
-
commander: "^12.0.0",
|
|
919
|
-
"jsonc-parser": "^3.3.1",
|
|
920
|
-
open: "^10.0.0",
|
|
921
|
-
ora: "^7.0.1"
|
|
922
|
-
},
|
|
923
|
-
devDependencies: {
|
|
924
|
-
"@types/node": "^20.10.0",
|
|
925
|
-
tsup: "^8.0.1",
|
|
926
|
-
typescript: "^5.3.3"
|
|
927
|
-
},
|
|
928
|
-
engines: {
|
|
929
|
-
node: ">=18.0.0"
|
|
930
|
-
},
|
|
931
|
-
repository: {
|
|
932
|
-
type: "git",
|
|
933
|
-
url: "https://github.com/commet-labs/commet.git",
|
|
934
|
-
directory: "packages/cli"
|
|
935
|
-
},
|
|
936
|
-
publishConfig: {
|
|
937
|
-
access: "public",
|
|
938
|
-
provenance: true
|
|
939
|
-
}
|
|
940
|
-
};
|
|
941
|
-
|
|
942
960
|
// src/index.ts
|
|
943
961
|
var program = new import_commander10.Command();
|
|
944
962
|
program.name("commet").description(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Commet CLI - Manage your billing platform from the command line",
|
|
5
5
|
"bin": {
|
|
6
6
|
"commet": "./bin/commet"
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
"author": "Commet Team",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@inquirer/prompts": "
|
|
23
|
-
"chalk": "
|
|
24
|
-
"commander": "
|
|
25
|
-
"jsonc-parser": "
|
|
26
|
-
"open": "
|
|
27
|
-
"ora": "
|
|
28
|
-
"@commet/node": "0.9.0"
|
|
22
|
+
"@inquirer/prompts": "8.0.1",
|
|
23
|
+
"chalk": "5.6.2",
|
|
24
|
+
"commander": "14.0.2",
|
|
25
|
+
"jsonc-parser": "3.3.1",
|
|
26
|
+
"open": "11.0.0",
|
|
27
|
+
"ora": "9.0.0"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@types/node": "
|
|
32
|
-
"tsup": "
|
|
33
|
-
"typescript": "
|
|
30
|
+
"@types/node": "24.10.1",
|
|
31
|
+
"tsup": "8.5.1",
|
|
32
|
+
"typescript": "5.9.3"
|
|
34
33
|
},
|
|
35
34
|
"engines": {
|
|
36
35
|
"node": ">=18.0.0"
|
|
37
36
|
},
|
|
37
|
+
"homepage": "https://commet.co",
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
40
|
"url": "https://github.com/commet-labs/commet.git",
|