-
-
Notifications
You must be signed in to change notification settings - Fork 197
Use tns_modules from npm #805
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
Conversation
Can one of the admins verify this patch? |
@@ -1,3 +1,8 @@ | |||
interface ITNSModulesService { | |||
tnsModulesInstallationPath(projectRoot: string): IFuture<string>; | |||
NPM_TNS_CORE_MODULES_NAME: string; |
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.
The convention for property names is to use camelCase
.
The build fails executing unit tests with |
///<reference path="../.d.ts"/> | ||
"use strict"; | ||
|
||
import util = require("util"); |
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.
Consider using ES2015 style imports where possible
I'm not sure that the currently implemented workflow is the right one. The process should be like:
|
import path = require("path"); | ||
import shell = require("shelljs"); | ||
import npm = require("npm"); | ||
var helpers = require("../common/helpers"); |
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.
You can import
here. By the way, are these imports used? If not, you can remove them.
Consider writing unit tests for TNSModulesService. |
abea2b7
to
3a7b69f
Compare
} | ||
else { | ||
let coreModulesName = this.$tnsModulesService.npmTnsCoreModulesName; | ||
tnsModulesVersion = this.$fs.readJson(path.join(appPath, constants.PACKAGE_JSON_FILE_NAME)).wait()[coreModulesName]["version"]; |
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.
Consider using $projectDataService
instead readJson
bcaba8b
to
6215768
Compare
@@ -111,6 +113,9 @@ export class ProjectService implements IProjectService { | |||
|
|||
this.$projectDataService.initialize(projectDir); | |||
this.$projectDataService.setValue("id", projectId).wait(); | |||
//Start child process because --save --save-exact option is necessary when installing tns-core-modules | |||
//in order to create "dependencies" key in package.json. | |||
this.$childProcess.exec("npm install " + constants.TNS_CORE_MODULES_NAME + " --save --save-exact", { cwd: projectDir }).wait(); |
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.
Should it be better to use INodePackageManager
and expose this functionality there?
13761a1
to
f768c15
Compare
I will squash all commits right before merging this pull request. |
@@ -75,6 +75,11 @@ export class DestCopy implements IBroccoliPlugin { | |||
if(isPlugin) { | |||
this.$pluginsService.prepare(dependency).wait(); | |||
} | |||
|
|||
if (dependency.name == constants.TNS_CORE_MODULES_NAME) { |
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.
Use ===
instead ==
34067fe
to
1f1543d
Compare
let tnsModulesVersion: string = this.$options.tnsModulesVersion; | ||
let packageName: string = constants.TNS_CORE_MODULES_NAME; | ||
if (tnsModulesVersion) { | ||
packageName = packageName.concat("@" + tnsModulesVersion); |
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.
You can use packageName = ${packageName}@${tnsModulesVersion}
c028a0e
to
2a68d08
Compare
2a68d08
to
6d56327
Compare
this.$broccoliBuilder.prepareNodeModules(tnsModulesDestinationPath, this.$projectData.projectDir, platform, lastModifiedTime).wait(); | ||
} catch(error) { | ||
this.$logger.debug(error); | ||
this.$logger.error("Processing tns core modules failed."); |
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.
This is user visible error. Consider at least showing the users the actual error. This way, they have a chance to understand what went wrong.
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.
The error might be produced while processing some other module or plugin. It is not obligatory to be produced while "Processing tns core modules"
👍 after addressing my small remark and a green build. |
@@ -111,6 +112,14 @@ export class ProjectService implements IProjectService { | |||
|
|||
this.$projectDataService.initialize(projectDir); | |||
this.$projectDataService.setValue("id", projectId).wait(); | |||
|
|||
let tnsModulesVersion: string = this.$options.tnsModulesVersion; | |||
let packageName: string = constants.TNS_CORE_MODULES_NAME; |
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.
You do not need to specify the variable type.
6d56327
to
d906519
Compare
d906519
to
8f9283c
Compare
Use npm to fetch tns-core-modules package.
Create tns_modules folder from tns-core-modules package.
See issue #390