pdm-ts
v0.0.3
Published
Convert PDM files to TypeScript types via CLI
Maintainers
Readme
pdm-ts
Convert PDM files to TypeScript types via CLI
install
npm install pdm-tsnpm script
package.json
{
"scripts": {
"gen": "pdm-ts"
}
}When you excute npm run gen, cli will read the default the configuration file.
configuration file
default configuration file
pdm2ts.json is default config file。when you run npm script, cli will read the json file。
//pdm2ts.json
{
"pdmPath": "./demo.pdm",
"output": "./",
"date2string": true,
}pdmPath: For the.pdmfile path, absoute path are recommended.output: Output directory for generated the.tsfile.date2string: If set to true, data of types such as time and Date from the database will be converted to string; otherwise, they will remain Date objects (default false),
custome configuration file
You can customize the configuration file。For example, you create a configuration file:pd.json。
pd.json
{
"pdmPath": "./demo.pdm",
"output": "./",
}Now, you need set your npm script:
package.json
{
"scripts":{
"gen": "pdm-ts --config pd.json"
}
}Then, you excute npm run gen , cli will read the specified configuration file.
