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 1
1
const fs = require ( 'fs' )
2
2
3
- module . exports = ( api ) => {
3
+ module . exports = ( api , options ) => {
4
4
api . extendPackage ( {
5
5
dependencies : {
6
6
'vue-extensionpoints' : '^0.1.4' ,
7
7
} ,
8
8
} )
9
- api . render ( './template' ) ;
9
+ api . render ( './template' , {
10
+ ...options ,
11
+ } ) ;
12
+ if ( options . addExample ) {
13
+ api . render ( './example' , {
14
+ ...options ,
15
+ } ) ;
16
+ }
10
17
11
18
// add import
12
19
api . injectImports ( api . entryFile ,
@@ -32,7 +39,7 @@ module.exports.hooks = (api) => {
32
39
const appPath = api . resolve ( 'src/App.vue' )
33
40
if ( fs . existsSync ( appPath ) ) {
34
41
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 ' )
36
43
fs . writeFileSync ( appPath , content )
37
44
}
38
45
} )
File renamed without changes.
Original file line number Diff line number Diff line change 9
9
//
10
10
// or, directly here:
11
11
//
12
- // var BarPlugin = {
12
+ // var FooPlugin = {
13
13
// hooks: {
14
- // "bar-hook ": [BarComponent, BeezComponent ]
14
+ // "plugins ": [FooComponent ]
15
15
// }
16
16
// }
17
17
18
18
export default {
19
19
// MyPlugin,
20
- // BarPlugin
20
+ // FooPlugin
21
21
}
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