Skip to content

Commit 4dec542

Browse files
Merge pull request #12 from nativescript-vue/dev
Fix #9 & Fix #11
2 parents 86b9c5a + 80cc51b commit 4dec542

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

generator/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,13 @@ const extractCallDir = (module.exports.extractCallDir = () => {
904904
try {
905905
const obj = {};
906906
Error.captureStackTrace(obj);
907-
return path.dirname(obj.stack.split('\n')[3].match(/\s\((.*):\d+:\d+\)$/)[1]);
907+
const callSite = obj.stack.split('\n')[3];
908+
let { fileName } = /(?<fileName>[^(\s]+):[0-9]+:[0-9]+/.exec(callSite).groups;
909+
if (fileName.indexOf('file') >= 0) {
910+
fileName = new URL(fileName).pathname;
911+
}
912+
let dirname = path.dirname(fileName);
913+
return dirname;
908914
} catch (err) {
909915
throw err;
910916
}

generator/templates/nvw/src/App.vue

+5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
<%_ } else if (!usingTS && !rootOptions.router) { _%>
7171
<%# -------------------- IS NOT Using TypeScript AND IS NOT Using vue-router -------------------- -%>
7272
<script>
73+
import HelloWorld from './components/HelloWorld';
74+
7375
const { VUE_APP_MODE, VUE_APP_PLATFORM } = process.env;
7476

7577
export default {
@@ -79,6 +81,9 @@
7981
msg: `Mode=${VUE_APP_MODE} and Platform=${VUE_APP_PLATFORM}`,
8082
};
8183
},
84+
components: {
85+
HelloWorld,
86+
},
8287
};
8388
</script>
8489
<%_ } else if (usingTS && rootOptions.router) { _%>

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"preversion": "npm test",
1818
"version": "git add -A",
1919
"postversion": "git push --tags origin master",
20-
"prep": "npm version patch -m \"build %s\""
20+
"prep:patch": "npm version patch -m \"build %s\"",
21+
"prep:minor": "npm version minor -m \"build %s\"",
22+
"prep:major": "npm version major -m \"build %s\""
2123
},
2224
"author": "Igor Randjelovic",
2325
"license": "MIT",

0 commit comments

Comments
 (0)