diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 3e27363508b2..966fe2621884 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -54,8 +54,6 @@ public TypeScriptFetchClientCodegen() { outputFolder = "generated-code/typescript-fetch"; embeddedTemplateDir = templateDir = "typescript-fetch"; - this.apiPackage = "src" + File.separator +"apis"; - this.modelPackage = "src" + File.separator + "models"; this.apiTemplateFiles.put("apis.mustache", ".ts"); this.modelTemplateFiles.put("models.mustache", ".ts"); this.addExtraReservedWords(); @@ -98,10 +96,17 @@ public void processOpts() { super.processOpts(); additionalProperties.put("isOriginalModelPropertyNaming", getModelPropertyNaming().equals("original")); additionalProperties.put("modelPropertyNaming", getModelPropertyNaming()); - supportingFiles.add(new SupportingFile("index.mustache", "src", "index.ts")); - supportingFiles.add(new SupportingFile("runtime.mustache", "src", "runtime.ts")); - supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); - supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + + String sourceDir = ""; + if (additionalProperties.containsKey(NPM_NAME)) { + sourceDir = "src" + File.separator; + } + + this.apiPackage = sourceDir + "apis"; + this.modelPackage = sourceDir + "models"; + + supportingFiles.add(new SupportingFile("index.mustache", sourceDir, "index.ts")); + supportingFiles.add(new SupportingFile("runtime.mustache", sourceDir, "runtime.ts")); if (additionalProperties.containsKey(USE_SINGLE_REQUEST_PARAMETER)) { this.setUseSingleRequestParameter(convertPropertyToBoolean(USE_SINGLE_REQUEST_PARAMETER)); @@ -211,7 +216,9 @@ private void addNpmPackageGeneration() { //Files for building our lib supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); supportingFiles.add(new SupportingFile("npmignore.mustache", "", ".npmignore")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); } @Override diff --git a/samples/client/petstore/typescript-fetch/builds/default/.gitignore b/samples/client/petstore/typescript-fetch/builds/default/.gitignore deleted file mode 100644 index 149b57654723..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/apis/PetApi.ts rename to samples/client/petstore/typescript-fetch/builds/default/apis/PetApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/apis/StoreApi.ts rename to samples/client/petstore/typescript-fetch/builds/default/apis/StoreApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/apis/UserApi.ts rename to samples/client/petstore/typescript-fetch/builds/default/apis/UserApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/apis/index.ts b/samples/client/petstore/typescript-fetch/builds/default/apis/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/apis/index.ts rename to samples/client/petstore/typescript-fetch/builds/default/apis/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/index.ts b/samples/client/petstore/typescript-fetch/builds/default/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/index.ts rename to samples/client/petstore/typescript-fetch/builds/default/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/Category.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/Category.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/ModelApiResponse.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/ModelApiResponse.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/Order.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/Order.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/Pet.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/Pet.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/Tag.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/Tag.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/default/models/User.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/User.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/User.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/default/models/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/models/index.ts rename to samples/client/petstore/typescript-fetch/builds/default/models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/default/runtime.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/default/src/runtime.ts rename to samples/client/petstore/typescript-fetch/builds/default/runtime.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json deleted file mode 100644 index 4567ec19899a..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/default/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "outDir": "dist", - "lib": [ - "es6", - "dom" - ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "dist", - "node_modules" - ] -} diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/.gitignore b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/.gitignore deleted file mode 100644 index 149b57654723..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/PetApi.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/PetApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/StoreApi.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/StoreApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/UserApi.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/index.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/apis/index.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/index.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/index.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Category.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Category.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/ModelApiResponse.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/ModelApiResponse.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Order.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Order.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Pet.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Pet.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/Tag.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/Tag.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/User.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/User.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/models/index.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/multiple-parameters/src/runtime.ts rename to samples/client/petstore/typescript-fetch/builds/multiple-parameters/runtime.ts diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/tsconfig.json deleted file mode 100644 index 4567ec19899a..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "outDir": "dist", - "lib": [ - "es6", - "dom" - ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "dist", - "node_modules" - ] -} diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore b/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore deleted file mode 100644 index 149b57654723..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -wwwroot/*.js -node_modules -typings -dist diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/PetApi.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/PetApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/StoreApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/StoreApi.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/StoreApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/UserApi.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/UserApi.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/index.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/apis/index.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/apis/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/index.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/index.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Category.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Category.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Category.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/ModelApiResponse.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/ModelApiResponse.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/ModelApiResponse.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Order.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Order.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Order.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Pet.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Pet.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Tag.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/Tag.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/Tag.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/User.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/User.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/User.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/models/index.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/models/index.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/models/index.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/src/runtime.ts b/samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts similarity index 100% rename from samples/client/petstore/typescript-fetch/builds/with-interfaces/src/runtime.ts rename to samples/client/petstore/typescript-fetch/builds/with-interfaces/runtime.ts diff --git a/samples/client/petstore/typescript-fetch/builds/with-interfaces/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/with-interfaces/tsconfig.json deleted file mode 100644 index 4567ec19899a..000000000000 --- a/samples/client/petstore/typescript-fetch/builds/with-interfaces/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "outDir": "dist", - "lib": [ - "es6", - "dom" - ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "dist", - "node_modules" - ] -}