File tree 6 files changed +76
-0
lines changed
6 files changed +76
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Vue CLI plugin for UI5-Webcomponents
2
+
Original file line number Diff line number Diff line change
1
+ let ui5 = `\nVue.config.ignoredElements = [/^ui5-/];` ;
2
+
3
+ module . exports = ( api , opts , rootOptions ) => {
4
+ api . extendPackage ( {
5
+ dependencies : {
6
+ "@ui5/webcomponents" : "^0.9.0"
7
+ }
8
+ } ) ;
9
+ if ( opts . addExample ) {
10
+ api . render ( './template' , {
11
+ ...opts ,
12
+ } ) ;
13
+ }
14
+ api . onCreateComplete ( ( ) => {
15
+ // inject to main.js
16
+ const fs = require ( 'fs' ) ;
17
+ const ext = api . hasPlugin ( 'typescript' ) ?
18
+ 'ts' :
19
+ 'js' ;
20
+ const mainPath = api . resolve ( `./src/main.${ ext } ` ) ;
21
+ // get content
22
+ let contentMain = fs . readFileSync ( mainPath , {
23
+ encoding : 'utf-8'
24
+ } ) ;
25
+ const lines = contentMain
26
+ . split ( / \r ? \n / g)
27
+ . reverse ( ) ;
28
+
29
+ // inject import
30
+ const lastImportIndex = lines . findIndex ( line => line . match ( / ^ i m p o r t / ) ) ;
31
+ lines [ lastImportIndex ] += ui5 ;
32
+
33
+ // modify app
34
+ contentMain = lines
35
+ . reverse ( )
36
+ . join ( '\n' ) ;
37
+ fs . writeFileSync ( mainPath , contentMain , {
38
+ encoding : 'utf-8'
39
+ } ) ;
40
+ } ) ;
41
+ }
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <ui5-button >Button</ui5-button >
3
+ </template >
4
+ <script >
5
+ import " @ui5/webcomponents/dist/Button" ;
6
+ export default {};
7
+ </script >
8
+
Original file line number Diff line number Diff line change
1
+ module . exports = ( api , opts ) => { }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " vue-cli-plugin-ui5-webcomponents" ,
3
+ "version" : " 0.0.1" ,
4
+ "description" : " " ,
5
+ "main" : " index.js" ,
6
+ "repository" : {
7
+ "type" : " git" ,
8
+ "url" : " git+https://github.com/CodesOfRa/vue-cli-plugin-ui5-webcomponents.git"
9
+ },
10
+ "keywords" : [
11
+ " vue" ,
12
+ " vue-cli" ,
13
+ " ui5"
14
+ ],
15
+ "author" : " Ramona Biscoveanu" ,
16
+ "license" : " ISC" ,
17
+ "homepage" : " https://github.com/CodesOfRa/vue-cli-plugin-ui5-webcomponents#readme"
18
+ }
Original file line number Diff line number Diff line change
1
+ module . exports = [ {
2
+ name : `addExample` ,
3
+ type : 'confirm' ,
4
+ message : 'Do you want to add an example component to components folder?' ,
5
+ default : false
6
+ } ] ;
You can’t perform that action at this time.
0 commit comments