Skip to content

Commit

Permalink
Upgrade bojler to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmielnik committed Mar 13, 2023
1 parent b8d743f commit 0e730a0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
20 changes: 8 additions & 12 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { boil, BOILER_DIRECTORY, getTemplates, resolvePath } = require('bojler');
const path = require('path');
const { boil, BOILER_DIRECTORY, getTemplates, readTemplate } = require('../bojler');
const vscode = require('vscode');

exports.activate = (context) => {
Expand All @@ -18,26 +17,23 @@ exports.activate = (context) => {
return;
}

const template = await vscode.window.showQuickPick(templates, {
const templateFilename = await vscode.window.showQuickPick(templates, {
canPickMany: false,
title: 'Choose template',
});

if (typeof template === 'undefined') {
if (typeof templateFilename === 'undefined') {
return;
}

const name = await vscode.window.showInputBox({
prompt: 'Enter component name',
});
const template = readTemplate(templateFilename);
const parameters = {};

if (typeof name === 'undefined') {
return;
for (const [name, prompt] of Object.entries(template.parameters)) {
parameters[name] = await vscode.window.showInputBox({ prompt });
}

const folderPath = resolvePath(path.join(commandContext.path, name));

await boil(template, folderPath);
await boil(templateFilename, commandContext.path, parameters);
});

context.subscriptions.push(disposable);
Expand Down
45 changes: 23 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
}
},
"dependencies": {
"bojler": "^1.0.0"
"bojler": "^2.0.0"
}
}

0 comments on commit 0e730a0

Please sign in to comment.