Skip to content
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

allowing any angular version greater than 13 #668

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

dfa1234
Copy link
Contributor

@dfa1234 dfa1234 commented Jul 2, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ x] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

When we use any angular version > major release 13 it's like:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: <my super duper personnal project>@<version of my project>
npm ERR! Found: @angular/core@16.1.3
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"^16.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@"13.3.10" from @ngneat/transloco-scoped-libs@3.0.5
npm ERR! node_modules/@ngneat/transloco-scoped-libs
npm ERR!   @ngneat/transloco-scoped-libs@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry

Issue Number: #646

What is the new behavior?

No log complaing we should force for scoped libs utils

Does this PR introduce a breaking change?

[ ] Yes
[X ] No

@shaharkazaz
Copy link
Collaborator

shaharkazaz commented Jul 2, 2023

@dfa1234 Thanks for the PR!
This is actually an issue with the scoped-libs package build. since in the original package.json, you don't see any peerDeps.
This needs to be disabled at Nx level, you can see an example in other package configurations.
Try it

@dfa1234
Copy link
Contributor Author

dfa1234 commented Jul 2, 2023

@shaharkazaz Thank to you

Lately now I'm really into Nx so I'm very glad to try what ( I think ) you suggest do to.

The only problem is that when I'm doing npm run build:scoped-libs in your project,
and look in dist directory
I don't really see the same package.json that I get from npm when I download your library.
So I pressume I need to do something else than npm run build:scoped-libs to really see the final build that you publish on npm

@shaharkazaz
Copy link
Collaborator

@dfa1234 I'm not sure I understand, the change you made should cover it.
npm run build:scoped-libs is what you need to run to see the npm build version, nothing else. share the package.json that you are getting.
make sure to run it before your change 🙂

@dfa1234
Copy link
Contributor Author

dfa1234 commented Jul 2, 2023

@shaharkazaz
wonderfull, but I'm still affraid there is something I'm missing here.
I was so affraid of issue with nx cache (that I don't really want to use rn)
That I did some tests for you with 2 clean install

My commands are:

rm -rf ~/.nx # just to be sure there is no cache here!
git clone git@github.com:ngneat/transloco.git
cd transloco/ 
npm i
npm run build:scoped-libs
cat dist/libs/transloco-scoped-libs/package.json # to see what we have here

WITHOUT ANY CHANGES

Here the result I have:

{
  "name": "@ngneat/transloco-scoped-libs",
  "version": "3.0.5",
  "description": "Transloco support tool for libraries with translations",
  "main": "src/lib/transloco-scoped-libs.js",
  "bin": {
    "transloco-scoped-libs": "src/index.js"
  },
  "publishConfig": {
    "access": "public"
  },
  "bugs": {
    "url": "https://github.com/ngneat/transloco/issues"
  },
  "homepage": "https://ngneat.github.io/transloco/docs/tools/scope-lib-extractor",
  "repository": {
    "type": "git",
    "url": "https://github.com/ngneat/transloco"
  },
  "keywords": [
    "angular",
    "angular 2",
    "i18n",
    "translate",
    "angular translate",
    "angular i18n",
    "transloco",
    "comments",
    "build",
    "optimize"
  ],
  "license": "MIT",
  "author": "Itay Oded",
  "contributors": [
    {
      "name": "Shahar Kazaz",
      "url": "https://github.com/shaharkazaz"
    },
    {
      "name": "Netanel Basal",
      "url": "https://netbasal.com"
    }
  ],
  "dependencies": {
    "@angular/animations": "16.0.4",
    "@angular/common": "16.0.4",
    "@angular/compiler": "16.0.4",
    "@angular/core": "16.0.4",
    "@angular/platform-browser": "16.0.4",
    "@angular/platform-browser-dynamic": "16.0.4",
    "@ngneat/transloco-utils": "^3.0.5",
    "chalk": "4.1.2",
    "chokidar": "3.5.2",
    "command-line-args": "5.2.0",
    "cosmiconfig": "8.1.3",
    "fs-extra": "9.1.0",
    "glob": "7.1.7",
    "rxjs": "7.8.0",
    "tslib": "2.3.1",
    "zone.js": "0.13.0"
  },
  "types": "./src/index.d.ts"
}

WITH MY CHANGE

I added updateBuildableProjectDepsInPackageJson:false
before performing npm run build:scoped-libs

{
  "name": "@ngneat/transloco-scoped-libs",
  "version": "3.0.5",
  "description": "Transloco support tool for libraries with translations",
  "main": "src/lib/transloco-scoped-libs.js",
  "bin": {
    "transloco-scoped-libs": "src/index.js"
  },
  "publishConfig": {
    "access": "public"
  },
  "bugs": {
    "url": "https://github.com/ngneat/transloco/issues"
  },
  "homepage": "https://ngneat.github.io/transloco/docs/tools/scope-lib-extractor",
  "repository": {
    "type": "git",
    "url": "https://github.com/ngneat/transloco"
  },
  "keywords": [
    "angular",
    "angular 2",
    "i18n",
    "translate",
    "angular translate",
    "angular i18n",
    "transloco",
    "comments",
    "build",
    "optimize"
  ],
  "license": "MIT",
  "author": "Itay Oded",
  "contributors": [
    {
      "name": "Shahar Kazaz",
      "url": "https://github.com/shaharkazaz"
    },
    {
      "name": "Netanel Basal",
      "url": "https://netbasal.com"
    }
  ],
  "dependencies": {
    "@ngneat/transloco-utils": "^3.0.5",
    "chalk": "^4.1.2",
    "chokidar": "^3.5.2",
    "command-line-args": "^5.1.1",
    "glob": "^7.1.7",
    "fs-extra": "^9.1.0"
  },
  "types": "./src/index.d.ts"
}

Here what I have right now for you, maybe I will try to perform a complete build to see if it differ from this

@shaharkazaz
Copy link
Collaborator

The 2nd package seems correct.
What's the issue you are worried about? the change resolved the issue.
When these flags were added I guess the scoped libs got missed.

@dfa1234
Copy link
Contributor Author

dfa1234 commented Jul 2, 2023

My concern is that the result with or without the flag slightly differ from what there is in npm right now: package.json version 3.0.5

Here we have (wrong) peerDependencies:

{
  "name": "@ngneat/transloco-scoped-libs",
  "version": "3.0.5",
  "description": "Transloco support tool for libraries with translations",
  "main": "src/lib/transloco-scoped-libs.js",
  "bin": {
    "transloco-scoped-libs": "src/index.js"
  },
  "publishConfig": {
    "access": "public"
  },
  "bugs": {
    "url": "https://github.com/ngneat/transloco/issues"
  },
  "homepage": "https://ngneat.github.io/transloco/docs/tools/scope-lib-extractor",
  "repository": {
    "type": "git",
    "url": "https://github.com/ngneat/transloco"
  },
  "keywords": [
    "angular",
    "angular 2",
    "i18n",
    "translate",
    "angular translate",
    "angular i18n",
    "transloco",
    "comments",
    "build",
    "optimize"
  ],
  "license": "MIT",
  "author": "Itay Oded",
  "contributors": [
    {
      "name": "Shahar Kazaz",
      "url": "https://github.com/shaharkazaz"
    },
    {
      "name": "Netanel Basal",
      "url": "https://netbasal.com"
    }
  ],
  "dependencies": {
    "@ngneat/transloco-utils": "^3.0.5",
    "chalk": "^4.1.2",
    "chokidar": "^3.5.2",
    "command-line-args": "^5.1.1",
    "glob": "^7.1.7",
    "fs-extra": "^9.1.0"
  },
  "typings": "./src/index.d.ts",
  "peerDependencies": {
    "cosmiconfig": "^8.1.3",
    "tslib": "2.3.1",
    "zone.js": "0.11.5",
    "@angular/core": "13.3.10",
    "@angular/platform-browser-dynamic": "13.3.10"
  }
}

@shaharkazaz shaharkazaz merged commit 8a05565 into jsverse:master Jul 17, 2023
4 checks passed
shaharkazaz added a commit that referenced this pull request Jul 30, 2023
* origin/master:
  fix(transloco-scoped-libs): 🐛 remove unwanted peerDependencies (#668)
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.

None yet

2 participants