Skip to content

[ENG-467] Upgrade dependencies #654

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
e31861c
chore: upgrade all dependencies with latest patch versions
jamescdavis Apr 15, 2019
eb0cfa5
types: update for more restrictive RelationshipsFor/AttributesFor
jamescdavis Apr 16, 2019
53a88fd
chore: upgrade all dependencies with latest minor versions
jamescdavis Apr 16, 2019
5800b2a
tests: remove duplicate osf-adapter test
jamescdavis Apr 29, 2019
4b478bd
tests: update ember-data-factory-guy usage for 3.7
jamescdavis Apr 29, 2019
5a807d8
types: update for improved typechecking
jamescdavis Apr 16, 2019
5afc529
chore: upgrade to TypeScript 3.4.5
jamescdavis Apr 16, 2019
0ceff0c
chore: upgrade dependencies to stable or latest rc
jamescdavis Apr 16, 2019
b9341ae
types: s/Array<unknown>/unknown[]/
jamescdavis Apr 17, 2019
e329e83
tests: reduce dashboard project count to 21
jamescdavis Apr 17, 2019
bf373e4
tests: stub head-tags for collections route unit tests
jamescdavis Apr 17, 2019
ebbdf23
chore: downgrade ember-cli-meta-tags to 5.0.0
jamescdavis Apr 17, 2019
2c43581
chore: upgrade to @ember/jquery 0.6.0
jamescdavis Apr 17, 2019
d3337e6
chore: upgrade to @ember/[email protected]
jamescdavis Apr 17, 2019
2470e58
upgrade to @ember/[email protected]
jamescdavis Apr 17, 2019
224d82c
chore: upgrade to @types/[email protected]
jamescdavis Apr 17, 2019
f5098c9
chore upgrade to @types/[email protected]
jamescdavis Apr 17, 2019
d1d3724
chore: upgrade to @types/[email protected]
jamescdavis Apr 17, 2019
83f2e76
types: update keen adapter test for stricter sinon types
jamescdavis Apr 17, 2019
3704879
types: update registries-navbar integration test for stricter sinon t…
jamescdavis Apr 26, 2019
26e101d
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
2c97bb1
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
4525ef4
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
42d98d4
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
f172619
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
70c6e6d
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
8a21c17
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
815ae15
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
916c49b
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
fb4d82a
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
08f0776
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
c7bd9b0
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
ca12cca
styles: add path for variables import in osf-components
jamescdavis Apr 17, 2019
973f7f4
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
80960f0
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
d21538f
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
cfadec4
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
5369ffd
tests: use Object.assign instead of .copy()
jamescdavis Apr 17, 2019
349d89a
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
a8232c9
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
928f121
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
af06f54
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
c3e2cd6
chore: increase testem browser disconnect timeout
jamescdavis Apr 17, 2019
055bc8d
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
b8fade5
chore: upgrade to [email protected]
jamescdavis Apr 17, 2019
8ae6d9c
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
7043990
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
76605b5
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
e7f903c
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
25f1735
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
aa8ffbe
chore: upgrade to [email protected]
jamescdavis Apr 26, 2019
1580171
chore: upgrade to latest minor versions
jamescdavis May 3, 2019
e489f7e
tests: change withContributors node trait to max out at 5
jamescdavis May 3, 2019
3559ee0
Merge branch 'develop' into upgrade_dependencies
aaxelb May 20, 2019
bc5be2f
fix: make managers more test-friendly
aaxelb May 20, 2019
b070c86
Merge branch 'develop' into upgrade_dependencies
aaxelb May 20, 2019
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
2 changes: 1 addition & 1 deletion app/guid-user/quickfiles/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class UserQuickfiles extends Controller {
}
});

flash = task(function *(item: File, message: string, type = 'success', duration = 2000) {
flash = task(function *(item: File, message: string, type: string = 'success', duration: number = 2000) {
Copy link
Member Author

@jamescdavis jamescdavis Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be a change (possibly a regression) in TypeScript 3.4 that prevents it form inferring the type from default arguments in some cases (turn on the noImplicitAny option). Here's the same with TypeScript 3.3 (as of this writing typescript-play.js.org was still on 3.3. Note: noImplicitAny is on by default in this playground).

item.set('flash', { message, type });
yield timeout(duration);
item.set('flash', null);
Expand Down
2 changes: 1 addition & 1 deletion app/home/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
background: url('/assets/images/home/Ana_transparent_gradient.png') no-repeat center bottom;
background-size: contain;
position: relative;
margin: -80px 0 -65px 0;
margin: -80px 0 -65px;
Copy link
Member Author

@jamescdavis jamescdavis Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


.quote {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion app/models/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default class NodeModel extends BaseFileItem.extend(Validations, Collecta

@computed('root')
get isRoot() {
const rootId = this.belongsTo('root').id();
const rootId = (this as NodeModel).belongsTo('root').id();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure why this is necessary, but it definitely breaks without it! 😆

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also confused why this breaks... but in looking into it I found you can also fix it with:

get isRoot(this: NodeModel) {

Unsure which is better/cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably relevant: microsoft/TypeScript#29413

return !rootId || rootId === this.id;
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/osf-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class OsfModel extends Model {

// HACK: ember-data discards/ignores the link if an object on the belongsTo side
// came first. In that case, grab the link where we expect it from OSF's API
const url = reference.link() || getRelatedHref(this.relationshipLinks[relationshipName]);
const url = reference.link() || getRelatedHref(this.relationshipLinks[relationshipName as string]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to the types changes to RelationshipsFor. RelationshipsFor includes the possibility of attribute keys of type symbol, which type Relationships does not accept. We previously restricted to string keys:

export type RelationshipsFor<Model, T extends keyof Model = keyof Model> = T extends string ? T : never;

but this now breaks this.hasMany() above due to stricter typing in ember-data.

if (!url) {
throw new Error(`Could not find a link for '${relationshipName}' relationship`);
}
Expand Down
4 changes: 4 additions & 0 deletions config/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ declare const config: {
};

defaultProvider: string;

pageTitle: {
prepend: boolean;
};
};

export default config;
3 changes: 3 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ module.exports = function(environment) {
mirageScenarios: MIRAGE_SCENARIOS,

defaultProvider: 'osf',
pageTitle: {
prepend: false,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};

if (environment === 'development') {
Expand Down
32 changes: 19 additions & 13 deletions lib/app-components/addon/components/subject-picker/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,26 @@ export default class SubjectPicker extends Component.extend({
this.get('querySubjects').perform();
},

querySubjects: task(function *(this: SubjectPicker, parents = 'null', tier = 0): IterableIterator<any> {
const column: Column = this.columns.objectAt(tier)!;

const taxonomies: Taxonomy[] = yield this.provider.queryHasMany('taxonomies', {
filter: {
parents,
},
page: {
size: 150, // Law category has 117 (Jan 2018)
},
});
querySubjects: task(
function *(
this: SubjectPicker,
parents: string = 'null',
tier: number = 0,
): IterableIterator<any> {
const column: Column = this.columns.objectAt(tier)!;

const taxonomies: Taxonomy[] = yield this.provider.queryHasMany('taxonomies', {
filter: {
parents,
},
page: {
size: 150, // Law category has 117 (Jan 2018)
},
});

column.set('subjects', taxonomies ? taxonomies.toArray() : []);
}),
column.set('subjects', taxonomies ? taxonomies.toArray() : []);
},
),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reformatted this, but the only change is adding types for parents and tier.

}) {
@service analytics!: Analytics;
@service store!: DS.Store;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tagName } from '@ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { alias } from '@ember-decorators/object/computed';
import { alias, and } from '@ember-decorators/object/computed';
import { service } from '@ember-decorators/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
Expand Down Expand Up @@ -40,7 +40,7 @@ export default class InstitutionsManager extends Component.extend({
yield this.node.updateM2MRelationship('affiliatedInstitutions', this.affiliatedList);
this.setProperties({
currentAffiliatedList: [...this.affiliatedList],
inEditMode: false,
requestedEditMode: false,
});
this.reloadList();
}),
Expand All @@ -52,13 +52,15 @@ export default class InstitutionsManager extends Component.extend({
@service i18n!: I18N;
@service toast!: Toast;

inEditMode: boolean = false;
affiliatedList!: QueryHasManyResult<Institution>;
currentAffiliatedList!: QueryHasManyResult<Institution>;
reloadList!: (page?: number) => void;
requestedEditMode: boolean = false;

@alias('node.userHasAdminPermission') userCanEdit!: boolean;

@and('userCanEdit', 'requestedEditMode') inEditMode!: boolean;

@computed('currentAffiliatedList.[]', 'loadNodeAffiliatedInstitutions.isRunning')
get fieldIsEmpty() {
if (this.loadNodeAffiliatedInstitutions.isRunning) {
Expand All @@ -82,7 +84,7 @@ export default class InstitutionsManager extends Component.extend({

@action
startEditing() {
this.set('inEditMode', true);
this.set('requestedEditMode', true);
}

@action
Expand All @@ -97,6 +99,6 @@ export default class InstitutionsManager extends Component.extend({

@action
cancel() {
this.set('inEditMode', false);
this.set('requestedEditMode', false);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tagName } from '@ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { alias } from '@ember-decorators/object/computed';
import { alias, and } from '@ember-decorators/object/computed';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import config from 'ember-get-config';
Expand All @@ -18,18 +18,20 @@ export default class TagsManager extends Component.extend({
save: task(function *(this: TagsManager) {
this.registration.set('tags', [...this.currentTags]);
yield this.registration.save();
this.set('inEditMode', false);
this.set('requestedEditMode', false);
}),
}) {
// required
registration!: Registration;

// private
inEditMode: boolean = false;
requestedEditMode: boolean = false;
currentTags: string[] = [];

@alias('registration.userHasAdminPermission') userCanEdit!: boolean;

@and('userCanEdit', 'requestedEditMode') inEditMode!: boolean;

didReceiveAttrs() {
if (this.registration) {
this.setProperties({ currentTags: [...this.registration.tags] });
Expand All @@ -48,7 +50,7 @@ export default class TagsManager extends Component.extend({

@action
startEditing() {
this.set('inEditMode', true);
this.set('requestedEditMode', true);
}

@action
Expand All @@ -68,6 +70,6 @@ export default class TagsManager extends Component.extend({

@action
cancel() {
this.set('inEditMode', false);
this.set('requestedEditMode', false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import template from './template';
@layout(template)
export default class PaginatedList extends Component {
// Required arguments
items?: Array<unknown>;
items?: unknown[];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer tslint treats unknown as a simple type.

page!: number;
pageSize!: number;
@requiredAction next!: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { isEmpty } from '@ember/utils';
import { ChangesetDef } from 'ember-changeset/types';
import { ResultCollection } from 'ember-cp-validations';
import DS from 'ember-data';
import DS, { AttributesFor, RelationshipsFor } from 'ember-data';
import I18n from 'ember-i18n/services/i18n';

import defaultTo from 'ember-osf-web/utils/default-to';
Expand All @@ -24,9 +24,9 @@ export enum ValidationStatus {
HasWarning,
}

export default abstract class BaseValidatedInput extends Component {
export default abstract class BaseValidatedInput<M extends DS.Model> extends Component {
// Required arguments
valuePath!: keyof DS.Model;
valuePath!: AttributesFor<M> | RelationshipsFor<M>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some validated-input components will operate on attributes or relationships. I tried to make this abstract, requiring you to choose, but then it can't be used in the constructor in the base class.


// Optional arguments
changeset?: ChangesetDef & DS.Model;
Expand All @@ -35,7 +35,7 @@ export default abstract class BaseValidatedInput extends Component {
placeholder?: string;
disabled: boolean = defaultTo(this.disabled, false);
shouldShowMessages: boolean = defaultTo(this.shouldShowMessages, true);
model?: DS.Model;
model?: M;

// Private properties
@service i18n!: I18n;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedCheckbox extends BaseValidatedComponent {
export default class ValidatedCheckbox<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assert } from '@ember/debug';
import DS, { RelationshipsFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

Expand All @@ -7,7 +8,9 @@ import styles from './styles';
import template from './template';

@layout(template, styles)
export default class ValidatedCheckboxes extends BaseValidatedComponent {
export default class ValidatedCheckboxes<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: RelationshipsFor<M>;

// Additional required arguments
options!: any[]; // Model instances that could be added to the hasMany

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import DS, { AttributesFor, RelationshipsFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedCheckbox extends BaseValidatedComponent {
export default class ValidatedCheckbox<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M> | RelationshipsFor<M>;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { action } from '@ember-decorators/object';
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedDatePicker extends BaseValidatedComponent {
export default class ValidatedDatePicker<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;

@action
forceParse(component: any) {
component._forceParse();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { action } from '@ember-decorators/object';
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedPowerSelect extends BaseValidatedComponent {
export default class ValidatedPowerSelect<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;

onchange?: (value: string) => void;

search: () => any = this.search;
Expand All @@ -16,7 +19,7 @@ export default class ValidatedPowerSelect extends BaseValidatedComponent {
placeholder?: string = this.placeholder;

@action
powerSelectChanged(this: ValidatedPowerSelect, value: string) {
powerSelectChanged(value: string) {
if (this.model && this.valuePath) {
this.model.set(this.valuePath, value);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { action, computed } from '@ember-decorators/object';
import Ember from 'ember';
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';
import BaseValidatedComponent from '../base-component';
Expand All @@ -10,7 +11,9 @@ export interface GRecaptcha {
}

@layout(template)
export default class ValidatedRecaptcha extends BaseValidatedComponent {
export default class ValidatedRecaptcha<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;

// Exposes a reset action the the parent scope.
// Usage: `bindReset=(action (mut this.resetRecaptcha))`, then call `this.resetRecaptcha()` to trigger a reset
bindReset?: (action: () => void) => void;
Expand Down Expand Up @@ -38,12 +41,12 @@ export default class ValidatedRecaptcha extends BaseValidatedComponent {
}

@action
onCaptchaResolved(this: ValidatedRecaptcha, reCaptchaResponse: string) {
onCaptchaResolved(reCaptchaResponse: string) {
this.set('value', reCaptchaResponse);
}

@action
onCaptchaExpired(this: ValidatedRecaptcha) {
onCaptchaExpired() {
this.set('value', '');
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';
import defaultTo from 'ember-osf-web/utils/default-to';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedText extends BaseValidatedComponent {
export default class ValidatedText<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;

// Additional arguments
password: boolean = defaultTo(this.password, false);
onKeyUp?: () => void; // Action
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import DS, { AttributesFor } from 'ember-data';

import { layout } from 'ember-osf-web/decorators/component';

import BaseValidatedComponent from '../base-component';
import template from './template';

@layout(template)
export default class ValidatedTextArea extends BaseValidatedComponent {
export default class ValidatedTextArea<M extends DS.Model> extends BaseValidatedComponent<M> {
valuePath!: AttributesFor<M>;
}
2 changes: 1 addition & 1 deletion lib/osf-components/addon/styles/headers.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import 'variables';
@import 'app/styles/variables';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newer ember-cli-sass wants this to be the full path.

2 changes: 1 addition & 1 deletion lib/registries/addon/components/comment-card/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class CommentCard extends Component.extend({

this.toast.success(this.i18n.t('registries.overview.comments.retract_report.success'));
}),
loadReplies: task(function *(this: CommentCard, more = false) {
loadReplies: task(function *(this: CommentCard, more: boolean = false) {
if (!more) {
const replies = yield this.comment.replies;
if (!this.replies) {
Expand Down
Loading