@palantir/pack.sdkgen 0.0.1-beta.1

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 (80) hide show
  1. package/LICENSE.txt +13 -0
  2. package/README.md +589 -0
  3. package/bin/cli.ts +7 -0
  4. package/build/esm/__tests__/createCommand.test.js +157 -0
  5. package/build/esm/__tests__/createCommand.test.js.map +1 -0
  6. package/build/esm/__tests__/generator.test.js +190 -0
  7. package/build/esm/__tests__/generator.test.js.map +1 -0
  8. package/build/esm/__tests__/schemaParser.test.js +67 -0
  9. package/build/esm/__tests__/schemaParser.test.js.map +1 -0
  10. package/build/esm/__tests__/templateLoader.test.js +67 -0
  11. package/build/esm/__tests__/templateLoader.test.js.map +1 -0
  12. package/build/esm/__tests__/templateUtils.test.js +94 -0
  13. package/build/esm/__tests__/templateUtils.test.js.map +1 -0
  14. package/build/esm/__tests__/types/testTypes.js +2 -0
  15. package/build/esm/__tests__/types/testTypes.js.map +1 -0
  16. package/build/esm/cli.js +25 -0
  17. package/build/esm/cli.js.map +1 -0
  18. package/build/esm/commands/create.js +173 -0
  19. package/build/esm/commands/create.js.map +1 -0
  20. package/build/esm/core/contextBuilder.js +33 -0
  21. package/build/esm/core/contextBuilder.js.map +1 -0
  22. package/build/esm/core/generator.js +248 -0
  23. package/build/esm/core/generator.js.map +1 -0
  24. package/build/esm/core/hookRunner.js +68 -0
  25. package/build/esm/core/hookRunner.js.map +1 -0
  26. package/build/esm/core/schemaParser.js +50 -0
  27. package/build/esm/core/schemaParser.js.map +1 -0
  28. package/build/esm/core/templateLoader.js +99 -0
  29. package/build/esm/core/templateLoader.js.map +1 -0
  30. package/build/esm/index.js +26 -0
  31. package/build/esm/index.js.map +1 -0
  32. package/build/esm/types/index.js +2 -0
  33. package/build/esm/types/index.js.map +1 -0
  34. package/build/esm/utils/fileSystem.js +72 -0
  35. package/build/esm/utils/fileSystem.js.map +1 -0
  36. package/build/esm/utils/logger.js +44 -0
  37. package/build/esm/utils/logger.js.map +1 -0
  38. package/build/esm/utils/prompts.js +25 -0
  39. package/build/esm/utils/prompts.js.map +1 -0
  40. package/build/esm/utils/templateUtils.js +61 -0
  41. package/build/esm/utils/templateUtils.js.map +1 -0
  42. package/build/types/__tests__/createCommand.test.d.ts +2 -0
  43. package/build/types/__tests__/createCommand.test.d.ts.map +1 -0
  44. package/build/types/__tests__/generator.test.d.ts +2 -0
  45. package/build/types/__tests__/generator.test.d.ts.map +1 -0
  46. package/build/types/__tests__/schemaParser.test.d.ts +2 -0
  47. package/build/types/__tests__/schemaParser.test.d.ts.map +1 -0
  48. package/build/types/__tests__/templateLoader.test.d.ts +2 -0
  49. package/build/types/__tests__/templateLoader.test.d.ts.map +1 -0
  50. package/build/types/__tests__/templateUtils.test.d.ts +2 -0
  51. package/build/types/__tests__/templateUtils.test.d.ts.map +1 -0
  52. package/build/types/__tests__/types/testTypes.d.ts +38 -0
  53. package/build/types/__tests__/types/testTypes.d.ts.map +1 -0
  54. package/build/types/cli.d.ts +2 -0
  55. package/build/types/cli.d.ts.map +1 -0
  56. package/build/types/commands/create.d.ts +3 -0
  57. package/build/types/commands/create.d.ts.map +1 -0
  58. package/build/types/core/contextBuilder.d.ts +5 -0
  59. package/build/types/core/contextBuilder.d.ts.map +1 -0
  60. package/build/types/core/generator.d.ts +15 -0
  61. package/build/types/core/generator.d.ts.map +1 -0
  62. package/build/types/core/hookRunner.d.ts +3 -0
  63. package/build/types/core/hookRunner.d.ts.map +1 -0
  64. package/build/types/core/schemaParser.d.ts +7 -0
  65. package/build/types/core/schemaParser.d.ts.map +1 -0
  66. package/build/types/core/templateLoader.d.ts +12 -0
  67. package/build/types/core/templateLoader.d.ts.map +1 -0
  68. package/build/types/index.d.ts +11 -0
  69. package/build/types/index.d.ts.map +1 -0
  70. package/build/types/types/index.d.ts +68 -0
  71. package/build/types/types/index.d.ts.map +1 -0
  72. package/build/types/utils/fileSystem.d.ts +8 -0
  73. package/build/types/utils/fileSystem.d.ts.map +1 -0
  74. package/build/types/utils/logger.d.ts +11 -0
  75. package/build/types/utils/logger.d.ts.map +1 -0
  76. package/build/types/utils/prompts.d.ts +3 -0
  77. package/build/types/utils/prompts.d.ts.map +1 -0
  78. package/build/types/utils/templateUtils.d.ts +3 -0
  79. package/build/types/utils/templateUtils.d.ts.map +1 -0
  80. package/package.json +61 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=templateUtils.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateUtils.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/templateUtils.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ export interface TestSchema {
2
+ version: string;
3
+ description: string;
4
+ types: {
5
+ User: {
6
+ id: string;
7
+ name: string;
8
+ email: string;
9
+ createdAt: string;
10
+ };
11
+ Post: {
12
+ id: string;
13
+ title: string;
14
+ content: string;
15
+ authorId: string;
16
+ };
17
+ Comment: {
18
+ id: string;
19
+ postId: string;
20
+ userId: string;
21
+ content: string;
22
+ createdAt: string;
23
+ };
24
+ };
25
+ }
26
+ export interface PackageJson {
27
+ name: string;
28
+ version: string;
29
+ description: string;
30
+ author: string;
31
+ license: string;
32
+ main?: string;
33
+ types?: string;
34
+ scripts?: Record<string, string>;
35
+ dependencies?: Record<string, string>;
36
+ devDependencies?: Record<string, string>;
37
+ }
38
+ //# sourceMappingURL=testTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testTypes.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/types/testTypes.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC;YACX,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,IAAI,EAAE;YACJ,EAAE,EAAE,MAAM,CAAC;YACX,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,OAAO,EAAE;YACP,EAAE,EAAE,MAAM,CAAC;YACX,MAAM,EAAE,MAAM,CAAC;YACf,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,2 @@
1
+ export declare function cli(args: string[]): void;
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAmBA,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAsBxC"}
@@ -0,0 +1,3 @@
1
+ import type { CreateCommandOptions } from "../types/index.js";
2
+ export declare function createCommand(projectName: string, options: CreateCommandOptions): Promise<void>;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/create.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,mBAAmB,CAAC;AAI7E,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
@@ -0,0 +1,5 @@
1
+ import type { GeneratorContext, GeneratorOptions, TemplateConfig } from "../types/index.js";
2
+ export declare class ContextBuilder {
3
+ build(projectName: string, schema: unknown, answers: Record<string, unknown>, templateConfig: TemplateConfig, outputPath: string, options: GeneratorOptions, schemaPath?: string): GeneratorContext;
4
+ }
5
+ //# sourceMappingURL=contextBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextBuilder.d.ts","sourceRoot":"","sources":["../../../src/core/contextBuilder.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG5F,qBAAa,cAAc;IACzB,KAAK,CACH,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,EACzB,UAAU,CAAC,EAAE,MAAM,GAClB,gBAAgB;CAapB"}
@@ -0,0 +1,15 @@
1
+ import type { GeneratorContext } from "../types/index.js";
2
+ import type { Logger } from "../utils/logger.js";
3
+ export declare class Generator {
4
+ private context;
5
+ private readonly templateDir;
6
+ private readonly logger;
7
+ constructor(context: GeneratorContext, templateDir: string, logger: Logger);
8
+ generate(): Promise<void>;
9
+ private processTemplateFiles;
10
+ private copyStaticFiles;
11
+ private copySchemaDirectory;
12
+ private runHook;
13
+ private installDependencies;
14
+ }
15
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/core/generator.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,qBAAa,SAAS;IAElB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFf,OAAO,EAAE,gBAAgB,EAChB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM;IAG3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BjB,oBAAoB;YA4BpB,eAAe;YAYf,mBAAmB;YAoCnB,OAAO;YA6FP,mBAAmB;CA6BlC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=hookRunner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hookRunner.d.ts","sourceRoot":"","sources":["../../../src/core/hookRunner.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { Logger } from "../utils/logger.js";
2
+ export declare class SchemaParser {
3
+ private readonly logger;
4
+ constructor(logger: Logger);
5
+ loadSchema(schemaPath?: string): Promise<unknown>;
6
+ }
7
+ //# sourceMappingURL=schemaParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaParser.d.ts","sourceRoot":"","sources":["../../../src/core/schemaParser.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAgCxD"}
@@ -0,0 +1,12 @@
1
+ import type { TemplateConfig } from "../types/index.js";
2
+ import type { Logger } from "../utils/logger.js";
3
+ export declare class TemplateLoader {
4
+ private readonly logger;
5
+ constructor(logger: Logger);
6
+ loadTemplate(templatePath: string): Promise<{
7
+ config: TemplateConfig;
8
+ templateDir: string;
9
+ }>;
10
+ private resolveNodeModule;
11
+ }
12
+ //# sourceMappingURL=templateLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateLoader.d.ts","sourceRoot":"","sources":["../../../src/core/templateLoader.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAErC,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAChD,MAAM,EAAE,cAAc,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;YA6CY,iBAAiB;CA0ChC"}
@@ -0,0 +1,11 @@
1
+ export { cli } from "./cli.js";
2
+ export { createCommand } from "./commands/create.js";
3
+ export { ContextBuilder } from "./core/contextBuilder.js";
4
+ export { Generator } from "./core/generator.js";
5
+ export { SchemaParser } from "./core/schemaParser.js";
6
+ export { TemplateLoader } from "./core/templateLoader.js";
7
+ export type * from "./types/index.js";
8
+ export { Logger } from "./utils/logger.js";
9
+ export { promptUser } from "./utils/prompts.js";
10
+ export { createTemplateUtils } from "./utils/templateUtils.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,mBAAmB,kBAAkB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,68 @@
1
+ export interface GeneratorContext {
2
+ readonly projectName: string;
3
+ readonly schema: unknown;
4
+ readonly answers: Readonly<Record<string, unknown>>;
5
+ readonly templateConfig: TemplateConfig;
6
+ readonly schemaPath?: string;
7
+ readonly outputPath: string;
8
+ readonly options: GeneratorOptions;
9
+ readonly utils: TemplateUtils;
10
+ readonly additionalData?: Readonly<Record<string, unknown>>;
11
+ }
12
+ export interface GeneratorOptions {
13
+ readonly skipInstall?: boolean;
14
+ readonly verbose?: boolean;
15
+ readonly dryRun?: boolean;
16
+ }
17
+ export interface TemplateConfig {
18
+ readonly name: string;
19
+ readonly description?: string;
20
+ readonly prompts?: PromptQuestion[];
21
+ readonly templateFiles?: readonly string[];
22
+ readonly staticFiles?: readonly string[];
23
+ readonly hooks?: {
24
+ readonly beforeGenerate?: string | ((context: GeneratorContext) => Promise<GeneratorContext>);
25
+ readonly afterGenerate?: string | ((context: GeneratorContext, outputPath: string) => Promise<void>);
26
+ readonly beforeInstall?: string | ((context: GeneratorContext, outputPath: string) => Promise<void>);
27
+ readonly afterInstall?: string | ((context: GeneratorContext, outputPath: string) => Promise<void>);
28
+ };
29
+ readonly transformers?: {
30
+ readonly [key: string]: string | ((schema: unknown, context: GeneratorContext) => Promise<unknown>);
31
+ };
32
+ readonly dependencies?: Readonly<Record<string, string>>;
33
+ readonly devDependencies?: Readonly<Record<string, string>>;
34
+ }
35
+ export interface PromptQuestion {
36
+ readonly type: "input" | "number" | "confirm" | "list" | "checkbox" | "password";
37
+ readonly name: string;
38
+ readonly message: string;
39
+ readonly default?: unknown;
40
+ readonly choices?: readonly string[] | readonly {
41
+ readonly name: string;
42
+ readonly value: unknown;
43
+ }[];
44
+ readonly validate?: (input: unknown) => boolean | string;
45
+ readonly when?: (answers: Readonly<Record<string, unknown>>) => boolean;
46
+ }
47
+ export interface TemplateUtils {
48
+ readonly camelCase: (str: string) => string;
49
+ readonly capitalize: (str: string) => string;
50
+ readonly kebabCase: (str: string) => string;
51
+ readonly lower: (str: string) => string;
52
+ readonly pascalCase: (str: string) => string;
53
+ readonly pluralize: (str: string) => string;
54
+ readonly singularize: (str: string) => string;
55
+ readonly snakeCase: (str: string) => string;
56
+ readonly upper: (str: string) => string;
57
+ }
58
+ export interface CreateCommandOptions {
59
+ readonly config?: string | Record<string, unknown>;
60
+ readonly dryRun?: boolean;
61
+ readonly nonInteractive?: boolean;
62
+ readonly overwrite?: boolean;
63
+ readonly schema?: string;
64
+ readonly skipInstall?: boolean;
65
+ readonly template?: string;
66
+ readonly verbose?: boolean;
67
+ }
68
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CA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C,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -0,0 +1,8 @@
1
+ export declare function copyFiles(source: string, destination: string, patterns: readonly string[], dryRun?: boolean): Promise<void>;
2
+ export declare function ensureDir(dirPath: string, dryRun?: boolean): Promise<void>;
3
+ export declare function writeFile(filePath: string, content: string, dryRun?: boolean): Promise<void>;
4
+ export declare function readFile(filePath: string): Promise<string>;
5
+ export declare function pathExists(filePath: string): Promise<boolean>;
6
+ export declare function readJSON(filePath: string): Promise<unknown>;
7
+ export declare function writeJSON(filePath: string, data: unknown, dryRun?: boolean): Promise<void>;
8
+ //# sourceMappingURL=fileSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileSystem.d.ts","sourceRoot":"","sources":["../../../src/utils/fileSystem.ts"],"names":[],"mappings":"AAoBA,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAIvF;AAED,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEhE;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjE;AAED,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAKf"}
@@ -0,0 +1,11 @@
1
+ export declare class Logger {
2
+ private consola;
3
+ constructor(verbose?: boolean);
4
+ info(message: string): void;
5
+ success(message: string): void;
6
+ warning(message: string): void;
7
+ error(message: string): void;
8
+ debug(message: string): void;
9
+ log(message: string): void;
10
+ }
11
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAkBA,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAkB;gBAErB,OAAO,GAAE,OAAe;IAMpC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI9B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI5B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG3B"}
@@ -0,0 +1,3 @@
1
+ import type { PromptQuestion } from "../types/index.js";
2
+ export declare function promptUser(questions: PromptQuestion[]): Promise<Record<string, unknown>>;
3
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/utils/prompts.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,UAAU,CAC9B,SAAS,EAAE,cAAc,EAAE,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAQlC"}
@@ -0,0 +1,3 @@
1
+ import type { TemplateUtils } from "../types/index.js";
2
+ export declare function createTemplateUtils(): TemplateUtils;
3
+ //# sourceMappingURL=templateUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/templateUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,wBAAgB,mBAAmB,IAAI,aAAa,CAiEnD"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@palantir/pack.sdkgen",
3
+ "version": "0.0.1-beta.1",
4
+ "description": "Generic Typescript SDK generator CLI",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/palantir/pack.git"
9
+ },
10
+ "bin": {
11
+ "sdkgen": "./bin/cli.ts"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./build/types/index.d.ts",
16
+ "default": "./build/esm/index.js"
17
+ }
18
+ },
19
+ "dependencies": {
20
+ "bun": "^1.3.0",
21
+ "commander": "^14.0.0",
22
+ "consola": "^3.2.3",
23
+ "ejs": "^3.1.10",
24
+ "find-up": "^8.0.0",
25
+ "fs-extra": "^11.3.2",
26
+ "glob": "^11.0.3",
27
+ "inquirer": "^12.9.6"
28
+ },
29
+ "devDependencies": {
30
+ "@types/ejs": "^3.1.5",
31
+ "@types/fs-extra": "^11.0.4",
32
+ "@types/inquirer": "^9.0.9",
33
+ "@types/node": "^20.19.17",
34
+ "prettier": "^3.6.2",
35
+ "rimraf": "^6.0.1",
36
+ "tslib": "^2.8.1",
37
+ "typescript": "^5.9.2",
38
+ "@palantir/pack.monorepo.tsconfig": "~0.4.0-beta.1"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "files": [
44
+ "bin",
45
+ "build"
46
+ ],
47
+ "main": "./build/esm/index.js",
48
+ "types": "./build/types/index.d.ts",
49
+ "type": "module",
50
+ "scripts": {
51
+ "clean": "rimraf .turbo build dist lib test-output *.tgz tsconfig.tsbuildinfo",
52
+ "lint": "eslint ./src && dprint check --config $(find-up dprint.json) --allow-no-files",
53
+ "lint:fix": "eslint ./src --fix && dprint fmt --config $(find-up dprint.json) --allow-no-files",
54
+ "test": "vitest run --passWithNoTests -u",
55
+ "test:watch": "vitest --passWithNoTests",
56
+ "transpile": "tsc",
57
+ "transpileEsm": "monorepo-transpile -f esm -m normal -t node",
58
+ "transpileTypes": "tsc --emitDeclarationOnly",
59
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false"
60
+ }
61
+ }