2.1.0 • Published 9 months ago
laravel-codegen v2.1.0
Laravel Codegen
Install
yarn add laravel-codegen
Create a laravel-codegen.ts in the root of your project with the following syntax
const config = {
apiUrl: 'https://someurl.fetch/api/types', // Must use
path: '/', //defaults to root folder
token: '', //If bearer token to api
};
module.exports = config;
Then in your package json add the following script command
"laravel-codegen": "laravel-codegen"
The types will then be generated in the path from your config whenever you run the following command
yarn laravel-codegen
#DONT FORGET - reference the types somewhere in your repo f.ex. index.ts or similar Then you can import your types anywhere in your project
/// <reference path="./types/laravel-types.d.ts" />