webalys-hq / streamlinehq-npm

The deprecated Streamline NPM package, which will be deleted on 1st November 2022.
https://medium.com/streamline-icons/how-streamline-narrows-down-its-focus-eac6fdb5c6f2
24 stars 5 forks source link

CommonJS or AMD dependencies optimization bailouts #4

Closed TobiasJu closed 3 years ago

TobiasJu commented 3 years ago

Hi there, good news, i got the icons dispalyed in my application. And i really like your wrapper.

But it gives me this error:

Build at: 2021-03-26T15:23:46.856Z - Hash: 8a2be9b6de33040e9a29 - Time: 9179ms

Warning: C:\Users\t\angular\libs\room-management\src\lib\shared-components\room-header\room-header.component.ts depends on '@streamlinehq/streamline-regular/lib/users'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: C:\Users\t\angular\libs\room-management\src\lib\shared-components\room-header\room-header.component.ts  depends on '@streamlinehq/streamline-regular/lib/health-beauty'. CommonJS or AMD dependencies can cause optimization ba
ilouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
cbrwizard commented 3 years ago

Apparently the error is coming from an old package @streamlinehq/streamline-regular which was installed from Cloudsmith (please correct me if I'm wrong). The only package you need right now is @streamlinehq/streamlinehq. Eg you should uninstall any packages like

    "@streamlinehq/streamline-bold": "^0.6.1",
    "@streamlinehq/streamline-mini-bold": "0.6.1",
    "@streamlinehq/streamline-regular": "0.6.1",
    "@streamlinehq/streamline-wrapper-react": "^1.3.2",

and have only

    "@streamlinehq/streamlinehq": "^1.0.3",

in your package.json and let it fetch the images for you.

I've edited the README file to reflect this.

TobiasJu commented 3 years ago

Yes the old streamline packages like @streamlinehq/streamline-regular did cause this error, thanks for the quick response.

I tried to migrate to the new "@streamlinehq/streamlinehq": "^1.0.4", But we do not use yarn, we only use npm for packages, so the >npm i @streamlinehq/streamlinehq fails.

Why do you guys deliver a npm package which depends on yarn?

cbrwizard commented 3 years ago

I believe npm commands will work just as fine, can you try those? Which command is failing? Perhaps you're having a configuration issue caused by previous packages like described here https://github.com/webalys-hq/streamlinehq-npm/issues/5?

TobiasJu commented 3 years ago

I removed the token from the .npmrc, (streamlinehq.json is already present). Than i added "@streamlinehq/streamlinehq": "^1.0.4", to my package.json and run 'npm install' inside my IDE.

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install --scripts-prepend-node-path=auto

> @streamlinehq/streamlinehq@1.0.4 postinstall C:\Users\tjuhre\GIT\angular\node_modules\@streamlinehq\streamlinehq
> yarn start

The command "yarn" is either misspelled or could not be found.
...

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @streamlinehq/streamlinehq@1.0.4 postinstall: `yarn start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @streamlinehq/streamlinehq@1.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tjuhre\AppData\Roaming\npm-cache\_logs

Looks like it tries to start yarn, but it's not installed. And i really do not want to use 2 package managers. I mean this is not Python.

cbrwizard commented 3 years ago

The link you've posted corresponds to a different case when you try to run npm install and yarn in the same project, which results in package-lock.json and yarn.lock. This is not the case here. If you install yarn globally it will just work and won't pollute your project with any extra files (as far as I know). Personally I have both yarn and npm installed for several years on my local machine.

I agree though that it should be up to a developer to choose a package manager. I will research ways to improve this

TobiasJu commented 3 years ago

Thank you for your understanding. My team is strictly against using two package managers. I think this package will get quite popular, so i think your investigation will also help many others.

cbrwizard commented 3 years ago

Okay I have migrated to npm since it's the default packages manager. It just works.

This change is implemented in version 2.0.0 https://github.com/webalys-hq/streamlinehq-npm/releases/tag/2.0.0. Please note that it introduces a couple of other breaking changes as well.

Please check it out and tell if it solves your issue.

TobiasJu commented 3 years ago

Well this was exceptionally fast, thanks! It solved my yarn problem indeed and i could successfully install the package. Something looks still a bit odd, all the svg icons have an alphanumeric string at the end, is this wanted? image

cbrwizard commented 3 years ago

Yup, that was introduced as a measure to fight the naming conflict as some images had the same names across families and categories, see https://github.com/webalys-hq/streamlinehq-npm/issues/6. See our updated readme https://github.com/webalys-hq/streamlinehq-npm#how-to-find-a-path-to-a-streamline-image for more info