Skip to content

Commit

Permalink
Merge pull request #2604 from mainmatter/v2-addon
Browse files Browse the repository at this point in the history
V2 addon
  • Loading branch information
BobrImperator authored Aug 18, 2023
2 parents 5565f68 + 5c768c8 commit 7f33a6a
Show file tree
Hide file tree
Showing 163 changed files with 2,720 additions and 4,458 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ module.exports = {
'testem.js',
'config/**/*.js',
'.eslintrc.js',
'.template-lintrc.js',
'.prettierc.js',
'addon-main.cjs'
],
excludedFiles: [
'app/**',
Expand Down
10 changes: 10 additions & 0 deletions .github/actions/download-built-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Download built package from cache
description: Download built package from cache
runs:
using: "composite"
steps:
- name: Download built package from cache
uses: actions/download-artifact@v3
with:
name: dist
path: ${{ env.dist }}
49 changes: 42 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

env:
VOLTA_FEATURE_PNPM: 1
dist: packages/ember-simple-auth/dist

on:
push:
Expand All @@ -21,7 +22,7 @@ jobs:
strategy:
matrix:
workspace:
- ember-simple-auth
- test-esa
- classic-test-app
- test-app

Expand All @@ -41,16 +42,39 @@ jobs:
- name: lint
run: pnpm run --filter ${{ matrix.workspace }} lint

build:
name: Build Ember Simple Auth
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- uses: volta-cli/action@d253558a6e356722728a10e9a469190de21a83ef # v4
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Build dist
run: pnpm run --filter ember-simple-auth build
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: ${{ env.dist }}


tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build

strategy:
fail-fast: false
matrix:
workspace:
- ember-simple-auth
- test-esa
- classic-test-app
- test-app
test-suite:
Expand All @@ -63,10 +87,16 @@ jobs:
- test:one ember-release
allow-failure: [false]
include:
- workspace: ember-simple-auth
- workspace: test-esa
test-suite: "test:one embroider-safe"
allow-failure: false
- workspace: test-esa
test-suite: "test:one embroider-optimized"
allow-failure: false
- workspace: test-app
test-suite: "test:one embroider-safe"
allow-failure: false
- workspace: ember-simple-auth
- workspace: test-app
test-suite: "test:one embroider-optimized"
allow-failure: false

Expand All @@ -79,6 +109,7 @@ jobs:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- uses: ./.github/actions/download-built-package

- name: install dependencies
run: pnpm install
Expand All @@ -91,14 +122,15 @@ jobs:
name: ${{ matrix.workspace }} ${{ matrix.test-suite }} - Allowed to fail
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build
permissions:
pull-requests: write

strategy:
fail-fast: false
matrix:
workspace:
- ember-simple-auth
- test-esa
- classic-test-app
- test-app
test-suite:
Expand All @@ -114,6 +146,7 @@ jobs:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- uses: ./.github/actions/download-built-package

- name: install dependencies
run: pnpm install
Expand All @@ -133,11 +166,12 @@ jobs:
name: Tests (Floating Dependenies)
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build

strategy:
matrix:
workspace:
- ember-simple-auth
- test-esa
- classic-test-app
- test-app

Expand All @@ -150,6 +184,7 @@ jobs:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- uses: ./.github/actions/download-built-package

- name: install dependencies
run: pnpm install --no-lockfile
Expand Down Expand Up @@ -177,4 +212,4 @@ jobs:
run: pnpm install

- name: tests
run: pnpm run --filter ember-simple-auth test:node
run: pnpm run --filter test-esa test:node
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ package.json.ember-try
package-lock.json

.eslintcache

packages/ember-simple-auth/README*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolution-mode=highest
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ __[Ember Simple Auth API docs](http://ember-simple-auth.com/api/)__

__[![Discord](https://img.shields.io/discord/480462759797063690.svg?logo=discord)](https://discord.gg/zT3asNS)__

Ember Simple Auth __supports all Ember.js versions starting with 3.28.__
__Doesn't support IE11__
Node __>=16 is required__

- Ember Simple Auth __supports all Ember.js versions starting with 3.28.__
- __Doesn't support IE11__
- Node __>=16 is required__
- Supports __Embroider__ see our [ember-try scenario](https://github.com/mainmatter/ember-simple-auth/blob/master/packages/test-esa/config/ember-try.js) and [test app](https://github.com/mainmatter/ember-simple-auth/blob/master/packages/test-app/ember-cli-build.js) for guidance.
# Ember Simple Auth

![Logo](http://ember-simple-auth.com/images/logo.png)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"version": "6.0.0-rc.1",
"volta": {
"node": "16.20.2",
"pnpm": "8.6.12"
"node": "16.20.1",
"pnpm": "8.6.11"
}
}
14 changes: 7 additions & 7 deletions packages/classic-test-app/app/authenticators/torii.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import Torii from 'ember-simple-auth/authenticators/torii';

export default Torii.extend({
torii: service(),
ajax: service(),

authenticate() {
const ajax = this.get('ajax');

return this._super(...arguments).then((data) => {
return ajax.request('/token', {
type: 'POST',
dataType: 'json',
data: { 'grant_type': 'facebook_auth_code', 'auth_code': data.authorizationCode }
return fetch('/token', {
method: 'POST',
body: JSON.stringify({
grant_type: 'facebook_auth_code',
auth_code: data.authorizationCode,
}),
headers: { 'Content-Type': 'application/json' },
}).then((response) => {
return {
access_token: response.access_token,
Expand Down
2 changes: 1 addition & 1 deletion packages/classic-test-app/config/ember-try.js
14 changes: 3 additions & 11 deletions packages/classic-test-app/server/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
module.exports = function(app) {
var globSync = require('glob').sync;
var bodyParser = require('body-parser');
var cors = require('cors');
var mocks = globSync('./mocks/**/*.js', { cwd: __dirname }).map(require);
var proxies = globSync('./proxies/**/*.js', { cwd: __dirname }).map(require);

app.use(bodyParser.json({ type: 'application/*+json' }));
app.use(bodyParser.urlencoded({
extended: true
}));
require('./mocks/token')(app);
require('./mocks/posts')(app);
require('./mocks/accounts')(app);

// Log proxy requests
var morgan = require('morgan');
app.use(morgan('dev'));

// enable *all* CORS requests
app.use(cors());

mocks.forEach(function(route) { route(app); });
proxies.forEach(function(route) { route(app); });
};
5 changes: 5 additions & 0 deletions packages/classic-test-app/server/mocks/token.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = function(app) {
var express = require('express');
var bodyParser = require('body-parser');
var tokenRouter = express.Router();
app.use(bodyParser.json({ type: 'application/*+json' }));
app.use(bodyParser.urlencoded({
extended: true
}));

tokenRouter.post('/token', function(req, res) {
if (req.body.grant_type === 'password') {
Expand Down
19 changes: 19 additions & 0 deletions packages/ember-simple-auth/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 0 additions & 9 deletions packages/ember-simple-auth/.ember-cli

This file was deleted.

61 changes: 0 additions & 61 deletions packages/ember-simple-auth/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 7f33a6a

Please sign in to comment.