Skip to content

Commit

Permalink
remove unused store file
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-urbanski committed Jun 20, 2024
1 parent aecd360 commit 0658abc
Show file tree
Hide file tree
Showing 38 changed files with 6,835 additions and 9,252 deletions.
38 changes: 22 additions & 16 deletions src/generators/AngularGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default class extends BaseGenerator {
// COMMON COMPONENTS
"app/components/common/delete/delete.component.html",
"app/components/common/delete/delete.component.ts",
"app/components/common/form/form.component.html",
"app/components/common/form/form.component.ts",
"app/components/common/header/header.component.html",
"app/components/common/header/header.component.ts",
"app/components/common/layout/layout.component.html",
"app/components/common/layout/layout.component.ts",
"app/components/common/sidebar/sidebar.component.html",
"app/components/common/sidebar/sidebar.component.ts",
"app/components/common/table/table.component.html",
Expand All @@ -26,6 +26,8 @@ export default class extends BaseGenerator {
"app/components/foo/create/create.component.ts",
"app/components/foo/edit/edit.component.html",
"app/components/foo/edit/edit.component.ts",
"app/components/foo/form/form.component.html",
"app/components/foo/form/form.component.ts",
"app/components/foo/list/list.component.html",
"app/components/foo/list/list.component.ts",
"app/components/foo/show/show.component.html",
Expand All @@ -45,11 +47,6 @@ export default class extends BaseGenerator {

//INTERFACE
"app/interface/api.ts",
"app/interface/foo.model.ts",
"app/interface/hero.model.ts",
"app/interface/list.model.ts",
"app/interface/show.model.ts",
"app/interface/update.model.ts",

// ROUTER
"app/router/foo.ts",
Expand Down Expand Up @@ -89,7 +86,6 @@ export default class extends BaseGenerator {
const titleUcFirst =
resource.title.charAt(0).toUpperCase() + resource.title.slice(1);
const fields = this.parseFields(resource);
console.log(fields);
const hasIsRelation = fields.some((field) => field.isRelation);
const hasIsRelations = fields.some((field) => field.isRelations);
const hasDateField = fields.some((field) => field.type === "dateTime");
Expand All @@ -108,19 +104,19 @@ export default class extends BaseGenerator {
hasIsRelations,
hasRelations: hasIsRelation || hasIsRelations,
hasDateField,
apiResource: this.apiResource(api),
};
console.log("api ==>", api);

//CREATE DIRECTORIES - These directories may already exist
[
`${dir}/assets`,
`${dir}/utils`,
`${dir}/app/components/${lc}/create`,
`${dir}/app/components/${lc}/edit`,
`${dir}/app/components/${lc}/form`,
`${dir}/app/components/${lc}/list`,
`${dir}/app/components/${lc}/show`,
`${dir}/app/components/common/delete`,
`${dir}/app/components/common/form`,
`${dir}/app/components/common/header`,
`${dir}/app/components/common/sidebar`,
`${dir}/app/components/common/table`,
Expand All @@ -145,13 +141,14 @@ export default class extends BaseGenerator {
"app/components/svg/menu/menu.component.ts",
"app/components/common/delete/delete.component.html",
"app/components/common/delete/delete.component.ts",
"app/components/common/form/form.component.html",
"app/components/common/form/form.component.ts",
"app/components/common/header/header.component.html",
"app/components/common/header/header.component.ts",
"app/components/common/sidebar/sidebar.component.css",
"app/components/common/sidebar/sidebar.component.html",
"app/components/common/sidebar/sidebar.component.ts",

"app/components/common/table/table.component.html",
"app/components/common/table/table.component.ts",
"app/interface/api.ts",
"app/app.component.html",
"app/app.component.ts",
"app/app.routes.ts",
Expand All @@ -165,10 +162,13 @@ export default class extends BaseGenerator {
"app/components/%s/list/list.component.ts",
"app/components/%s/create/create.component.html",
"app/components/%s/create/create.component.ts",
/*"app/components/%s/edit/edit.component.html",
"app/components/%s/edit/edit.component.html",
"app/components/%s/edit/edit.component.ts",
"app/components/%s/show/show.component.svg",
"app/components/%s/show/show.component.ts",*/
"app/components/%s/form/form.component.html",
"app/components/%s/form/form.component.ts",
"app/components/%s/show/show.component.html",
"app/components/%s/show/show.component.ts",
"app/components/%s/show/show.component.html",
].forEach((file) =>
this.createFileFromPattern(file, dir, [lc, formFields], context)
);
Expand Down Expand Up @@ -202,4 +202,10 @@ export default class extends BaseGenerator {

return Object.values(fields);
}

apiResource(api) {
return api.resources
.filter((val) => !val.deprecated)
.map((val) => val.title);
}
}
3 changes: 0 additions & 3 deletions src/generators/BaseGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export default class {
}

createFile(template, dest, context = {}, warn = true) {
console.table(this.templates);
console.log("template ==>", template);
console.log("dest ==>", dest);
if (undefined === this.templates[template]) {
console.log(
`The template ${template} does not exists in the registered templates.`
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
program
.version(packageJson.version)
.description(
"Generate apps built with Next, Nuxt, Quasar, React, React Native, Vue or Vuetify for any API documented using Hydra or OpenAPI"
"Generate apps built with Next, Nuxt, Quasar, React, React Native, Vue, Vuetify or Angular for any API documented using Hydra or OpenAPI"
)
.usage("entrypoint outputDirectory")
.option(
Expand Down
10 changes: 1 addition & 9 deletions templates/angular/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
<app-header></app-header>
<div class="flex">
<div class="w-1/6 h-100">
<app-sidebar></app-sidebar>
</div>
<div class="w-5/6 ">
<router-outlet></router-outlet>
</div>
</div>
<router-outlet></router-outlet>
5 changes: 2 additions & 3 deletions templates/angular/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import {Component} from '@angular/core';
import {RouterOutlet} from '@angular/router';
import {AsyncPipe} from "@angular/common";
import {HttpClientModule} from "@angular/common/http";
import {SidebarComponent} from "./components/common/sidebar/sidebar.component";
import {HeaderComponent} from "./components/common/header/header.component";
import {LayoutComponent} from "@components/common/layout/layout.component";

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, AsyncPipe, HttpClientModule, SidebarComponent, HeaderComponent],
imports: [RouterOutlet, AsyncPipe, HttpClientModule,LayoutComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
Expand Down
45 changes: 26 additions & 19 deletions templates/angular/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
import {Routes} from '@angular/router';
import {ListComponent} from "./components/{{lc}}/list/list.component";
import {ShowComponent} from "./components/{{lc}}/show/show.component";
import {EditComponent} from "./components/{{lc}}/edit/edit.component";
import {CreateComponent} from "./components/{{lc}}/create/create.component";
import {ListComponent} from "@components/foo/list/list.component";
import {ShowComponent} from "@components/foo/show/show.component";
import {EditComponent} from "@components/foo/edit/edit.component";
import {CreateComponent} from "@components/foo/create/create.component";
import {LayoutComponent} from "@components/common/layout/layout.component";

export const routes: Routes = [
{
path: '{{lc}}',
component: ListComponent
},
{
path: '{{lc}}/add',
component: CreateComponent
},
{
path: '{{lc}}/:id',
component: ShowComponent,
},
{
path: '{{lc}}/:id/edit',
component: EditComponent
},
path: '',
component: LayoutComponent,
children: [
{
path: '{{lc}}',
component: ListComponent
},
{
path: '{{lc}}/add',
component: CreateComponent
},
{
path: '{{lc}}/:id',
component: ShowComponent,
},
{
path: '{{lc}}/:id/edit',
component: EditComponent
},
]
}
];
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<button
(click)="deleteAction()"
[className]="!disabled ?
'py-2 px-4 bg-red-600 text-white text-sm rounded shadow-md hover:bg-red-700' :
'py-2 px-4 bg-red-600 text-white text-sm rounded shadow-md opacity-25'"
'py-2 px-6 bg-red-600 text-white text-sm rounded shadow-md hover:bg-red-700' :
'py-2 px-6 bg-red-600 text-white text-sm rounded shadow-md opacity-25'"
[disabled]="disabled">
Delete
</button>
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {ApiService} from "../../../service/api.service";
import {Location} from "@angular/common";

@Component({
selector: 'app-delete',
Expand All @@ -11,11 +9,6 @@ import {Location} from "@angular/common";
export class DeleteComponent {
@Input() disabled!: boolean
@Output() delete: EventEmitter<Function> = new EventEmitter<Function>()
constructor(
private heroService: ApiService,
private location: Location
) {
}

deleteAction () {
return this.delete.emit()
Expand Down
18 changes: 0 additions & 18 deletions templates/angular/app/components/common/form/form.component.html

This file was deleted.

33 changes: 0 additions & 33 deletions templates/angular/app/components/common/form/form.component.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
}

.menu {
padding: 8px;
padding: 8px;
cursor: pointer;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import {MenuComponent} from "../../svg/menu/menu.component";
import {MenuComponent} from "@components/svg/menu/menu.component";

@Component({
selector: 'app-header',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<app-header></app-header>
<div class="flex">
<div class="w-1/6 h-100">
<app-sidebar></app-sidebar>
</div>
<div class="w-5/6 ">
<router-outlet></router-outlet>
</div>
</div>
17 changes: 17 additions & 0 deletions templates/angular/app/components/common/layout/layout.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Component} from '@angular/core';
import {RouterOutlet} from "@angular/router";
import {HeaderComponent} from "@components/common/header/header.component";
import {SidebarComponent} from "@components/common/sidebar/sidebar.component";

@Component({
selector: 'app-layout',
standalone: true,
imports: [
HeaderComponent,
RouterOutlet,
SidebarComponent
],
templateUrl: './layout.component.html',
})
export class LayoutComponent {
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
<div class="sidebar px-3 py-6">
<ul>
{{#each apiResource}}
<li class="py-2 hover:bg-neutral-100">
<a routerLink="/heroes" [routerLinkActive]="['active']">
<a routerLink="/{{lowercase this}}" [routerLinkActive]="['active']">
<div class="flex just-center items-center px-4 text-lg">
<app-list-svg/>
<span class="ml-4">Heroes</span>
</div>
</a>
</li>
<li class="py-2 hover:bg-neutral-100">
<a routerLink="/heroes2" [routerLinkActive]="['active']">
<div class="flex just-center items-center px-4 text-lg">
<app-list-svg/>
<span class="ml-4">Heroes</span>
<app-list-svg></app-list-svg>
<span class="ml-4">{{this}}</span>
</div>
</a>
</li>
{{/each}}
</ul>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import {ListComponent} from "../../foo/list/list.component";
import {ListSvgComponent} from "../../svg/list-svg/list-svg.component";
import {RouterLink, RouterLinkActive} from "@angular/router";
import {ListSvgComponent} from "@components/svg/list-svg/list-svg.component";

@Component({
selector: 'app-sidebar',
Expand Down
Loading

0 comments on commit 0658abc

Please sign in to comment.