@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.
- package/build/browser/index.js +0 -21
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +0 -21
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +0 -5
- package/build/esm/config.js +0 -5
- package/build/esm/hooks/afterGenerate.js +1 -18
- package/build/types/config.d.ts +0 -4
- package/build/types/config.d.ts.map +1 -1
- package/build/types/hooks/afterGenerate.d.ts +0 -1
- package/build/types/hooks/afterGenerate.d.ts.map +1 -1
- package/package.json +5 -5
package/build/cjs/index.cjs
CHANGED
|
@@ -49,10 +49,6 @@ var config = {
|
|
|
49
49
|
name: "author",
|
|
50
50
|
message: "Author:",
|
|
51
51
|
default: ""
|
|
52
|
-
}, {
|
|
53
|
-
type: "number",
|
|
54
|
-
name: "minVersion",
|
|
55
|
-
message: "Minimum supported schema version (leave blank to track latest):"
|
|
56
52
|
}],
|
|
57
53
|
hooks: {
|
|
58
54
|
afterGenerate: "./build/esm/hooks/afterGenerate.js"
|
|
@@ -1149,23 +1145,10 @@ async function syncModelTypesVersion(outputPath, typeGenPackageJsonPath) {
|
|
|
1149
1145
|
consola.log(`Updated model-types dependency to ${modelTypesVersion}`);
|
|
1150
1146
|
}
|
|
1151
1147
|
}
|
|
1152
|
-
function readMinVersion(answers) {
|
|
1153
|
-
const raw = answers?.minVersion;
|
|
1154
|
-
if (raw == null || raw === "") return void 0;
|
|
1155
|
-
if (typeof raw !== "number" && typeof raw !== "string") {
|
|
1156
|
-
throw new Error(`minVersion answer must be a number or numeric string`);
|
|
1157
|
-
}
|
|
1158
|
-
const value = typeof raw === "number" ? raw : Number(raw);
|
|
1159
|
-
if (!Number.isInteger(value)) {
|
|
1160
|
-
throw new Error(`minVersion answer must be an integer, got: ${raw}`);
|
|
1161
|
-
}
|
|
1162
|
-
return value;
|
|
1163
|
-
}
|
|
1164
1148
|
async function afterGenerate(context) {
|
|
1165
1149
|
const {
|
|
1166
1150
|
outputPath,
|
|
1167
1151
|
schemaPath,
|
|
1168
|
-
answers,
|
|
1169
1152
|
options
|
|
1170
1153
|
} = context;
|
|
1171
1154
|
if (options.dryRun) return;
|
|
@@ -1181,12 +1164,8 @@ async function afterGenerate(context) {
|
|
|
1181
1164
|
cli: typeGenCli,
|
|
1182
1165
|
packageJsonPath: typeGenPackageJsonPath
|
|
1183
1166
|
} = resolveTypeGenCli();
|
|
1184
|
-
const minVersion = readMinVersion(answers);
|
|
1185
1167
|
consola.log("Generating versioned SDK files from IR...");
|
|
1186
1168
|
const genArgs = ["ir", "gen-types", "-s", resolvedIr, "-o", path__default.default.join(outputPath, "src")];
|
|
1187
|
-
if (minVersion != null) {
|
|
1188
|
-
genArgs.push("--min-version", String(minVersion));
|
|
1189
|
-
}
|
|
1190
1169
|
const genResult = child_process.spawnSync(typeGenCli, genArgs, {
|
|
1191
1170
|
stdio: "inherit",
|
|
1192
1171
|
cwd: outputPath
|