Skip to content

Commit

Permalink
fix template
Browse files Browse the repository at this point in the history
  • Loading branch information
Danzo7 authored Feb 15, 2021
1 parent f397638 commit 854f4f9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can use default templates to generate components
The default templates ais opinionated, admittedly. They adhere to the principles of feature-based structuring, as promoted in this article by Max Stoiber.
>You dont have to use the default templates and you should'nt.
## Costumize templates
## Customize templates
You can use a costum template boilerplate to generate your component just by adding a confguration file to the root folder.
create a file in the root folder and name it `components-boilerplate.js`
use this syntax `[string=path,string=content][]`
Expand All @@ -46,7 +46,7 @@ Use the backtick \`` to avoid the missmatching
'{{componentName}}.tsx',
`
import React from 'react';
import './styles/index{{StyleExtension}}';
import './index.scss';
interface {{componentName}} {
}
Expand All @@ -67,11 +67,18 @@ Use the backtick \`` to avoid the missmatching
export default {{componentName}};
`,
],
['style/index.scss', ``],
[
'index.scss',
`.{{componentName}}{
}`,
],
];
```
## report issues an featues
[create an issue](https://github.com/Danzo7/vscode-components-boilerplate/issues)
## Roadmap
- add suppoet for multiple templates
- add support for multiple cases (now only name)
- add support for multiple costum boilerplates
- add support for costum variables (now only name)
- add more templates
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vm=require('vm');
fs=require("fs");
test=vm.runInThisContext(fs.readFileSync("test.js", 'utf8'));
console.log(test);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "components-boilerplate",
"displayName": "Components boilerplate",
"description": "generate component folders and files, reactJs, vueJS ...etc, based on predefined or custom hierarchy",
"version": "0.1.1",
"version": "0.1.2",
"publisher": "Danzo7",
"engines": {
"vscode": "^1.52.0"
Expand Down
2 changes: 1 addition & 1 deletion src/component-boilerplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const options:IOption =
"{{componentName}}.tsx",
`
import React from 'react';
import './styles/index{{StyleExtension}}';
import './styles/index';
interface {{componentName}} {
}
Expand Down
7 changes: 4 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const excute = ({fsPath}: { fsPath: string; }) => {
validateInput: validate,
ignoreFocusOut: true
};

window.showQuickPick


window.showInputBox(componentNameOptions).then(componentName => {
Expand All @@ -42,8 +42,9 @@ const excute = ({fsPath}: { fsPath: string; }) => {
"styling":workspace.getConfiguration().get("componentBoiler.component.Styling"),
"storybook":workspace.getConfiguration().get("componentBoiler.component.StoryBook")
};
console.log("config: "+config);
buildTemplate([componentName], componentFolder,workspace.workspaceFolders[0].uri.path,config);
console.log("config: " + config);

buildTemplate([componentName], componentFolder,workspace.workspaceFolders[0].uri.path,config,);
window.showInformationMessage(componentName+" component has been created under "+componentFolder);

}
Expand Down

0 comments on commit 854f4f9

Please sign in to comment.