Skip to content

Commit 3a7b69f

Browse files
committed
Optional parameter has a higher priority than defined version in package.json.
1 parent 62d543e commit 3a7b69f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/services/project-service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ export class ProjectService implements IProjectService {
7676
this.$logger.trace("Copying NativeScript hello world application into %s", appDirectory);
7777
appPath = defaultTemplatePath;
7878
}
79-
79+
80+
var tnsModulesVersion: string = null;
81+
// Optional parameter has a higher priority than defined version in package.json
82+
if (this.$options.tnsModulesVersion) {
83+
tnsModulesVersion = this.$options.tnsModulesVersion;
84+
}
85+
else {
86+
var coreModulesName = this.$tnsModulesService.NPM_TNS_CORE_MODULES_NAME;
87+
tnsModulesVersion = this.$fs.readJson(path.join(appPath, constants.PACKAGE_JSON_FILE_NAME)).wait()[coreModulesName]["version"];
88+
}
89+
8090
// Download tns-core-modules via npm and get destination file path
8191
var tnsModulesResourcePath = this.$tnsModulesService.tnsModulesInstallationPath(tnsModulesVersion).wait();
8292

0 commit comments

Comments
 (0)