feat(install): 1. and 3. phase from design docs#294
feat(install): 1. and 3. phase from design docs#294jkuri wants to merge 6 commits intoangular:masterfrom
Conversation
3c8b2c6 to
65ac052
Compare
|
no tests? :) |
|
Not yet :-) |
addon/ng2/tasks/uninstall.js
Outdated
| uninstallProcedure: function() { | ||
| const that = this; | ||
|
|
||
| return that.removeFromPackageJSON(that.package) |
There was a problem hiding this comment.
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.
2768925 to
2b01261
Compare
addon/ng2/tasks/uninstall.js
Outdated
| this.ui.writeLine(chalk.red(this.completionErrorMessage)); | ||
| }, | ||
|
|
||
| existsSync: function(path) { |
| @@ -0,0 +1,8 @@ | |||
| var systemConfig = { | |||
There was a problem hiding this comment.
Could you use System.config(...) here directly?
There was a problem hiding this comment.
Sure, its nicer. Done.
| @@ -0,0 +1 @@ | |||
| addon/ng2/blueprints/ng2/files/src/config/system.config.js | |||
There was a problem hiding this comment.
Why do we want to ignore that single file? It seems like it should be linted.
There was a problem hiding this comment.
Because of the double quotes which are mandatory for JSON.parse in systemjs-helper.ts.
cf22ff9 to
7318c0d
Compare
addon/ng2/tasks/install.ts
Outdated
| return new Promise(resolve => { | ||
| let promises = []; | ||
|
|
||
| that.packages.forEach(p => { |
There was a problem hiding this comment.
This sounds more like a map() than a forEach().
387b3d5 to
319cb3a
Compare
addon/ng2/tasks/uninstall.ts
Outdated
| 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.
You don't need that, just return Promise.all(...).then(...). then() returns a Promise.
| } | ||
|
|
||
| compile(fileName, inputPath, outputPath) { | ||
| return new Promise(resolve => { |
There was a problem hiding this comment.
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 :)
|
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 notifications@github.com 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-nodeUninstall examle:
ng uninstall lodash --typings lodash