Initial commit
This commit is contained in:
36
commands/create-angular-app.md
Normal file
36
commands/create-angular-app.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
description: Create a new Angular application with routing and guards
|
||||
argument-hint: [app-name]
|
||||
---
|
||||
|
||||
Create a new Angular application named $1 with the following structure:
|
||||
|
||||
1. Use Angular CLI to create the app with routing and SCSS:
|
||||
```bash
|
||||
ng new $1 --routing --style=scss
|
||||
```
|
||||
|
||||
2. Generate essential structure:
|
||||
```bash
|
||||
cd $1
|
||||
ng generate guard auth/guards/auth
|
||||
ng generate service auth/services/auth
|
||||
ng generate module core
|
||||
ng generate module shared
|
||||
ng generate component core/components/layout
|
||||
```
|
||||
|
||||
3. Create a basic folder structure:
|
||||
- `src/app/core/` - Core functionality (singletons, guards, interceptors)
|
||||
- `src/app/shared/` - Shared components, directives, pipes
|
||||
- `src/app/features/` - Feature modules
|
||||
- `src/app/auth/` - Authentication logic
|
||||
|
||||
4. Initialize git repository if not already done
|
||||
|
||||
5. Create a README.md explaining the project structure and how to run it
|
||||
|
||||
After creation, provide the user with:
|
||||
- Next steps to run the application
|
||||
- Explanation of the folder structure
|
||||
- Common commands they might need
|
||||
24
commands/ng-component.md
Normal file
24
commands/ng-component.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
description: Generate a new Angular component
|
||||
argument-hint: [path/component-name]
|
||||
---
|
||||
|
||||
Generate a new Angular component at $1:
|
||||
|
||||
1. Create the component using Angular CLI:
|
||||
```bash
|
||||
ng generate component $1
|
||||
```
|
||||
|
||||
2. The component will include:
|
||||
- TypeScript component class
|
||||
- HTML template
|
||||
- CSS/SCSS stylesheet
|
||||
- Spec file for testing
|
||||
|
||||
3. Provide guidance on:
|
||||
- How to use the component in templates
|
||||
- Common component patterns (inputs, outputs, lifecycle hooks)
|
||||
- Where to import it if needed
|
||||
|
||||
If the user didn't specify a path, ask them where they want to create it (e.g., `features/user/components/user-profile` or `shared/components/button`).
|
||||
44
commands/ng-module.md
Normal file
44
commands/ng-module.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
description: Generate a new Angular feature module
|
||||
argument-hint: [module-name] [--routing]
|
||||
---
|
||||
|
||||
Generate a new Angular feature module named $1:
|
||||
|
||||
1. Create the module with routing (if requested):
|
||||
```bash
|
||||
ng generate module $1 --routing
|
||||
```
|
||||
|
||||
Or without routing:
|
||||
```bash
|
||||
ng generate module $1
|
||||
```
|
||||
|
||||
2. The module will include:
|
||||
- NgModule class with @NgModule decorator
|
||||
- Routing module (if --routing flag used)
|
||||
- Proper imports and exports structure
|
||||
|
||||
3. Set up recommended structure:
|
||||
```
|
||||
src/app/features/$1/
|
||||
├── components/
|
||||
├── services/
|
||||
├── models/
|
||||
├── $1.module.ts
|
||||
└── $1-routing.module.ts (if routing enabled)
|
||||
```
|
||||
|
||||
4. Provide guidance on:
|
||||
- How to lazy-load the module in app routing
|
||||
- How to organize feature components
|
||||
- When to use shared vs feature modules
|
||||
- How to export components for use in other modules
|
||||
|
||||
5. If creating a feature module, suggest:
|
||||
- Creating a landing/container component
|
||||
- Setting up routing for the feature
|
||||
- Adding it to the main app routing with lazy loading
|
||||
|
||||
Ask the user if they want routing enabled and what type of module this is (feature, shared, or core).
|
||||
28
commands/ng-service.md
Normal file
28
commands/ng-service.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
description: Generate a new Angular service
|
||||
argument-hint: [path/service-name]
|
||||
---
|
||||
|
||||
Generate a new Angular service at $1:
|
||||
|
||||
1. Create the service using Angular CLI:
|
||||
```bash
|
||||
ng generate service $1
|
||||
```
|
||||
|
||||
2. The service will include:
|
||||
- TypeScript service class with @Injectable decorator
|
||||
- Spec file for testing
|
||||
- providedIn: 'root' for singleton pattern (by default)
|
||||
|
||||
3. Provide guidance on:
|
||||
- How to inject the service into components
|
||||
- Common service patterns (HTTP calls, state management, business logic)
|
||||
- Best practices for service organization
|
||||
|
||||
4. Suggest appropriate location based on service type:
|
||||
- Core services (singleton, app-wide) → `core/services/`
|
||||
- Feature-specific services → `features/{feature-name}/services/`
|
||||
- Shared utilities → `shared/services/`
|
||||
|
||||
If the user didn't specify a path, ask them what type of service it is and suggest the appropriate location.
|
||||
Reference in New Issue
Block a user