-
-
Notifications
You must be signed in to change notification settings - Fork 197
Fix installation of tns-core-modules during project creation #2790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ export class ProjectService implements IProjectService { | |
private $projectHelper: IProjectHelper, | ||
private $projectNameService: IProjectNameService, | ||
private $projectTemplatesService: IProjectTemplatesService, | ||
private $staticConfig: IStaticConfig) { } | ||
private $staticConfig: IStaticConfig, | ||
private $npmInstallationManager: INpmInstallationManager) { } | ||
|
||
@exported("projectService") | ||
public async createProject(projectOptions: IProjectSettings): Promise<void> { | ||
|
@@ -50,10 +51,12 @@ export class ProjectService implements IProjectService { | |
|
||
await this.ensureAppResourcesExist(projectDir); | ||
|
||
let packageName = constants.TNS_CORE_MODULES_NAME; | ||
await this.$npm.install(packageName, projectDir, { save: true, "save-exact": true }); | ||
|
||
let templatePackageJsonData = this.getDataFromJson(templatePath); | ||
|
||
if (!(templatePackageJsonData && templatePackageJsonData.dependencies && templatePackageJsonData.dependencies[constants.TNS_CORE_MODULES_NAME])) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the Template contains the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
await this.$npmInstallationManager.install(constants.TNS_CORE_MODULES_NAME, projectDir, { dependencyType: "save" }); | ||
} | ||
|
||
this.mergeProjectAndTemplateProperties(projectDir, templatePackageJsonData); //merging dependencies from template (dev && prod) | ||
this.removeMergedDependencies(projectDir, templatePackageJsonData); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosen-vladimirov Isn't it more correct to install the correct version of the Template? I.e. if you install 3.0.0 template and you override the tns_core_modules, won't still there be a possibility that this 3.0.0 template doesn't work with them? For pure NS I don't know, but for NS+Angular I think it's likely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yyosifov the template versioning may differ and we also do not have control over the templates - basically everything is template.
Also the current code will install
tns-core-modules
only in case they are not defined in the template itself.