@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.
@@ -1225,7 +1225,7 @@ import { ${serviceNameTitle} } from '@accelbyte/sdk-${serviceNameTitle.toLowerCa
1225
1225
 
1226
1226
  const sdk = AccelByte.SDK({
1227
1227
  coreConfig: {
1228
- baseURL: 'https://demo.accelbyte.io',
1228
+ baseURL: '__DOMAIN__',
1229
1229
  clientId: '77f88506b6174c3ea4d925f5b4096ce8',
1230
1230
  namespace: 'accelbyte',
1231
1231
  redirectURI: 'http://localhost:3030'
@@ -1255,7 +1255,7 @@ var normalizeMethodSnippet = (methodInput, splitWord) => {
1255
1255
  };
1256
1256
 
1257
1257
  // src/helpers/SwaggerReaderHelpers.ts
1258
- var GIT_URL = "https://github.com/AccelByte/accelbyte-web-sdk/blob/main/packages";
1258
+ var GIT_URL = "https://github.com/AccelByte/accelbyte-typescript-sdk/blob/main/packages";
1259
1259
  var SwaggerReaderHelpers = class _SwaggerReaderHelpers {
1260
1260
  static getServicePrefix = (servicePaths) => servicePaths[servicePaths.length - 1].split("/")[1];
1261
1261
  static parseAllEndpoints = async ({
@@ -1755,7 +1755,9 @@ var CodeGenerator = class _CodeGenerator {
1755
1755
  const queryImportsSet = /* @__PURE__ */ new Set();
1756
1756
  const apiInfo = { ...api.info, "x-version": api["x-version"]?.version };
1757
1757
  console.log("----------\nGenerating API:", { title: apiInfo.title, version: apiInfo.version });
1758
- ParserUtils.writeXVersion(_CodeGenerator.srcFolder(), api["x-version"], api.info);
1758
+ if (!CliParser.isGenerateSnippetOnly()) {
1759
+ ParserUtils.writeXVersion(_CodeGenerator.srcFolder(), api["x-version"], api.info);
1760
+ }
1759
1761
  const parsedInformation = await SwaggerReaderHelpers.parseAllEndpoints({ api, sdkName, serviceName });
1760
1762
  if (CliParser.getSnippetOutputPath()) {
1761
1763
  try {
@@ -1980,30 +1982,36 @@ import_yargs.default.command("download-swaggers", "Download swaggers JSON files"
1980
1982
  CliParser.createInstance(yargs2);
1981
1983
  SwaggerDownloader.main();
1982
1984
  }).command("generate-code", "Generate code based on downloaded swagger files", async (yargs2) => {
1983
- yargs2.check(({ output }) => {
1984
- if (!output?.trim()) {
1985
+ yargs2.check(({ output, snippetOnly, snippetOutput }) => {
1986
+ if (!output?.trim() && !snippetOnly) {
1985
1987
  throw new Error("output is required for generate-code");
1986
1988
  }
1989
+ if (snippetOnly && !snippetOutput) {
1990
+ throw new Error("snippetOutput is required when generating snippets.");
1991
+ }
1987
1992
  return true;
1988
1993
  });
1989
1994
  CliParser.createInstance(yargs2);
1990
1995
  await generateSdk();
1991
1996
  }).option("config", {
1992
- description: "Config file providing backend services URL.",
1997
+ description: "Path to the config file with backend service URLs.",
1993
1998
  type: "string",
1994
1999
  demandOption: true
1995
2000
  }).option("swaggersOutput", {
1996
- description: "Output path for downloaded swaggers JSON files.",
2001
+ description: "Directory to save the downloaded Swagger JSON files.",
1997
2002
  type: "string",
1998
2003
  demandOption: true
1999
2004
  }).option("output", {
2000
- description: "Output path for generated code. Required for generate-code",
2005
+ description: "Directory for the generated code. Required when using the generate-code command.",
2001
2006
  type: "string"
2002
2007
  }).option("skipReactQuery", {
2003
- description: "Skip generating react query",
2008
+ description: "Disable React Query code generation.",
2004
2009
  type: "boolean"
2005
2010
  }).option("snippetOnly", {
2006
- description: "Only generate snippet",
2011
+ description: "Generate only code snippets.",
2007
2012
  type: "boolean"
2013
+ }).option("snippetOutput", {
2014
+ description: "Directory for the generated code snippets. Required when generating snippets.",
2015
+ type: "string"
2008
2016
  }).demandCommand(1).help().argv;
2009
2017
  //# sourceMappingURL=accelbyte-codegen.js.map