type-genius
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "type-genius", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
"main": "index.js", | ||
"main": "./dist/index.js", | ||
"author": "Mike Carbone", | ||
"repository": { | ||
"url": "https://github.com/MikeCarbone/type-genius" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"prepare": "npm run build", | ||
"test": "jest" | ||
}, | ||
"license": "ISC", | ||
"types": "./index.d.ts", | ||
"types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"deep-equal": "^2.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/deep-equal": "^1.0.1", | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "^18.14.1", | ||
"jest": "^29.4.3", | ||
"ts-jest": "^29.0.5", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
@@ -18,3 +18,3 @@ # Type Genius | ||
```ts | ||
import {} from "type-genius"; | ||
import { buildTypes } from "type-genius"; | ||
@@ -26,5 +26,22 @@ // Get some data | ||
// Generate type file | ||
types(data); | ||
buildTypes(data); | ||
``` | ||
## Options | ||
The `buildTypes` function takes a second parameter where you can pass an options object. Below are the expected keys for that option object. | ||
| **Option Name** | **Type** | **Default** | **Description** | | ||
|---|---|---|---| | ||
| customTypes | Object? | ```js { string: "string", number: "number", boolean: "boolean", object: "object" } ``` | Customize the types that get rendered. For objects, you can render a Record like this: ```js customTypes: { object: "Record<string, unknown>" ``` | | ||
| forceOptional | Boolean? | false | Forces each value in every type to be optional. | | ||
| initialInterfaceName | String? | "Response" | The name given to the first generated interface. | | ||
| logSuccess | Boolean? | false | Should a success message get rendered after successfully generating the types. | | ||
| outputFilename | String? | "exported.d.ts" | File name to give the rendered types file. | | ||
| outputPath | String? | "../dist/" | Where to render the generated types. | | ||
| renderSemis | Boolean? | false | Render semicolons in the outputted file. | | ||
| skipFileWrite | Boolean? | false | Whether to write the file or not. | | ||
| useStore | TypeStore? | [] | Store of existing InterfaceConfiguration objects to use for this generation. | | ||
| useTypes | Boolean? | false | Whether to render "type"s instead of "interface"s. | | ||
## Architecture | ||
@@ -143,13 +160,1 @@ | ||
At this stage, each interface configuration string is concatenated into a single string. This big string will get written to a file, and exported with the specified options. | ||
## Options | ||
- Return configurations | ||
- Initial interface name | ||
- Output path | ||
- Output filename | ||
- Customize unknown type | ||
- Customeize all types | ||
- Everything optional | ||
- Use types instead of interfaces | ||
- Render semi-colons |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
17933
7
414
158
1
6
1