ngneat / svg-icon

👻 A lightweight library that makes it easier to use SVG icons in your Angular Application
https://netbasal.com
MIT License
260 stars 35 forks source link

Running ng-add on new project fails #20

Closed vltansky closed 3 years ago

vltansky commented 3 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

ng add will fail if assets/svg folder not exists

Expected behavior

ng add should not run npm run generate-icons if there is no svg folder / shouldn't run at all / console log instructions with next steps

Minimal reproduction of the problem with instructions

  1. ng new svg-icons-test
  2. ng add @ngneat/svg-icon
  3. Output:
    
    ng add @ngneat/svg-icon
    Installing packages for tooling via npm.
    Installed packages for tooling via npm.
    ✅️ Update package.json
    🔍 Installing package...
    ✅️ @ngneat/svg-icon is imported
    👏 @ngneat/svg-icon ready to use
    UPDATE src/app/app.module.ts (459 bytes)
    ✔ Packages installed successfully.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! svg-icons-test@0.0.0 generate-icons: `svg-to-ts`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the svg-icons-test@0.0.0 generate-icons 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! /home/vladta/.npm/_logs/2021-01-19T09_32_51_893Z-debug.log Unknown error: Error: Command failed: npm run generate-icons npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! svg-icons-test@0.0.0 generate-icons: svg-to-ts npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the svg-icons-test@0.0.0 generate-icons 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! /home/vladta/.npm/_logs/2021-01-19T09_32_51_893Z-debug.log



## What is the motivation / use case for changing the behavior?

<!-- Describe the motivation or the concrete use case. -->

## Environment

<pre><code>
Angular version: X.Y.Z
<!-- Check whether this is still an issue in the most recent Angular version -->

Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: XX  <!-- run `node --version` -->
- Platform:  <!-- Mac, Linux, Windows -->

Others:
<!-- Anything else relevant?  Operating system version, IDE, package manager, HTTP server, ... -->
</code></pre>
NetanelBasal commented 3 years ago

Do you want to submit a PR?