I have a TypeScript CDK Project. Per the recommendation I read somewhere, I've put both my infrastructure and runtime code into the same project.
The runtime code is required to use an obscure js library which does not have any type definitions. I've created a custom .d.ts file with types as described here. The TypeScript compiler is happy with this and tsc builds correctly.
When however I run cdk synth I get the "Could not find a declaration file for module 'xyz'" error. I'm guessing that the CDK can't find the definition file, however it's in the same location as other .ts files.
I've edited cdk.json and removed "**/*.d.ts" from the exclude filter to no effect.
tsconfig.json:
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": [
"es2020"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": [
"./types",
"./node_modules/#types"
],
"outDir": "./out",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
},
"include":[
"lib",
"bin",
"lib/**/*",
"bin/**/*",
"types"
],
"exclude": [
"node_modules",
"cdk.out",
"./out/**/*",
"test/**/*.spec.ts"
]
}
cdk.json:
{
"app": "npx ts-node --prefer-ts-exts bin/LeopardGeotabApp.ts",
"watch": {
"include": [
"**",
"lib/geotab/mg-api.js.d.ts"
],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"build": "",
"versionReporting": true,
"context": {
"#aws-cdk/aws-lambda:recognizeLayerVersion": true,
"#aws-cdk/core:checkSecretUsage": true,
"#aws-cdk/core:target-partitions": [
"aws",
"aws-cn"
],
"#aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"#aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"#aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"#aws-cdk/aws-iam:minimizePolicies": true,
"#aws-cdk/core:validateSnapshotRemovalPolicy": true,
"#aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"#aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"#aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"#aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"#aws-cdk/core:enablePartitionLiterals": true,
"#aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
"#aws-cdk/aws-iam:standardizedServicePrincipals": true,
"#aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true
}
}
I'm just executing cdk synth with no parameters.
I got around this by modifying cdk.json
{
"app": "cp ./types/mg-api-js.d.ts ./node_modules/#types/ && npx ts-node --prefer-ts-exts bin/LeopardGeotabApp.ts && rm ./node_modules/#types/mg-api-js.d.ts",
....
}
If I didn't delete the file after the ts-node step, then if I ran tsc on its own it would fail because of the duplication of the module in the .d.ts file.
Related
I am using electron-builder to build mac and windows app. Abouve is my electron build output directory. I don't need autoupdater. So I just wanna .dmg and .exe files. How can I set builder config to diable electron generate those useless files(yal、yaml、zip、zip.blockmap)?
Below is my package.json
"build": {
"appId": "we-media-helper",
"copyright": "Copyright © 2022 Eve-Sama",
"generateUpdatesFilesForAllChannels": true,
"directories": {
"output": "./dist/installer"
},
"mac": {
"target": {
"target": "default",
"arch": [
"arm64",
"x64",
"universal"
]
},
"icon": "./assets/icons/mac-dock.icns",
"publish": {
"owner": "Eve-Sama",
"repo": "we-media-helper",
"provider": "github"
}
},
"dmg": {
"writeUpdateInfo": false
},
"nsis": {
"differentialPackage": false,
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "./assets/icons/win-taskbar.ico",
"uninstallerIcon": "./assets/icons/win-taskbar.ico",
"installerHeaderIcon": "./assets/icons/win-taskbar.ico",
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"artifactName": "${productName}_Setup_${version}.${ext}"
},
"win": {
"icon": "./assets/icons/win-taskbar.ico",
"target": [
{
"target": "nsis",
"arch": [
"ia32"
]
}
]
},
"files": [
"**/*",
"!dist/installer",
"!**/*.ts",
"!**/*.tsx",
"!src/",
"!public/",
"!.eslintignore",
"!.eslintrc.js",
"!.gitignore",
"!.prettierrc",
"!gulpfile.ts",
"!LICENSE",
"!package-lock.json",
"!README.md",
"!tsconfig.json",
"!yarn.lock"
],
"extends": null
},
And I have another question. As you can see, I set mac.target.arch as ['arm64', 'x64', 'universal']. And output directory contains folder mac rather than mac-x64. why? How can I set it as mac-x64
I want to auto-format all html, css, sass, rb, and html.erb,js files with setting.json_Vs-code. But the next file after setting.json can only be the above *.rb file.
Please advise.
"workbench.colorTheme": "Dracula Soft",
"python.defaultInterpreterPath": "/opt/anaconda3/bin/python",
"editor.tabSize": 2,
"editor.fontSize": 16,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.minimap.enabled": false,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"window.zoomLevel": 1,
"emmet.includeLanguages": {
"erb": "html"
},
"[python]": {
"editor.tabSize": 4
},
"terminal.integrated.fontSize": 14,
"beautify.language": {
"html": [
"erb"
]
},
"[scss]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[css]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"[javascript]": {
"editor.defaultFormatter": "HookyQR.beautify"
}
I want to install my windows service with my electron builder MSI
Using NSIS I am able to include "build/installer.nsh" using installer.nsh I am able to call windows service EXE after NSIS EXE install.... but there is no option in MSI to include "build/installer.nsh" so is there a way to call other EXE/MSI from electron builder MSI or other way to install windows service exe from electron builder MSI
Package FIle
"win": {
"target": [
"nsis",
"msi"
],
"certificateFile": "C:\\SVN\\mancrossplatform\\trunk\\mcs.pfx",
"certificatePassword": "",
"publisherName": "",
"requestedExecutionLevel": "asInvoker",
"signAndEditExecutable": true,
"signDlls": true
},
"nsis": {
"oneClick": true,
"perMachine": false,
"deleteAppDataOnUninstall": true,
"createDesktopShortcut": true,
"include": "build/installer.nsh"
},
"extraFiles": [
"software"
],
"msi": {
"oneClick": true,
"perMachine": true,
"createDesktopShortcut": true
},
"files": [
"resources",
"dist/",
"dist/main.prod.js",
"dist/main.prod.js.map",
"package.json"
],
"directories": {
"buildResources": "resources",
"output": "release"
}
When using NSwagStudio for generating C# client code (not in file) it generates the way that only one client class and corresponding interface is getting generated with all controllers methods in them.
However when trying to do the same thing with NSwag.MSBuild it generates separate partial classes/interfaces for each controller.
Here is the nswag.json:
{
"openApiToCSharpClient": {
"clientBaseClass": "BillingBaseClient",
"configurationClass": "ConnectionOptions",
"generateClientClasses": true,
"generateClientInterfaces": true,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [
],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": true,
"useBaseUrl": true,
"generateBaseUrlProperty": false,
"generateSyncMethods": false,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "BillingClient",
"operationGenerationMode": "MultipleClientsFromOperationId",
"additionalNamespaceUsages": [
],
"additionalContractNamespaceUsages": [
],
"generateOptionalParameters": true,
"generateJsonMethods": true,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [
],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "ServiceTitan.Billing.Api.Client",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [
],
"excludedParameterNames": [
],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": false,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"serviceHost": null,
"serviceSchemes": null,
"output": "BillingClient.g.cs"
}
}
So which option am I missing for telling NSwag to generate single class/interface?
The option you need to change is operationGenerationMode which you have already in your nswag.json file, but you need to change its value to SingleClientFromOperationId if you want to have one interface for multiple controllers. MultipleClientsFromOperationId which is what you currently have set, will generate a class per controller.
I'm trying to deploy an Angular-cli 6 Universal app to App Engine for the first time. I'm getting the error:
ENOENT: no such file or directory, stat '/app/src/tsconfig.app.json'
I don't have any issues building or testing the app. What determines the path? I've looked at the migration guide that describes changes from angular-cli.json to angular.json, but I can't find the solution.
tsconfig.json (root project folder)
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/#types"
],
"lib": [
"es2017",
"dom"
]
}
}
tsconfig.app.json (in /src under the root)
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"typeRoots": [
"node_modules/#types"
],
"types": [
"jasmine", "node"
],
"lib": [
"es2017",
"dom"
]
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
angular.json has this reference
"tsConfig": "src/tsconfig.spec.json"
I found the solution. I was excluding some files in app.yaml that I should not have excluded.