Skip to content

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

Closed
wants to merge 6 commits into from

Conversation

jkuri
Copy link
Contributor

@jkuri jkuri commented Mar 11, 2016

Install example: ng install moment --typings moment-node
Uninstall examle: ng uninstall lodash --typings lodash

@jkuri jkuri added feature Issue that requests a new feature pr_action: review labels Mar 11, 2016
@jkuri jkuri force-pushed the install branch 3 times, most recently from 3c8b2c6 to 65ac052 Compare March 12, 2016 01:49
@cironunes cironunes self-assigned this Mar 12, 2016
@cironunes
Copy link
Member

no tests? :)

@jkuri
Copy link
Contributor Author

jkuri commented Mar 12, 2016

Not yet :-)

uninstallProcedure: function() {
const that = this;

return that.removeFromPackageJSON(that.package)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Ciro.

@cironunes cironunes removed their assignment Mar 13, 2016
@jkuri jkuri force-pushed the install branch 5 times, most recently from 2768925 to 2b01261 Compare March 17, 2016 22:55
this.ui.writeLine(chalk.red(this.completionErrorMessage));
},

existsSync: function(path) {
Copy link
Contributor

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 = {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@jkuri jkuri force-pushed the install branch 2 times, most recently from cf22ff9 to 7318c0d Compare April 1, 2016 03:16
return new Promise(resolve => {
let promises = [];

that.packages.forEach(p => {
Copy link
Contributor

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().

@jkuri jkuri force-pushed the install branch 4 times, most recently from 387b3d5 to 319cb3a Compare April 1, 2016 17:56
this.packages = this.packages.filter(p => !/node-sass|stylus|less|compass-importer/.test(p));
let typingsList = [];

return new Promise(resolve => {
Copy link
Contributor

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.

Copy link
Contributor Author

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 => {
Copy link
Contributor

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@jkuri
Copy link
Contributor Author

jkuri commented Apr 1, 2016

Closing this. If nothing else, I learned something from this PR :-) Thanks @hansl!

@jkuri jkuri closed this Apr 1, 2016
@jkuri jkuri deleted the install branch April 3, 2016 00:06
@choeller
Copy link

choeller commented Apr 4, 2016

@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...

@jkuri
Copy link
Contributor Author

jkuri commented Apr 4, 2016

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.

@choeller
Copy link

choeller commented Apr 4, 2016

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?

@jkuri
Copy link
Contributor Author

jkuri commented Apr 4, 2016

Unfortunately yes

@hansl
Copy link
Contributor

hansl commented Apr 4, 2016

I just want to clarify that you don't need to copy files to your project
for ngrx. You should simply be able to npm install ngrx and add those
files to your vendorNpmFiles.

We are working on the production build story to use CDN versions of those
vendor files.

On Mon, Apr 4, 2016 at 10:41 AM, Jan Kuri [email protected] wrote:

Unfortunately yes


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#294 (comment)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants