Deveo / ember-emojione

EmojiOne helper and components for your Ember App
https://deveo.github.io/ember-emojione/
MIT License
17 stars 9 forks source link

Issue with building after install #51

Open Houndsto0th opened 6 years ago

Houndsto0th commented 6 years ago

I'm getting a Build Error (Funnel) issue after installing the addon + option 2 of the installation options (we have to serve the sprite sheets locally for offline use). The error reads:

ENOENT: no such file or directory, lstat 'undefined/emojione-defs'

If there's any other information I can supply to help resolve this I'm happy to give it. Thanks

lolmaus commented 6 years ago

Hey @Houndsto0th!

I've just tried installing the addon to a fresh Ember CLI 3.1.3 app. I see some deprecation warnings, but no build errors.

What's the ember-cli version of your app? What's your ember-cli-build.js config?

Houndsto0th commented 6 years ago

my ember-cli-build.js is:

/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function (defaults) {
    var app = new EmberAddon(defaults, {
        // Add options here
        'ember-emojione': {
            // Did you install individual files or the full package?
            separatePackages: true,
            // Do you want EmojiOne CSS to be included in your app?
            shouldImportCss: false,
            // Are you going to use components that insert emoji?
            shouldImportDefs: false,
            // Whether to use a sprite sheet or individual images
            spriteSheet: true,
            // Enable one of these options if you want to include
            // EmojiOne assets into your app's distro. 
            shouldIncludePngSprite: false,
            shouldIncludeSvgSprite: true,
            shouldIncludePngImages: false,
            shouldIncludeSvgImages: false,
            pngImagesKind: 'png',
            svgImagesKind: 'svg',
            packageNameMain:        'emojione',
            packageNameJs:          'emojione-js',
            packageNameSvgSprite:   'emojione-svg',
            shouldIncludeComponents: false,
          },
    });

    /*
     This build file specifies the options for the dummy test app of this
     addon, located in `/tests/dummy`
     This build file does *not* influence how the addon or the app using it
     behave. You most likely want to be modifying `./index.js` or app's build file
     */

    app.import('bower_components/moment/moment.js');
    return app.toTree();
};

and I'm on "ember-cli": "~2.18.2",

lolmaus commented 6 years ago

Please also post the relevant part of your bower.json.

Houndsto0th commented 6 years ago

This might be caused by a different problem that I'm working through right now. I'll either comment back or close this based on the next hour or so of troubleshooting. I appreciate the quick responses

Houndsto0th commented 6 years ago

So, after pulling a fresh branch I'm still getting the error with:

Build failed.
Build Error (Funnel)

ENOENT: no such file or directory, lstat 'bower_components/emojione-defs'

This happened after following the install steps: yarn add -D ember-emojione then bower install -S emojione

In this instance I didn't make any edits to my ember-cli-build.js file whatsoever. I need to have the files locally from the install although we're really only using some methods from the library and the svg spritesheet so I'm completely open to other install paths that would give me the same results

Houndsto0th commented 6 years ago

So, after following the other install step I'm able to get further it seems but I still run into an issue with the svg spritesheet ENOENT: no such file or directory, lstat 'bower_components/emojione-svg/assets/sprites'

 "dependencies": {
    "emojione-js": "https://raw.githubusercontent.com/Ranks/emojione/v2.2.7/lib/js/emojione.js",
    "emojione-css": "https://raw.githubusercontent.com/Ranks/emojione/v2.2.7/assets/css/emojione.css",
    "emojione-svg": "https://raw.githubusercontent.com/Ranks/emojione/v2.2.7/assets/sprites/emojione.sprites.svg",
    "emojione-defs": "https://raw.githubusercontent.com/Ranks/emojione/v2.2.7/emoji.json"
  }

is what my bower.json looks like

Houndsto0th commented 6 years ago

One more thing to note, it looks like if I use the png sprite sheet that works just fine but using the svg sheet seems broken

lolmaus commented 6 years ago

I confirm this is a bug.

I have attempted a fix in the fix-51-svg-sprite-import-path branch. Can you please try it via:

yarn add -D Deveo/ember-emojione#fix-51-svg-sprite-import-path

I'll release it after you confirm it resolves the issue.

Houndsto0th commented 6 years ago

I can confirm switching to this branch allowed me to run tests with my ember-cli-build.js having the svg import set to true and the png set to false.

Houndsto0th commented 6 years ago

I'm not sure this is related but it looks like the svg sprite sheet is being brought in as bower_components/emojione-svg/index.svg instead of the emojione.sprites.svg file and that's interfering with the _generateTreeForSvgSprite method in your index.js

lolmaus commented 6 years ago

I'm not sure this is related but it looks like the svg sprite sheet is being brought in as bower_components/emojione-svg/index.svg

This is expected when you choose not install the whole emojione package and instead go for

bower install -S emojione-svg=https://raw.githubusercontent.com/Ranks/emojione/v2.2.7/assets/sprites/emojione.sprites.svg

The problem you were seeing was caused by the addon using the whole-package path to the SVG file instead of the individual import path.

I'm gonna release the fix later. Meanwhile, please use the addon from the branch.

Houndsto0th commented 6 years ago

So how can I fix the file import for the svg sprite sheet?

lolmaus commented 6 years ago

Oh, I thought using the fix-51-svg-sprite-import-path branch fixed the issue for you. 😦

Can you please tell me what error you see on that branch?

Houndsto0th commented 6 years ago

it looks like the svg sprite sheet file is called index.svg but the addon looks for it to be named emojione.sprites.svg

Houndsto0th commented 6 years ago

Maybe it's that the installation instructions aren't comprehensive for using the svg sprite sheet?

lolmaus commented 6 years ago

That may be true, but please describe what's happening for you on the branch. Any specific error message?

Houndsto0th commented 6 years ago

I just get a 404 on the localhost:4200/assets/sprites/emojione.sprites.svg

lolmaus commented 6 years ago

Ah, dammit! I've recently switched from Linux back to Windows. Windows substitutes emoji symbols with graphical emoji. I didn't realize that, I saw the emoji and thought that my fix was working.

Will look again, sorry about that.

Houndsto0th commented 6 years ago

Any update on this? I've just added an app.import statement pointing to the index.svg file for now