Skip to content

[BREAKING] Remove ember-fetch #444

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion .ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": true
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ module.exports = {
'addon/**',
'addon-test-support/**',
'app/**',
'tests/helpers/**',
'tests/dummy/app/**',
],
parserOptions: {
Expand Down
84 changes: 55 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,48 @@ on:
- 'v*'
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10

env:
CI: 'true'

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
- name: Run Tests
run: yarn test:ember

floating:
name: "Floating Dependencies"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12.x
- name: Install yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install
- name: Test
run: yarn test
node-version: 16.x
cache: yarn
- name: Install Dependencies
run: yarn install --no-lockfile
- name: Run Tests
run: yarn test:ember

try-scenarios:
name: Tests ${{ matrix.ember-try-scenario }}
Expand All @@ -35,29 +58,32 @@ jobs:
env:
CI: 'true'


timeout-minutes: 10

strategy:
fail-fast: true
matrix:
ember-try-scenario:
- ember-lts-3.24
- ember-lts-3.28
- ember-release
- ember-beta
- ember-canary
- ember-classic
- embroider-safe
- embroider-optimized
try-scenario:
#- ember-lts-4.4
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-lts-5.8
#- ember-release
#- ember-beta
#- ember-canary
#- embroider-safe
#- embroider-optimized

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 12.x
- name: Install yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install
- name: Test
env:
EMBER_TRY_SCENARIO: ${{ matrix.ember-try-scenario }}
run: yarn ember try:one $EMBER_TRY_SCENARIO
node-version: 16.x
cache: yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ jsconfig.json
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Install the [Apollo Client Developer tools for Chrome](https://chrome.google.com
* Apollo Client v3.0 or above
* Ember.js v3.24 or above
* Ember CLI v2.13 or above
* Node.js v12 or above
* Node.js v16 or above
* FastBoot 1.0+

For compatibility with Ember versions below 3.4, use version 1.x.
Expand Down Expand Up @@ -683,7 +683,7 @@ Note: The `graphql` module above is included when you `ember install ember-apoll
### Testing

This addon is test-ready! All promises from the apollo service are tracked with
`Ember.Test.registerWaiter`, so your tests should be completely deterministic.
`waitForPromise` and `waitForFetch` so your tests should be completely deterministic.

The dummy app contains example routes for mutations and queries:

Expand Down
9 changes: 6 additions & 3 deletions addon/services/apollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { get, set, setProperties, defineProperty } from '@ember/object';
import { sendEvent } from '@ember/object/events';
import RSVP from 'rsvp';
import Service from '@ember/service';
import fetch from 'fetch';
import { A } from '@ember/array';
import {
ApolloClient,
Expand All @@ -14,10 +13,14 @@ import { isArray } from '@ember/array';
import { isNone, isPresent } from '@ember/utils';
import { run, next } from '@ember/runloop';
import { QueryManager } from '../index';
import { waitForPromise } from '@ember/test-waiters';
import { waitForPromise, waitForFetch } from '@ember/test-waiters';
import { tracked } from '@glimmer/tracking';
import { macroCondition, isTesting } from '@embroider/macros';

export function wrappedFetch(...args) {
return waitForFetch(fetch(...args));
}

const apolloObservableWeakMap = new WeakMap();
const apolloUnsubscribeWeakMap = new WeakMap();

Expand Down Expand Up @@ -151,7 +154,7 @@ export default class ApolloService extends Service {

link() {
const { apiURL, requestCredentials } = this.options;
const linkOptions = { uri: apiURL, fetch };
const linkOptions = { uri: apiURL, fetch: wrappedFetch };

if (isPresent(requestCredentials)) {
linkOptions.credentials = requestCredentials;
Expand Down
46 changes: 26 additions & 20 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,66 @@ module.exports = async function () {
useYarn: true,
scenarios: [
{
name: 'ember-lts-3.24',
name: 'ember-lts-4.4',
npm: {
devDependencies: {
'ember-source': '~3.24.3',
'ember-source': '~4.4.0',
},
},
},
{
name: 'ember-lts-3.28',
name: 'ember-lts-4.8',
npm: {
devDependencies: {
'ember-source': '~3.28.0',
'ember-source': '~4.8.0',
},
},
},
{
name: 'ember-release',
name: 'ember-lts-4.12',
npm: {
devDependencies: {
'ember-source': await getChannelURL('release'),
'ember-source': '~4.12.0',
},
},
},
{
name: 'ember-beta',
name: 'ember-lts-5.4',
npm: {
devDependencies: {
'ember-source': await getChannelURL('beta'),
'ember-source': '~5.4.0',
},
},
},
{
name: 'ember-canary',
name: 'ember-lts-5.8',
npm: {
devDependencies: {
'ember-source': await getChannelURL('canary'),
'ember-source': '~5.8.0',
},
},
},
{
name: 'ember-classic',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'application-template-wrapper': true,
'default-async-observers': false,
'template-only-glimmer-components': false,
}),
name: 'ember-release',
npm: {
devDependencies: {
'ember-source': await getChannelURL('release'),
},
},
},
{
name: 'ember-beta',
npm: {
devDependencies: {
'ember-source': '~3.28.0',
'ember-source': await getChannelURL('beta'),
},
ember: {
edition: 'classic',
},
},
{
name: 'ember-canary',
npm: {
devDependencies: {
'ember-source': await getChannelURL('canary'),
},
},
},
Expand Down
62 changes: 37 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,71 +26,83 @@
},
"scripts": {
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
"lint": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
"lint:fix": "npm-run-all --print-name --aggregate-output --continue-on-error --parallel \"lint:*:fix\"",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"test": "npm-run-all lint test:*",
"test": "npm-run-all --print-name \"lint\" \"test:*\"",
"test:ember": "ember test"
},
"dependencies": {
"@apollo/client": "^3.5.10",
"@ember/test-waiters": "~3.0.1",
"@embroider/macros": "^1.5.0",
"@glimmer/tracking": "^1.0.4",
"@ember/string": "^3.1.1",
"@ember/test-waiters": "^4.1.0",
"@embroider/macros": "^1.18.0",
"@glimmer/tracking": "^1.1.2",
"broccoli-graphql-filter": "^1.0.0",
"ember-auto-import": "^2.4.0",
"ember-auto-import": "^2.4.3",
"ember-cli-babel": "^7.26.11"
},
"devDependencies": {
"@babel/core": "^7.17.7",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@embroider/test-setup": "^1.2.0",
"@glimmer/component": "^1.0.4",
"@ember/test-helpers": "^4.0.4",
"@embroider/test-setup": "^1.8.3",
"@glimmer/component": "^1.1.2",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~4.2.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^6.0.1",
"ember-cli": "~4.8.1",
"ember-cli-dependency-checker": "^3.3.1",
"ember-cli-htmlbars": "^6.1.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-terser": "^4.0.2",
"ember-compatibility-helpers": "^1.2.6",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-fetch": "^8.1.1",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-qunit": "^5.1.5",
"ember-qunit": "^8.1.1",
"ember-resolver": "^8.0.3",
"ember-source": "~4.2.0",
"ember-source": "~4.8.0",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^4.2.0",
"ember-template-lint": "^4.16.1",
"ember-try": "^2.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-ember": "^10.5.9",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-ember": "^11.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-qunit": "^7.2.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.1",
"minimatch": "^5.1.6",
"glob": "^7.1.7",
"graphql": "^16.0.0",
"graphql-tag": "^2.12.6",
"graphql-tools": "^4.0.8",
"loader.js": "^4.7.0",
"npm-run-all": "^4.1.5",
"pretender": "^3.4.7",
"prettier": "^2.5.1",
"qunit": "^2.18.0",
"prettier": "^2.7.1",
"qunit": "^2.19.2",
"qunit-dom": "^2.0.0",
"webpack": "^5.69.1"
"webpack": "^5.74.0"
},
"peerDependencies": {
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
},
"//resolutions": {
"isbinaryfile": "later versions of isbinaryfile require node.js 18 or later, while this addon maintains compatibility with node.js 16. To ensure compatibility, we pin isbinaryfile to version 5.0.0.",
"glob": "later versions of glob require node.js 18 or later, while this addon maintains compatibility with node.js 16. To ensure compatibility, we pin glob to version ^7.2.3.",
"minimatch": "later versions of minimatch require node.js 18 or later, while this addon maintains compatibility with node.js 16. To ensure compatibility, we pin minimatch to version ^5.1.6."
},
"resolutions": {
"isbinaryfile": "5.0.0",
"glob": "^7.2.3",
"minimatch": "^5.1.6"
},
"engines": {
"node": "12.* || 14.* || >= 16"
"node": "16.* || >= 18"
},
"ember": {
"edition": "octane"
Expand Down
1 change: 1 addition & 0 deletions testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
test_page: 'tests/index.html?hidepassed',
framework: 'qunit',
disable_watching: true,
client_decycle_depth: 10,
launch_in_ci: ['Chrome'],
Expand Down
Loading