diff --git a/README.md b/README.md index 3200f7b..6d9d65e 100644 --- a/README.md +++ b/README.md @@ -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][]` @@ -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}} { } @@ -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) \ No newline at end of file +- add support for multiple costum boilerplates +- add support for costum variables (now only name) +- add more templates \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..012cd81 --- /dev/null +++ b/index.js @@ -0,0 +1,4 @@ +vm=require('vm'); +fs=require("fs"); +test=vm.runInThisContext(fs.readFileSync("test.js", 'utf8')); +console.log(test); \ No newline at end of file diff --git a/package.json b/package.json index e2b57ae..2265de6 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/component-boilerplate.ts b/src/component-boilerplate.ts index cad7f9a..b10b1b4 100644 --- a/src/component-boilerplate.ts +++ b/src/component-boilerplate.ts @@ -26,7 +26,7 @@ const options:IOption = "{{componentName}}.tsx", ` import React from 'react'; - import './styles/index{{StyleExtension}}'; + import './styles/index'; interface {{componentName}} { } diff --git a/src/extension.ts b/src/extension.ts index f8f6c79..be7cc39 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -25,7 +25,7 @@ const excute = ({fsPath}: { fsPath: string; }) => { validateInput: validate, ignoreFocusOut: true }; - + window.showQuickPick window.showInputBox(componentNameOptions).then(componentName => { @@ -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); }