@accelbyte/codegen 4.0.1 → 4.0.2

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.
@@ -1203,7 +1203,7 @@ import { ${serviceNameTitle} } from '@accelbyte/sdk-${serviceNameTitle.toLowerCa
1203
1203
 
1204
1204
  const sdk = AccelByte.SDK({
1205
1205
  coreConfig: {
1206
- baseURL: 'https://demo.accelbyte.io',
1206
+ baseURL: '__DOMAIN__',
1207
1207
  clientId: '77f88506b6174c3ea4d925f5b4096ce8',
1208
1208
  namespace: 'accelbyte',
1209
1209
  redirectURI: 'http://localhost:3030'
@@ -1233,7 +1233,7 @@ var normalizeMethodSnippet = (methodInput, splitWord) => {
1233
1233
  };
1234
1234
 
1235
1235
  // src/helpers/SwaggerReaderHelpers.ts
1236
- var GIT_URL = "https://github.com/AccelByte/accelbyte-web-sdk/blob/main/packages";
1236
+ var GIT_URL = "https://github.com/AccelByte/accelbyte-typescript-sdk/blob/main/packages";
1237
1237
  var SwaggerReaderHelpers = class _SwaggerReaderHelpers {
1238
1238
  static getServicePrefix = (servicePaths) => servicePaths[servicePaths.length - 1].split("/")[1];
1239
1239
  static parseAllEndpoints = async ({
@@ -1733,7 +1733,9 @@ var CodeGenerator = class _CodeGenerator {
1733
1733
  const queryImportsSet = /* @__PURE__ */ new Set();
1734
1734
  const apiInfo = { ...api.info, "x-version": api["x-version"]?.version };
1735
1735
  console.log("----------\nGenerating API:", { title: apiInfo.title, version: apiInfo.version });
1736
- ParserUtils.writeXVersion(_CodeGenerator.srcFolder(), api["x-version"], api.info);
1736
+ if (!CliParser.isGenerateSnippetOnly()) {
1737
+ ParserUtils.writeXVersion(_CodeGenerator.srcFolder(), api["x-version"], api.info);
1738
+ }
1737
1739
  const parsedInformation = await SwaggerReaderHelpers.parseAllEndpoints({ api, sdkName, serviceName });
1738
1740
  if (CliParser.getSnippetOutputPath()) {
1739
1741
  try {
@@ -1958,30 +1960,36 @@ yargs.command("download-swaggers", "Download swaggers JSON files", (yargs2) => {
1958
1960
  CliParser.createInstance(yargs2);
1959
1961
  SwaggerDownloader.main();
1960
1962
  }).command("generate-code", "Generate code based on downloaded swagger files", async (yargs2) => {
1961
- yargs2.check(({ output }) => {
1962
- if (!output?.trim()) {
1963
+ yargs2.check(({ output, snippetOnly, snippetOutput }) => {
1964
+ if (!output?.trim() && !snippetOnly) {
1963
1965
  throw new Error("output is required for generate-code");
1964
1966
  }
1967
+ if (snippetOnly && !snippetOutput) {
1968
+ throw new Error("snippetOutput is required when generating snippets.");
1969
+ }
1965
1970
  return true;
1966
1971
  });
1967
1972
  CliParser.createInstance(yargs2);
1968
1973
  await generateSdk();
1969
1974
  }).option("config", {
1970
- description: "Config file providing backend services URL.",
1975
+ description: "Path to the config file with backend service URLs.",
1971
1976
  type: "string",
1972
1977
  demandOption: true
1973
1978
  }).option("swaggersOutput", {
1974
- description: "Output path for downloaded swaggers JSON files.",
1979
+ description: "Directory to save the downloaded Swagger JSON files.",
1975
1980
  type: "string",
1976
1981
  demandOption: true
1977
1982
  }).option("output", {
1978
- description: "Output path for generated code. Required for generate-code",
1983
+ description: "Directory for the generated code. Required when using the generate-code command.",
1979
1984
  type: "string"
1980
1985
  }).option("skipReactQuery", {
1981
- description: "Skip generating react query",
1986
+ description: "Disable React Query code generation.",
1982
1987
  type: "boolean"
1983
1988
  }).option("snippetOnly", {
1984
- description: "Only generate snippet",
1989
+ description: "Generate only code snippets.",
1985
1990
  type: "boolean"
1991
+ }).option("snippetOutput", {
1992
+ description: "Directory for the generated code snippets. Required when generating snippets.",
1993
+ type: "string"
1986
1994
  }).demandCommand(1).help().argv;
1987
1995
  //# sourceMappingURL=accelbyte-codegen.mjs.map