@palantir/pack.sdkgen.pack-versioned-template 0.2.0 → 0.4.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.
@@ -35,11 +35,6 @@ export const config = {
35
35
  message: "Author:",
36
36
  default: "",
37
37
  },
38
- {
39
- type: "number",
40
- name: "minVersion",
41
- message: "Minimum supported schema version (leave blank to track latest):",
42
- },
43
38
  ],
44
39
  hooks: {
45
40
  afterGenerate: "./build/esm/hooks/afterGenerate.js",
@@ -40,21 +40,8 @@ async function syncModelTypesVersion(outputPath, typeGenPackageJsonPath) {
40
40
  consola.log(`Updated model-types dependency to ${modelTypesVersion}`);
41
41
  }
42
42
  }
43
- function readMinVersion(answers) {
44
- const raw = answers?.minVersion;
45
- if (raw == null || raw === "")
46
- return undefined;
47
- if (typeof raw !== "number" && typeof raw !== "string") {
48
- throw new Error(`minVersion answer must be a number or numeric string`);
49
- }
50
- const value = typeof raw === "number" ? raw : Number(raw);
51
- if (!Number.isInteger(value)) {
52
- throw new Error(`minVersion answer must be an integer, got: ${raw}`);
53
- }
54
- return value;
55
- }
56
43
  export default async function afterGenerate(context) {
57
- const { outputPath, schemaPath, answers, options } = context;
44
+ const { outputPath, schemaPath, options } = context;
58
45
  if (options.dryRun)
59
46
  return;
60
47
  if (schemaPath == null) {
@@ -67,7 +54,6 @@ export default async function afterGenerate(context) {
67
54
  }
68
55
  const resolvedIr = path.resolve(schemaPath);
69
56
  const { cli: typeGenCli, packageJsonPath: typeGenPackageJsonPath } = resolveTypeGenCli();
70
- const minVersion = readMinVersion(answers);
71
57
  consola.log("Generating versioned SDK files from IR...");
72
58
  const genArgs = [
73
59
  "ir",
@@ -77,9 +63,6 @@ export default async function afterGenerate(context) {
77
63
  "-o",
78
64
  path.join(outputPath, "src"),
79
65
  ];
80
- if (minVersion != null) {
81
- genArgs.push("--min-version", String(minVersion));
82
- }
83
66
  const genResult = spawnSync(typeGenCli, genArgs, { stdio: "inherit", cwd: outputPath });
84
67
  if (genResult.status !== 0) {
85
68
  throw new Error(`'ir gen-types' failed with exit code ${genResult.status ?? "unknown"}`);
@@ -13,10 +13,6 @@ export declare const config: {
13
13
  readonly name: "author";
14
14
  readonly message: "Author:";
15
15
  readonly default: "";
16
- }, {
17
- readonly type: "number";
18
- readonly name: "minVersion";
19
- readonly message: "Minimum supported schema version (leave blank to track latest):";
20
16
  }];
21
17
  hooks: {
22
18
  afterGenerate: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAuClB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;CAkClB,CAAC"}
@@ -2,7 +2,6 @@ interface HookContext {
2
2
  outputPath: string;
3
3
  schema: unknown;
4
4
  schemaPath?: string;
5
- answers?: Readonly<Record<string, unknown>>;
6
5
  options: {
7
6
  dryRun?: boolean;
8
7
  skipInstall?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"afterGenerate.d.ts","sourceRoot":"","sources":["../../../src/hooks/afterGenerate.ts"],"names":[],"mappings":"AAsBA,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACtD;AA2DD,wBAA8B,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C/E"}
1
+ {"version":3,"file":"afterGenerate.d.ts","sourceRoot":"","sources":["../../../src/hooks/afterGenerate.ts"],"names":[],"mappings":"AAsBA,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACtD;AA4CD,wBAA8B,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC/E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palantir/pack.sdkgen.pack-versioned-template",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "PACK SDK template for generating versioned types and Zod schemas from a versioned IR JSON file",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "fs-extra": "^11.3.2",
32
- "@palantir/pack.document-schema.model-types": "0.10.0",
33
- "@palantir/pack.document-schema.type-gen": "0.11.0"
32
+ "@palantir/pack.document-schema.model-types": "0.12.0",
33
+ "@palantir/pack.document-schema.type-gen": "0.13.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/fs-extra": "^11.0.4",
@@ -40,8 +40,8 @@
40
40
  "tslib": "^2.8.1",
41
41
  "typescript": "^5.9.3",
42
42
  "vitest": "^4.0.14",
43
- "@palantir/pack.sdkgen": "0.2.2",
44
- "@palantir/pack.monorepo.tsconfig": "~0.4.3"
43
+ "@palantir/pack.monorepo.tsconfig": "~0.4.3",
44
+ "@palantir/pack.sdkgen": "0.3.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"