Skip to content

Commit 6075103

Browse files
committed
Implement review comment: generator-langium: Only node path is called path
1 parent e6ab4bb commit 6075103

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

packages/generator-langium/src/index.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,17 @@ export class LangiumGenerator extends Generator {
174174
const referencedTsconfigBaseName = this.answers.includeTest ? 'tsconfig.src.json' : 'tsconfig.json';
175175
const templateCopyOptions: CopyOptions = {
176176
process: content => this._replaceTemplateWords(fileExtensionGlob, languageName, languageId, referencedTsconfigBaseName, content),
177-
processDestinationPath: path => this._replaceTemplateNames(languageId, path)
177+
processDestinationPath: destPath => this._replaceTemplateNames(languageId, destPath)
178178
};
179179

180180
this.sourceRoot(path.join(__dirname, TEMPLATE_CORE_DIR));
181181
const pkgJson = this.fs.readJSON(path.join(this.sourceRoot(), '.package.json'));
182182
this.fs.extendJSON(this._extensionPath('package-template.json'), pkgJson, undefined, 4);
183183

184-
for (const path of ['.', '.vscode', 'eslint.config.mjs']) {
184+
for (const pathElement of ['.', '.vscode', 'eslint.config.mjs']) {
185185
this.fs.copy(
186-
this.templatePath(path),
187-
this._extensionPath(path),
186+
this.templatePath(pathElement),
187+
this._extensionPath(pathElement),
188188
templateCopyOptions
189189
);
190190
}
@@ -197,10 +197,10 @@ export class LangiumGenerator extends Generator {
197197
const pkgJson = this.fs.readJSON(path.join(this.sourceRoot(), '.package.json'));
198198
this.fs.extendJSON(this._extensionPath('package-template.json'), pkgJson, undefined, 4);
199199
this.sourceRoot(path.join(__dirname, TEMPLATE_VSCODE_DIR));
200-
for (const path of ['.', '.vscode', '.vscodeignore']) {
200+
for (const pathElement of ['.', '.vscode', '.vscodeignore']) {
201201
this.fs.copy(
202-
this.templatePath(path),
203-
this._extensionPath(path),
202+
this.templatePath(pathElement),
203+
this._extensionPath(pathElement),
204204
templateCopyOptions
205205
);
206206
}
@@ -210,10 +210,10 @@ export class LangiumGenerator extends Generator {
210210
this.sourceRoot(path.join(__dirname, TEMPLATE_CLI_DIR));
211211
const pkgJson = this.fs.readJSON(path.join(this.sourceRoot(), '.package.json'));
212212
this.fs.extendJSON(this._extensionPath('package-template.json'),pkgJson, undefined, 4);
213-
for (const path of ['.']) {
213+
for (const pathElement of ['.']) {
214214
this.fs.copy(
215-
this.templatePath(path),
216-
this._extensionPath(path),
215+
this.templatePath(pathElement),
216+
this._extensionPath(pathElement),
217217
templateCopyOptions
218218
);
219219
}
@@ -224,10 +224,10 @@ export class LangiumGenerator extends Generator {
224224
const pkgJson = this.fs.readJSON(path.join(this.sourceRoot(), '.package.json'));
225225
this.fs.extendJSON(this._extensionPath('package-template.json'), pkgJson, undefined, 4);
226226
this.sourceRoot(path.join(__dirname, TEMPLATE_WEB_DIR));
227-
for (const path of ['.']) {
227+
for (const pathElement of ['.']) {
228228
this.fs.copy(
229-
this.templatePath(path),
230-
this._extensionPath(path),
229+
this.templatePath(pathElement),
230+
this._extensionPath(pathElement),
231231
templateCopyOptions
232232
);
233233
}
@@ -306,8 +306,8 @@ export class LangiumGenerator extends Generator {
306306
}
307307
}
308308

309-
_extensionPath(...path: string[]): string {
310-
return this.destinationPath(USER_DIR, this.answers.extensionName, ...path);
309+
_extensionPath(...pathElement: string[]): string {
310+
return this.destinationPath(USER_DIR, this.answers.extensionName, ...pathElement);
311311
}
312312

313313
_replaceTemplateWords(fileExtensionGlob: string, languageName: string, languageId: string, tsconfigBaseName: string, content: string | Buffer): string {
@@ -322,8 +322,8 @@ export class LangiumGenerator extends Generator {
322322
.replace(NEWLINES, EOL);
323323
}
324324

325-
_replaceTemplateNames(languageId: string, path: string): string {
326-
return path.replace(LANGUAGE_PATH_ID, languageId);
325+
_replaceTemplateNames(languageId: string, inputPath: string): string {
326+
return inputPath.replace(LANGUAGE_PATH_ID, languageId);
327327
}
328328
}
329329

0 commit comments

Comments
 (0)