Skip to content

Commit cd93956

Browse files
Gary GambillGary Gambill
authored andcommitted
updated dependencies
fixed hmr bug
1 parent 4d7a265 commit cd93956

File tree

4 files changed

+203
-156
lines changed

4 files changed

+203
-156
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ An example of this would be the following Vue component:
5353
```
5454

5555
### Optional Separation of concerns for Web and Native SFC's
56-
If you want complete seperation of concerns between Web and Native for components, core logic and styling, you can also provide an alternate file naming scheme in your project. The name will dictate which mode (Web or Native) and platform (Android or IOS) the file will be used with. The same overall schema will work for `.vue`, `.js`, `.ts`, `.scss` and `.css` files.
56+
If you want complete seperation of concerns between Web and Native for components, core logic and styling, you can also provide an alternate file naming scheme in your project. The name will dictate which mode (Web or Native) and platform (Android or IOS) the file will be used with. The same overall schema will work for `.vue`, `.js`, `.ts`, `.scss`, `.css`, `.styl`, and `.less` files.
5757

5858
| File Type | Android __and__ IOS | Android only | IOS only | Web only |
5959
| ---------- | ------------------- | --------------- | --------------- | --------------- |
@@ -62,6 +62,8 @@ If you want complete seperation of concerns between Web and Native for component
6262
| ts | *.native.ts | *.android.ts | *.ios.ts | *.ts |
6363
| scss | *.native.scss | *.android.scss | *.ios.scss | *.scss |
6464
| css | *.native.css | *.android.css | *.ios.css | *.css |
65+
| stylus | *.native.styl | *.android.styl | *.ios.styl | *.styl |
66+
| less | *.native.less | *.android.less | *.ios.less | *.less |
6567

6668
Webpack will handle figuring out which files to include based on the `npm run` command syntax you pass in. You can also mix and match this file naming schema with the `web` or `native` tag options mentioned above.
6769

@@ -204,10 +206,12 @@ You should be able to use the NativeScript Playground and Preview Apps via the f
204206
1. `npm run preview:android`
205207
2. `npm run preview:ios`
206208

207-
#### --env command line recognition
209+
#### --env & --hmr command line recognition
208210
Basic support for passing the `env` command line option is in place, but has a slightly different syntax since we're working with the CLI 3 webpack infrastructure. To inject items into `env` at run-time, you will need to add `-- --env.option` Where option is one of the recognized options that Nativescript-Vue and this project supports.
209211
An example of this would be something like this: `npm run serve:android -- --env.production`. This would allow you to serve up a Production build of your Android app versus just running `npm run serve:android` which would serve a Development version of the same.
210212

213+
HMR will also work by passing in `-- --hmr`. An example of this would be `npm run serve:android -- --hmr`
214+
211215
#### Webpack related information
212216
The options passed in at `npm run` will dictate what webpack config is provided. The first choice webpack will make is if this is a `web` or `native` environment. Then, if it's a `native` environment, it will determine choices to be made between `ios` and `android`.
213217

generator/index.js

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ module.exports = async (api, options, rootOptions) => {
5454
nativescript: {
5555
id: 'org.nativescript.application',
5656
'tns-ios': {
57-
version: '5.2.0'
57+
version: '5.4.0'
5858
},
5959
'tns-android': {
60-
version: '5.2.1'
60+
version: '5.4.0'
6161
}
6262
},
6363
scripts: {
@@ -78,12 +78,12 @@ module.exports = async (api, options, rootOptions) => {
7878
'clean:ios': 'rimraf platforms/ios'
7979
},
8080
dependencies: {
81-
'nativescript-vue': '^2.2.0',
82-
'tns-core-modules': '^5.2.2'
81+
'nativescript-vue': '^2.2.2',
82+
'tns-core-modules': '^5.4.1'
8383
},
8484
devDependencies: {
85-
'nativescript-dev-webpack': '^0.20.3',
86-
'nativescript-vue-template-compiler': '^2.2.0',
85+
'nativescript-dev-webpack': '^0.22.0',
86+
'nativescript-vue-template-compiler': '^2.2.2',
8787
'nativescript-worker-loader': '~0.9.5',
8888
'node-sass': '^4.11.0',
8989
'string-replace-loader': '^2.1.1',
@@ -127,8 +127,8 @@ module.exports = async (api, options, rootOptions) => {
127127
api.extendPackage({
128128
dependencies: {},
129129
devDependencies: {
130-
'fork-ts-checker-webpack-plugin': '^1.0.0',
131-
'terser-webpack-plugin': '^1.2.3'
130+
'fork-ts-checker-webpack-plugin': '^1.3.4',
131+
'terser-webpack-plugin': '^1.3.0'
132132
//'tns-platform-declarations': '^4.2.1'
133133
}
134134
});
@@ -138,7 +138,7 @@ module.exports = async (api, options, rootOptions) => {
138138
api.extendPackage({
139139
dependencies: {},
140140
devDependencies: {
141-
'@babel/types': '^7.4.0'
141+
'@babel/types': '^7.4.4'
142142
}
143143
});
144144
}
@@ -148,10 +148,10 @@ module.exports = async (api, options, rootOptions) => {
148148
if (api.hasPlugin('babel')) {
149149
api.extendPackage({
150150
devDependencies: {
151-
'@babel/core': '^7.4.0',
152-
'@babel/preset-env': '^7.4.1',
153-
'babel-loader': '^8.0.5',
154-
'@babel/traverse': '^7.4.0'
151+
'@babel/core': '^7.4.5',
152+
'@babel/preset-env': '^7.4.5',
153+
'babel-loader': '^8.0.6',
154+
'@babel/traverse': '^7.4.5'
155155
}
156156
});
157157

@@ -845,10 +845,7 @@ const renderDirectoryStructure = (module.exports.renderDirectoryStructure = asyn
845845
) => {
846846
try {
847847
const files = new Array();
848-
const baseDir = await extractCallDir();
849-
console.log('baseDir - ', baseDir);
850-
const _files = await getAllFilesInDirStructure(srcPathPrefix, baseDir);
851-
console.log('_files - ', _files);
848+
const _files = await getAllFilesInDirStructure(srcPathPrefix, __dirname);
852849

853850
for (const rawPath of _files) {
854851
// // // let filename = path.basename(rawPath);
@@ -902,28 +899,41 @@ const renderDirectoryStructure = (module.exports.renderDirectoryStructure = asyn
902899
}
903900
});
904901

905-
// extract callsite file location using error stack
906-
const extractCallDir = (module.exports.extractCallDir = () => {
907-
try {
908-
const obj = {};
909-
Error.captureStackTrace(obj);
910-
const callSite = obj.stack.split('\n')[3];
911-
console.log('callSite - ', callSite);
912-
913-
let { fileName } = /(?<fileName>[^(]+):[0-9]+:[0-9]+/.exec(callSite).groups;
914-
console.log('fileName - ', fileName);
915-
916-
if (fileName.indexOf('file') >= 0) {
917-
fileName = new URL(fileName).pathname;
918-
}
919-
let dirname = path.dirname(fileName);
920-
console.log('dirname - ', dirname);
921-
922-
return dirname;
923-
} catch (err) {
924-
throw err;
925-
}
926-
});
902+
// THIS FUNCTION MAY NOT LONGER BE NEEDED AS OF 0.0.16
903+
// WILL KEEP THIS COMMENTED OUT CODE IN FOR A FEW OF RELEASES
904+
// // extract callsite file location using error stack
905+
// const extractCallDir = (module.exports.extractCallDir = () => {
906+
// try {
907+
// const obj = {};
908+
// console.log('__dirname - ', __dirname);
909+
// Error.captureStackTrace(obj);
910+
// const callSite = obj.stack.split('\n')[3];
911+
// console.log('callSite - ', callSite);
912+
913+
// let { fileName } = /(?<fileName>[^(]+):[0-9]+:[0-9]+/.exec(callSite).groups;
914+
// console.log('fileName 1 - ', fileName);
915+
916+
// if (fileName.indexOf('file') >= 0) {
917+
// fileName = new URL(fileName).pathname;
918+
// }
919+
920+
// if (fileName.indexOf(fileName.length - 1) === ')') {
921+
// fileName = fileName.splice(0, fileName.length - 1);
922+
// }
923+
924+
// console.log(`fileName 2 - '`, fileName + `'`);
925+
926+
// fileName = fileName.replace('at ', '');
927+
// console.log(`fileName 3 - '`, fileName) + `'`;
928+
929+
// let dirname = path.dirname(fileName);
930+
// console.log(`dirname - '`, dirname + `'`);
931+
932+
// return __dirname;
933+
// } catch (err) {
934+
// throw err;
935+
// }
936+
// });
927937

928938
// utility function used to get all the files in a directory structure. is recursive in nature due to globby
929939
const getAllFilesInDirStructure = (module.exports.replaceInFile = async (srcPathPrefix, baseDir) => {

0 commit comments

Comments
 (0)