Skip to content

Commit

Permalink
Merge pull request #439 from kaliber5/update
Browse files Browse the repository at this point in the history
Update to Ember 3.28
  • Loading branch information
simonihmig authored Nov 23, 2021
2 parents 9af2faf + 917dac2 commit 637ba24
Show file tree
Hide file tree
Showing 54 changed files with 2,985 additions and 697 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
67 changes: 32 additions & 35 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ module.exports = {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true
}
legacyDecorators: true,
},
},
plugins: [
'ember',
'@typescript-eslint'
],
plugins: ['ember', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true
browser: true,
},
rules: {
'no-restricted-imports': ['error',
'no-restricted-imports': [
'error',
{
name: '@babylonjs/core',
message: 'Don\'t import from @babylonjs/core, use a direct import instead! See https://doc.babylonjs.com/features/es6_support#tree-shaking'
message:
"Don't import from @babylonjs/core, use a direct import instead! See https://doc.babylonjs.com/features/es6_support#tree-shaking",
},
{
name: 'ecsy-babylon',
Expand All @@ -37,7 +37,7 @@ module.exports = {
message:
"Don't import from index modules of ecsy-babylon, use a direct import instead to support tree shaking! See https://github.com/ef4/ember-auto-import/issues/121",
},
]
],
},
overrides: [
// ts files
Expand All @@ -50,40 +50,37 @@ module.exports = {
rules: {
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-function': 'warn'
}
'@typescript-eslint/no-empty-function': 'warn',
},
},
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
'lib/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**'
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
'./lib/*.js',
],
parserOptions: {
sourceType: 'script'
sourceType: 'script',
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
rules: {
'ember/no-string-prototype-extensions': 'off'
}
}
]
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ jobs:
strategy:
matrix:
scenario:
- ember-lts-3.16
- ember-lts-3.20
- ember-lts-3.24
- ember-release
- ember-beta
- ember-canary
- ember-default-with-jquery
- ember-classic
- embroider-safe
- embroider-optimized
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
Expand All @@ -23,6 +26,7 @@
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep

Expand Down
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
singleQuote: true,
};
6 changes: 3 additions & 3 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

module.exports = {
extends: 'octane',
extends: 'recommended',
rules: {
'no-action': false
}
'no-action': false,
},
};
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

## Linting

* `yarn lint:hbs`
* `yarn lint:js`
* `yarn lint:js --fix`
* `yarn lint`
* `yarn lint:fix`

## Running tests

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ember-ecsy-babylon
Compatibility
------------------------------------------------------------------------------

* Ember.js v3.16 or above
* Ember CLI v2.13 or above
* Ember.js v3.20 or above
* Ember CLI v3.20 or above
* Node.js v12 or above


Expand Down
19 changes: 11 additions & 8 deletions addon/component-managers/domless-glimmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export interface Constructor<T> {
new (owner: unknown, args: {}): T;
}


interface DomlessGlimmerStateBucket {
instance: DomlessGlimmerComponent;
previousArgs: ComponentManagerArgs['named'];
Expand All @@ -50,16 +49,17 @@ interface DomlessGlimmerStateBucket {
const CAPABILITIES = capabilities('3.13', {
destructor: true,
asyncLifecycleCallbacks: false,
updateHook: true
updateHook: true,
});

function snapshot<T>(object: T): T {
return Object.freeze({...object});
return Object.freeze({ ...object });
}

export default class DomlessGlimmerComponentManager
/*implements ComponentManagerWithAsyncLifeCycleCallbacks<DomlessGlimmerStateBucket>, ComponentManagerWithDestructors<DomlessGlimmerStateBucket>, ComponentManagerWithAsyncUpdateHook<DomlessGlimmerStateBucket>*/ {
static create(attrs: unknown): DomlessGlimmerComponentManager {
export default class DomlessGlimmerComponentManager {
/*implements ComponentManagerWithAsyncLifeCycleCallbacks<DomlessGlimmerStateBucket>, ComponentManagerWithDestructors<DomlessGlimmerStateBucket>, ComponentManagerWithAsyncUpdateHook<DomlessGlimmerStateBucket>*/ static create(
attrs: unknown
): DomlessGlimmerComponentManager {
const owner = getOwner(attrs);
return new this(owner);
}
Expand All @@ -81,7 +81,10 @@ export default class DomlessGlimmerComponentManager
};
}

updateComponent(bucket: DomlessGlimmerStateBucket, args: ComponentManagerArgs) {
updateComponent(
bucket: DomlessGlimmerStateBucket,
args: ComponentManagerArgs
) {
const newArgs = snapshot(args.named);
const { instance: component, previousArgs } = bucket;

Expand All @@ -91,7 +94,7 @@ export default class DomlessGlimmerComponentManager

const argsDiff = Object.keys(newArgs)
.filter((key) => newArgs[key] !== previousArgs[key])
.reduce((result, key) => ({...result, [key]: newArgs[key]}), {});
.reduce((result, key) => ({ ...result, [key]: newArgs[key] }), {});

if (Object.keys(argsDiff).length > 0) {
component.didUpdate(argsDiff);
Expand Down
37 changes: 25 additions & 12 deletions addon/components/domless-glimmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ export interface DomlessGlimmerArgs<C> {
parent?: DomlessGlimmerComponent<C, DomlessGlimmerArgs<C>>;
}

export default class DomlessGlimmerComponent<C = object, T extends DomlessGlimmerArgs<C> = object> {
export default class DomlessGlimmerComponent<
C = object,
T extends DomlessGlimmerArgs<C> = object
> {
constructor(owner: unknown, args: T) {
if (DEBUG && !(owner !== null && typeof owner === 'object' && args !== null && typeof args === 'object')) {
if (
DEBUG &&
!(
owner !== null &&
typeof owner === 'object' &&
args !== null &&
typeof args === 'object'
)
) {
throw new Error(
`You must pass both the owner and args to super() in your component: ${
this.constructor.name
}. You can pass them directly, or use ...arguments to pass all arguments through.`
`You must pass both the owner and args to super() in your component: ${this.constructor.name}. You can pass them directly, or use ...arguments to pass all arguments through.`
);
}

Expand Down Expand Up @@ -53,7 +62,9 @@ export default class DomlessGlimmerComponent<C = object, T extends DomlessGlimme
}

get context(): C | undefined {
return this._context !== undefined ? this._context : (this.args.parent && this.args.parent.context);
return this._context !== undefined
? this._context
: this.args.parent && this.args.parent.context;
}
set context(context: C | undefined) {
this._context = context;
Expand All @@ -70,12 +81,14 @@ export default class DomlessGlimmerComponent<C = object, T extends DomlessGlimme
* Called before the component has been removed from the DOM.
*/
willDestroy(): void {
Array.from(this.children).reverse().forEach(c => {
if (!c[WILL_DESTROY]) {
c[WILL_DESTROY] = true;
c.willDestroy();
}
});
Array.from(this.children)
.reverse()
.forEach((c) => {
if (!c[WILL_DESTROY]) {
c[WILL_DESTROY] = true;
c.willDestroy();
}
});
}

/**
Expand Down
Loading

0 comments on commit 637ba24

Please sign in to comment.