File tree Expand file tree Collapse file tree 7 files changed +51
-6
lines changed
Expand file tree Collapse file tree 7 files changed +51
-6
lines changed Original file line number Diff line number Diff line change 1+ // plugins.js
2+
3+ // this file should be generated automatically by your plugin system
4+ // It should export a default object which contains plugins.
5+ // A plugin is a named index of "hooks" pointing to a list of Vue components
6+ // implementing that hook.
7+
8+ import MyPlugin from '@/plugins/myplugin'
9+ //
10+ // or, directly here:
11+ //
12+ // var FooPlugin = {
13+ // hooks: {
14+ // "plugins": [FooComponent]
15+ // }
16+ // }
17+
18+ export default {
19+ MyPlugin,
20+ // FooPlugin
21+ }
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ Greetings from the Foo plugin!
4+ </div >
5+ </template >
Original file line number Diff line number Diff line change 1+ import FooComponent from './components/FooComponent.vue'
2+ export default {
3+ hooks : [ FooComponent ]
4+ }
Original file line number Diff line number Diff line change 11const fs = require ( 'fs' )
22
3- module . exports = ( api ) => {
3+ module . exports = ( api , options ) => {
44 api . extendPackage ( {
55 dependencies : {
66 'vue-extensionpoints' : '^0.1.4' ,
77 } ,
88 } )
9- api . render ( './template' ) ;
9+ api . render ( './template' , {
10+ ...options ,
11+ } ) ;
12+ if ( options . addExample ) {
13+ api . render ( './example' , {
14+ ...options ,
15+ } ) ;
16+ }
1017
1118 // add import
1219 api . injectImports ( api . entryFile ,
@@ -32,7 +39,7 @@ module.exports.hooks = (api) => {
3239 const appPath = api . resolve ( 'src/App.vue' )
3340 if ( fs . existsSync ( appPath ) ) {
3441 let content = fs . readFileSync ( appPath , { encoding : 'utf8' } )
35- content = content . replace ( / H e l l o W o r l d / gi, 'ExtensionpointExample ' )
42+ content = content . replace ( / H e l l o W o r l d \b / gi, 'HelloWorldWithPlugins ' )
3643 fs . writeFileSync ( appPath , content )
3744 }
3845 } )
File renamed without changes.
Original file line number Diff line number Diff line change 99//
1010// or, directly here:
1111//
12- // var BarPlugin = {
12+ // var FooPlugin = {
1313// hooks: {
14- // "bar-hook ": [BarComponent, BeezComponent ]
14+ // "plugins ": [FooComponent ]
1515// }
1616// }
1717
1818export default {
1919 // MyPlugin,
20- // BarPlugin
20+ // FooPlugin
2121}
Original file line number Diff line number Diff line change 1+ module . exports = [
2+ {
3+ name : `addExample` ,
4+ type : 'confirm' ,
5+ message : 'Add example plugin/components?' ,
6+ default : false ,
7+ } ,
8+ ] ;
You can’t perform that action at this time.
0 commit comments