|
| 1 | +# csproj2ts |
| 2 | + |
| 3 | +Queries a Visual Studio project file (.csproj or .vbproj) for TypeScript configuration information. Will also find default config in a `Microsoft.TypeScript.Default.props` file, if referenced. |
| 4 | + |
| 5 | +Tested with project configuration settings in TypeScript 1.4. |
| 6 | + |
| 7 | +Run `node demo.js` for a working example (assumes `csproj2ts.csproj` in current folder). |
| 8 | + |
| 9 | +## Example Usage: |
| 10 | +```javascript |
| 11 | + |
| 12 | + var csproj2ts = require('csproj2ts'); |
| 13 | + |
| 14 | + var vsProjInfo = { |
| 15 | + ProjectFileName: "path/to/my/project.csproj", // the name and path to the project file |
| 16 | + ActiveConfiguration: "Release" // the MSBuild config to query |
| 17 | + } |
| 18 | + |
| 19 | + csproj2ts.getTypeScriptSettings(vsProjInfo).then(function (settings) { |
| 20 | + console.log(settings.files); // will output the array of files |
| 21 | + console.log(settings.RemoveComments); // will output true or false. |
| 22 | + console.log(settings.OutDir); // will output the OutDir string or undefined. |
| 23 | + }); |
| 24 | + |
| 25 | +``` |
| 26 | + |
| 27 | +## API: |
| 28 | + |
| 29 | +The returned settings object has the following documented properties: |
| 30 | + |
| 31 | + * files: string[] - This is an array of the files that will be compiled. |
| 32 | + * VSProjectDetails - This object has the following properties: |
| 33 | + * ProjectFileName: string |
| 34 | + * MSBuildExtensionsPath32: string |
| 35 | + * VisualStudioVersion: string |
| 36 | + * ActiveConfiguration: string |
| 37 | + * DefaultProjectConfiguration?: string; |
| 38 | + * DefaultVisualStudioVersion?: string; |
| 39 | + * TypeScriptDefaultPropsFilePath: string; |
| 40 | + * NormalizedTypeScriptDefaultPropsFilePath: string; |
| 41 | + * TypeScriptDefaultConfiguration: - this property has the settings (seen below) that correspond to the defaults on the referenced .props file. |
| 42 | + |
| 43 | + |
| 44 | +The returned settings object has the following properties that correspond to TypeScript configuration settings: |
| 45 | + |
| 46 | + * AdditionalFlags?: string; |
| 47 | + * Charset?: string; |
| 48 | + * CodePage?: string; |
| 49 | + * CompileOnSaveEnabled?: boolean; |
| 50 | + * EmitBOM?: boolean; |
| 51 | + * GeneratesDeclarations?: boolean; |
| 52 | + * MapRoot?: string; |
| 53 | + * ModuleKind?: string; |
| 54 | + * NoEmitOnError?: boolean; |
| 55 | + * NoImplicitAny?: boolean; |
| 56 | + * NoLib?: boolean; |
| 57 | + * NoResolve?: boolean; |
| 58 | + * OutFile?: string; |
| 59 | + * OutDir?: string; |
| 60 | + * PreserveConstEnums?: boolean; |
| 61 | + * RemoveComments?: boolean; |
| 62 | + * SourceMap?: boolean; |
| 63 | + * SourceRoot?: string; |
| 64 | + * SuppressImplicitAnyIndexErrors?: boolean; |
| 65 | + * Target?: string; |
0 commit comments