Skip to content

Commit

Permalink
chore: make embroider safe
Browse files Browse the repository at this point in the history
  • Loading branch information
velrest committed Jun 30, 2023
1 parent 1b5518a commit 04ced13
Show file tree
Hide file tree
Showing 11 changed files with 1,019 additions and 70 deletions.
43 changes: 19 additions & 24 deletions addon/components/relationship-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@
...attributes
{{did-insert (perform this.fetchModels)}}
/>
{{#let
(component (if @multiple "power-select-multiple" "power-select"))
as |RelationPowerSelect|
}}
<RelationPowerSelect
@searchEnabled={{this.searchEnabled}}
@search={{perform this.fetchModels}}
@options={{this.models}}
@selected={{@selected}}
@placeholder={{if
this.fetchModels.isRunning
(t "emeis.loading")
@placeholder
}}
@noMatchesMessage={{t "emeis.empty"}}
@renderInPlace={{true}}
@allowClear={{true}}
@onChange={{@onChange}}
{{did-update (perform this.fetchModels) @model}}
as |model|
>
{{yield model}}
</RelationPowerSelect>
{{/let}}
<this.selectComponent
@searchEnabled={{this.searchEnabled}}
@search={{perform this.fetchModels}}
@options={{this.models}}
@selected={{@selected}}
@placeholder={{if
this.fetchModels.isRunning
(t "emeis.loading")
@placeholder
}}
@noMatchesMessage={{t "emeis.empty"}}
@renderInPlace={{true}}
@allowClear={{true}}
@onChange={{@onChange}}
{{did-update (perform this.fetchModels) @model}}
as |model|
>
{{yield model}}
</this.selectComponent>
6 changes: 6 additions & 0 deletions addon/components/relationship-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { inject as service } from "@ember/service";
import { isTesting, macroCondition } from "@embroider/macros";
import Component from "@glimmer/component";
import { restartableTask, lastValue, timeout } from "ember-concurrency";
import PowerSelect from "ember-power-select/components/power-select";
import PowerSelectMultiple from "ember-power-select/components/power-select-multiple";

import { handleTaskErrors } from "ember-emeis/-private/decorators";

Expand All @@ -16,6 +18,10 @@ export default class RelationshipSelectComponent extends Component {
return this.models && this.args.modelName && this.models.length > 5;
}

get selectComponent() {
return this.args.multiple ? PowerSelectMultiple : PowerSelect;
}

@restartableTask
@handleTaskErrors
*fetchModels(search) {
Expand Down
2 changes: 1 addition & 1 deletion app/decorators/localized-attr.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from "ember-emeis/decorators/localized-attrs";
export { default } from "ember-emeis/decorators/localized-attr";
1 change: 0 additions & 1 deletion app/routes/users/edit/acl.js

This file was deleted.

1 change: 0 additions & 1 deletion app/routes/users/edit/index.js

This file was deleted.

1 change: 0 additions & 1 deletion app/templates/scopes/index.js

This file was deleted.

1 change: 0 additions & 1 deletion app/templates/users/edit/acl.js

This file was deleted.

1 change: 0 additions & 1 deletion app/templates/users/edit/index.js

This file was deleted.

10 changes: 7 additions & 3 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ module.exports = function (defaults) {
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
*/

const { maybeEmbroider } = require("@embroider/test-setup");
return maybeEmbroider(app, {
const { Webpack } = require("@embroider/webpack");
return require("@embroider/compat").compatBuild(app, Webpack, {
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticModifiers: true,
staticComponents: true,
skipBabel: [
{
package: "qunit",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@
"@commitlint/config-conventional": "17.6.5",
"@ember/optional-features": "2.0.0",
"@ember/test-helpers": "2.9.3",
"@embroider/compat": "3.1.3",
"@embroider/core": "3.1.1",
"@embroider/test-setup": "3.0.1",
"@embroider/webpack": "3.1.1",
"@faker-js/faker": "6.2.0",
"broccoli-asset-rev": "3.0.0",
"concurrently": "7.6.0",
Expand Down Expand Up @@ -114,7 +117,7 @@
"qunit": "2.19.4",
"qunit-dom": "2.0.0",
"sass": "1.56.1",
"webpack": "5.81.0"
"webpack": "5.88.1"
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0"
Expand Down
Loading

0 comments on commit 04ced13

Please sign in to comment.