@ng-annotate/angular 0.1.2 → 0.1.4
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 +14 -8
- package/schematics/ng-add/index.ts +15 -8
package/package.json
CHANGED
|
@@ -71,14 +71,20 @@ function addProviders() {
|
|
|
71
71
|
}
|
|
72
72
|
function addMcpConfig() {
|
|
73
73
|
return (tree, context) => {
|
|
74
|
-
//
|
|
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
|
+
const projectRoot = process.cwd().replace(/\\/g, '/');
|
|
78
|
+
const serverEntry = `${projectRoot}/node_modules/@ng-annotate/mcp-server/dist/index.js`;
|
|
79
|
+
const env = { NG_ANNOTATE_PROJECT_ROOT: projectRoot };
|
|
80
|
+
// .mcp.json — Claude Code
|
|
75
81
|
if (!tree.exists('.mcp.json')) {
|
|
76
82
|
const isWindows = process.platform === 'win32';
|
|
77
83
|
const mcpConfig = {
|
|
78
84
|
mcpServers: {
|
|
79
85
|
'ng-annotate': isWindows
|
|
80
|
-
? { command: 'cmd', args: ['/c', '
|
|
81
|
-
: { command: '
|
|
86
|
+
? { command: 'cmd', args: ['/c', 'node', serverEntry], env }
|
|
87
|
+
: { command: 'node', args: [serverEntry], env },
|
|
82
88
|
},
|
|
83
89
|
};
|
|
84
90
|
tree.create('.mcp.json', JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
@@ -87,16 +93,16 @@ function addMcpConfig() {
|
|
|
87
93
|
else {
|
|
88
94
|
context.logger.info('.mcp.json already exists, skipping.');
|
|
89
95
|
}
|
|
90
|
-
// .vscode/mcp.json — VS Code Copilot
|
|
96
|
+
// .vscode/mcp.json — VS Code Copilot
|
|
91
97
|
const vscodeMcpPath = '.vscode/mcp.json';
|
|
92
98
|
if (!tree.exists(vscodeMcpPath)) {
|
|
93
99
|
const vscodeMcpConfig = {
|
|
94
100
|
servers: {
|
|
95
101
|
'ng-annotate': {
|
|
96
102
|
type: 'stdio',
|
|
97
|
-
command: '
|
|
98
|
-
args: [
|
|
99
|
-
|
|
103
|
+
command: 'node',
|
|
104
|
+
args: [serverEntry],
|
|
105
|
+
env,
|
|
100
106
|
},
|
|
101
107
|
},
|
|
102
108
|
};
|
|
@@ -134,7 +140,7 @@ function addDevDependency() {
|
|
|
134
140
|
}
|
|
135
141
|
function default_1() {
|
|
136
142
|
return (tree, context) => {
|
|
137
|
-
context.logger.info('Setting up @ng-annotate
|
|
143
|
+
context.logger.info('Setting up @ng-annotate...');
|
|
138
144
|
return (0, schematics_1.chain)([checkAngularVersion(), addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(tree, context);
|
|
139
145
|
};
|
|
140
146
|
}
|
|
@@ -102,14 +102,21 @@ function addProviders(): Rule {
|
|
|
102
102
|
|
|
103
103
|
function addMcpConfig(): Rule {
|
|
104
104
|
return (tree: Tree, context: SchematicContext) => {
|
|
105
|
-
//
|
|
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
|
+
const projectRoot = process.cwd().replace(/\\/g, '/');
|
|
109
|
+
const serverEntry = `${projectRoot}/node_modules/@ng-annotate/mcp-server/dist/index.js`;
|
|
110
|
+
const env = { NG_ANNOTATE_PROJECT_ROOT: projectRoot };
|
|
111
|
+
|
|
112
|
+
// .mcp.json — Claude Code
|
|
106
113
|
if (!tree.exists('.mcp.json')) {
|
|
107
114
|
const isWindows = process.platform === 'win32';
|
|
108
115
|
const mcpConfig = {
|
|
109
116
|
mcpServers: {
|
|
110
117
|
'ng-annotate': isWindows
|
|
111
|
-
? { command: 'cmd', args: ['/c', '
|
|
112
|
-
: { command: '
|
|
118
|
+
? { command: 'cmd', args: ['/c', 'node', serverEntry], env }
|
|
119
|
+
: { command: 'node', args: [serverEntry], env },
|
|
113
120
|
},
|
|
114
121
|
};
|
|
115
122
|
tree.create('.mcp.json', JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
@@ -118,16 +125,16 @@ function addMcpConfig(): Rule {
|
|
|
118
125
|
context.logger.info('.mcp.json already exists, skipping.');
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
// .vscode/mcp.json — VS Code Copilot
|
|
128
|
+
// .vscode/mcp.json — VS Code Copilot
|
|
122
129
|
const vscodeMcpPath = '.vscode/mcp.json';
|
|
123
130
|
if (!tree.exists(vscodeMcpPath)) {
|
|
124
131
|
const vscodeMcpConfig = {
|
|
125
132
|
servers: {
|
|
126
133
|
'ng-annotate': {
|
|
127
134
|
type: 'stdio',
|
|
128
|
-
command: '
|
|
129
|
-
args: [
|
|
130
|
-
|
|
135
|
+
command: 'node',
|
|
136
|
+
args: [serverEntry],
|
|
137
|
+
env,
|
|
131
138
|
},
|
|
132
139
|
},
|
|
133
140
|
};
|
|
@@ -173,7 +180,7 @@ function addDevDependency(): Rule {
|
|
|
173
180
|
|
|
174
181
|
export default function (): Rule {
|
|
175
182
|
return (tree: Tree, context: SchematicContext) => {
|
|
176
|
-
context.logger.info('Setting up @ng-annotate
|
|
183
|
+
context.logger.info('Setting up @ng-annotate...');
|
|
177
184
|
return chain([checkAngularVersion(), addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(
|
|
178
185
|
tree,
|
|
179
186
|
context,
|