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

Use yarn package manager #2368

Merged
merged 2 commits into from
Mar 22, 2017
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
5 changes: 3 additions & 2 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM node:6.9.0
RUN npm install -g yarn
WORKDIR /home/weave
COPY package.json /home/weave/
COPY package.json yarn.lock /home/weave/
ENV NPM_CONFIG_LOGLEVEL=warn NPM_CONFIG_PROGRESS=false
RUN npm install
RUN yarn --pure-lockfile
COPY webpack.local.config.js webpack.production.config.js server.js .babelrc .eslintrc .eslintignore /home/weave/
4 changes: 2 additions & 2 deletions client/app/scripts/selectors/nodes-chart-graph.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import debug from 'debug';
import { createSelector, createStructuredSelector } from 'reselect';
import { Map as makeMap } from 'immutable';
import timely from 'timely';

import { initEdgesFromNodes } from '../utils/layouter-utils';
import { viewportWidthSelector, viewportHeightSelector } from './canvas-viewport';
import { activeTopologyOptionsSelector } from './topology';
import { shownNodesSelector } from './node-filters';
import { doLayout } from '../charts/nodes-layout';
import timer from '../utils/timer-utils';

const log = debug('scope:nodes-chart');

Expand Down Expand Up @@ -49,7 +49,7 @@ const graphLayoutSelector = createSelector(
}

const edges = initEdgesFromNodes(nodes);
const timedLayouter = timely(doLayout);
const timedLayouter = timer(doLayout);
const graph = timedLayouter(nodes, edges, options);

// NOTE: We probably shouldn't log anything in a
Expand Down
18 changes: 18 additions & 0 deletions client/app/scripts/utils/__tests__/timer-utils-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import expect from 'expect';
import timer from '../timer-utils';

describe('timer', () => {
it('records how long a function takes to execute', () => {
const add100k = (number) => {
for (let i = 0; i < 100000; i += 1) {
number += 1;
}
return number;
};

const timedFn = timer(add100k);
const result = timedFn(70);
expect(result).toEqual(100070);
expect(timedFn.time).toBeA('number');
});
});
11 changes: 11 additions & 0 deletions client/app/scripts/utils/timer-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Replacement for timely dependency

export default function timer(fn) {
const timedFn = (...args) => {
const start = new Date();
const result = fn.apply(fn, args);
timedFn.time = new Date() - start;
return result;
};
return timedFn;
}
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"reqwest": "2.0.5",
"reselect": "2.5.4",
"reselect-map": "1.0.0",
"timely": "0.1.0",
"whatwg-fetch": "2.0.1",
"react-addons-perf": "15.4.2",
"xterm": "2.2.3"
Expand Down
Loading