File tree Expand file tree Collapse file tree 15 files changed +9088
-0
lines changed Expand file tree Collapse file tree 15 files changed +9088
-0
lines changed Original file line number Diff line number Diff line change 1+ node_modules /
Original file line number Diff line number Diff line change 1+ # nativescript-vue-cli-plugin
Original file line number Diff line number Diff line change 1+ module . exports = ( api , options , rootOptions ) => {
2+ const fs = require ( 'fs' )
3+ const rimraf = require ( 'rimraf' )
4+
5+ api . extendPackage ( {
6+ scripts : {
7+ 'watch:android' : 'vue-cli-service tns --android' ,
8+ 'watch:ios' : 'vue-cli-service tns --ios' ,
9+ } ,
10+ dependencies : {
11+ 'nativescript-vue' : '^1.3.1'
12+ } ,
13+ devDependencies : {
14+ 'nativescript-vue-loader' : '1.0.0' ,
15+ 'nativescript-vue-template-compiler' : '^1.3.1' ,
16+ }
17+ } )
18+
19+ api . extendPackage ( pkg => {
20+ delete pkg . dependencies [ 'vue' ]
21+ delete pkg . devDependencies [ 'vue-template-compiler' ]
22+ delete pkg . browserslist
23+ } )
24+
25+ api . render ( './templates/simple' )
26+
27+ // delete the "public" directory
28+ api . onCreateComplete ( ( ) => {
29+ const publicPath = api . resolve ( 'public' )
30+ if ( fs . existsSync ( publicPath ) ) {
31+ rimraf . sync ( publicPath )
32+ }
33+ } )
34+ }
Original file line number Diff line number Diff line change 1+ <%_ if (!rootOptions.router ) { _%>
2+ <template>
3+ <Page>
4+ <ActionBar title="NativeScript-Vue"/>
5+ <GridLayout rows="auto, auto">
6+ <Image src="./assets/logo.png" row="0" />
7+ <HelloWorld msg="Welcome to Your Vue.js App" row="1" />
8+ </GridLayout>
9+ </Page>
10+ </template>
11+
12+ <script>
13+ import HelloWorld from './components/HelloWorld.vue'
14+
15+ export default {
16+ name: 'app',
17+ components: {
18+ HelloWorld
19+ }
20+ }
21+ </script>
22+ <%_ } else { _%>
23+ <template>
24+ <Page>
25+ <ActionBar title="NativeScript-Vue"/>
26+ <GridLayout rows="auto, auto, *">
27+ <Button text="Home" @tap="$router.replace('/')" />
28+ <Button text="About" @tap="$router.replace('/about')" />
29+
30+ <router-view row="2" />
31+ </GridLayout>
32+ </Page>
33+ </template>
34+ <%_ } _%>
35+
36+ <%_ if (rootOptions.cssPreprocessor !== 'stylus') { _%>
37+ <style<%-
38+ rootOptions.cssPreprocessor
39+ ? ` lang="${
40+ rootOptions.cssPreprocessor === 'sass'
41+ ? 'scss'
42+ : rootOptions.cssPreprocessor
43+ }"`
44+ : ``
45+ %>>
46+ ActionBar {
47+ color: #42b983;
48+ }
49+ </style>
50+ <%_ } else { _%>
51+ <style lang="stylus">
52+ ActionBar
53+ color #42b983
54+ </style>
55+ <%_ } _%>
Original file line number Diff line number Diff line change 1+ <template >
2+ <GridLayout >
3+ <Label class =" message" :text =" msg" row =" 0" />
4+ </GridLayout >
5+ </template >
6+
7+ <script >
8+ export default {
9+ name: ' HelloWorld' ,
10+ props: {
11+ msg: String
12+ }
13+ }
14+ </script >
15+
16+ <!-- Add "scoped" attribute to limit CSS to this component only -->
17+ <%_ if (rootOptions.cssPreprocessor !== 'stylus') { _%>
18+ <style scoped<%-
19+ rootOptions.cssPreprocessor
20+ ? ` lang="${
21+ rootOptions.cssPreprocessor === 'sass'
22+ ? 'scss'
23+ : rootOptions.cssPreprocessor
24+ }"`
25+ : ``
26+ %>>
27+ .message {
28+ color: #42b983;
29+ }
30+ </style>
31+ <%_ } else { _%>
32+ <style scoped lang="stylus">
33+ .message
34+ color #42b983
35+ </style>
36+ <%_ } _%>
Original file line number Diff line number Diff line change 1+ -- -
2+ extend : '@vue/cli-service/generator/template/src/main.js'
3+ replace:
4+ - ! ! js / regexp / import Vue from 'vue' /
5+ - ! ! js / regexp / Vue . config . productionTip = false /
6+ - ! ! js / regexp / } \)\.\$mount \('app' \)/
7+ -- -
8+
9+ < % # REPLACE % >
10+ import Vue from 'nativescript-vue'
11+ < % # END_REPLACE % >
12+
13+ < % # REPLACE % >
14+ // Set the following to `true` to hide the logs created by nativescript-vue
15+ Vue.config.silent = false
16+ < % # END_REPLACE % >
17+
18+ < % # REPLACE % >
19+ } ) . $start ( )
20+ < % # END_REPLACE % >
Original file line number Diff line number Diff line change 1+ -- -
2+ extend : '@vue/cli-service/generator/template/src/router.js'
3+ replace :
4+ - ! ! js / regexp / import Vue from 'vue' /
5+ -- -
6+
7+ < % # REPLACE % >
8+ import Vue from 'nativescript-vue'
9+ < % # END_REPLACE % >
Original file line number Diff line number Diff line change 1+ -- -
2+ extend : '@vue/cli-service/generator/template/src/store.js'
3+ replace :
4+ - ! ! js / regexp / import Vue from 'vue' /
5+ -- -
6+
7+ < % # REPLACE % >
8+ import Vue from 'nativescript-vue'
9+ < % # END_REPLACE % >
Original file line number Diff line number Diff line change 1+ <%_ if (rootOptions.router ) { _%>
2+ <template>
3+ <GridLayout>
4+ <Label text="This is an about page" textWrap="true" />
5+ </GridLayout>
6+ </template>
7+ <%_ } _%>
You can’t perform that action at this time.
0 commit comments