erikvullings / strapi-to-typescript

Convert the strapi models to typescript.
MIT License
153 stars 32 forks source link

Please add strapi components #2

Closed maxbaluev closed 4 years ago

aperron commented 4 years ago

Done in v1.0.0 release

JuanmanDev commented 4 years ago

I just have run sts api/ -o api_ts/models/ but the components is not generating data:

Here is the strapi web admin: image

Here is the generated interfaced, note that the comoponent RegisterData is typed by any instead other type. image

Now the components are in ./components not in api folder. image

/**
 * Model definition for Register
 */
export interface IRegister {
  id: string;
  Pictures: any[];
  PolicePictures: any[];
  createdTime?: Date;
  PDFpolice: any[];
  PDFgenerated: any[];
  PoliceNotified?: boolean;
  Printed?: boolean;
  RegisterData?: any;
}

I have run with:

Full package.json:

{
  "name": "my-project",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "gen-ts-interfaces": "sts api/ -o api_ts/models/",
    "build-ts": "tsc"
  },
  "devDependencies": {
    "strapi-to-typescript": "^1.0.1"
  },
  "dependencies": {
    "knex": "<0.20.0",
    "reflect-metadata": "^0.1.13",
    "sqlite3": "latest",
    "strapi": "3.0.5",
    "strapi-admin": "3.0.5",
    "strapi-connector-bookshelf": "3.0.5",
    "strapi-plugin-content-manager": "3.0.5",
    "strapi-plugin-content-type-builder": "3.0.5",
    "strapi-plugin-documentation": "3.0.5",
    "strapi-plugin-email": "3.0.5",
    "strapi-plugin-entity-relationship-chart": "^0.2.0",
    "strapi-plugin-graphql": "3.0.5",
    "strapi-plugin-upload": "3.0.5",
    "strapi-plugin-users-permissions": "3.0.5",
    "strapi-utils": "3.0.5",
    "tsyringe": "^4.3.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "a8d8b8f0-49c1-4f74-bf70-dec7530dc4f0"
  },
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}
aperron commented 4 years ago

@Juanmabs22 : Hello, have you try the command line option -g ?

JuanmanDev commented 4 years ago

@Juanmabs22 : Hello, have you try the command line option -g ?

Yes, same result.

aperron commented 4 years ago

@Juanmabs22 : Hello, have you try the command line option -g ?

Yes, same result.

Could you paste the full command used with the option -g

aperron commented 4 years ago

@Juanmabs22 Component with PascalCase/CamelCase naming is converted in snakeCase by strapi. I try to fix this. You can rename registerData in registerdata, this should be fix this problem temporally.

JuanmanDev commented 4 years ago

@Juanmabs22 : Hello, have you try the command line option -g ?

Yes, same result.

Could you paste the full command used with the option -g

sts api/ -o api_ts/models/ -g

Thanks for your support.

@Juanmabs22 Component with PascalCase/CamelCase naming is converted in snakeCase by strapi. I try to fix this. You can rename registerData in registerdata, this should be fix this problem temporally.

Still same result, I think the components is not being processed.

I attach the project if you could check the problem. my-project.zip

Now is not important due I'm working on a personal project :).

aperron commented 4 years ago

@Juanmabs22 : Just add folder of Strapi components. sts api/ -o api_ts/models/ -g components/

JuanmanDev commented 4 years ago

@Juanmabs22 : Just add folder of Strapi components. sts api/ -o api_ts/models/ -g components/

Thanks! It's works like a charm. Thanks for supporting me.