Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from mainmatter:master #106

Merged
merged 13 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions guides/upgrade-to-v7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### tl;dr

Release 7.0.0 doesn't contain any new features and the API haven't really changed.
It focuses on housekeeping, modernizing the codebase and introducing Typescript to our library.
The biggest change was getting rid of as much "classic" Ember syntax as possible and get onto ES6 classes.

### Extending ember-simple-auth's classes

Most if not all of the public API is ES6 classes, as a result you'll have to change how ESA's classes are extended in your codebases.
Here's an example based on the OAuth2PasswordGrant authenticator.

Old

```js
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import config from '../config/environment';

export default OAuth2PasswordGrant.extend({
serverTokenEndpoint: `${config.apiHost}/token`,
serverTokenRevocationEndpoint: `${config.apiHost}/revoke`,
});
```

New

```js
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import config from '../config/environment';

export default class OAuth2 extends OAuth2PasswordGrant {
serverTokenEndpoint = `${config.apiHost}/token`;
serverTokenRevocationEndpoint = `${config.apiHost}/revoke`;
}
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"@eslint/js": "9.14.0",
"@mermaid-js/mermaid-cli": "11.4.2",
"@release-it-plugins/lerna-changelog": "7.0.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@typescript-eslint/eslint-plugin": "8.18.2",
"@typescript-eslint/parser": "8.18.2",
"eslint-config-prettier": "9.1.0",
"eslint-config-simplabs": "0.4.0",
"eslint-plugin-ember": "12.3.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/classic-test-app/app/authenticators/oauth2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
import config from '../config/environment';

export default OAuth2PasswordGrant.extend({
serverTokenEndpoint: `${config.apiHost}/token`,
serverTokenRevocationEndpoint: `${config.apiHost}/revoke`,
});
export default class OAuth2 extends OAuth2PasswordGrant {
serverTokenEndpoint = `${config.apiHost}/token`;
serverTokenRevocationEndpoint = `${config.apiHost}/revoke`;
}
3 changes: 2 additions & 1 deletion packages/classic-test-app/app/components/login-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ export default Component.extend({
await this.get('session').authenticate('authenticator:oauth2', identification, password);

if (this.rememberMe) {
this.get('session').set('store.cookieExpirationTime', 60 * 60 * 24 * 14);
this.get('session').set('cookieExpirationTime', 60 * 60 * 24 * 14);
}
} catch (response) {
console.error(response.toString());
this.set('errorMessage', response.toString());
}
}),
Expand Down
5 changes: 4 additions & 1 deletion packages/classic-test-app/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';

export default Controller.extend({
router: service(),

actions: {
transitionToLoginRoute() {
this.transitionToRoute('login');
this.router.transitionTo('login');
},
},
});
4 changes: 2 additions & 2 deletions packages/classic-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ember-maybe-import-regenerator": "1.0.0",
"ember-qunit": "7.0.0",
"ember-resolver": "11.0.1",
"ember-simple-auth": "6.1.0",
"ember-simple-auth": "link:../ember-simple-auth",
"ember-source": "5.12.0",
"ember-source-channel-url": "3.0.0",
"ember-try": "3.0.0",
Expand All @@ -57,7 +57,7 @@
"my-engine": "workspace:../classic-test-app/lib/my-engine",
"npm-run-all2": "7.0.2",
"pretender": "3.4.7",
"qunit": "2.22.0",
"qunit": "2.23.1",
"qunit-dom": "2.0.0",
"torii": "1.0.0-beta.2",
"webpack": "5.96.1"
Expand Down
25 changes: 12 additions & 13 deletions packages/ember-simple-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"release": "npm publish"
},
"dependencies": {
"@babel/eslint-parser": "^7.24.7",
"@ember/test-waiters": "^3",
"@embroider/addon-shim": "^1.0.0",
"@embroider/macros": "^1.0.0",
Expand All @@ -43,26 +42,26 @@
"@babel/plugin-proposal-decorators": "7.25.9",
"@babel/runtime": "7.26.0",
"@embroider/addon-dev": "7.1.1",
"@glint/core": "^1.5.0",
"@glint/environment-ember-loose": "^1.5.0",
"@glint/environment-ember-template-imports": "^1.5.0",
"@glint/core": "1.5.0",
"@glint/environment-ember-loose": "1.5.0",
"@glint/environment-ember-template-imports": "1.5.0",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-node-resolve": "15.3.1",
"@tsconfig/ember": "^3.0.8",
"@types/ember__application": "^4.0.11",
"@types/ember__debug": "^4.0.8",
"@types/ember__object": "^4.0.12",
"@types/ember__routing": "^4.0.22",
"@types/ember__service": "^4.0.9",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@tsconfig/ember": "3.0.8",
"@types/ember__application": "4.0.11",
"@types/ember__debug": "4.0.8",
"@types/ember__object": "4.0.12",
"@types/ember__routing": "4.0.22",
"@types/ember__service": "4.0.9",
"@typescript-eslint/eslint-plugin": "8.18.2",
"@typescript-eslint/parser": "8.18.2",
"concurrently": "9.1.0",
"ember-template-lint": "6.0.0",
"eslint": "8.57.1",
"prettier": "3.3.3",
"rollup": "4.25.0",
"rollup-plugin-copy": "3.5.0",
"typescript": "^5.7.2"
"typescript": "5.7.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
4 changes: 2 additions & 2 deletions packages/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"ember-maybe-import-regenerator": "1.0.0",
"ember-qunit": "7.0.0",
"ember-resolver": "11.0.1",
"ember-simple-auth": "workspace:*",
"ember-simple-auth": "link:../ember-simple-auth",
"ember-source": "5.12.0",
"ember-source-channel-url": "3.0.0",
"ember-try": "3.0.0",
Expand All @@ -62,7 +62,7 @@
"najax": "1.0.7",
"npm-run-all2": "7.0.2",
"pretender": "3.4.7",
"qunit": "2.22.0",
"qunit": "2.23.1",
"qunit-dom": "2.0.0",
"torii": "1.0.0-beta.2",
"webpack": "5.96.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/test-esa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"najax": "1.0.7",
"npm-run-all2": "7.0.2",
"pretender": "3.4.7",
"qunit": "2.22.0",
"qunit": "2.23.1",
"qunit-dom": "2.0.0",
"sinon": "19.0.2",
"torii": "1.0.0-beta.2",
Expand Down
Loading
Loading