-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(install): 1. and 3. phase from design docs #294
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
3c8b2c6
to
65ac052
Compare
no tests? :) |
Not yet :-) |
uninstallProcedure: function() { | ||
const that = this; | ||
|
||
return that.removeFromPackageJSON(that.package) |
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 goal of promises was to avoid this kind of thing :) you can simplify this like this:
return that.removeFromPackageJSON(that.package)
.then(() => that.npmUninstall(that.package))
.then(() => that.unlinkPackage(that.package))
.then(() => that.removeFromSystemJSConfig(that.package))
.then(() => {
that.ui.stopProgress();
if (that.typings) {
that.ui.startProgress(chalk.green('Uninstalling typings:', chalk.yellow(that.typings)), chalk.green('.'));
return that.typingsUninstall(that.typings)
}
})
.then(() => {
that.ui.stopProgress();
that.announceOKCompletion();
});
This uses both the fact that the arrow function returns the value if you don't put it in a block, and that a promise executor returns a promise.
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.
thanks Ciro.
2768925
to
2b01261
Compare
this.ui.writeLine(chalk.red(this.completionErrorMessage)); | ||
}, | ||
|
||
existsSync: function(path) { |
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 seems unused.
@@ -0,0 +1,8 @@ | |||
var systemConfig = { |
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.
Could you use System.config(...)
here directly?
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.
Sure, its nicer. Done.
@@ -0,0 +1 @@ | |||
addon/ng2/blueprints/ng2/files/src/config/system.config.js |
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.
Why do we want to ignore that single file? It seems like it should be linted.
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.
Because of the double quotes which are mandatory for JSON.parse
in systemjs-helper.ts
.
cf22ff9
to
7318c0d
Compare
return new Promise(resolve => { | ||
let promises = []; | ||
|
||
that.packages.forEach(p => { |
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 sounds more like a map()
than a forEach()
.
387b3d5
to
319cb3a
Compare
this.packages = this.packages.filter(p => !/node-sass|stylus|less|compass-importer/.test(p)); | ||
let typingsList = []; | ||
|
||
return new Promise(resolve => { |
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 don't need that, just return Promise.all(...).then(...)
. then()
returns a Promise.
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.
Thanks, updated.
} | ||
|
||
compile(fileName, inputPath, outputPath) { | ||
return new Promise(resolve => { |
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 do something like this to simplify:
compile(fileName, inputPath, outputPath) {
let content = fs.readFileSync(fileName, 'utf8');
return less.render(content)
.then(output => {
let filePath = fileName.replace(inputPath, outputPath).replace(/\.less$/, '.css');
fse.outputFileSync(filePath, output.css, 'utf8');
});
}
please do that for all compile()
functions :)
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.
Fixed.
Closing this. If nothing else, I learned something from this PR :-) Thanks @hansl! |
@jkuri Do I understand it correct, that this did not make it into the master? And if so - why?! 😳 I think this a super essential feature and many people are looking forward to it... |
We had some problems with typings. This will be implemented but cannot tell you when because I don't know it myself :) If you are interested for sass/less support you can follow it here, the rest of the things from design docs will follow later. |
Oh, ok - that's sad to hear :/ so to use 3rd party libraries like ngrx we still need to copy the sources to the project? |
Unfortunately yes |
I just want to clarify that you don't need to copy files to your project We are working on the production build story to use CDN versions of those On Mon, Apr 4, 2016 at 10:41 AM, Jan Kuri [email protected] wrote:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Install example:
ng install moment --typings moment-node
Uninstall examle:
ng uninstall lodash --typings lodash