@shivay_18/ng-crud 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -26
- package/dist/crud/files/module/components/__name@dasherize__-form/__name@dasherize__-form.component.ts.template +9 -2
- package/dist/crud/files/module/components/__name@dasherize__-list/__name@dasherize__-list.component.html.template +2 -0
- package/dist/crud/files/module/models/__name@dasherize__.model.ts.template +1 -1
- package/dist/crud/files/module/services/__name@dasherize__.service.ts.template +18 -10
- package/dist/crud/files/standalone/components/__name@dasherize__-form/__name@dasherize__-form.component.ts.template +9 -2
- package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-list.component.html.template +2 -0
- package/dist/crud/files/standalone/components/__name@dasherize__-list/__name@dasherize__-list.component.ts.template +2 -1
- package/dist/crud/files/standalone/models/__name@dasherize__.model.ts.template +1 -1
- package/dist/crud/files/standalone/services/__name@dasherize__.service.ts.template +18 -10
- package/dist/crud/index.js +24 -1
- package/dist/crud/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# ng-crud
|
|
1
|
+
# @shivay_18/ng-crud
|
|
2
2
|
|
|
3
3
|
Angular CRUD generator using Angular Schematics and Angular Material.
|
|
4
4
|
|
|
5
5
|
Generates a **complete, production-ready CRUD** (List, Create, Edit, Delete) with:
|
|
6
6
|
|
|
7
|
-
- Angular Material UI (table, paginator, sort, dialogs, snackbar, forms)
|
|
7
|
+
- Angular Material UI (table, paginator, sort, dialogs, snackbar, forms, chips, tooltips, progress spinner)
|
|
8
8
|
- Reactive Forms with validation
|
|
9
|
-
- REST HTTP service
|
|
9
|
+
- REST HTTP service with error handling
|
|
10
10
|
- Auto-detects Angular 14+ (Module-based) or Angular 17+ (Standalone)
|
|
11
11
|
- **Safe to uninstall** — generated code has zero dependency on this package
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ Generates a **complete, production-ready CRUD** (List, Create, Edit, Delete) wit
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install --save-dev ng-crud
|
|
25
|
+
npm install --save-dev @shivay_18/ng-crud
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
---
|
|
@@ -30,7 +30,7 @@ npm install --save-dev ng-crud
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
ng generate ng-crud:crud <name> --fields="field1:type,field2:type" --apiUrl="http://localhost:3000"
|
|
33
|
+
ng generate @shivay_18/ng-crud:crud <name> --fields="field1:type,field2:type" --apiUrl="http://localhost:3000"
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
### Options
|
|
@@ -50,6 +50,7 @@ ng generate ng-crud:crud <name> --fields="field1:type,field2:type" --apiUrl="htt
|
|
|
50
50
|
| `string` | text input | `name:string` |
|
|
51
51
|
| `number` | number input | `price:number` |
|
|
52
52
|
| `boolean` | checkbox | `active:boolean` |
|
|
53
|
+
| `date` | date input | `createdAt:date` |
|
|
53
54
|
|
|
54
55
|
Append `*` to mark a field as required: `name*:string`
|
|
55
56
|
|
|
@@ -59,16 +60,16 @@ Append `*` to mark a field as required: `name*:string`
|
|
|
59
60
|
|
|
60
61
|
```bash
|
|
61
62
|
# Basic
|
|
62
|
-
ng generate ng-crud:crud product
|
|
63
|
+
ng generate @shivay_18/ng-crud:crud product
|
|
63
64
|
|
|
64
65
|
# With fields
|
|
65
|
-
ng generate ng-crud:crud product --fields="name*:string,price*:number,active:boolean"
|
|
66
|
+
ng generate @shivay_18/ng-crud:crud product --fields="name*:string,price*:number,active:boolean"
|
|
66
67
|
|
|
67
68
|
# With custom API and path
|
|
68
|
-
ng generate ng-crud:crud order --fields="orderId*:number,status*:string,total:number" --apiUrl="https://api.myapp.com" --path="features"
|
|
69
|
+
ng generate @shivay_18/ng-crud:crud order --fields="orderId*:number,status*:string,total:number" --apiUrl="https://api.myapp.com" --path="features"
|
|
69
70
|
|
|
70
71
|
# Force standalone (Angular 17+)
|
|
71
|
-
ng generate ng-crud:crud user --fields="username*:string,email*:string,isAdmin:boolean" --standalone=true
|
|
72
|
+
ng generate @shivay_18/ng-crud:crud user --fields="username*:string,email*:string,isAdmin:boolean" --standalone=true
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
---
|
|
@@ -79,60 +80,103 @@ ng generate ng-crud:crud user --fields="username*:string,email*:string,isAdmin:b
|
|
|
79
80
|
|
|
80
81
|
```
|
|
81
82
|
src/app/<name>/
|
|
82
|
-
├── <name>.module.ts ← NgModule with routing & all Material imports
|
|
83
|
-
├── models/
|
|
84
|
-
│ └── <name>.model.ts ← TypeScript interface
|
|
85
|
-
├── services/
|
|
86
|
-
│ └── <name>.service.ts ← HTTP CRUD service (GET/POST/PUT/DELETE)
|
|
87
83
|
├── <name>-list/
|
|
84
|
+
│ ├── <name>.module.ts ← NgModule with child routes & all Material imports
|
|
88
85
|
│ ├── <name>-list.component.ts
|
|
89
|
-
│ ├── <name>-list.component.html
|
|
86
|
+
│ ├── <name>-list.component.html ← Material table, paginator, sort, search
|
|
90
87
|
│ ├── <name>-list.component.scss
|
|
91
88
|
│ └── <name>-delete-dialog.component.ts
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
├── <name>-form/
|
|
90
|
+
│ ├── <name>-form.component.ts ← Create & Edit (shared), Reactive Form
|
|
91
|
+
│ ├── <name>-form.component.html
|
|
92
|
+
│ └── <name>-form.component.scss
|
|
93
|
+
├── models/
|
|
94
|
+
│ └── <name>.model.ts ← TypeScript interface
|
|
95
|
+
└── services/
|
|
96
|
+
└── <name>.service.ts ← HTTP CRUD service (GET/POST/PUT/DELETE)
|
|
96
97
|
```
|
|
97
98
|
|
|
99
|
+
> The module is auto-imported into `app.module.ts`.
|
|
100
|
+
|
|
98
101
|
### Angular 17+ (Standalone)
|
|
99
102
|
|
|
100
103
|
Same structure but without `<name>.module.ts`. Each component is standalone with its own imports.
|
|
101
104
|
|
|
105
|
+
> Routes are auto-added to `app.routes.ts` with `children` for list, new, and edit paths.
|
|
106
|
+
|
|
102
107
|
---
|
|
103
108
|
|
|
104
|
-
##
|
|
109
|
+
## Routing
|
|
105
110
|
|
|
106
111
|
### Module-based (Angular 14–16)
|
|
107
112
|
|
|
108
|
-
Add a lazy-loaded route to your `app-routing.module.ts`:
|
|
113
|
+
The schematic auto-imports the module into `app.module.ts`. Add a lazy-loaded route to your `app-routing.module.ts`:
|
|
109
114
|
|
|
110
115
|
```ts
|
|
111
116
|
{
|
|
112
117
|
path: 'products',
|
|
113
|
-
loadChildren: () => import('./product/product.module').then(m => m.ProductModule)
|
|
118
|
+
loadChildren: () => import('./product/product-list/product.module').then(m => m.ProductModule)
|
|
114
119
|
}
|
|
115
120
|
```
|
|
116
121
|
|
|
122
|
+
The module includes internal child routes:
|
|
123
|
+
|
|
124
|
+
| Path | Component |
|
|
125
|
+
| ----------- | ------------------- |
|
|
126
|
+
| `` | `<Name>ListComponent` |
|
|
127
|
+
| `new` | `<Name>FormComponent` |
|
|
128
|
+
| `:id/edit` | `<Name>FormComponent` |
|
|
129
|
+
|
|
117
130
|
### Standalone (Angular 17+)
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
Routes are auto-added to `app.routes.ts`:
|
|
120
133
|
|
|
121
134
|
```ts
|
|
122
135
|
{
|
|
123
136
|
path: 'products',
|
|
124
|
-
|
|
137
|
+
children: [
|
|
138
|
+
{ path: '', component: ProductListComponent, title: 'Product List' },
|
|
139
|
+
{ path: 'new', component: ProductFormComponent, title: 'New Product' },
|
|
140
|
+
{ path: ':id/edit', component: ProductFormComponent, title: 'Edit Product' }
|
|
141
|
+
]
|
|
125
142
|
}
|
|
126
143
|
```
|
|
127
144
|
|
|
128
145
|
---
|
|
129
146
|
|
|
147
|
+
## Environment Configuration
|
|
148
|
+
|
|
149
|
+
On first run, the schematic auto-generates `src/environments/environment.ts` and `src/environments/environment.prod.ts` using the `--apiUrl` option:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
export const environment = {
|
|
153
|
+
production: false,
|
|
154
|
+
apiUrl: 'http://localhost:3000',
|
|
155
|
+
};
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If the files already exist, they are left untouched. Update `apiUrl` there to change the base URL for all generated services.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## API Response Format
|
|
163
|
+
|
|
164
|
+
The generated service expects wrapped API responses:
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{ "statusCode": 200, "statusMessage": "OK", "data": [...], "message": "..." }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The service automatically unwraps `data` before returning it to components. Errors are passed through as-is for component-level handling.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
130
174
|
## Uninstall
|
|
131
175
|
|
|
132
|
-
The generated code has **zero runtime dependency** on
|
|
176
|
+
The generated code has **zero runtime dependency** on `@shivay_18/ng-crud`. Uninstall safely anytime:
|
|
133
177
|
|
|
134
178
|
```bash
|
|
135
|
-
npm uninstall ng-crud
|
|
179
|
+
npm uninstall @shivay_18/ng-crud
|
|
136
180
|
```
|
|
137
181
|
|
|
138
182
|
---
|
|
@@ -86,8 +86,15 @@ export class <%= classify(name) %>FormComponent implements OnInit {
|
|
|
86
86
|
},
|
|
87
87
|
error: (error) => {
|
|
88
88
|
let errorMessage = 'Save failed. Please try again.';
|
|
89
|
-
if (error.status === 400
|
|
90
|
-
|
|
89
|
+
if (error.status === 400) {
|
|
90
|
+
const body = error.error;
|
|
91
|
+
if (body?.errors && typeof body.errors === 'object') {
|
|
92
|
+
const messages = Object.values(body.errors as Record<string, string[]>)
|
|
93
|
+
.flat().join(' ');
|
|
94
|
+
errorMessage = messages || errorMessage;
|
|
95
|
+
} else if (body?.message) {
|
|
96
|
+
errorMessage = body.message;
|
|
97
|
+
}
|
|
91
98
|
} else if (error.status === 404) {
|
|
92
99
|
errorMessage = '<%= classify(name) %> not found.';
|
|
93
100
|
} else if (error.status === 500) {
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
<mat-chip [color]="row.<%= field.name %> ? 'primary' : ''" selected>
|
|
37
37
|
{{ row.<%= field.name %> ? 'Yes' : 'No' }}
|
|
38
38
|
</mat-chip>
|
|
39
|
+
<% } else if (field.type === 'date') { %>
|
|
40
|
+
{{ row.<%= field.name %> | date:'mediumDate' }}
|
|
39
41
|
<% } else { %>
|
|
40
42
|
{{ row.<%= field.name %> }}
|
|
41
43
|
<% } %>
|
|
@@ -1,33 +1,41 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
3
3
|
import { Observable, throwError } from 'rxjs';
|
|
4
|
-
import { catchError } from 'rxjs/operators';
|
|
4
|
+
import { catchError, map } from 'rxjs/operators';
|
|
5
|
+
import { environment } from '../../../../environments/environment';
|
|
5
6
|
import { <%= classify(name) %> } from '../models/<%= dasherize(name) %>.model';
|
|
6
7
|
|
|
8
|
+
interface ApiResponse<T> {
|
|
9
|
+
statusCode: number;
|
|
10
|
+
statusMessage: string;
|
|
11
|
+
data: T;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
@Injectable({ providedIn: 'root' })
|
|
8
16
|
export class <%= classify(name) %>Service {
|
|
9
|
-
private apiUrl =
|
|
17
|
+
private apiUrl = `${environment.apiUrl}/<%= dasherize(name) %>s`;
|
|
10
18
|
|
|
11
19
|
constructor(private http: HttpClient) {}
|
|
12
20
|
|
|
13
21
|
getAll(): Observable<<%= classify(name) %>[]> {
|
|
14
|
-
return this.http.get<<%= classify(name) %>[]
|
|
15
|
-
.pipe(catchError(this.handleError));
|
|
22
|
+
return this.http.get<ApiResponse<<%= classify(name) %>[]>>(this.apiUrl)
|
|
23
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
getById(id: number): Observable<<%= classify(name) %>> {
|
|
19
|
-
return this.http.get<<%= classify(name)
|
|
20
|
-
.pipe(catchError(this.handleError));
|
|
27
|
+
return this.http.get<ApiResponse<<%= classify(name) %>>>(`${this.apiUrl}/${id}`)
|
|
28
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
create(item: <%= classify(name) %>): Observable<<%= classify(name) %>> {
|
|
24
|
-
return this.http.post<<%= classify(name)
|
|
25
|
-
.pipe(catchError(this.handleError));
|
|
32
|
+
return this.http.post<ApiResponse<<%= classify(name) %>>>(this.apiUrl, item)
|
|
33
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
update(id: number, item: <%= classify(name) %>): Observable<<%= classify(name) %>> {
|
|
29
|
-
return this.http.put<<%= classify(name)
|
|
30
|
-
.pipe(catchError(this.handleError));
|
|
37
|
+
return this.http.put<ApiResponse<<%= classify(name) %>>>(`${this.apiUrl}/${id}`, item)
|
|
38
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
delete(id: number): Observable<void> {
|
|
@@ -107,8 +107,15 @@ export class <%= classify(name) %>FormComponent implements OnInit {
|
|
|
107
107
|
},
|
|
108
108
|
error: (error) => {
|
|
109
109
|
let errorMessage = 'Save failed. Please try again.';
|
|
110
|
-
if (error.status === 400
|
|
111
|
-
|
|
110
|
+
if (error.status === 400) {
|
|
111
|
+
const body = error.error;
|
|
112
|
+
if (body?.errors && typeof body.errors === 'object') {
|
|
113
|
+
const messages = Object.values(body.errors as Record<string, string[]>)
|
|
114
|
+
.flat().join(' ');
|
|
115
|
+
errorMessage = messages || errorMessage;
|
|
116
|
+
} else if (body?.message) {
|
|
117
|
+
errorMessage = body.message;
|
|
118
|
+
}
|
|
112
119
|
} else if (error.status === 404) {
|
|
113
120
|
errorMessage = '<%= classify(name) %> not found.';
|
|
114
121
|
} else if (error.status === 500) {
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
<mat-chip [color]="row.<%= field.name %> ? 'primary' : ''" selected>
|
|
37
37
|
{{ row.<%= field.name %> ? 'Yes' : 'No' }}
|
|
38
38
|
</mat-chip>
|
|
39
|
+
<% } else if (field.type === 'date') { %>
|
|
40
|
+
{{ row.<%= field.name %> | date:'mediumDate' }}
|
|
39
41
|
<% } else { %>
|
|
40
42
|
{{ row.<%= field.name %> }}
|
|
41
43
|
<% } %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { CommonModule, DatePipe } from '@angular/common';
|
|
3
3
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
4
4
|
import { MatTableModule, MatTableDataSource } from '@angular/material/table';
|
|
5
5
|
import { MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
|
|
@@ -23,6 +23,7 @@ import { <%= classify(name) %>DeleteDialogComponent } from './<%= dasherize(name
|
|
|
23
23
|
standalone: true,
|
|
24
24
|
imports: [
|
|
25
25
|
CommonModule,
|
|
26
|
+
DatePipe,
|
|
26
27
|
MatTableModule,
|
|
27
28
|
MatPaginatorModule,
|
|
28
29
|
MatSortModule,
|
|
@@ -1,33 +1,41 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
3
3
|
import { Observable, throwError } from 'rxjs';
|
|
4
|
-
import { catchError } from 'rxjs/operators';
|
|
4
|
+
import { catchError, map } from 'rxjs/operators';
|
|
5
|
+
import { environment } from '../../../../environments/environment';
|
|
5
6
|
import { <%= classify(name) %> } from '../models/<%= dasherize(name) %>.model';
|
|
6
7
|
|
|
8
|
+
interface ApiResponse<T> {
|
|
9
|
+
statusCode: number;
|
|
10
|
+
statusMessage: string;
|
|
11
|
+
data: T;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
@Injectable({ providedIn: 'root' })
|
|
8
16
|
export class <%= classify(name) %>Service {
|
|
9
|
-
private apiUrl =
|
|
17
|
+
private apiUrl = `${environment.apiUrl}/<%= dasherize(name) %>s`;
|
|
10
18
|
|
|
11
19
|
constructor(private http: HttpClient) {}
|
|
12
20
|
|
|
13
21
|
getAll(): Observable<<%= classify(name) %>[]> {
|
|
14
|
-
return this.http.get<<%= classify(name) %>[]
|
|
15
|
-
.pipe(catchError(this.handleError));
|
|
22
|
+
return this.http.get<ApiResponse<<%= classify(name) %>[]>>(this.apiUrl)
|
|
23
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
getById(id: number): Observable<<%= classify(name) %>> {
|
|
19
|
-
return this.http.get<<%= classify(name)
|
|
20
|
-
.pipe(catchError(this.handleError));
|
|
27
|
+
return this.http.get<ApiResponse<<%= classify(name) %>>>(`${this.apiUrl}/${id}`)
|
|
28
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
create(item: <%= classify(name) %>): Observable<<%= classify(name) %>> {
|
|
24
|
-
return this.http.post<<%= classify(name)
|
|
25
|
-
.pipe(catchError(this.handleError));
|
|
32
|
+
return this.http.post<ApiResponse<<%= classify(name) %>>>(this.apiUrl, item)
|
|
33
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
update(id: number, item: <%= classify(name) %>): Observable<<%= classify(name) %>> {
|
|
29
|
-
return this.http.put<<%= classify(name)
|
|
30
|
-
.pipe(catchError(this.handleError));
|
|
37
|
+
return this.http.put<ApiResponse<<%= classify(name) %>>>(`${this.apiUrl}/${id}`, item)
|
|
38
|
+
.pipe(map(res => res.data), catchError(this.handleError));
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
delete(id: number): Observable<void> {
|
package/dist/crud/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function parseFields(raw) {
|
|
|
8
8
|
const [namePart, type = 'string'] = entry.trim().split(':');
|
|
9
9
|
const name = namePart.replace('*', '').trim();
|
|
10
10
|
const required = namePart.includes('*');
|
|
11
|
-
const control = type === 'boolean' ? 'checkbox' : type === 'number' ? 'number' : 'text';
|
|
11
|
+
const control = type === 'boolean' ? 'checkbox' : type === 'number' ? 'number' : type === 'date' ? 'date' : 'text';
|
|
12
12
|
const label = name.replace(/([A-Z])/g, ' $1').replace(/^./, (s) => s.toUpperCase());
|
|
13
13
|
return { name, type, label, control, required };
|
|
14
14
|
});
|
|
@@ -36,6 +36,28 @@ function getTemplateContext(name, fields, apiUrl, isStandalone, angularVersion)
|
|
|
36
36
|
classify: core_1.strings.classify,
|
|
37
37
|
dasherize: core_1.strings.dasherize,
|
|
38
38
|
camelize: core_1.strings.camelize,
|
|
39
|
+
hasDateField: fields.some(f => f.type === 'date'),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function createEnvironmentFile(apiUrl) {
|
|
43
|
+
return (tree) => {
|
|
44
|
+
const envPath = '/src/environments/environment.ts';
|
|
45
|
+
const envProdPath = '/src/environments/environment.prod.ts';
|
|
46
|
+
if (!tree.exists(envPath)) {
|
|
47
|
+
tree.create(envPath, `export const environment = {
|
|
48
|
+
production: false,
|
|
49
|
+
apiUrl: '${apiUrl}',
|
|
50
|
+
};
|
|
51
|
+
`);
|
|
52
|
+
}
|
|
53
|
+
if (!tree.exists(envProdPath)) {
|
|
54
|
+
tree.create(envProdPath, `export const environment = {
|
|
55
|
+
production: true,
|
|
56
|
+
apiUrl: '${apiUrl}',
|
|
57
|
+
};
|
|
58
|
+
`);
|
|
59
|
+
}
|
|
60
|
+
return tree;
|
|
39
61
|
};
|
|
40
62
|
}
|
|
41
63
|
function addToAppRoutes(name, isStandalone, path) {
|
|
@@ -120,6 +142,7 @@ function crud(options) {
|
|
|
120
142
|
(0, schematics_1.move)(`${targetPath}/services`),
|
|
121
143
|
]);
|
|
122
144
|
const rules = [
|
|
145
|
+
createEnvironmentFile(apiUrl),
|
|
123
146
|
(0, schematics_1.mergeWith)(componentsSource, schematics_1.MergeStrategy.Overwrite),
|
|
124
147
|
];
|
|
125
148
|
// only write model/service if they don't already exist
|
package/dist/crud/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crud/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crud/index.ts"],"names":[],"mappings":";;AA6IA,oBAyDC;AAtMD,2DAWoC;AACpC,+CAA+C;AAW/C,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,MAAM,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACnH,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QACpF,OAAO,EAAE,I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IAAI,SAAS,EAAE,CAAC,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAS,EAAC,WAAW,EAAE,0BAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAS,EAAC,aAAa,EAAE,0BAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivay_18/ng-crud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Angular CRUD generator with Material UI. Generates complete CRUD operations. Safe to uninstall after generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"@angular/core": ">=14.0.0",
|
|
31
31
|
"@angular/material": ">=14.0.0"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|