Skip to content

Commit df476be

Browse files
authored
fix: replace all occurences of prefix
* fix: replace all occurences of prefix * refactor: update imports in ngverse * feat: update
1 parent b34be45 commit df476be

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

projects/docs/src/app/blueprint/command-installation/command-installation.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ import { SourceCodeComponent } from '../source-code/source-code.component';
99
})
1010
export class CommandInstallationComponent {
1111
name = input.required<string>();
12-
installation = computed(() => `ng g ngverse:element ${this.name()}`);
12+
installation = computed(() => `ng g ngverse:add ${this.name()}`);
1313
}

projects/ngverse/schematics/element/index.ts projects/ngverse/schematics/add/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function getElementName(inputPath: string): string {
1313
return basename(normalizedPath);
1414
}
1515

16-
export function element(options: Schema) {
16+
export function add(options: Schema) {
1717
return async (host: Tree) => {
1818
const workspace = await getWorkspace(host);
1919

@@ -81,6 +81,6 @@ function prefixIsDefault(prefix?: string) {
8181
* @param prefix
8282
*/
8383
function updatePrefix(content: string, prefix: string) {
84-
const defaultSelector = 'app';
84+
const defaultSelector = /\bapp\b/g; // Match 'app' as a whole word
8585
return content.replace(defaultSelector, prefix);
8686
}

projects/ngverse/schematics/element/index_spec.ts projects/ngverse/schematics/add/index_spec.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('element', () => {
8989

9090
it('should throw error on empty name', async () => {
9191
await expectAsync(
92-
testRunner.runSchematic('element', appTree)
92+
testRunner.runSchematic('add', appTree)
9393
).toBeRejectedWithError(
9494
InvalidInputOptions,
9595
/Data path "" must have required property 'name'/
@@ -100,7 +100,7 @@ describe('element', () => {
100100
const componentName = 'foo';
101101
await expectAsync(
102102
testRunner.runSchematic(
103-
'element',
103+
'add',
104104
{ name: componentName, project: PROJECT_NAME },
105105
appTree
106106
)
@@ -113,14 +113,14 @@ describe('element', () => {
113113
it('should throw an exception on existing component', async () => {
114114
const componentName = 'button';
115115
await testRunner.runSchematic(
116-
'element',
116+
'add',
117117
{ name: componentName, project: PROJECT_NAME },
118118
appTree
119119
);
120120

121121
await expectAsync(
122122
testRunner.runSchematic(
123-
'element',
123+
'add',
124124
{ name: componentName, project: PROJECT_NAME },
125125
appTree
126126
)
@@ -133,12 +133,12 @@ describe('element', () => {
133133
it('should not throw an exception if --replace option is used', async () => {
134134
const componentName = 'button';
135135
await testRunner.runSchematic(
136-
'element',
136+
'add',
137137
{ name: componentName, project: PROJECT_NAME },
138138
appTree
139139
);
140140
await testRunner.runSchematic(
141-
'element',
141+
'add',
142142
{ name: componentName, project: PROJECT_NAME, replace: true },
143143
appTree
144144
);
@@ -147,7 +147,7 @@ describe('element', () => {
147147
it('should add components to project files', async () => {
148148
const componentName = 'button';
149149
await testRunner.runSchematic(
150-
'element',
150+
'add',
151151
{ name: componentName, project: PROJECT_NAME },
152152
appTree
153153
);
@@ -165,7 +165,7 @@ describe('element', () => {
165165
it('should not add spec file by default', async () => {
166166
const componentName = 'button';
167167
await testRunner.runSchematic(
168-
'element',
168+
'add',
169169
{ name: componentName, project: PROJECT_NAME },
170170
appTree
171171
);
@@ -176,7 +176,7 @@ describe('element', () => {
176176
it('should add spec file if includeTests=true', async () => {
177177
const componentName = 'button';
178178
await testRunner.runSchematic(
179-
'element',
179+
'add',
180180
{ name: componentName, project: PROJECT_NAME, includeTests: true },
181181
appTree
182182
);
@@ -196,7 +196,7 @@ describe('element', () => {
196196
}
197197
`;
198198
await testRunner.runSchematic(
199-
'element',
199+
'add',
200200
{ name: componentName, project: PROJECT_NAME, prefix: 'demo' },
201201
appTree
202202
);
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
33
"schematics": {
4-
"element": {
5-
"description": "Generate a element in the project.",
6-
"factory": "./element/index#element",
7-
"schema": "./element/schema.json"
4+
"add": {
5+
"description": "Generate a component in the project.",
6+
"factory": "./add/index#add",
7+
"schema": "./add/schema.json"
88
}
99
}
1010
}

projects/ngverse/src/lib/dark-mode/dark-mode-toggle.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
2-
import { ButtonComponent } from '../button/button.component';
32
import { DarkModeIconComponent } from './dark-mode-icon.component';
43
import { DarkModeService } from './dark-mode.service';
4+
import { ButtonComponent } from '@/ui/button/button.component';
55

66
@Component({
77
selector: 'app-dark-mode-toggle',

projects/ngverse/src/lib/dark-mode/dark-mode.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
22
import { Platform } from '@angular/cdk/platform';
33
import { DOCUMENT } from '@angular/common';
44
import { effect, inject, Injectable, signal } from '@angular/core';
5-
import { LocalStorageService } from '../local-storage/local-storage.service';
5+
import { LocalStorageService } from '@/ui/local-storage/local-storage.service';
66

77
const DARK_MODE_STORAGE_KEY = 'dark-mode';
88

projects/ngverse/src/lib/dialog/alert-dialog/alert-dialog.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
22
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
3-
import { ButtonComponent } from '../../button/button.component';
43
import { DIALOG_ENTER_ANIMATION } from '../dialog-animations';
54
import { DialogCloseDirective } from '../dialog-close.directive';
5+
import { ButtonComponent } from '@/ui/button/button.component';
66

77
export interface AlertDialogOption {
88
title: string;

projects/ngverse/src/lib/dialog/confirm-dialog/confirm-dialog.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
22
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
3-
import { ButtonComponent } from '../../button/button.component';
43
import { DIALOG_ENTER_ANIMATION } from '../dialog-animations';
4+
import { ButtonComponent } from '@/ui/button/button.component';
55

66
export interface ConfirmDialogOptions {
77
title: string;

projects/ngverse/src/lib/otp-input/otp-input.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
viewChildren,
1414
} from '@angular/core';
1515
import { interval, Subscription } from 'rxjs';
16-
import { InputDirective } from '../input/input.directive';
16+
import { InputDirective } from '@/ui/input/input.directive';
1717

1818
@Component({
1919
selector: 'app-otp-input',

projects/ngverse/src/lib/pagination/pagination.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
input,
66
output,
77
} from '@angular/core';
8-
import { ButtonComponent } from '../button/button.component';
98
import { PaginationNextIconComponent } from './pagination-next-icon.component';
109
import { PaginationPrevIconComponent } from './pagination-prev-icon.component';
10+
import { ButtonComponent } from '@/ui/button/button.component';
1111

1212
// We will keep always 7 visible items so it will prevent the width of the pagination from changing
1313
const ALWAYS_VISIBLE_ITEMS = 7;

projects/ngverse/src/lib/select/select.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
2222
import { SelectionModel } from '@angular/cdk/collections';
2323
import { toSignal } from '@angular/core/rxjs-interop';
2424
import { map } from 'rxjs';
25-
import { PopoverOriginDirective } from '../popover/popover-origin.directive';
26-
import { PopoverComponent } from '../popover/popover.component';
2725
import { OptionComponent } from './option.component';
2826
import { SelectIconComponent } from './select-icon.component';
27+
import { PopoverComponent } from '@/ui/popover/popover.component';
28+
import { PopoverOriginDirective } from '@/ui/popover/popover-origin.directive';
2929

3030
type OnTouchedFunction = (() => void) | undefined;
3131

0 commit comments

Comments
 (0)