Skip to content

improve package.json #46

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 3 commits into from
Closed

improve package.json #46

wants to merge 3 commits into from

Conversation

k7sleeper
Copy link
Contributor

@k7sleeper k7sleeper commented Jun 2, 2016

Improve package.json to have a proper main and typings attribute.

Setting the main attribute in package.json to core.js enables client code to write import {Logger} from "angular2-logger"; instead of import {Logger} from "angular2-logger/core";. Angular2 folks do the same.

Setting the typings attribute in package.json to core.d.ts let's the TypeScript compiler use core.d.ts when compiling import {Logger} from "angular2-logger";. That's what's needed to avoid compiling whole angular2-logger sources. Angular2 folks do the same. They set the typings attribute in package.json.

@langley-agm
Copy link
Contributor

@k7sleeper what do you mean by Angular folks do the same?

https://angular.io/docs/ts/latest/quickstart.html

I see them importing from the core module just like I am: import { Component } from '@angular/core';

@langley-agm
Copy link
Contributor

@k7sleeper I tried these changes but #39 is still occurring, did this fixed it for you?

@k7sleeper
Copy link
Contributor Author

k7sleeper commented Jun 6, 2016

No, these changes alone did not fix #39. You also have to delete *.ts files in app\core. So, the final solution must be that angular2-logger either creates only one .d.ts or the angular2-logger distribution does not contain the .ts files.

@k7sleeper
Copy link
Contributor Author

Well, if you carefully look at import { Component } from '@angular/core';you'll see that @angular/coreis a package whereas angular2-logger/core is a file!

import { Component } from '@angular/core'; is resolved by the main attribute in @angular/core/package.json.

… into improve-package.json

# Conflicts:
#	README.md
@k7sleeper
Copy link
Contributor Author

Has this PR a chance to be merged?

@langley-agm
Copy link
Contributor

@k7sleeper I thought you said this didnt fix the defect ?

@k7sleeper
Copy link
Contributor Author

k7sleeper commented Jul 1, 2016

@langley-agm Yes, you're right. The defect is solved for me by the following steps which I put into a Grunt task of my build script:

  • insert attribute "typings": "core.d.ts" into package.json
  • change attribute mainto "core.js" in package.json
  • remove all *.ts files from app folder

So, if you'd merge this PR I can remove the first 2 patches from my Grunt tasks and generally, package.json would increase in quality.

For the last issue I could send another PR but I have no idea how to omit the *.ts files from the published package.

@langley-agm
Copy link
Contributor

I'm confused, does this solve the defect or not? What defect do you want to solve with this PR ?

@k7sleeper
Copy link
Contributor Author

I'm sorry. I think of #39.

This PR would solve the first 2 issues of the above mentioned list.

@langley-agm
Copy link
Contributor

Like I mentioned before, I already ran the code in this PR and it does not solve #39 .

@k7sleeper
Copy link
Contributor Author

Ah, yes your're right. Sorry.

All the time I'm working with import {Logger} from "angular2-logger"which I prefer, but that's not what you've documented. So, my way isn't the right.

Anyway, I think merging this PR increases quality of package.json, isn't it?

@langley-agm
Copy link
Contributor

This PR changes both the package.json and the Guide.

The Guide works just as Angular 2 does: import { Component } from '@angular/core'; not import { Component } from '@angular'; so I'd prefer to leave it as it is right now.

@k7sleeper
Copy link
Contributor Author

Oh yes, you're right. I oversaw the changes in the guide.
I think it's time now to close this PR.

@k7sleeper k7sleeper closed this Jul 5, 2016
@k7sleeper k7sleeper deleted the improve-package.json branch July 5, 2016 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants