add linter, prettier and typescript support for jetstream (#1)

* add linter, prettier and typescript support for jetstream

* add github actions for lint, build and typecheck

* add composer install to build action

* fix composer lock

* add ext-intl and fixed php version

* fix intl php extension install

* add tip php extension to github npm build action

* fix php version to 8.3.1

* change github php base action

* fix primary button default type

* updated typescript types from Team to Organization

---------

Co-authored-by: Gregor Vostrak <gregorvostrak@Gregors-MacBook-Pro.local>
This commit is contained in:
Gregor Vostrak
2024-01-21 22:35:43 +01:00
committed by GitHub
parent 0a8d958ccc
commit 27140d4ffc
73 changed files with 4727 additions and 886 deletions

View File

@@ -0,0 +1 @@
export type HtmlButtonType = 'button' | 'submit' | 'reset';

22
resources/js/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
import { PageProps as InertiaPageProps } from '@inertiajs/core';
import { AxiosInstance } from 'axios';
import ziggyRoute from 'ziggy-js';
import { PageProps as AppPageProps } from './';
declare global {
interface Window {
axios: AxiosInstance;
}
let route: typeof ziggyRoute;
}
declare module 'vue' {
interface ComponentCustomProperties {
route: typeof ziggyRoute;
}
}
declare module '@inertiajs/core' {
interface PageProps extends InertiaPageProps, AppPageProps {}
}

19
resources/js/types/inertia.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
export {};
declare global {
export namespace inertia {
export interface Props {
user: {
id: number;
name: string;
email: string;
created_at: Date;
updated_at: Date;
};
jetstream: {
[key: string]: boolean;
};
errorBags: unknown;
errors: unknown;
}
}
}

View File

@@ -0,0 +1,42 @@
import type { User } from '@/types/models';
export interface Permissions {
canAddTeamMembers: boolean;
canDeleteTeam: boolean;
canRemoveTeamMembers: boolean;
canUpdateTeam: boolean;
canUpdateTeamMembers: boolean;
}
export interface Session {
agent: {
platform: string;
browser: string;
is_desktop: boolean;
};
ip_address: string;
is_current_device: string;
last_active: boolean;
}
export interface Membership {
role: string;
}
export interface Role {
key: string;
name: string;
description: string;
}
export type JetstreamUser = User & {
two_factor_enabled: boolean;
};
export interface Token {
name: string;
token: string;
abilities: string[];
id: string;
last_used_ago: string;
}

View File

@@ -0,0 +1,132 @@
export interface Client {
// columns
id: string;
name: string;
organization_id: string;
created_at: string | null;
updated_at: string | null;
// relations
organization: Organization;
}
export interface Membership {
// columns
id: string;
organization_id: string;
user_id: string;
role: string | null;
created_at: string | null;
updated_at: string | null;
}
export interface Organization {
// columns
id: string;
user_id: string;
name: string;
personal_team: boolean;
created_at: string | null;
updated_at: string | null;
// relations
owner: User;
users: User[];
team_invitations: OrganizationInvitation[];
}
export interface OrganizationInvitation {
// columns
id: string;
organization_id: string;
email: string;
role: string | null;
created_at: string | null;
updated_at: string | null;
// relations
organization: Organization;
team: Organization;
}
export interface Project {
// columns
id: string;
name: string;
color: string;
client_id: string | null;
organization_id: string;
created_at: string | null;
updated_at: string | null;
// relations
organization: Organization;
client: Client;
tasks: Task[];
}
export interface Tag {
// columns
id: string;
name: string;
organization_id: string;
created_at: string | null;
updated_at: string | null;
// relations
organization: Organization;
}
export interface Task {
// columns
id: string;
name: string;
project_id: string;
organization_id: string;
created_at: string | null;
updated_at: string | null;
// relations
project: Project;
organization: Organization;
}
export interface TimeEntry {
// columns
id: string;
description: string;
start: string;
end: string | null;
billable: boolean;
user_id: string;
organization_id: string;
project_id: string | null;
task_id: string | null;
tags: string[] | null;
created_at: string | null;
updated_at: string | null;
// relations
user: User;
organization: Organization;
project: Project;
task: Task;
}
export interface User {
// columns
id: string;
name: string;
email: string;
email_verified_at: string | null;
password?: string;
remember_token?: string | null;
current_team_id: string | null;
profile_photo_path: string | null;
created_at: string | null;
updated_at: string | null;
two_factor_secret?: string | null;
two_factor_recovery_codes?: string | null;
two_factor_confirmed_at: string | null;
// mutators
profile_photo_url: string;
// relations
organizations: Organization[];
clients: Client[];
current_team: Organization;
owned_teams: Organization[];
teams: Organization[];
}

1
resources/js/types/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

5
resources/js/types/vue-shim.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
declare module '*.vue' {
import { defineComponent } from 'vue';
const component: ReturnType<typeof defineComponent>;
export default component;
}

5
resources/js/types/ziggy.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import routeFn from 'ziggy-js';
declare global {
let route: typeof routeFn;
}