@ng-annotate/angular 0.1.4 → 0.1.5
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/package.json +1 -1
- package/schematics/ng-add/index.js +6 -10
- package/schematics/ng-add/index.ts +6 -10
package/package.json
CHANGED
|
@@ -71,20 +71,16 @@ function addProviders() {
|
|
|
71
71
|
}
|
|
72
72
|
function addMcpConfig() {
|
|
73
73
|
return (tree, context) => {
|
|
74
|
-
// The project root at ng-add time — used to build stable absolute paths.
|
|
75
|
-
// MCP hosts (VS Code Copilot, Claude Code) may spawn the server with a
|
|
76
|
-
// different cwd, so we bake in the paths rather than relying on cwd.
|
|
77
74
|
const projectRoot = process.cwd().replace(/\\/g, '/');
|
|
78
|
-
const serverEntry = `${projectRoot}/node_modules/@ng-annotate/mcp-server/dist/index.js`;
|
|
79
75
|
const env = { NG_ANNOTATE_PROJECT_ROOT: projectRoot };
|
|
80
|
-
// .mcp.json — Claude Code
|
|
76
|
+
// .mcp.json — Claude Code (needs cmd /c on Windows to invoke npx.cmd)
|
|
81
77
|
if (!tree.exists('.mcp.json')) {
|
|
82
78
|
const isWindows = process.platform === 'win32';
|
|
83
79
|
const mcpConfig = {
|
|
84
80
|
mcpServers: {
|
|
85
81
|
'ng-annotate': isWindows
|
|
86
|
-
? { command: 'cmd', args: ['/c', '
|
|
87
|
-
: { command: '
|
|
82
|
+
? { command: 'cmd', args: ['/c', 'npx', '-y', '@ng-annotate/mcp-server'], env }
|
|
83
|
+
: { command: 'npx', args: ['-y', '@ng-annotate/mcp-server'], env },
|
|
88
84
|
},
|
|
89
85
|
};
|
|
90
86
|
tree.create('.mcp.json', JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
@@ -93,15 +89,15 @@ function addMcpConfig() {
|
|
|
93
89
|
else {
|
|
94
90
|
context.logger.info('.mcp.json already exists, skipping.');
|
|
95
91
|
}
|
|
96
|
-
// .vscode/mcp.json — VS Code Copilot
|
|
92
|
+
// .vscode/mcp.json — VS Code Copilot (handles npx.cmd natively on Windows)
|
|
97
93
|
const vscodeMcpPath = '.vscode/mcp.json';
|
|
98
94
|
if (!tree.exists(vscodeMcpPath)) {
|
|
99
95
|
const vscodeMcpConfig = {
|
|
100
96
|
servers: {
|
|
101
97
|
'ng-annotate': {
|
|
102
98
|
type: 'stdio',
|
|
103
|
-
command: '
|
|
104
|
-
args: [
|
|
99
|
+
command: 'npx',
|
|
100
|
+
args: ['-y', '@ng-annotate/mcp-server'],
|
|
105
101
|
env,
|
|
106
102
|
},
|
|
107
103
|
},
|
|
@@ -102,21 +102,17 @@ function addProviders(): Rule {
|
|
|
102
102
|
|
|
103
103
|
function addMcpConfig(): Rule {
|
|
104
104
|
return (tree: Tree, context: SchematicContext) => {
|
|
105
|
-
// The project root at ng-add time — used to build stable absolute paths.
|
|
106
|
-
// MCP hosts (VS Code Copilot, Claude Code) may spawn the server with a
|
|
107
|
-
// different cwd, so we bake in the paths rather than relying on cwd.
|
|
108
105
|
const projectRoot = process.cwd().replace(/\\/g, '/');
|
|
109
|
-
const serverEntry = `${projectRoot}/node_modules/@ng-annotate/mcp-server/dist/index.js`;
|
|
110
106
|
const env = { NG_ANNOTATE_PROJECT_ROOT: projectRoot };
|
|
111
107
|
|
|
112
|
-
// .mcp.json — Claude Code
|
|
108
|
+
// .mcp.json — Claude Code (needs cmd /c on Windows to invoke npx.cmd)
|
|
113
109
|
if (!tree.exists('.mcp.json')) {
|
|
114
110
|
const isWindows = process.platform === 'win32';
|
|
115
111
|
const mcpConfig = {
|
|
116
112
|
mcpServers: {
|
|
117
113
|
'ng-annotate': isWindows
|
|
118
|
-
? { command: 'cmd', args: ['/c', '
|
|
119
|
-
: { command: '
|
|
114
|
+
? { command: 'cmd', args: ['/c', 'npx', '-y', '@ng-annotate/mcp-server'], env }
|
|
115
|
+
: { command: 'npx', args: ['-y', '@ng-annotate/mcp-server'], env },
|
|
120
116
|
},
|
|
121
117
|
};
|
|
122
118
|
tree.create('.mcp.json', JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
@@ -125,15 +121,15 @@ function addMcpConfig(): Rule {
|
|
|
125
121
|
context.logger.info('.mcp.json already exists, skipping.');
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
// .vscode/mcp.json — VS Code Copilot
|
|
124
|
+
// .vscode/mcp.json — VS Code Copilot (handles npx.cmd natively on Windows)
|
|
129
125
|
const vscodeMcpPath = '.vscode/mcp.json';
|
|
130
126
|
if (!tree.exists(vscodeMcpPath)) {
|
|
131
127
|
const vscodeMcpConfig = {
|
|
132
128
|
servers: {
|
|
133
129
|
'ng-annotate': {
|
|
134
130
|
type: 'stdio',
|
|
135
|
-
command: '
|
|
136
|
-
args: [
|
|
131
|
+
command: 'npx',
|
|
132
|
+
args: ['-y', '@ng-annotate/mcp-server'],
|
|
137
133
|
env,
|
|
138
134
|
},
|
|
139
135
|
},
|