Skip to content

Commit

Permalink
Update plugin for router conf°
Browse files Browse the repository at this point in the history
Related to vue cli v4 and the use of @vue/cli-plugin-router
  • Loading branch information
mdartic committed Nov 11, 2019
1 parent e13ae2c commit a51f909
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you want to add additional templates to the plugin, then here's the informati
* The directory name should __exactly match__ the value from #1. For example if the value from #1 is `simple`, then the directory structure would be `/generator/templates/simple`
3. The new template directory __must__ have a single first-level subdirectory named `src`.
4. Inside the `src` directory, you should add the following in an effort to give the template feature consistancy to the other templates:
* router.js
* router/index.js
* main.js
* main.native.js (the NS-Vue project entry point)
* package.json (this is the standard NativeScript-Vue package.json file. Just copy/paste from the simple template)
Expand Down
2 changes: 1 addition & 1 deletion generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ module.exports = async (api, options, rootOptions) => {

// remove router config for projects that don't use vue-router
if (!rootOptions.router) {
fs.remove(genConfig.dirPathPrefix + genConfig.nativeAppPathModifier + 'router' + genConfig.jsOrTs, (err) => {
fs.remove(genConfig.dirPathPrefix + genConfig.nativeAppPathModifier + 'router/index' + genConfig.jsOrTs, (err) => {
if (err) throw err;
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
extend: '@vue/cli-service/generator/router/template/src/router.js'
extend: '@vue/cli-plugin-router/generator/template/src/router/index.js'
replace:
- !!js/regexp /import Vue from 'vue'/
- !!js/regexp /import Router from 'vue-router'/
- !!js/regexp /Vue.use\(Router\)/
- !!js/regexp /import Home from './views/Home.vue'/
- !!js/regexp /'./views/About.vue'\)/
- !!js/regexp /import Home from '../views/Home.vue'/
- !!js/regexp /'../views/About.vue'\)/
- !!js/regexp /\}\)/
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
extend: '@vue/cli-service/generator/router/template/src/router.js'
extend: '@vue/cli-plugin-router/generator/template/src/router/index.js'
replace:
- !!js/regexp /import Vue from 'vue'/
- !!js/regexp /import Router from 'vue-router'/
- !!js/regexp /Vue.use\(Router\)/
- !!js/regexp /export default new Router\(\{/
- !!js/regexp /import Home from '\./views/Home.vue'/
- !!js/regexp /\(\) => import(.*)\.\/views\/About\.vue'\)/
- !!js/regexp /import Home from '\.\./views/Home.vue'/
- !!js/regexp /\(\) => import(.*)\.\.\/views\/About\.vue'\)/
- !!js/regexp /(\s+)\/\/ (.*)/
- !!js/regexp /(\s+)\/\/ (.*)/
- !!js/regexp /(\s+)\/\/ (.*)/
Expand Down

0 comments on commit a51f909

Please sign in to comment.