Skip to content

Commit

Permalink
Change ember-data import to @ember-data
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed Sep 4, 2022
1 parent 1c49ddc commit 136a99e
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
'ember/no-mixins': 'off',
'ember/no-new-mixins': 'off',
'ember/no-string-prototype-extensions': 'off',
'ember/use-ember-data-rfc-395-imports': 'off',
// 'ember/use-ember-data-rfc-395-imports': 'off',
},
overrides: [
// node files
Expand Down
4 changes: 1 addition & 3 deletions addon/adapters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import RSVP from 'rsvp';
import { run } from '@ember/runloop';
import { isEmpty, typeOf } from '@ember/utils';
import { computed, get } from '@ember/object';
import DS from 'ember-data';
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import ImportExportMixin from '../mixins/adapters/import-export';
import { _buildKey } from '../helpers/storage';

const getKeys = Object.keys || keys;

const { JSONAPIAdapter } = DS;

// Ember data ships with ember-inflector
import { singularize, pluralize } from 'ember-inflector';

Expand Down
6 changes: 3 additions & 3 deletions addon/initializers/local-storage-adapter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import DS from 'ember-data';
import Store from '@ember-data/store';
import {
importData,
exportData,
} from 'ember-local-storage/helpers/import-export';

export function initialize() {
if (!DS.Store.prototype._emberLocalStoragePatched) {
DS.Store.reopen({
if (!Store.prototype._emberLocalStoragePatched) {
Store.reopen({
_emberLocalStoragePatched: true,
importData: function (json, options) {
return importData(this, json, options);
Expand Down
8 changes: 5 additions & 3 deletions addon/serializers/serializer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import DS from 'ember-data';

const { JSONAPISerializer } = DS;
import JSONAPISerializer from '@ember-data/serializer/json-api';
import DS from 'ember-data'; // eslint-disable-line ember/use-ember-data-rfc-395-imports

// Should be removed
// https://github.com/emberjs/data/pull/5317
// https://github.com/emberjs/data/pull/5324
const emberDataVersionOlderThan3Point1 = DS.VERSION.match(/^[0-2]\.|^3\.0/);

export default JSONAPISerializer.extend({
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/blog/post.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, belongsTo, hasMany } = DS;
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/book-publication.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, hasMany } = DS;
import Model, { attr, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/comment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, belongsTo } = DS;
import Model, { attr, belongsTo } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/pet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, hasMany } = DS;
import Model, { attr, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/post.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, belongsTo, hasMany } = DS;
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/project.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, hasMany } = DS;
import Model, { attr, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/task.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, belongsTo, hasMany } = DS;
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
4 changes: 1 addition & 3 deletions tests/dummy/app/models/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import DS from 'ember-data';

const { Model, attr, hasMany } = DS;
import Model, { attr, hasMany } from '@ember-data/model';

export default Model.extend({
name: attr('string'),
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/adapters/application-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { run } from '@ember/runloop';
import DS from 'ember-data';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

const { AdapterError, Model, attr } = DS;
import { run } from '@ember/runloop';
import Model, { attr } from '@ember-data/model';
import AdapterError from '@ember-data/adapter/error';

let SimpleModel = Model.extend({
prop: attr('string'),
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/models/post-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { get } from '@ember/object';
import { run } from '@ember/runloop';
import DS from 'ember-data';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

import { get } from '@ember/object';
import { run } from '@ember/runloop';
import DS from 'ember-data'; // eslint-disable-line ember/use-ember-data-rfc-395-imports

import {
registerConfigEnvironment,
setConfigEnvironment,
Expand Down

0 comments on commit 136a99e

Please sign in to comment.