Skip to content

Commit

Permalink
build: disable Embroider adapter ember-get-config
Browse files Browse the repository at this point in the history
`ember-get-config`, latest version 0.5.0, doesn't support Embroider yet
as this PR has not been merged as the time of writing this commit:

mansona/ember-get-config#29

In parallel, Embroider tests scenarios fail on our side:

https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177
  |
  `--> Relates to this issue:
       embroider-build/embroider#823

This issue 823 recommends to use `require('@embroider/compat').compatBuild`
in order to disable Embroider's adapter `ember-get-config` (see also
https://github.com/embroider-build/embroider/tree/v0.47.1#options).

But it does not work: `app` is not accepted by `compatBuild()` because
it is an `EmberAddon`, not an `EmberApp`. Log from the error:

```
Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'.
  Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345)
```

However, the following document indicates we can pass these options to
`maybeEmbroider()` to configure Embroider:

https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions

References:
- Embroider's adapter for `ember-get-config`:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts

- Embroider compatibility options:
  https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61

- Discussions on Discord where I first saw the same initial issue:
  - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
  - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
  • Loading branch information
MrChocolatine committed Nov 2, 2021
1 parent b7d1970 commit 28eba81
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
const { maybeEmbroider } = require('@embroider/test-setup')

module.exports = function (defaults) {
let app = new EmberAddon(defaults, {
Expand All @@ -15,12 +16,24 @@ module.exports = function (defaults) {
*/
app.import('node_modules/milligram/dist/milligram.css')

const { maybeEmbroider } = require('@embroider/test-setup')
return maybeEmbroider(app, {
skipBabel: [
{
package: 'qunit',
},
],

/**
* See:
* - https://github.com/embroider-build/embroider/issues/823
* - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233
* - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433
*
* TODO: to remove once the following PR is released:
* https://github.com/mansona/ember-get-config/pull/29
*/
compatAdapters: new Map([
[ 'ember-get-config', null ] // eslint-disable-line prettier/prettier
]),
})
}

0 comments on commit 28eba81

Please sign in to comment.