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

as-clean-up-deps #1827

Merged
merged 8 commits into from
Oct 4, 2018
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
3 changes: 1 addition & 2 deletions app/helpers/format-config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { helper } from '@ember/component/helper';
import { copy } from 'ember-copy';

export function safeFormatConfig(config) {
const rejectKeys = ['.result', 'notifications', 'branches', 'linux_shared'];
const rejectIfEmptyKeys = ['addons'];

// create deep copy of config
let deepCopy = copy(config[0] || {}, true);
const deepCopy = JSON.parse(JSON.stringify(config[0] || {}));

rejectKeys.forEach((keyToReject) => {
delete deepCopy[keyToReject];
Expand Down
20 changes: 11 additions & 9 deletions app/models/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { all } from 'rsvp';

import { isEmpty } from '@ember/utils';
import safelistedConfigKeys from 'travis/utils/safelisted-config-keys';
import pickBy from 'lodash.pickby';
import { isEmpty, isPresent } from '@ember/utils';
import configKeysMap from 'travis/utils/keys-map';
import Model from 'ember-data/model';
import DurationCalculations from 'travis/mixins/duration-calculations';
Expand Down Expand Up @@ -49,7 +47,11 @@ export default Model.extend(DurationCalculations, {
@computed('_config', 'currentState.stateName')
config(config, stateName) {
if (config) {
return pickBy(config);
return Object.keys(config).reduce((compact, key) => {
const value = config[key];
if (isPresent(value)) compact[key] = value;
return compact;
});
} else if (stateName !== 'root.loading') {
if (this.get('isFetchingConfig')) {
return;
Expand Down Expand Up @@ -98,11 +100,11 @@ export default Model.extend(DurationCalculations, {

@computed('jobs.@each.config')
rawConfigKeys(jobs) {
let keys = [];
jobs.forEach((job) => {
const configKeys = safelistedConfigKeys(job.get('config'));
return configKeys.forEach((key) => {
if (!keys.includes(key)) {
const keys = [];
jobs.forEach(job => {
const configKeys = job.config || [];
return configKeys.forEach(key => {
if (!keys.includes(key) && configKeysMap.hasOwnProperty(key)) {
return keys.pushObject(key);
}
});
Expand Down
16 changes: 9 additions & 7 deletions app/templates/components/repository-filter-form-search-field.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{one-way-search
query
update=(action 'onSearch')
class="search"
id=inputId
placeholder=placeholder title=title
}}
<input
type="search"
value={{query}}
oninput={{action 'onSearch' value="target.value"}}
class="search"
id={{inputId}}
placeholder={{placeholder}}
title={{title}}
/>
9 changes: 0 additions & 9 deletions app/utils/safelisted-config-keys.js

This file was deleted.

27 changes: 16 additions & 11 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ module.exports = function () {
'ember-cli-babel': {
includePolyfill: true,
},
autoImport: {
webpack: {
// workaround for https://github.com/jeremyfa/yaml.js/issues/102
node: {
fs: 'empty'
},
module: {
noParse: /pusher/
}
}
},
babel: {
blacklist: ['regenerator'],
plugins: [
Expand Down Expand Up @@ -88,12 +77,28 @@ module.exports = function () {
}
]
}
},
'ember-composable-helpers': {
only: ['sort-by', 'compute']
}
});

const emojiAssets = new Funnel('node_modules/emoji-datasource-apple/img/apple/64', {
destDir: '/images/emoji'
});

importNpmDependency(app, 'node_modules/fuzzysort/fuzzysort.js');
importNpmDependency(app, 'node_modules/pusher-js/dist/web/pusher.js');
importNpmDependency(app, 'node_modules/raven-js/dist/raven.js');
importNpmDependency(app, 'node_modules/emoji-js/lib/emoji.js');
importNpmDependency(app, 'node_modules/visibilityjs/index.js');
importNpmDependency(app, 'node_modules/ansiparse/lib/ansiparse.js', 'amd');
importNpmDependency(app, 'node_modules/yamljs/index.js');

return app.toTree(emojiAssets);
};

function importNpmDependency(app, path, transformation = 'cjs', alias) {
const as = alias || path.split('/')[1];
app.import(path, { using: [{ transformation, as }] });
}
5 changes: 2 additions & 3 deletions mirage/serializers/owner.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Serializer } from 'ember-cli-mirage';
import { copy } from 'ember-copy';

export default Serializer.extend({
serialize(object) {
const user = copy(object.attrs);
const user = Object.assign({}, object.attrs);
user['@type'] = 'user';

user.repositories = object.schema.repositories.where(repo => {
return repo.slug.indexOf(user.login) === 0;
}).models.map(repo => {
const data = copy(repo.attrs);
const data = Object.assign({}, repo.attrs);

const defaultBranch = repo.branches.models.filterBy('default_branch', true)[0];

Expand Down
Loading