Skip to content

Commit

Permalink
chore: support ember-modifier 3.x and 4.x
Browse files Browse the repository at this point in the history
* refactor: ember-modifier 4 depreciations
* chore: upgrade to ember-modifier 4.x
* chore: support ember-modifier 3.x and 4.x (#396)
* test: fixing compatibility tests

---------

Co-authored-by: oliverlj <oliverlj@protonmail.com>
Co-authored-by: Charles Fries <charliefries@icloud.com>
  • Loading branch information
3 people authored Aug 22, 2023
1 parent 1f79ea4 commit e398557
Show file tree
Hide file tree
Showing 7 changed files with 1,133 additions and 1,909 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-3.24
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
- ember-lts-4.12
- ember-release
- ember-beta
- ember-canary
Expand All @@ -71,7 +73,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x
cache: npm
- name: Install Dependencies
run: npm ci
Expand Down
15 changes: 13 additions & 2 deletions addon/modifiers/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import ClipboardJS from 'clipboard';
import { isBlank } from '@ember/utils';
import { capitalize } from '@ember/string';
import { guidFor } from '@ember/object/internals';
import { macroCondition, dependencySatisfies } from '@embroider/macros';

const CLIPBOARD_EVENTS = ['success', 'error'];

export default modifier(function clipboard(element, params, hash) {
function clipboard(element, params, hash) {
const {
action = 'copy',
container,
Expand Down Expand Up @@ -56,4 +57,14 @@ export default modifier(function clipboard(element, params, hash) {
});

return () => clipboard.destroy();
});
}

let clipboardModifier;

if (macroCondition(dependencySatisfies('ember-modifier', '4.x'))) {
clipboardModifier = modifier(clipboard, { eager: false });
} else {
clipboardModifier = modifier(clipboard);
}

export default clipboardModifier;
31 changes: 27 additions & 4 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,38 @@ module.exports = async function () {
return {
scenarios: [
{
name: 'ember-lts-3.24',
name: 'ember-lts-3.28',
npm: {
devDependencies: {
'ember-source': '~3.24.3',
'ember-resolver': '^8.0.0',
'ember-source': '~3.28.0',
'@ember/test-helpers': '^2.9.3',
'ember-qunit': '^6.2.0',
},
},
},
{
name: 'ember-lts-3.28',
name: 'ember-lts-4.4',
npm: {
devDependencies: {
'ember-source': '~3.28.0',
'ember-resolver': '^8.0.0',
'ember-source': '~4.4.0',
},
},
},
{
name: 'ember-lts-4.8',
npm: {
devDependencies: {
'ember-source': '~4.8.0',
},
},
},
{
name: 'ember-lts-4.12',
npm: {
devDependencies: {
'ember-source': '~4.12.0',
},
},
},
Expand Down Expand Up @@ -57,7 +77,10 @@ module.exports = async function () {
},
npm: {
devDependencies: {
'ember-resolver': '^8.0.0',
'ember-source': '~3.28.0',
'@ember/test-helpers': '^2.9.3',
'ember-qunit': '^6.2.0',
},
ember: {
edition: 'classic',
Expand Down
Loading

0 comments on commit e398557

Please sign in to comment.