Skip to content

Commit

Permalink
Fixed yeoman generator
Browse files Browse the repository at this point in the history
  • Loading branch information
spoenemann committed Jun 16, 2021
1 parent f73c1be commit c12dea0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/generator-langium/langium-template/package.json
Expand Up @@ -45,6 +45,7 @@
"vscode-languageserver": "^7.0.0"
},
"devDependencies": {
"@types/node": "^14.17.3",
"@types/vscode": "^1.56.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-langium/langium-template/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES5",
"target": "ES6",
"module": "commonjs",
"lib": ["ESNext"],
"sourceMap": true,
Expand Down
16 changes: 6 additions & 10 deletions packages/generator-langium/src/index.ts
Expand Up @@ -34,13 +34,13 @@ class LangiumGenerator extends Generator {
type: 'input',
name: 'extensionName',
message: 'Your extension name:',
default: EXTENSION_NAME,
default: 'hello-world',
},
{
type: 'input',
name: 'rawLanguageName',
message: 'Your language name:',
default: LANGUAGE_NAME,
default: 'Hello World',
validate: (input: string): boolean | string =>
/^[a-zA-Z].*$/.test(input)
? true
Expand All @@ -51,7 +51,7 @@ class LangiumGenerator extends Generator {
name: 'fileExtensions',
message:
'File extensions of your language, separated by commas:',
default: FILE_EXTENSION,
default: '.hello',
validate: (input: string): boolean | string =>
/^\.?[a-z]+(\s*,\s*\.?[a-z]+)*$/.test(input)
? true
Expand Down Expand Up @@ -84,7 +84,7 @@ class LangiumGenerator extends Generator {
const languageName = _.upperFirst(
_.camelCase(this.answers.rawLanguageName)
);
const languageId = _.snakeCase(this.answers.rawLanguageName);
const languageId = _.kebabCase(this.answers.rawLanguageName);

this.sourceRoot(path.join(__dirname, TEMPLATE_DIR));
['.', '.vscode', '.eslintrc.json', '.vscodeignore'].forEach(
Expand Down Expand Up @@ -141,12 +141,8 @@ class LangiumGenerator extends Generator {
this.answers.extensionName
);

this.spawnCommand('npm', [
'run',
'--prefix',
extensionPath,
'langium:generate',
]);
this.spawnCommand('npm', ['install', '--prefix', extensionPath]);
this.spawnCommand('npm', ['run', '--prefix', extensionPath, 'langium:generate']);
this.spawnCommand('npm', ['run', '--prefix', extensionPath, 'build']);
}
}
Expand Down

0 comments on commit c12dea0

Please sign in to comment.