adopted-ember-addons / ember-paper

The Ember approach to Material Design.
https://ember-paper.netlify.app/
MIT License
888 stars 333 forks source link

octane / module unification support #883

Open NullVoxPopuli opened 6 years ago

NullVoxPopuli commented 6 years ago

I did:

npm install -g https://github.com/ember-cli/ember-cli.git
ember new ember-app --blueprint module-unification-app --yarn
ember install ember-paper

I moved app/styles/app.scss to ui/styles/app.scss

Got this error

Build Error (SassCompiler)

File not found: /app/styles/app.scss
in any of the following include paths:
  /home/me/Development/tmp/ember-app/tmp/sass_compiler-input_base_path-HrmUtsmg.tmp

Stack Trace and Error Report: /tmp/error.dump.d82574aad036cdf57a0561a8215102dc.log

So, I moved the file back to app/styles/app.scss, and the problem/error was the exact same. I even tried the steps again without moving the defaultly generated file.

NullVoxPopuli commented 6 years ago

Here is a test app: https://github.com/NullVoxPopuli/test-ember-paper-with-module-unification

Some notes on setting things up:

npm install -g https://github.com/ember-cli/ember-cli.git
# output omitted
MODULE_UNIFICATION=true EMBER_CLI_MODULE_UNIFICATION=true ember new test-ember-paper-with-module-unification
# output omitted
cd test-ember-paper-with-module-unification
# output omitted
yarn
# output omitted
ember- install ember-paper
# output omitted
yarn start
yarn run v1.7.0
$ ember serve
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Deprecation warning: sassOptions should be moved to your ember-cli-build
Build Error (ConfigReplace)

ENOENT: no such file or directory, stat '/home/me/Development/NullVoxPopuli/test-ember-paper-with-module-unification/tmp/config_replace-input_base_path-sd0dO3vt.tmp/0/index.html'

Stack Trace and Error Report: /tmp/error.dump.097bcfd9117d288a7c91c0b812847f6f.log

blueprint still using classic layout -- which is fine. I move content to src/ui/styles/app.scss image I delete the app folder, and re-run yarn start

yarn run v1.7.0
$ ember serve
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Deprecation warning: sassOptions should be moved to your ember-cli-build
Build Error (ConfigReplace)

ENOENT: no such file or directory, stat '/home/me/Development/NullVoxPopuli/test-ember-paper-with-module-unification/tmp/config_replace-input_base_path-s0K9Is7y.tmp/0/index.html'

Stack Trace and Error Report: /tmp/error.dump.9df0ae4736a5d0d1a0179715c4bd0d95.log

So, I'm not sure if this is a module-unification issue or an ember-paper one.

//cc @miguelcobain @mixonic

blmundie commented 5 years ago

ember-cli/ember-cli#8133

NullVoxPopuli commented 5 years ago

good news: it kinda works now:

the only remaining TODO is to:

ember new my-app -b ember-octane-app-blueprint # note: this blueprint name may change in the future
cd my-app
yarn ember install ember-paper
mv app/styles/app.scss src/ui/styles/app.scss
rm -rf app/
rm -rf src/ui/styles/app.css
yarn start
# replace welcome page with any ember-paper component
miguelcobain commented 5 years ago

@NullVoxPopuli it would be nice we could detect if the addon is being installed in an MU enabled app and create the scss file accordingly.

NullVoxPopuli commented 5 years ago

@miguelcobain I think there is an isModuleUnification() helper function on ... the project object? It's been a while since I looked at that. But yes! there is a way! :D

ppcano commented 5 years ago

@miguelcobain

it would be nice we could detect if the addon is being installed in an MU enabled app and create the scss file accordingly.

Yes, I also think we need an API for that.

See how it has been detected at https://github.com/ember-cli/ember-welcome-page/blob/1b62db3bbd728c8a2df9dd1e56739a2b94be0a40/index.js#L17

ppcano commented 5 years ago

@NullVoxPopuli https://github.com/emberjs/ember.js/issues/17234#issuecomment-461810595

seems like it mostly has to do with there styles get exposed to the host app. idk if there is something simple we can do so that existing style addons can "just work", or if we're going to make all the style addons add an octane / isModuleUnification condition?

  1. Importing styles into MU apps from Classic addons works. I have tested a few addons and seems to be working, there may be unexpected edge cases but they have to be reported by addon authors and investigated.

This particular issue is that the blueprint generator does not create file in the correct location for MU apps and it should be fixed by https://github.com/miguelcobain/ember-paper/pull/1054

  1. Atm, the API is project.isModuleUnification.