diff --git a/README.md b/README.md index 1a26974..45f46a4 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ $ npm install --save csharp-models-to-typescript "locale": "en-US" }, "numericEnums": false, + "omitFilePathComment": false, "stringLiteralTypesInsteadOfEnums": false, "customTypeTranslations": { "ProductName": "string", diff --git a/converter.js b/converter.js index 35781de..95fae46 100644 --- a/converter.js +++ b/converter.js @@ -67,7 +67,9 @@ const createConverter = config => { const members = [...(model.Fields || []), ...(model.Properties || [])]; const baseClasses = model.BaseClasses && model.BaseClasses.length ? ` extends ${model.BaseClasses.join(', ')}` : ''; - rows.push(`// ${filename}`); + if (!config.omitFilePathComment) { + rows.push(`// ${filename}`); + } let classCommentRows = formatComment(model.ExtraInfo, '') if (classCommentRows) { rows.push(classCommentRows); @@ -95,7 +97,9 @@ const createConverter = config => { const convertEnum = (enum_, filename) => { const rows = []; - rows.push(`// ${filename}`); + if (!config.omitFilePathComment) { + rows.push(`// ${filename}`); + } const entries = Object.entries(enum_.Values); diff --git a/index.js b/index.js index f6c4824..df397d6 100755 --- a/index.js +++ b/index.js @@ -38,6 +38,7 @@ const converter = createConverter({ camelCaseOptions: config.camelCaseOptions || {}, camelCaseEnums: config.camelCaseEnums || false, numericEnums: config.numericEnums || false, + omitFilePathComment: config.omitFilePathComment || false, stringLiteralTypesInsteadOfEnums: config.stringLiteralTypesInsteadOfEnums || false }); diff --git a/package-lock.json b/package-lock.json index e748d8c..a8844ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,35 @@ { "name": "csharp-models-to-typescript", - "version": "0.21.1", - "lockfileVersion": 1, + "version": "0.22.0", + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "csharp-models-to-typescript", + "version": "0.22.0", + "license": "MIT", + "dependencies": { + "camelcase": "^6.0.0" + }, + "bin": { + "csharp-models-to-typescript": "index.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/camelcase": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz", + "integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, "dependencies": { "camelcase": { "version": "6.0.0", diff --git a/package.json b/package.json index e0fd394..12a03cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csharp-models-to-typescript", - "version": "0.21.1", + "version": "0.22.0", "title": "C# models to TypeScript", "author": "Jonathan Svenheden ", "license": "MIT",