@ng-annotate/angular 0.5.1 → 0.5.2
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 +20 -13
- package/dist/README.md +20 -13
- package/package.json +1 -1
- package/schematics/ng-add/index.js +9 -3
- package/schematics/ng-add/index.spec.ts +21 -0
- package/schematics/ng-add/index.ts +10 -3
package/README.md
CHANGED
|
@@ -16,24 +16,31 @@ ng add @ng-annotate/angular
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
The schematic configures everything automatically:
|
|
19
|
-
-
|
|
19
|
+
- Switches the Angular dev server to `@ng-annotate/angular:dev-server` (handles WebSocket + manifest injection — no separate config file or proxy needed)
|
|
20
20
|
- Adds `provideNgAnnotate()` to `app.config.ts`
|
|
21
|
-
- Creates the MCP config file for your AI editor
|
|
21
|
+
- Creates the MCP config file for your AI editor (`.mcp.json` for Claude Code, `.vscode/mcp.json` for VS Code, or both)
|
|
22
|
+
|
|
23
|
+
Works with both `@angular/build:dev-server` and the legacy `@angular-devkit/build-angular:dev-server` builder.
|
|
22
24
|
|
|
23
25
|
## Manual install
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
npm install @ng-annotate/angular
|
|
28
|
+
npm install @ng-annotate/angular --save-dev
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
**`
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
**`angular.json`** — change the serve builder:
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"projects": {
|
|
35
|
+
"your-app": {
|
|
36
|
+
"architect": {
|
|
37
|
+
"serve": {
|
|
38
|
+
"builder": "@ng-annotate/angular:dev-server"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
37
44
|
```
|
|
38
45
|
|
|
39
46
|
**`src/app/app.config.ts`**
|
|
@@ -56,7 +63,7 @@ Once installed:
|
|
|
56
63
|
|
|
57
64
|
**1. Start the dev server**
|
|
58
65
|
```bash
|
|
59
|
-
|
|
66
|
+
ng serve
|
|
60
67
|
```
|
|
61
68
|
|
|
62
69
|
**2. Start the agent polling loop**
|
|
@@ -113,8 +120,8 @@ export class AppModule {}
|
|
|
113
120
|
|
|
114
121
|
| Package | Purpose |
|
|
115
122
|
|---|---|
|
|
116
|
-
| [`@ng-annotate/vite-plugin`](https://www.npmjs.com/package/@ng-annotate/vite-plugin) | Vite plugin (WebSocket server, component manifest) |
|
|
117
123
|
| [`@ng-annotate/mcp-server`](https://www.npmjs.com/package/@ng-annotate/mcp-server) | MCP server exposing tools to the AI agent |
|
|
124
|
+
| [`@ng-annotate/vite-plugin`](https://www.npmjs.com/package/@ng-annotate/vite-plugin) | For non-Angular-CLI Vite projects (Vue, Svelte, etc.) |
|
|
118
125
|
|
|
119
126
|
## License
|
|
120
127
|
|
package/dist/README.md
CHANGED
|
@@ -16,24 +16,31 @@ ng add @ng-annotate/angular
|
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
The schematic configures everything automatically:
|
|
19
|
-
-
|
|
19
|
+
- Switches the Angular dev server to `@ng-annotate/angular:dev-server` (handles WebSocket + manifest injection — no separate config file or proxy needed)
|
|
20
20
|
- Adds `provideNgAnnotate()` to `app.config.ts`
|
|
21
|
-
- Creates the MCP config file for your AI editor
|
|
21
|
+
- Creates the MCP config file for your AI editor (`.mcp.json` for Claude Code, `.vscode/mcp.json` for VS Code, or both)
|
|
22
|
+
|
|
23
|
+
Works with both `@angular/build:dev-server` and the legacy `@angular-devkit/build-angular:dev-server` builder.
|
|
22
24
|
|
|
23
25
|
## Manual install
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
npm install @ng-annotate/angular
|
|
28
|
+
npm install @ng-annotate/angular --save-dev
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
**`
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
**`angular.json`** — change the serve builder:
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"projects": {
|
|
35
|
+
"your-app": {
|
|
36
|
+
"architect": {
|
|
37
|
+
"serve": {
|
|
38
|
+
"builder": "@ng-annotate/angular:dev-server"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
37
44
|
```
|
|
38
45
|
|
|
39
46
|
**`src/app/app.config.ts`**
|
|
@@ -56,7 +63,7 @@ Once installed:
|
|
|
56
63
|
|
|
57
64
|
**1. Start the dev server**
|
|
58
65
|
```bash
|
|
59
|
-
|
|
66
|
+
ng serve
|
|
60
67
|
```
|
|
61
68
|
|
|
62
69
|
**2. Start the agent polling loop**
|
|
@@ -113,8 +120,8 @@ export class AppModule {}
|
|
|
113
120
|
|
|
114
121
|
| Package | Purpose |
|
|
115
122
|
|---|---|
|
|
116
|
-
| [`@ng-annotate/vite-plugin`](https://www.npmjs.com/package/@ng-annotate/vite-plugin) | Vite plugin (WebSocket server, component manifest) |
|
|
117
123
|
| [`@ng-annotate/mcp-server`](https://www.npmjs.com/package/@ng-annotate/mcp-server) | MCP server exposing tools to the AI agent |
|
|
124
|
+
| [`@ng-annotate/vite-plugin`](https://www.npmjs.com/package/@ng-annotate/vite-plugin) | For non-Angular-CLI Vite projects (Vue, Svelte, etc.) |
|
|
118
125
|
|
|
119
126
|
## License
|
|
120
127
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-annotate/angular",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
5
|
"builders": "./builders.json",
|
|
6
6
|
"description": "Angular library for ng-annotate-mcp — browser overlay for annotating components and routing instructions to an AI agent",
|
|
@@ -41,7 +41,13 @@ const path = __importStar(require("path"));
|
|
|
41
41
|
const helpers_1 = require("./helpers");
|
|
42
42
|
const MIN_ANGULAR_MAJOR = 21;
|
|
43
43
|
const NG_ANNOTATE_BUILDER = '@ng-annotate/angular:dev-server';
|
|
44
|
-
|
|
44
|
+
// Both builders use the same underlying implementation in Angular 17+.
|
|
45
|
+
// @angular-devkit/build-angular:dev-server is the legacy alias that many
|
|
46
|
+
// projects still have in their angular.json even on Angular 21.
|
|
47
|
+
const COMPATIBLE_DEV_SERVER_BUILDERS = [
|
|
48
|
+
'@angular/build:dev-server',
|
|
49
|
+
'@angular-devkit/build-angular:dev-server',
|
|
50
|
+
];
|
|
45
51
|
function checkAngularVersion() {
|
|
46
52
|
return (tree) => {
|
|
47
53
|
const pkgPath = 'package.json';
|
|
@@ -83,9 +89,9 @@ function updateAngularJsonBuilder() {
|
|
|
83
89
|
context.logger.info(`ng-annotate builder already configured in ${projectName}, skipping.`);
|
|
84
90
|
continue;
|
|
85
91
|
}
|
|
86
|
-
if (currentBuilder
|
|
92
|
+
if (!COMPATIBLE_DEV_SERVER_BUILDERS.includes(currentBuilder ?? '')) {
|
|
87
93
|
context.logger.warn(`⚠️ Project "${projectName}" uses builder "${String(currentBuilder)}" which is not ` +
|
|
88
|
-
`
|
|
94
|
+
`a compatible dev-server builder. Skipping automatic builder update — ` +
|
|
89
95
|
`set it to "${NG_ANNOTATE_BUILDER}" manually if compatible.`);
|
|
90
96
|
continue;
|
|
91
97
|
}
|
|
@@ -164,6 +164,27 @@ describe('ng-add schematic — updateAngularJsonBuilder', () => {
|
|
|
164
164
|
expect((serve['builder'] as string)).toBe('@ng-annotate/angular:dev-server');
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
+
it('updates legacy @angular-devkit/build-angular:dev-server builder too', async () => {
|
|
168
|
+
const withLegacyBuilder = JSON.stringify({
|
|
169
|
+
projects: {
|
|
170
|
+
'my-app': {
|
|
171
|
+
architect: {
|
|
172
|
+
serve: {
|
|
173
|
+
builder: '@angular-devkit/build-angular:dev-server',
|
|
174
|
+
options: {},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
const tree = makeTree({ 'package.json': BASE_PKG, 'angular.json': withLegacyBuilder });
|
|
181
|
+
const result = await runSchematic(tree);
|
|
182
|
+
const angular = JSON.parse(result.readText('angular.json')) as Record<string, unknown>;
|
|
183
|
+
const projects = angular['projects'] as Record<string, Record<string, unknown>>;
|
|
184
|
+
const serve = (projects['my-app']['architect'] as Record<string, Record<string, unknown>>)['serve'];
|
|
185
|
+
expect((serve['builder'] as string)).toBe('@ng-annotate/angular:dev-server');
|
|
186
|
+
});
|
|
187
|
+
|
|
167
188
|
it('warns but does not change unknown builders', async () => {
|
|
168
189
|
const withCustomBuilder = JSON.stringify({
|
|
169
190
|
projects: {
|
|
@@ -10,7 +10,14 @@ interface Options {
|
|
|
10
10
|
|
|
11
11
|
const MIN_ANGULAR_MAJOR = 21;
|
|
12
12
|
const NG_ANNOTATE_BUILDER = '@ng-annotate/angular:dev-server';
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
// Both builders use the same underlying implementation in Angular 17+.
|
|
15
|
+
// @angular-devkit/build-angular:dev-server is the legacy alias that many
|
|
16
|
+
// projects still have in their angular.json even on Angular 21.
|
|
17
|
+
const COMPATIBLE_DEV_SERVER_BUILDERS = [
|
|
18
|
+
'@angular/build:dev-server',
|
|
19
|
+
'@angular-devkit/build-angular:dev-server',
|
|
20
|
+
];
|
|
14
21
|
|
|
15
22
|
function checkAngularVersion(): Rule {
|
|
16
23
|
return (tree: Tree) => {
|
|
@@ -69,10 +76,10 @@ function updateAngularJsonBuilder(): Rule {
|
|
|
69
76
|
continue;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
|
-
if (currentBuilder
|
|
79
|
+
if (!COMPATIBLE_DEV_SERVER_BUILDERS.includes(currentBuilder ?? '')) {
|
|
73
80
|
context.logger.warn(
|
|
74
81
|
`⚠️ Project "${projectName}" uses builder "${String(currentBuilder)}" which is not ` +
|
|
75
|
-
`
|
|
82
|
+
`a compatible dev-server builder. Skipping automatic builder update — ` +
|
|
76
83
|
`set it to "${NG_ANNOTATE_BUILDER}" manually if compatible.`,
|
|
77
84
|
);
|
|
78
85
|
continue;
|