<commit_before>/**
 * Copyright 2017 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {GRID_LAYER_TEMPLATE_CLASS_NAMES} from './amp-story-grid-layer';
import {StoryAnimationPresetDef} from './animation-types';
import {
  calculateTargetScalingFactor,
  rotateAndTranslate,
  scaleAndTranslate,
  translate2d,
  whooshIn,
} from './animation-presets-utils';
import {px} from '../../../src/style';
import {userAssert} from '../../../src/log';

/** @const {string} */
const FULL_BLEED_CATEGORY = 'full-bleed';
/** @const {string} */
const FILL_TEMPLATE_LAYOUT = 'fill';
/** @const {number} */
const SCALE_HIGH_DEFAULT = 3;
/** @const {number} */
const SCALE_LOW_DEFAULT = 1;

/** @const {string} */
const SCALE_START_ATTRIBUTE_NAME = 'scale-start';
/** @const {string} */
const SCALE_END_ATTRIBUTE_NAME = 'scale-end';
/** @const {string} */
const TRANSLATE_X_ATTRIBUTE_NAME = 'translate-x';
/** @const {string} */
const TRANSLATE_Y_ATTRIBUTE_NAME = 'translate-y';
/** @const {string} */
const DEFAULT_CURVE = '0.4, 0.4, 0.0, 1';

/** @const {!Array<string>} */
export const PRESET_OPTION_ATTRIBUTES = [
  SCALE_START_ATTRIBUTE_NAME,
  SCALE_END_ATTRIBUTE_NAME,
  TRANSLATE_X_ATTRIBUTE_NAME,
  TRANSLATE_Y_ATTRIBUTE_NAME,
];

/**
 * A list of animations that are full bleed.
 * @private @const {!Array<string>}
 */
const FULL_BLEED_ANIMATION_NAMES = [
  'pan-up',
  'pan-down',
  'pan-right',
  'pan-left',
  'zoom-in',
  'zoom-out',
];

/**
 * A mapping of animation categories to corresponding CSS class names.
 * @private @const {!Object<string, string>}
 */
const ANIMATION_CSS_CLASS_NAMES = {
  [FULL_BLEED_CATEGORY]:
    'i-amphtml-story-grid-template-with-full-bleed-animation',
};

/**
 * Perform style-specific operations for presets.
 * @param {!Element} el
 * @param {string} presetName
 */
export function setStyleForPreset(el, presetName) {
  // For full bleed animations.
  if (FULL_BLEED_ANIMATION_NAMES.indexOf(presetName) >= 0) {
    const parent = el.parentElement;
    if (
      parent.classList.contains(
        GRID_LAYER_TEMPLATE_CLASS_NAMES[FILL_TEMPLATE_LAYOUT]
      )
    ) {
      parent.classList.remove(
        GRID_LAYER_TEMPLATE_CLASS_NAMES[FILL_TEMPLATE_LAYOUT]
      );
    }
    parent.classList.add(ANIMATION_CSS_CLASS_NAMES[FULL_BLEED_CATEGORY]);
  }
}

/**
 * First keyframe will always be considered offset: 0 and will be applied to the
 * element as the first frame before animation starts.
 * @type {!Object<string, !StoryAnimationPresetDef>}
 */
export const presets = {
  'pulse': {
    duration: 600,
    easing: 'cubic-bezier(0.3, 0.0, 0.0, 1)',
    keyframes: [
      {
        offset: 0,
        transform: 'scale(1)',
      },
      {
        offset: 0.25,
        transform: 'scale(0.95)',
      },
      {
        offset: 0.75,
        transform: 'scale(1.05)',
      },
      {
        offset: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'fly-in-left': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return translate2d(offsetX, 0, 0, 0);
    },
  },
  'fly-in-right': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return translate2d(offsetX, 0, 0, 0);
    },
  },
  'fly-in-top': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetY = -(dimensions.targetY + dimensions.targetHeight);
      return translate2d(0, offsetY, 0, 0);
    },
  },
  'fly-in-bottom': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetY = dimensions.pageHeight - dimensions.targetY;
      return translate2d(0, offsetY, 0, 0);
    },
  },
  'rotate-in-left': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return rotateAndTranslate(offsetX, 0, 0, 0, -1);
    },
  },
  'rotate-in-right': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return rotateAndTranslate(offsetX, 0, 0, 0, 1);
    },
  },
  'fade-in': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
      },
      {
        opacity: 1,
      },
    ],
  },
  'scale-fade-up': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
        transform: 'scale(0.8)',
      },
      {
        opacity: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'scale-fade-down': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
        transform: 'scale(1.4)',
      },
      {
        opacity: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'drop': {
    duration: 1600,
    keyframes(dimensions) {
      const maxBounceHeight = Math.max(
        160,
        dimensions.targetY + dimensions.targetHeight
      );

      // Adapted from easings.net/#easeOutBounce
      return [
        {
          offset: 0,
          transform: `translateY(${px((1 - 0) * -maxBounceHeight)})`,
        },
        {
          offset: 0.35,
          transform: `translateY(${px((1 - 0.9801) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 0.45,
          transform: `translateY(${px((1 - 0.7502) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 0.75,
          transform: `translateY(${px((1 - 0.9837) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 0.82,
          transform: `translateY(${px((1 - 0.9375) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 0.92,
          transform: `translateY(${px((1 - 0.9934) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 0.96,
          transform: `translateY(${px((1 - 0.9846) * -maxBounceHeight)})`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 0)',
        },
        {
          offset: 1,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0.3, 0.3, 1)',
        },
      ];
    },
  },
  'twirl-in': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        transform: 'rotate(-540deg) scale(0.1)',
        opacity: 0,
      },
      {
        transform: 'none',
        opacity: 1,
      },
    ],
  },
  'whoosh-in-left': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return whooshIn(offsetX, 0, 0, 0);
    },
  },
  'whoosh-in-right': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return whooshIn(offsetX, 0, 0, 0);
    },
  },
  'pan-left': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateX = options[TRANSLATE_X_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = dimensions.pageWidth - dimensions.targetWidth;
      const offsetY = (dimensions.pageHeight - dimensions.targetHeight) / 2;

      return scaleAndTranslate(
        offsetX,
        offsetY,
        translateX ? offsetX + translateX : 0,
        offsetY,
        scalingFactor
      );
    },
  },
  'pan-right': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateX = options[TRANSLATE_X_ATTRIBUTE_NAME];

      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = dimensions.pageWidth - dimensions.targetWidth;
      const offsetY = (dimensions.pageHeight - dimensions.targetHeight) / 2;

      return scaleAndTranslate(
        0,
        offsetY,
        -translateX || offsetX,
        offsetY,
        scalingFactor
      );
    },
  },
  'pan-down': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateY = options[TRANSLATE_Y_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = -dimensions.targetWidth / 2;
      const offsetY = dimensions.pageHeight - dimensions.targetHeight;

      return scaleAndTranslate(
        offsetX,
        0,
        offsetX,
        -translateY || offsetY,
        scalingFactor
      );
    },
  },
  'pan-up': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateY = options[TRANSLATE_Y_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = -dimensions.targetWidth / 2;
      const offsetY = dimensions.pageHeight - dimensions.targetHeight;

      return scaleAndTranslate(
        offsetX,
        offsetY,
        offsetX,
        translateY ? offsetY + translateY : 0,
        scalingFactor
      );
    },
  },
  'zoom-in': {
    duration: 1000,
    easing: 'linear',
    keyframes(unusedDimensions, options) {
      const scaleStart = options[SCALE_START_ATTRIBUTE_NAME];
      const scaleEnd = options[SCALE_END_ATTRIBUTE_NAME];

      if (scaleStart) {
        userAssert(
          scaleEnd > scaleStart,
          '"scale-end" value must be greater ' +
            'than "scale-start" value when using "zoom-in" animation.'
        );
      }

      return [
        {transform: `scale(${scaleStart || SCALE_LOW_DEFAULT})`},
        {transform: `scale(${scaleEnd || SCALE_HIGH_DEFAULT})`},
      ];
    },
  },
  'zoom-out': {
    duration: 1000,
    easing: 'linear',
    keyframes(unusedDimensions, options) {
      const scaleStart = options[SCALE_START_ATTRIBUTE_NAME];
      const scaleEnd = options[SCALE_END_ATTRIBUTE_NAME];

      if (scaleStart) {
        userAssert(
          scaleStart > scaleEnd,
          '"scale-start" value must be ' +
            'higher than "scale-end" value when using "zoom-out" animation.'
        );
      }

      return [
        {transform: `scale(${scaleStart || SCALE_HIGH_DEFAULT})`},
        {transform: `scale(${scaleEnd || SCALE_LOW_DEFAULT})`},
      ];
    },
  },
};
<commit_msg>Drop keyframes based on physics (#30220)<commit_after>/**
 * Copyright 2017 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {GRID_LAYER_TEMPLATE_CLASS_NAMES} from './amp-story-grid-layer';
import {StoryAnimationPresetDef} from './animation-types';
import {
  calculateTargetScalingFactor,
  rotateAndTranslate,
  scaleAndTranslate,
  translate2d,
  whooshIn,
} from './animation-presets-utils';
import {px} from '../../../src/style';
import {userAssert} from '../../../src/log';

/** @const {string} */
const FULL_BLEED_CATEGORY = 'full-bleed';
/** @const {string} */
const FILL_TEMPLATE_LAYOUT = 'fill';
/** @const {number} */
const SCALE_HIGH_DEFAULT = 3;
/** @const {number} */
const SCALE_LOW_DEFAULT = 1;

/** @const {string} */
const SCALE_START_ATTRIBUTE_NAME = 'scale-start';
/** @const {string} */
const SCALE_END_ATTRIBUTE_NAME = 'scale-end';
/** @const {string} */
const TRANSLATE_X_ATTRIBUTE_NAME = 'translate-x';
/** @const {string} */
const TRANSLATE_Y_ATTRIBUTE_NAME = 'translate-y';
/** @const {string} */
const DEFAULT_CURVE = '0.4, 0.4, 0.0, 1';

/** @const {!Array<string>} */
export const PRESET_OPTION_ATTRIBUTES = [
  SCALE_START_ATTRIBUTE_NAME,
  SCALE_END_ATTRIBUTE_NAME,
  TRANSLATE_X_ATTRIBUTE_NAME,
  TRANSLATE_Y_ATTRIBUTE_NAME,
];

/**
 * A list of animations that are full bleed.
 * @private @const {!Array<string>}
 */
const FULL_BLEED_ANIMATION_NAMES = [
  'pan-up',
  'pan-down',
  'pan-right',
  'pan-left',
  'zoom-in',
  'zoom-out',
];

/**
 * A mapping of animation categories to corresponding CSS class names.
 * @private @const {!Object<string, string>}
 */
const ANIMATION_CSS_CLASS_NAMES = {
  [FULL_BLEED_CATEGORY]:
    'i-amphtml-story-grid-template-with-full-bleed-animation',
};

/**
 * Perform style-specific operations for presets.
 * @param {!Element} el
 * @param {string} presetName
 */
export function setStyleForPreset(el, presetName) {
  // For full bleed animations.
  if (FULL_BLEED_ANIMATION_NAMES.indexOf(presetName) >= 0) {
    const parent = el.parentElement;
    if (
      parent.classList.contains(
        GRID_LAYER_TEMPLATE_CLASS_NAMES[FILL_TEMPLATE_LAYOUT]
      )
    ) {
      parent.classList.remove(
        GRID_LAYER_TEMPLATE_CLASS_NAMES[FILL_TEMPLATE_LAYOUT]
      );
    }
    parent.classList.add(ANIMATION_CSS_CLASS_NAMES[FULL_BLEED_CATEGORY]);
  }
}

/**
 * First keyframe will always be considered offset: 0 and will be applied to the
 * element as the first frame before animation starts.
 * @type {!Object<string, !StoryAnimationPresetDef>}
 */
export const presets = {
  'pulse': {
    duration: 600,
    easing: 'cubic-bezier(0.3, 0.0, 0.0, 1)',
    keyframes: [
      {
        offset: 0,
        transform: 'scale(1)',
      },
      {
        offset: 0.25,
        transform: 'scale(0.95)',
      },
      {
        offset: 0.75,
        transform: 'scale(1.05)',
      },
      {
        offset: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'fly-in-left': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return translate2d(offsetX, 0, 0, 0);
    },
  },
  'fly-in-right': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return translate2d(offsetX, 0, 0, 0);
    },
  },
  'fly-in-top': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetY = -(dimensions.targetY + dimensions.targetHeight);
      return translate2d(0, offsetY, 0, 0);
    },
  },
  'fly-in-bottom': {
    duration: 600,
    easing: `cubic-bezier(0.2, 0.6, 0.0, 1)`,
    keyframes(dimensions) {
      const offsetY = dimensions.pageHeight - dimensions.targetY;
      return translate2d(0, offsetY, 0, 0);
    },
  },
  'rotate-in-left': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return rotateAndTranslate(offsetX, 0, 0, 0, -1);
    },
  },
  'rotate-in-right': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return rotateAndTranslate(offsetX, 0, 0, 0, 1);
    },
  },
  'fade-in': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
      },
      {
        opacity: 1,
      },
    ],
  },
  'scale-fade-up': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
        transform: 'scale(0.8)',
      },
      {
        opacity: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'scale-fade-down': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        opacity: 0,
        transform: 'scale(1.4)',
      },
      {
        opacity: 1,
        transform: 'scale(1)',
      },
    ],
  },
  'drop': {
    duration: 1600,
    easing: `linear`,
    keyframes(dimensions) {
      const maxBounceHeight = Math.max(
        160,
        dimensions.targetY + dimensions.targetHeight
      );
      return [
        {
          offset: 0.0,
          transform: `translateY(${px(Number(-maxBounceHeight))})`,
          easing: 'cubic-bezier(.5, 0, 1, 1)',
        },
        {
          offset: 0.29,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0, .5, 1)',
        },
        {
          offset: 0.45,
          transform: `translateY(${px(-maxBounceHeight * 0.2812)})`,
          easing: 'cubic-bezier(.5, 0, 1, 1)',
        },
        {
          offset: 0.61,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0, .5, 1)',
        },
        {
          offset: 0.71,
          transform: `translateY(${px(-maxBounceHeight * 0.0956)})`,
          easing: 'cubic-bezier(.5, 0, 1, 1)',
        },
        {
          offset: 0.8,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0, .5, 1)',
        },
        {
          offset: 0.85,
          transform: `translateY(${px(-maxBounceHeight * 0.0359)})`,
          easing: 'cubic-bezier(.5, 0, 1, 1)',
        },
        {
          offset: 0.92,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0, .5, 1)',
        },
        {
          offset: 0.96,
          transform: `translateY(${px(-maxBounceHeight * 0.0156)})`,
          easing: 'cubic-bezier(.5, 0, 1, 1)',
        },
        {
          offset: 1,
          transform: `translateY(0)`,
          easing: 'cubic-bezier(0, 0, .5, 1)',
        },
      ];
    },
  },
  'twirl-in': {
    duration: 1000,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes: [
      {
        transform: 'rotate(-540deg) scale(0.1)',
        opacity: 0,
      },
      {
        transform: 'none',
        opacity: 1,
      },
    ],
  },
  'whoosh-in-left': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = -(dimensions.targetX + dimensions.targetWidth);
      return whooshIn(offsetX, 0, 0, 0);
    },
  },
  'whoosh-in-right': {
    duration: 600,
    easing: `cubic-bezier(${DEFAULT_CURVE})`,
    keyframes(dimensions) {
      const offsetX = dimensions.pageWidth - dimensions.targetX;
      return whooshIn(offsetX, 0, 0, 0);
    },
  },
  'pan-left': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateX = options[TRANSLATE_X_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = dimensions.pageWidth - dimensions.targetWidth;
      const offsetY = (dimensions.pageHeight - dimensions.targetHeight) / 2;

      return scaleAndTranslate(
        offsetX,
        offsetY,
        translateX ? offsetX + translateX : 0,
        offsetY,
        scalingFactor
      );
    },
  },
  'pan-right': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateX = options[TRANSLATE_X_ATTRIBUTE_NAME];

      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = dimensions.pageWidth - dimensions.targetWidth;
      const offsetY = (dimensions.pageHeight - dimensions.targetHeight) / 2;

      return scaleAndTranslate(
        0,
        offsetY,
        -translateX || offsetX,
        offsetY,
        scalingFactor
      );
    },
  },
  'pan-down': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateY = options[TRANSLATE_Y_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = -dimensions.targetWidth / 2;
      const offsetY = dimensions.pageHeight - dimensions.targetHeight;

      return scaleAndTranslate(
        offsetX,
        0,
        offsetX,
        -translateY || offsetY,
        scalingFactor
      );
    },
  },
  'pan-up': {
    duration: 1000,
    easing: 'linear',
    keyframes(dimensions, options) {
      const translateY = options[TRANSLATE_Y_ATTRIBUTE_NAME];
      const scalingFactor = calculateTargetScalingFactor(dimensions);
      dimensions.targetWidth *= scalingFactor;
      dimensions.targetHeight *= scalingFactor;

      const offsetX = -dimensions.targetWidth / 2;
      const offsetY = dimensions.pageHeight - dimensions.targetHeight;

      return scaleAndTranslate(
        offsetX,
        offsetY,
        offsetX,
        translateY ? offsetY + translateY : 0,
        scalingFactor
      );
    },
  },
  'zoom-in': {
    duration: 1000,
    easing: 'linear',
    keyframes(unusedDimensions, options) {
      const scaleStart = options[SCALE_START_ATTRIBUTE_NAME];
      const scaleEnd = options[SCALE_END_ATTRIBUTE_NAME];

      if (scaleStart) {
        userAssert(
          scaleEnd > scaleStart,
          '"scale-end" value must be greater ' +
            'than "scale-start" value when using "zoom-in" animation.'
        );
      }

      return [
        {transform: `scale(${scaleStart || SCALE_LOW_DEFAULT})`},
        {transform: `scale(${scaleEnd || SCALE_HIGH_DEFAULT})`},
      ];
    },
  },
  'zoom-out': {
    duration: 1000,
    easing: 'linear',
    keyframes(unusedDimensions, options) {
      const scaleStart = options[SCALE_START_ATTRIBUTE_NAME];
      const scaleEnd = options[SCALE_END_ATTRIBUTE_NAME];

      if (scaleStart) {
        userAssert(
          scaleStart > scaleEnd,
          '"scale-start" value must be ' +
            'higher than "scale-end" value when using "zoom-out" animation.'
        );
      }

      return [
        {transform: `scale(${scaleStart || SCALE_HIGH_DEFAULT})`},
        {transform: `scale(${scaleEnd || SCALE_LOW_DEFAULT})`},
      ];
    },
  },
};
<|endoftext|>


<commit_before>var path = require('path');
var glob = require('glob');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');

var env = process.env.NODE_ENV || 'development';

// Generate entries for all scripts
var scripts = glob.sync('js/*.js');
if (!scripts.length) {
	throw new Error('No scripts found in "js" folder.');
}
if (scripts.indexOf('js/main.js') === -1) {
	throw new Error('Main script not found: "js/main.js".');
}
var entries = {
	main: entries,
};
scripts.forEach(function(script) {
	entries[path.basename(script, '.js')] = './' + script;
});

module.exports = {
	context: process.cwd(),

	entry: entries,

	output: {
		path: path.resolve(process.cwd(), 'public/build'),
		publicPath: '/build/',
		filename: '[name].js',
	},

	resolve: {
		extensions: ['', '.js'],
	},

	resolveLoader: {
		modulesDirectories: [
			path.resolve(__dirname, '../node_modules'),
			'node_modules',
		],
	},

	plugins: [
		new webpack.DefinePlugin({
			'DEBUG': JSON.stringify(env === 'production' ? 'true' : 'false'),
			'process.env': {
				NODE_ENV: JSON.stringify(env),
			},
		}),
	],

	module: {
		noParse: /\.min\.js/,

		loaders: [
			{
				test: /\.js$/,
				include: [
					path.resolve(process.cwd(), 'js'),
				],
				loader: 'babel-loader',
			},
			{
				test: /\.styl$/,
				loaders: [
					'style',
					'css',
					'postcss',
					'stylus',
				],
			},
		],
	},

	stylus: {
		define: {
			DEBUG: env === 'development',
			embedurl: require('stylus').url(),
		},
		import: [
			path.resolve(process.cwd(), 'styles/config.styl'),
		],
	},

	postcss: function() {
		return [
			autoprefixer({
				browsers: ['last 2 versions', 'not ie < 11', 'not ie_mob < 11'],
			}),
		];
	},
};
<commit_msg>No need to define main bundle manually: it is required.<commit_after>var path = require('path');
var glob = require('glob');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');

var env = process.env.NODE_ENV || 'development';

// Generate entries for all scripts
var scripts = glob.sync('js/*.js');
if (!scripts.length) {
	throw new Error('No scripts found in "js" folder.');
}
if (scripts.indexOf('js/main.js') === -1) {
	throw new Error('Main script not found: "js/main.js".');
}
var entries = scripts.reduce(function(entries, script) {
	entries[path.basename(script, '.js')] = './' + script;
	return entries;
}, {});

module.exports = {
	context: process.cwd(),

	entry: entries,

	output: {
		path: path.resolve(process.cwd(), 'public/build'),
		publicPath: '/build/',
		filename: '[name].js',
	},

	resolve: {
		extensions: ['', '.js'],
	},

	resolveLoader: {
		modulesDirectories: [
			path.resolve(__dirname, '../node_modules'),
			'node_modules',
		],
	},

	plugins: [
		new webpack.DefinePlugin({
			'DEBUG': JSON.stringify(env === 'production' ? 'true' : 'false'),
			'process.env': {
				NODE_ENV: JSON.stringify(env),
			},
		}),
	],

	module: {
		noParse: /\.min\.js/,

		loaders: [
			{
				test: /\.js$/,
				include: [
					path.resolve(process.cwd(), 'js'),
				],
				loader: 'babel-loader',
			},
			{
				test: /\.styl$/,
				loaders: [
					'style',
					'css',
					'postcss',
					'stylus',
				],
			},
		],
	},

	stylus: {
		define: {
			DEBUG: env === 'development',
			embedurl: require('stylus').url(),
		},
		import: [
			path.resolve(process.cwd(), 'styles/config.styl'),
		],
	},

	postcss: function() {
		return [
			autoprefixer({
				browsers: ['last 2 versions', 'not ie < 11', 'not ie_mob < 11'],
			}),
		];
	},
};
<|endoftext|>


<commit_before>Package.describe({
  summary: "publish a count"
});

Package.on_use(function (api, where) {
  api.add_files('publish-counts.js', ['client', 'server']);
  api.export('Counts', 'client');
  api.export('publishCount', ['client', 'server']);
});

Package.on_test(function (api) {
  api.use(['publish-counts', 'tinytest']);
  api.add_files('publish-counts_tests.js', ['client', 'server']);
});
<commit_msg>update exports<commit_after>Package.describe({
  summary: "publish a count"
});

Package.on_use(function (api, where) {
  api.add_files('publish-counts.js', ['client', 'server']);
  api.export('Counts', 'client');
  api.export('publishCount', 'server');
});

Package.on_test(function (api) {
  api.use(['publish-counts', 'tinytest']);
  api.add_files('publish-counts_tests.js', ['client', 'server']);
});
<|endoftext|>


<commit_before>module.exports = Renderer;

var EntityManager = require('tiny-ecs').EntityManager;
var Vec2          = require('tiny-ecs').Vec2;
var Style         = require('../../lib/renderer/Style.js');
var Canvas        = require('../../lib/renderer/Canvas.js');
var Position      = require('../components/Position.js');
var Spatial       = require('../components/Spatial.js');
var LevelObject   = require('../components/LevelObject.js');
var ColorSpirit   = require('../components/ColorSpirit.js');
var Avatar        = require('../components/Avatar.js');
var Text          = require('../components/Text.js');

/**
 * @constructor
 * @param {EntityManager} entities
 * @param {Canvas} screen
 */
function Renderer(screen, entities, maps)
{
  this.screen     = screen;
  this.entities   = entities;
  this.maps       = maps;
  global.renderer = this;
}

var COLOR_FILTER = [Position, Spatial, ColorSpirit];
var LEVEL_FILTER = [Position, LevelObject];

var TEXT_FILTER = [Position, Text];

// All avatars have to have a color spirit
var AVATAR_FILTER = [Position, Spatial, Avatar, ColorSpirit];

/**
 * @param {Number} dt
 * @param {Number} time
 */
Renderer.prototype.update = function(dt, time)
{
  this.screen.save();
  this.screen.fill('black');
  this.cameraTransform();
  this.drawBg();
  this.drawWalls();
  this.drawGems();
  this.drawLevelObjects();
  this.drawAvatars();
  // this.drawTexts();
  this.screen.restore();
};

Renderer.prototype.drawBg = function()
{
  var player = this.entities.queryTag('player')[0];
  this.screen.drawRectangle(this.maps.size, player.colorSpirit.style);
};

var ct = new Vec2();
Renderer.prototype.cameraTransform = function()
{
  var player = this.entities.queryTag('player')[0];

  // cacl zoom
  var zoom = this.zoom || 1;
  var per = player.newtonian.velocity.magnitude() / player.newtonian.maxSpeed;

  // do zoom
  var p = 0.992;
  var newZoom = 2 - 1 * per;
  zoom = zoom * p + (1-p) * newZoom;
  this.screen.scale(zoom, zoom);
  this.zoom = zoom;

  // Translate to account for player
  ct.assign(this.screen.getSize()).smult(0.5 * (1/zoom));
  this.screen.vtranslate(ct);
  ct.assign(player.position.location).smult(-1);
  this.screen.vtranslate(ct);

};

Renderer.prototype.drawTexts = function()
{
  var entities = this.entities.queryComponents(TEXT_FILTER);

  for (var n = 0; n < entities.length; n++) {
    this.drawText(entities[n]);
  }
};

Renderer.prototype.drawWalls = function()
{
  var entities = this.entities.queryTag('wall');
  for (var n = 0; n < entities.length; n++) {
    this.drawWall(entities[n]);
  }
};

Renderer.prototype.drawWall = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawHwRect(entity.spatial.hwidth, entity.colorSpirit.style)
    .restore();
};

Renderer.prototype.drawGems = function()
{
  var entities = this.entities.queryTag('gem');
  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];
    this.drawGem(entity);
  }
};

Renderer.prototype.drawGem = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawCircle(entity.spatial.hwidth.x, entity.colorSpirit.style)
    .restore();
};

Renderer.prototype.drawAvatars = function()
{
  var entities = this.entities.queryComponents(AVATAR_FILTER);

  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];
    this.drawAvatar(entity);
  }
};

var vh = new Vec2();
var playerStyle = new Style();
playerStyle.color = '#fff';
Renderer.prototype.drawAvatar = function(entity)
{
  var h = Vec2.aquire();
  var pos = Vec2.aquire();

  h.assign(entity.spatial.hwidth);
  h.y *= 0.5;
  pos.set(entity.spatial.hwidth.x/2.2, 0);

  this.screen
    .save()
    .vtranslate(entity.position.location)
    .rotate(entity.position.rotation)
    .drawHwRect(entity.spatial.hwidth, playerStyle)
    .vtranslate(pos)
    .drawHwRect(h, playerStyle)
    .restore();

  Vec2.release(h);
  Vec2.release(pos);
};

Renderer.prototype.drawLevelObjects = function()
{
  var entities = this.entities.queryComponents(LEVEL_FILTER);
  var screen = this.screen;

  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];

    if (entity.levelObject.type === LevelObject.types.PLAYER_START)
      this.drawStart(entity);

    if (entity.levelObject.type === LevelObject.types.LEVEL_FINISH)
      this.drawStart(entity);
  }
};

var textStyle = new Style();
textStyle.color = '#fff';
Renderer.prototype.drawText = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawText(entity.text.value, textStyle)
    .restore();
}

var startSize = new Vec2(25, 25);
var startStyle = new Style()
startStyle.stroke = '#333';
startStyle.strokeWidth = 5;
Renderer.prototype.drawStart = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    //.drawHwRect(startSize, startStyle)
    .drawCircle(50, startStyle)
    .restore();
};

<commit_msg>draw border<commit_after>module.exports = Renderer;

var EntityManager = require('tiny-ecs').EntityManager;
var Vec2          = require('tiny-ecs').Vec2;
var Style         = require('../../lib/renderer/Style.js');
var Canvas        = require('../../lib/renderer/Canvas.js');
var Position      = require('../components/Position.js');
var Spatial       = require('../components/Spatial.js');
var LevelObject   = require('../components/LevelObject.js');
var ColorSpirit   = require('../components/ColorSpirit.js');
var Avatar        = require('../components/Avatar.js');
var Text          = require('../components/Text.js');

/**
 * @constructor
 * @param {EntityManager} entities
 * @param {Canvas} screen
 */
function Renderer(screen, entities, maps)
{
  this.screen     = screen;
  this.entities   = entities;
  this.maps       = maps;
  global.renderer = this;
}

var COLOR_FILTER = [Position, Spatial, ColorSpirit];
var LEVEL_FILTER = [Position, LevelObject];

var TEXT_FILTER = [Position, Text];

// All avatars have to have a color spirit
var AVATAR_FILTER = [Position, Spatial, Avatar, ColorSpirit];

/**
 * @param {Number} dt
 * @param {Number} time
 */
Renderer.prototype.update = function(dt, time)
{
  this.screen.save();
  this.screen.fill('black');
  this.cameraTransform();
  this.drawBg();
  this.drawWalls();
  this.drawGems();
  this.drawLevelObjects();
  this.drawAvatars();
  // this.drawTexts();
  this.screen.restore();
};

var borderStyle = new Style();
borderStyle.color = '#333';
var bV = new Vec2();
Renderer.prototype.drawBg = function()
{
  var player = this.entities.queryTag('player')[0];
  var pad = 30;
  bV.assign(this.maps.size);
  bV.x += pad*2;
  bV.y += pad*2;
  this.screen.save();
  this.screen.save();
  this.screen.translate(-pad, -pad);
  this.screen.drawRectangle(bV, borderStyle);
  this.screen.restore();
  this.screen.drawRectangle(this.maps.size, player.colorSpirit.style);
  this.screen.restore();
};

var ct = new Vec2();
Renderer.prototype.cameraTransform = function()
{
  var player = this.entities.queryTag('player')[0];

  // cacl zoom
  var zoom = this.zoom || 1;
  var per = player.newtonian.velocity.magnitude() / player.newtonian.maxSpeed;

  // do zoom
  var p = 0.992;
  var newZoom = 2 - 1 * per;
  zoom = zoom * p + (1-p) * newZoom;
  this.screen.scale(zoom, zoom);
  this.zoom = zoom;

  // Translate to account for player
  ct.assign(this.screen.getSize()).smult(0.5 * (1/zoom));
  this.screen.vtranslate(ct);
  ct.assign(player.position.location).smult(-1);
  this.screen.vtranslate(ct);

};

Renderer.prototype.drawTexts = function()
{
  var entities = this.entities.queryComponents(TEXT_FILTER);

  for (var n = 0; n < entities.length; n++) {
    this.drawText(entities[n]);
  }
};

Renderer.prototype.drawWalls = function()
{
  var entities = this.entities.queryTag('wall');
  for (var n = 0; n < entities.length; n++) {
    this.drawWall(entities[n]);
  }
};

Renderer.prototype.drawWall = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawHwRect(entity.spatial.hwidth, entity.colorSpirit.style)
    .restore();
};

Renderer.prototype.drawGems = function()
{
  var entities = this.entities.queryTag('gem');
  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];
    this.drawGem(entity);
  }
};

Renderer.prototype.drawGem = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawCircle(entity.spatial.hwidth.x, entity.colorSpirit.style)
    .restore();
};

Renderer.prototype.drawAvatars = function()
{
  var entities = this.entities.queryComponents(AVATAR_FILTER);

  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];
    this.drawAvatar(entity);
  }
};

var vh = new Vec2();
var playerStyle = new Style();
playerStyle.color = '#fff';
Renderer.prototype.drawAvatar = function(entity)
{
  var h = Vec2.aquire();
  var pos = Vec2.aquire();

  h.assign(entity.spatial.hwidth);
  h.y *= 0.5;
  pos.set(entity.spatial.hwidth.x/2.2, 0);

  this.screen
    .save()
    .vtranslate(entity.position.location)
    .rotate(entity.position.rotation)
    .drawHwRect(entity.spatial.hwidth, playerStyle)
    .vtranslate(pos)
    .drawHwRect(h, playerStyle)
    .restore();

  Vec2.release(h);
  Vec2.release(pos);
};

Renderer.prototype.drawLevelObjects = function()
{
  var entities = this.entities.queryComponents(LEVEL_FILTER);
  var screen = this.screen;

  for (var n = 0; n < entities.length; n++) {
    var entity = entities[n];

    if (entity.levelObject.type === LevelObject.types.PLAYER_START)
      this.drawStart(entity);

    if (entity.levelObject.type === LevelObject.types.LEVEL_FINISH)
      this.drawStart(entity);
  }
};

var textStyle = new Style();
textStyle.color = '#fff';
Renderer.prototype.drawText = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    .drawText(entity.text.value, textStyle)
    .restore();
}

var startSize = new Vec2(25, 25);
var startStyle = new Style()
startStyle.stroke = '#333';
startStyle.strokeWidth = 5;
Renderer.prototype.drawStart = function(entity)
{
  this.screen
    .save()
    .vtranslate(entity.position.location)
    //.drawHwRect(startSize, startStyle)
    .drawCircle(50, startStyle)
    .restore();
};

<|endoftext|>


<commit_before>import React from 'react'

import { Typography } from '@rmwc/typography'
import { Icon } from '@rmwc/icon'
import { Chip, ChipText, ChipIcon, ChipSet } from '@rmwc/chip'
import { Button, ButtonIcon } from '@rmwc/button'
import { LinearProgress } from '@rmwc/linear-progress'
import {
  Card,
  CardMedia,
  CardMediaItem,
  CardPrimary,
  CardTitle,
  CardActions,
  CardActionButtons,
  CardAction,
  CardPrimaryAction,
  CardActionIcons,
  CardSubtitle,
  CardSupportingText,
  CardHorizontalBlock
} from '@rmwc/card'
import {
  Dialog,
  DialogTitle,
  DialogContent,
  DialogActions,
  DialogButton
} from '@rmwc/dialog'

import Component from '../core/Component'
import Text from './Text'
import { renderResponsive } from '../utils/responsive'
import moment from 'moment'
import Media from './Media'

export default class Team extends Component {
  constructor(props) {
    super(props)
    this.state = { ...this.state, detailDialogOpen: false, item: null }
  }

  componentDidMount() {
    super.componentDidMount()
  }

  renderText(text) {
    return renderResponsive(
      'text',
      <Text
        source={text}
        style={{
          padding: '10px'
        }}
      />,
      <Text
        source={text}
        style={{
          paddingBottom: '10px'
        }}
      />
    )
  }

  renderCardMedia(item) {
    const image = item.image

    if (!image) {
      return

    }

    const width = this.props.small ? 100 : 220
    const height = this.props.small ? 100 : 220

    const style = {
      alignSelf: 'center',
      marginTop: '20px',
      objectFit: 'cover',
      height,
      width,
      borderRadius: '50%',
      objectPosition: 'center center'
    }
    const props = Object.assign({}, this.props)
    delete props.video
    return (
      <CardMedia
        style={{
          backgroundColor: item.backgroundColor,
          cursor:
            this.props.imageClickable && !this.state.detailDialogOpen
              ? 'pointer'
              : 'initial'
        }}
        onClick={() => {
          this.props.imageClickable
            ? this.setState({ detailDialogOpen: true, item })
            : false
        }}
      >
        <Media cache={this.props.cache} roundImg image={image} style={style} />
      </CardMedia>
    )
  }

  onLinkClick(url) {
    window.open(url, '_blank')
  }

  renderCard(item, index) {
    const { linkedIn, github, website, text } = item

    const width = this.props.small ? 230 : 320
    const height = this.props.small ? 340 : 540

    return (
      <Card
        style={{
          width,
          height,
          margin: 20,
          textAlign: 'center'
        }}
        key={`item${index}`}
      >
        {this.renderCardMedia(item)}

            <Typography
              use="headline"
              tag="h2"
              style={{ textAlign: 'center', fontWeight: 700 }}
            >
              {item.name}
            </Typography>
            <Typography use="title" tag="h3" style={{ textAlign: 'center' }}>
              {item.title}
            </Typography>

              {github && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.github)
                  }}
                >

                </ButtonIcon>
              )}
              {linkedIn && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.linkedIn)
                  }}
                >

                </ButtonIcon>
              )}
              {website && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.website)
                  }}
                >

                </ButtonIcon>
              )}

            {text && (
              <Button
                style={{ marginTop: 10 }}
                onClick={() => {
                  this.setState({ detailDialogOpen: true, item })
                }}
              >
                See More
              </Button>
            )}

      </Card>
    )
  }

  renderDetails() {
    const { item } = this.state
    if (!item) {
      return
    }
    return this.renderText(item.text)
  }

  renderDetailsTitle() {
    const { item } = this.state
    if (!item) {
      return
    }

    return this.renderCardMedia(item)
  }

  renderTeamMemebers(members) {
    var index = 0

    if (!members || members.length == 0) {
      return
    }

    return members.map(member => this.renderCard(member, index++))
  }

  renderSection(section, index) {
    const style = this.props.small
      ? { color: 'white', textShadow: '2px 2px 5px #607D8B' }
      : { color: this.props.textColor ? this.props.textColor : '#000' }
    return (

        <Typography use="display1" tag="h1" style={style}>
          {section.title}
        </Typography>

          {this.renderTeamMemebers(section.members)}

    )
  }

  renderTeamSections() {
    var index = 0
    return this.props.sections.map((section, index) =>
      this.renderSection(section, index)
    )
  }

  renderSections() {
    return (

        {this.renderTeamSections()}

    )
  }

  renderDialog() {
    return (
      <Dialog
        open={this.state.detailDialogOpen}
        onClose={evt => {
          this.setState({ detailDialogOpen: false })
        }}
      >
        <DialogTitle>{this.renderDetailsTitle()}</DialogTitle>
        <DialogContent>{this.renderDetails()}</DialogContent>
        <DialogActions style={{ display: 'flex', justifyContent: 'center' }}>
          <DialogButton action="close">Back</DialogButton>
        </DialogActions>
      </Dialog>
    )
  }

  renderComponent() {
    if (!this.props.sections) {
      return

    }

    return (

        {this.renderSections()}
        {this.renderDialog()}

    )
  }
}
<commit_msg>team translated<commit_after>import React from 'react'

import { Typography } from '@rmwc/typography'
import { Button, ButtonIcon } from '@rmwc/button'
import { Card, CardMedia } from '@rmwc/card'
import {
  Dialog,
  DialogTitle,
  DialogContent,
  DialogActions,
  DialogButton
} from '@rmwc/dialog'

import Component from '../core/Component'
import Text from './Text'
import { renderResponsive } from '../utils/responsive'
import Media from './Media'
import { Data } from 'react-chunky'

export default class Team extends Component {
  constructor(props) {
    super(props)
    this.state = {
      ...this.state,
      detailDialogOpen: false,
      item: null,
      selectedLanguage: null,
      strings: null
    }
  }

  componentDidMount() {
    super.componentDidMount()
    Data.Cache.retrieveCachedItem('selectedLanguage')
      .then(lang => {
        this.setState({ selectedLanguage: lang })
      })
      .catch(() => {
        return
      })
    fetch(this.props.theme.translatedStrings)
      .then(response => response.json())
      .then(translatedTexts => {
        this.setState({ strings: translatedTexts['team'] })
      })
      .catch(() => '')
  }

  renderText(text) {
    return renderResponsive(
      'text',
      <Text
        source={text}
        style={{
          padding: '10px'
        }}
      />,
      <Text
        source={text}
        style={{
          paddingBottom: '10px'
        }}
      />
    )
  }

  renderCardMedia(item) {
    const image = item.image

    if (!image) {
      return

    }

    const width = this.props.small ? 100 : 220
    const height = this.props.small ? 100 : 220

    const style = {
      alignSelf: 'center',
      marginTop: '20px',
      objectFit: 'cover',
      height,
      width,
      borderRadius: '50%',
      objectPosition: 'center center'
    }
    const props = Object.assign({}, this.props)
    delete props.video
    return (
      <CardMedia
        style={{
          backgroundColor: item.backgroundColor,
          cursor:
            this.props.imageClickable && !this.state.detailDialogOpen
              ? 'pointer'
              : 'initial'
        }}
        onClick={() => {
          this.props.imageClickable
            ? this.setState({ detailDialogOpen: true, item })
            : false
        }}
      >
        <Media cache={this.props.cache} roundImg image={image} style={style} />
      </CardMedia>
    )
  }

  onLinkClick(url) {
    window.open(url, '_blank')
  }

  renderCard(item, index) {
    const { linkedIn, github, website, text } = item

    const width = this.props.small ? 230 : 320
    const height = this.props.small ? 340 : 540
    const translatedBtnSeeMoreText =
      this.props.translation &&
      this.state.strings &&
      this.state.selectedLanguage
        ? this.state.strings[this.state.selectedLanguage][`btnTextDetails`]
        : 'See more'
    return (
      <Card
        style={{
          width,
          height,
          margin: 20,
          textAlign: 'center'
        }}
        key={`item${index}`}
      >
        {this.renderCardMedia(item)}

            <Typography
              use="headline"
              tag="h2"
              style={{ textAlign: 'center', fontWeight: 700 }}
            >
              {item.name}
            </Typography>
            <Typography use="title" tag="h3" style={{ textAlign: 'center' }}>
              {item.title}
            </Typography>

              {github && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.github)
                  }}
                >

                </ButtonIcon>
              )}
              {linkedIn && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.linkedIn)
                  }}
                >

                </ButtonIcon>
              )}
              {website && (
                <ButtonIcon
                  style={{ cursor: 'pointer' }}
                  onClick={() => {
                    this.onLinkClick(item.website)
                  }}
                >

                </ButtonIcon>
              )}

            {text && (
              <Button
                style={{ marginTop: 10 }}
                onClick={() => {
                  this.setState({ detailDialogOpen: true, item })
                }}
              >
                {translatedBtnSeeMoreText}
              </Button>
            )}

      </Card>
    )
  }

  renderDetails() {
    const { item } = this.state
    if (!item) {
      return
    }
    return this.renderText(item.text)
  }

  renderDetailsTitle() {
    const { item } = this.state
    if (!item) {
      return
    }

    return this.renderCardMedia(item)
  }

  renderTeamMemebers(members) {
    var index = 0

    if (!members || members.length == 0) {
      return
    }

    return members.map(member => this.renderCard(member, index++))
  }

  renderSection(section, index) {
    const style = this.props.small
      ? { color: 'white', textShadow: '2px 2px 5px #607D8B' }
      : { color: this.props.textColor ? this.props.textColor : '#000' }
    const translatedTitle =
      this.props.translation &&
      this.state.strings &&
      this.state.selectedLanguage
        ? this.state.strings[this.state.selectedLanguage][`section${index}`][
            `title`
          ]
        : section.title
    return (

        <Typography use="display1" tag="h1" style={style}>
          {translatedTitle}
        </Typography>

          {this.renderTeamMemebers(section.members)}

    )
  }

  renderTeamSections() {
    var index = 0
    return this.props.sections.map((section, index) =>
      this.renderSection(section, index)
    )
  }

  renderSections() {
    return (

        {this.renderTeamSections()}

    )
  }

  renderDialog() {
    const translatedBtnBackText =
      this.props.translation &&
      this.state.strings &&
      this.state.selectedLanguage
        ? this.state.strings[this.state.selectedLanguage][`btnTextGoBack`]
        : 'Back'
    return (
      <Dialog
        open={this.state.detailDialogOpen}
        onClose={evt => {
          this.setState({ detailDialogOpen: false })
        }}
      >
        <DialogTitle>{this.renderDetailsTitle()}</DialogTitle>
        <DialogContent>{this.renderDetails()}</DialogContent>
        <DialogActions style={{ display: 'flex', justifyContent: 'center' }}>
          <DialogButton action="close">{translatedBtnBackText}</DialogButton>
        </DialogActions>
      </Dialog>
    )
  }

  renderComponent() {
    if (!this.props.sections) {
      return

    }

    return (

        {this.renderSections()}
        {this.renderDialog()}

    )
  }
}
<|endoftext|>


<commit_before>var path = require('path');
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var url = require('url');
var paths = require('./paths');

var homepagePath = require(paths.appPackageJson).homepage;
var publicPath = homepagePath ? url.parse(homepagePath).pathname : '/';
if (!publicPath.endsWith('/')) {
  // Prevents incorrect paths in file-loader
  publicPath += '/';
}

module.exports = {
  bail: true,
  devtool: 'source-map',
  entry: [
    require.resolve('./polyfills'),
    path.join(paths.appSrc, 'index')
  ],
  output: {
    path: paths.appBuild,
    // filename: 'static/js/[name].[chunkhash:8].js',
    filename: 'static/js/[name].js',
    // chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
    publicPath: publicPath
  },
  resolve: {
    extensions: ['', '.js', '.json'],
    alias: {
      // This `alias` section can be safely removed after ejection.
      // We do this because `babel-runtime` may be inside `react-scripts`,
      // so when `babel-plugin-transform-runtime` imports it, it will not be
      // available to the app directly. This is a temporary solution that lets
      // us ship support for generators. However it is far from ideal, and
      // if we don't have a good solution, we should just make `babel-runtime`
      // a dependency in generated projects.
      // See https://github.com/facebookincubator/create-react-app/issues/255
      'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
    }
  },
  resolveLoader: {
    root: paths.ownNodeModules,
    moduleTemplates: ['*-loader']
  },
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'eslint',
        include: paths.appSrc
      }
    ],
    loaders: [
      {
        test: /\.js$/,
        include: paths.appSrc,
        loader: 'babel',
        query: require('./babel.prod')
      },
      {
        test: /\.css$/,
        include: [paths.appSrc, paths.appNodeModules],
        // Disable autoprefixer in css-loader itself:
        // https://github.com/webpack/css-loader/issues/281
        // We already have it thanks to postcss.
        loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss')
      },
      {
        test: /\.json$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'json'
      },
      {
        test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'file',
        query: {
          name: 'static/media/[name].[hash:8].[ext]'
        }
      },
      {
        test: /\.(mp4|webm)(\?.*)?$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'url',
        query: {
          limit: 10000,
          name: 'static/media/[name].[hash:8].[ext]'
        }
      }
    ]
  },
  eslint: {
    // TODO: consider separate config for production,
    // e.g. to enable no-console and no-debugger only in prod.
    configFile: path.join(__dirname, 'eslint.js'),
    useEslintrc: false
  },
  postcss: function() {
    return [autoprefixer];
  },
  plugins: [
    new HtmlWebpackPlugin({
      inject: true,
      template: paths.appHtml,
      favicon: paths.appFavicon,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,
        minifyJS: true,
        minifyCSS: true,
        minifyURLs: true
      }
    }),
    new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        screw_ie8: true,
        warnings: false
      },
      mangle: {
        screw_ie8: true
      },
      output: {
        comments: false,
        screw_ie8: true
      }
    }),
    new ExtractTextPlugin('static/css/[name].[contenthash:8].css')
  ]
};
<commit_msg>Remove CSS hash<commit_after>var path = require('path');
var autoprefixer = require('autoprefixer');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var url = require('url');
var paths = require('./paths');

var homepagePath = require(paths.appPackageJson).homepage;
var publicPath = homepagePath ? url.parse(homepagePath).pathname : '/';
if (!publicPath.endsWith('/')) {
  // Prevents incorrect paths in file-loader
  publicPath += '/';
}

module.exports = {
  bail: true,
  devtool: 'source-map',
  entry: [
    require.resolve('./polyfills'),
    path.join(paths.appSrc, 'index')
  ],
  output: {
    path: paths.appBuild,
    // filename: 'static/js/[name].[chunkhash:8].js',
    filename: 'static/js/[name].js',
    // chunkFilename: 'static/js/[name].[chunkhash:8].chunk.js',
    publicPath: publicPath
  },
  resolve: {
    extensions: ['', '.js', '.json'],
    alias: {
      // This `alias` section can be safely removed after ejection.
      // We do this because `babel-runtime` may be inside `react-scripts`,
      // so when `babel-plugin-transform-runtime` imports it, it will not be
      // available to the app directly. This is a temporary solution that lets
      // us ship support for generators. However it is far from ideal, and
      // if we don't have a good solution, we should just make `babel-runtime`
      // a dependency in generated projects.
      // See https://github.com/facebookincubator/create-react-app/issues/255
      'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator')
    }
  },
  resolveLoader: {
    root: paths.ownNodeModules,
    moduleTemplates: ['*-loader']
  },
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        loader: 'eslint',
        include: paths.appSrc
      }
    ],
    loaders: [
      {
        test: /\.js$/,
        include: paths.appSrc,
        loader: 'babel',
        query: require('./babel.prod')
      },
      {
        test: /\.css$/,
        include: [paths.appSrc, paths.appNodeModules],
        // Disable autoprefixer in css-loader itself:
        // https://github.com/webpack/css-loader/issues/281
        // We already have it thanks to postcss.
        loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss')
      },
      {
        test: /\.json$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'json'
      },
      {
        test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'file',
        query: {
          name: 'static/media/[name].[hash:8].[ext]'
        }
      },
      {
        test: /\.(mp4|webm)(\?.*)?$/,
        include: [paths.appSrc, paths.appNodeModules],
        loader: 'url',
        query: {
          limit: 10000,
          name: 'static/media/[name].[hash:8].[ext]'
        }
      }
    ]
  },
  eslint: {
    // TODO: consider separate config for production,
    // e.g. to enable no-console and no-debugger only in prod.
    configFile: path.join(__dirname, 'eslint.js'),
    useEslintrc: false
  },
  postcss: function() {
    return [autoprefixer];
  },
  plugins: [
    new HtmlWebpackPlugin({
      inject: true,
      template: paths.appHtml,
      favicon: paths.appFavicon,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,
        minifyJS: true,
        minifyCSS: true,
        minifyURLs: true
      }
    }),
    new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        screw_ie8: true,
        warnings: false
      },
      mangle: {
        screw_ie8: true
      },
      output: {
        comments: false,
        screw_ie8: true
      }
    }),
    new ExtractTextPlugin('static/css/[name].css')
  ]
};
<|endoftext|>


<commit_before>Package.describe({
  name: 'brwn:bootstrap-tagsinput',
  version: '1.0.0',
  // Brief, one-line summary of the package.
  summary: 'bootstrap-tagsinput wrapper using the official bootstrap package dependency.',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/aamdani/bootstrap-tagsinput',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1');
  api.addFiles('bootstrap-tagsinput.js');
});

Package.on_use(function (api) {
    // dependecies required by package
    api.use('twbs:bootstrap','client')
    // adding the required file for package
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.min.js', 'client');
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.css', 'client');
});
<commit_msg>Removed extraneous on_use handle.<commit_after>Package.describe({
  name: 'brwn:bootstrap-tagsinput',
  version: '1.0.0',
  // Brief, one-line summary of the package.
  summary: 'bootstrap-tagsinput wrapper using the official bootstrap package dependency.',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/aamdani/bootstrap-tagsinput',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.on_use(function (api) {
    // dependecies required by package
    api.use('twbs:bootstrap','client')
    // adding the required file for package
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.min.js', 'client');
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.css', 'client');
});
<|endoftext|>


<commit_before>/* eslint-disable no-var, arrow-parens, prefer-template, comma-dangle, object-shorthand, global-require, func-names, no-else-return, vars-on-top */

var webpack = require('webpack');
var paths = require('./paths');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
var getClientEnvironment = require('./env');

// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
var publicPath = '';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = '';
// Get enrivonment variables to inject into our app.
var env = getClientEnvironment(publicUrl);

// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env['process.env'].NODE_ENV !== '"production"') {
  throw new Error('Production builds must have NODE_ENV=production.');
}

module.exports = {
  // Don't attempt to continue if there are any errors.
  bail: true,
  devtool: false,
  entry: {
    main: './src/components/SmartBanner.js',
    example: [
      require.resolve('./polyfills'),
      './src/example.js',
    ],
  },

  output: {
    path: paths.appBuild,
    pathinfo: true,
    filename: '[name].js',
    publicPath: publicPath,
    library: 'SmartBanner',
    libraryTarget: 'umd'
  },

  externals: {
    'react': {
      root: 'React',
      commonjs2: 'react',
      commonjs: 'react',
      amd: 'react'
    },
    'react-dom': {
      root: 'ReactDOM',
      commonjs2: 'react-dom',
      commonjs: 'react-dom',
      amd: 'react-dom'
    }
  },

  resolve: {
    modules: [
      'src',
      'node_modules',
      ...paths.nodePaths,
    ],
    alias: {
      'react-smartbanner': './components/SmartBanner.js',
    },
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        loader: 'eslint-loader',
        enforce: 'pre',
        include: paths.appSrc,
      },
      {
        exclude: [
          /\.html$/,
          /\.(js|jsx)$/,
          /\.css$/,
          /\.scss$/,
          /\.json$/,
          /\.png$/,
          /\.svg$/
        ],
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: 'media/[name].[hash:8].[ext]'
        }
      },
      {
        test: /\.(js|jsx)$/,
        include: paths.appSrc,
        loader: 'babel-loader',
        options: require('./babel.prod')
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            'css-loader',
            'sass-loader?outputStyle=expanded',
          ],
        }),
      },
      {
        test: /\.css$/,
        use: [
          { loader: 'style-loader' },
          { loader: 'css-loader' },
        ],
      },
    ]
  },

  plugins: [
    new webpack.LoaderOptionsPlugin({
      minimize: true,
      debug: false
    }),
    new InterpolateHtmlPlugin({
      PUBLIC_URL: publicUrl,
    }),
    // Generates an `index.html` file with the <script> injected.
    new HtmlWebpackPlugin({
      inject: true,
      template: paths.appHtml,
      chunks: ['example'],
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,
        minifyJS: true,
        minifyCSS: true,
        minifyURLs: true
      }
    }),
    new CopyWebpackPlugin([
      { from: 'src/icon.png', to: './' },
    ]),
    new webpack.DefinePlugin(env),
    // Minify the code.
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        screw_ie8: true, // React doesn't support IE8
        warnings: false,
        conditionals: true,
        unused: true,
        comparisons: true,
        sequences: true,
        dead_code: true,
        evaluate: true,
        if_return: true,
        join_vars: true,
      },
      mangle: {
        screw_ie8: true
      },
      output: {
        comments: false,
        screw_ie8: true
      }
    }),
    new ExtractTextPlugin('main.css'),
  ],
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
};
<commit_msg>prop-types should be placed in externals umd setting<commit_after>/* eslint-disable no-var, arrow-parens, prefer-template, comma-dangle, object-shorthand, global-require, func-names, no-else-return, vars-on-top */

var webpack = require('webpack');
var paths = require('./paths');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
var getClientEnvironment = require('./env');

// Webpack uses `publicPath` to determine where the app is being served from.
// In development, we always serve from the root. This makes config easier.
var publicPath = '';
// `publicUrl` is just like `publicPath`, but we will provide it to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
var publicUrl = '';
// Get enrivonment variables to inject into our app.
var env = getClientEnvironment(publicUrl);

// Assert this just to be safe.
// Development builds of React are slow and not intended for production.
if (env['process.env'].NODE_ENV !== '"production"') {
  throw new Error('Production builds must have NODE_ENV=production.');
}

module.exports = {
  // Don't attempt to continue if there are any errors.
  bail: true,
  devtool: false,
  entry: {
    main: './src/components/SmartBanner.js',
    example: [
      require.resolve('./polyfills'),
      './src/example.js',
    ],
  },

  output: {
    path: paths.appBuild,
    pathinfo: true,
    filename: '[name].js',
    publicPath: publicPath,
    library: 'SmartBanner',
    libraryTarget: 'umd'
  },

  externals: {
    'react': {
      root: 'React',
      commonjs2: 'react',
      commonjs: 'react',
      amd: 'react'
    },
    'react-dom': {
      root: 'ReactDOM',
      commonjs2: 'react-dom',
      commonjs: 'react-dom',
      amd: 'react-dom'
    },
    'prop-types': {
      root: 'PropTypes',
      commonjs2: 'prop-types',
      commonjs: 'prop-types',
      amd: 'prop-types'
    },
  },

  resolve: {
    modules: [
      'src',
      'node_modules',
      ...paths.nodePaths,
    ],
    alias: {
      'react-smartbanner': './components/SmartBanner.js',
    },
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        loader: 'eslint-loader',
        enforce: 'pre',
        include: paths.appSrc,
      },
      {
        exclude: [
          /\.html$/,
          /\.(js|jsx)$/,
          /\.css$/,
          /\.scss$/,
          /\.json$/,
          /\.png$/,
          /\.svg$/
        ],
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: 'media/[name].[hash:8].[ext]'
        }
      },
      {
        test: /\.(js|jsx)$/,
        include: paths.appSrc,
        loader: 'babel-loader',
        options: require('./babel.prod')
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: [
            'css-loader',
            'sass-loader?outputStyle=expanded',
          ],
        }),
      },
      {
        test: /\.css$/,
        use: [
          { loader: 'style-loader' },
          { loader: 'css-loader' },
        ],
      },
    ]
  },

  plugins: [
    new webpack.LoaderOptionsPlugin({
      minimize: true,
      debug: false
    }),
    new InterpolateHtmlPlugin({
      PUBLIC_URL: publicUrl,
    }),
    // Generates an `index.html` file with the <script> injected.
    new HtmlWebpackPlugin({
      inject: true,
      template: paths.appHtml,
      chunks: ['example'],
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,
        minifyJS: true,
        minifyCSS: true,
        minifyURLs: true
      }
    }),
    new CopyWebpackPlugin([
      { from: 'src/icon.png', to: './' },
    ]),
    new webpack.DefinePlugin(env),
    // Minify the code.
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        screw_ie8: true, // React doesn't support IE8
        warnings: false,
        conditionals: true,
        unused: true,
        comparisons: true,
        sequences: true,
        dead_code: true,
        evaluate: true,
        if_return: true,
        join_vars: true,
      },
      mangle: {
        screw_ie8: true
      },
      output: {
        comments: false,
        screw_ie8: true
      }
    }),
    new ExtractTextPlugin('main.css'),
  ],
  node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
};
<|endoftext|>


<commit_before>// ```
// @datatype_void
// david.r.niciforovic@gmail.com
// webpack.config.js may be freely distributed under the MIT license
// ```

var helpers = require('./helpers');
//# Webpack Plugins
var ProvidePlugin = require('webpack/lib/ProvidePlugin');
var DefinePlugin  = require('webpack/lib/DefinePlugin');
//# Webpack Constants
const ENV = process.env.ENV = process.env.NODE_ENV = 'test';

//# Webpack Configuration
// See: http://webpack.github.io/docs/configuration.html#cli
module.exports = {
  // Developer tool to enhance debugging
  //
  // See: http://webpack.github.io/docs/configuration.html#devtool
  // See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
  devtool: 'source-map',
  // Options affecting the resolving of modules.
  //
  // See: http://webpack.github.io/docs/configuration.html#resolve
  resolve: {
    // An array of extensions that should be used to resolve modules.
    //
    // See: http://webpack.github.io/docs/configuration.html#resolve-extensions

    extensions: ['', '.ts', '.js', '.scss']
  },
  // Options affecting the normal modules.
  //
  // See: http://webpack.github.io/docs/configuration.html#module
  module: {
    // An array of applied pre and post loaders.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
    preLoaders: [
      // Tslint loader support for *.ts files
      //
      // See: https://github.com/wbuchwalter/tslint-loader
      {
        test: /\.ts$/,
        loader: 'tslint-loader',
        exclude: [
          helpers.root('node_modules')
        ]
      },
      // Source map loader support for *.js files
      // Extracts SourceMaps for source files that as added as sourceMappingURL comment.
      //
      // See: https://github.com/webpack/source-map-loader
      {
        test: /\.js$/, loader: 'source-map-loader', exclude: [
        // These packages have problems with their `sourcemaps`
        helpers.root('node_modules/rxjs'),
        helpers.root('node_modules/@angular2-material')
      ]}
    ],
    // An array of automatically applied loaders.
    //
    // IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
    // This means they are not resolved relative to the configuration file.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-loaders
    loaders: [
      // Typescript loader support for .ts and Angular 2 async routes via .async.ts
      //
      // See: https://github.com/s-panferov/awesome-typescript-loader
      {
        test: /\.ts$/,
        loader: 'awesome-typescript-loader',
        query: {
          "compilerOptions": {
            "removeComments": true,
          }
        },
        exclude: [ /\.e2e\.ts$/ ]
      },
      // Json loader support for *.json files.
      //
      // See: https://github.com/webpack/json-loader
      {
        test: /\.json$/,
        loader: 'json-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Raw loader support for *.html
      // Returns file content as string
      //
      // See: https://github.com/webpack/raw-loader
      {
        test: /\.html$/,
        loader: 'raw-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Raw loader support for *.css files
      // Returns file content as string
      //
      // See: https://github.com/webpack/raw-loader
      {
        test: /\.css$/,
        loader: 'raw-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Support for sass imports
      // Add CSS rules to your document:
      // `require("!style!css!sass!./file.scss");`
      {
        test: /\.scss$/,
        loader: 'style!css!autoprefixer-loader?browsers=last 2 versions!sass',
        exclude: [ helpers.root('src/index.html') ] },
    ],
    // An array of applied pre and post loaders.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
    postLoaders: [
      // Instruments JS files with Istanbul for subsequent code coverage reporting.
      // Instrument only testing sources.
      //
      // See: https://github.com/deepsweet/istanbul-instrumenter-loader
      {
        test: /\.(js|ts)$/,
        include: helpers.root('src'),
        loader: 'istanbul-instrumenter-loader',
        exclude: [
          /\.(e2e|spec)\.ts$/,
          /node_modules/
        ]
      }
    ]
  },
  // Add additional plugins to the compiler.
  //
  // See: http://webpack.github.io/docs/configuration.html#plugins
  plugins: [
    // Plugin: DefinePlugin
    // Description: Define free variables.
    // Useful for having development builds with debug logging or adding global constants.
    //
    // Environment helpers
    //
    // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
    // NOTE: when adding more properties make sure you include them in custom-typings.d.t    new webpack.DefinePlugin({
    new DefinePlugin({
      // Environment helpers
      'ENV': JSON.stringify(ENV),
      'HMR': false,
      'process.env': {
        'ENV': JSON.stringify(ENV),
        'NODE_ENV': JSON.stringify(ENV),
        'HMR': false
      }
    })
  ],

  // Other module loader config

  // Include polyfills or mocks for various node stuff
  // Description: Node configuration
  //
  // See: https://webpack.github.io/docs/configuration.html#node
  node: {
    global: 'window',
    process: false,
    crypto: 'empty',
    module: false,
    clearImmediate: false,
    setImmediate: false
  },
  // Static analysis linter for TypeScript advanced options configuration
  // Description: An extensible linter for the TypeScript language.
  //
  // See: https://github.com/wbuchwalter/tslint-loader
  tslint: {
    emitErrors: false,
    failOnHint: false,
    resourcePath: 'src',
  }
};
<commit_msg>fix(webpack.test): step-through debugging for tests in Karma<commit_after>// ```
// @datatype_void
// david.r.niciforovic@gmail.com
// webpack.config.js may be freely distributed under the MIT license
// ```

var helpers = require('./helpers');
//# Webpack Plugins
var ProvidePlugin = require('webpack/lib/ProvidePlugin');
var DefinePlugin  = require('webpack/lib/DefinePlugin');
//# Webpack Constants
const ENV = process.env.ENV = process.env.NODE_ENV = 'test';

//# Webpack Configuration
// See: http://webpack.github.io/docs/configuration.html#cli
module.exports = {
  // Developer tool to enhance debugging
  // Source map for Karma from the help of `karma-sourcemap-loader` &
  // `karma-webpack`
  //
  // Do not change, leave as is or it wont work.
  // See: https://github.com/webpack/karma-webpack#source-maps
  devtool: 'inline-source-map',
  // Options affecting the resolving of modules.
  //
  // See: http://webpack.github.io/docs/configuration.html#resolve
  resolve: {
    // An array of extensions that should be used to resolve modules.
    //
    // See: http://webpack.github.io/docs/configuration.html#resolve-extensions

    extensions: ['', '.ts', '.js', '.scss']
  },
  // Options affecting the normal modules.
  //
  // See: http://webpack.github.io/docs/configuration.html#module
  module: {
    // An array of applied pre and post loaders.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
    preLoaders: [
      // Tslint loader support for *.ts files
      //
      // See: https://github.com/wbuchwalter/tslint-loader
      {
        test: /\.ts$/,
        loader: 'tslint-loader',
        exclude: [
          helpers.root('node_modules')
        ]
      },
      // Source map loader support for *.js files
      // Extracts SourceMaps for source files that as added as sourceMappingURL comment.
      //
      // See: https://github.com/webpack/source-map-loader
      {
        test: /\.js$/, loader: 'source-map-loader', exclude: [
        // These packages have problems with their `sourcemaps`
        helpers.root('node_modules/rxjs'),
        helpers.root('node_modules/@angular2-material')
      ]}
    ],
    // An array of automatically applied loaders.
    //
    // IMPORTANT: The loaders here are resolved relative to the resource which they are applied to.
    // This means they are not resolved relative to the configuration file.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-loaders
    loaders: [
      // Typescript loader support for .ts and Angular 2 async routes via .async.ts
      //
      // See: https://github.com/s-panferov/awesome-typescript-loader
      {
        test: /\.ts$/,
        loader: 'awesome-typescript-loader',
        query: {
          "compilerOptions": {
            "removeComments": true,
          }
        },
        exclude: [ /\.e2e\.ts$/ ]
      },
      // Json loader support for *.json files.
      //
      // See: https://github.com/webpack/json-loader
      {
        test: /\.json$/,
        loader: 'json-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Raw loader support for *.html
      // Returns file content as string
      //
      // See: https://github.com/webpack/raw-loader
      {
        test: /\.html$/,
        loader: 'raw-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Raw loader support for *.css files
      // Returns file content as string
      //
      // See: https://github.com/webpack/raw-loader
      {
        test: /\.css$/,
        loader: 'raw-loader',
        exclude: [ helpers.root('src/index.html') ] },
      // Support for sass imports
      // Add CSS rules to your document:
      // `require("!style!css!sass!./file.scss");`
      {
        test: /\.scss$/,
        loader: 'style!css!autoprefixer-loader?browsers=last 2 versions!sass',
        exclude: [ helpers.root('src/index.html') ] },
    ],
    // An array of applied pre and post loaders.
    //
    // See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders
    postLoaders: [
      // Instruments JS files with Istanbul for subsequent code coverage reporting.
      // Instrument only testing sources.
      //
      // See: https://github.com/deepsweet/istanbul-instrumenter-loader
      {
        test: /\.(js|ts)$/,
        include: helpers.root('src'),
        loader: 'istanbul-instrumenter-loader',
        exclude: [
          /\.(e2e|spec)\.ts$/,
          /node_modules/
        ]
      }
    ]
  },
  // Add additional plugins to the compiler.
  //
  // See: http://webpack.github.io/docs/configuration.html#plugins
  plugins: [
    // Plugin: DefinePlugin
    // Description: Define free variables.
    // Useful for having development builds with debug logging or adding global constants.
    //
    // Environment helpers
    //
    // See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
    // NOTE: when adding more properties make sure you include them in custom-typings.d.t    new webpack.DefinePlugin({
    new DefinePlugin({
      // Environment helpers
      'ENV': JSON.stringify(ENV),
      'HMR': false,
      'process.env': {
        'ENV': JSON.stringify(ENV),
        'NODE_ENV': JSON.stringify(ENV),
        'HMR': false
      }
    })
  ],

  // Other module loader config

  // Include polyfills or mocks for various node stuff
  // Description: Node configuration
  //
  // See: https://webpack.github.io/docs/configuration.html#node
  node: {
    global: 'window',
    process: false,
    crypto: 'empty',
    module: false,
    clearImmediate: false,
    setImmediate: false
  },
  // Static analysis linter for TypeScript advanced options configuration
  // Description: An extensible linter for the TypeScript language.
  //
  // See: https://github.com/wbuchwalter/tslint-loader
  tslint: {
    emitErrors: false,
    failOnHint: false,
    resourcePath: 'src',
  }
};
<|endoftext|>


<commit_before>/* eslint strict: 0, no-shadow: 0, no-unused-vars: 0, no-console: 0 */
'use strict';

const os = require('os');
const webpack = require('webpack');
const cfg = require('./webpack.config.production.js');
const packager = require('electron-packager');
const del = require('del');
const exec = require('child_process').exec;
const argv = require('minimist')(process.argv.slice(2));
const pkg = require('./package.json');
const devDeps = Object.keys(pkg.devDependencies);

const appName = argv.name || argv.n || pkg.productName;
const shouldUseAsar = argv.asar || argv.a || false;
const shouldBuildAll = argv.all || false;

const DEFAULT_OPTS = {
  dir: './',
  name: appName,
  asar: shouldUseAsar,
  ignore: [
    '/test($|/)',
    '/release($|/)'
  ].concat(devDeps.map(name => `/node_modules/${name}($|/)`))
};

const icon = argv.icon || argv.i || 'app/app.icns';

if (icon) {
  DEFAULT_OPTS.icon = icon;
}

const version = argv.version || argv.v;

if (version) {
  DEFAULT_OPTS.version = version;
  startPack();
} else {
  // use the same version as the currently-installed electron-prebuilt
  exec('npm list electron-prebuilt', (err, stdout) => {
    if (err) {
      DEFAULT_OPTS.version = '0.36.2';
    } else {
      DEFAULT_OPTS.version = stdout.split('electron-prebuilt@')[1].replace(/\s/g, '');
    }

    startPack();
  });
}

function startPack() {
  console.log('start pack...');
  webpack(cfg, (err, stats) => {
    if (err) return console.error(err);
    del('release')
    .then(paths => {
      if (shouldBuildAll) {
        // build for all platforms
        const archs = ['ia32', 'x64'];
        const platforms = ['linux', 'win32', 'darwin'];

        platforms.forEach(plat => {
          archs.forEach(arch => {
            pack(plat, arch, log(plat, arch));
          });
        });
      } else {
        // build for current platform only
        pack(os.platform(), os.arch(), log(os.platform(), os.arch()));
      }
    })
    .catch(err => {
      console.error(err);
    });
  });
}

function pack(plat, arch, cb) {
  // there is no darwin ia32 electron
  if (plat === 'darwin' && arch === 'ia32') return;

  const opts = Object.assign({}, DEFAULT_OPTS, {
    platform: plat,
    arch,
    prune: true,
    out: `release/${plat}-${arch}`
  });

  packager(opts, cb);
}

function log(plat, arch) {
  return (err, filepath) => {
    if (err) return console.error(err);
    console.log(`${plat}-${arch} finished!`);
  };
}
<commit_msg>Write build version to package<commit_after>/* eslint strict: 0, no-shadow: 0, no-unused-vars: 0, no-console: 0 */
'use strict';

const os = require('os');
const webpack = require('webpack');
const cfg = require('./webpack.config.production.js');
const packager = require('electron-packager');
const del = require('del');
const exec = require('child_process').exec;
const argv = require('minimist')(process.argv.slice(2));
const pkg = require('./package.json');
const devDeps = Object.keys(pkg.devDependencies);

const appName = argv.name || argv.n || pkg.productName;
const shouldUseAsar = argv.asar || argv.a || false;
const shouldBuildAll = argv.all || false;

const DEFAULT_OPTS = {
  'app-version': pkg.version || null,
  dir: './',
  name: appName,
  asar: shouldUseAsar,
  ignore: [
    '/test($|/)',
    '/release($|/)'
  ].concat(devDeps.map(name => `/node_modules/${name}($|/)`))
};

const icon = argv.icon || argv.i || 'app/app.icns';

if (icon) {
  DEFAULT_OPTS.icon = icon;
}

const version = argv.version || argv.v;

if (version) {
  DEFAULT_OPTS.version = version;
  startPack();
} else {
  // use the same version as the currently-installed electron-prebuilt
  exec('npm list electron-prebuilt', (err, stdout) => {
    if (err) {
      DEFAULT_OPTS.version = '0.36.2';
    } else {
      DEFAULT_OPTS.version = stdout.split('electron-prebuilt@')[1].replace(/\s/g, '');
    }

    startPack();
  });
}

function startPack() {
  console.log('start pack...');
  webpack(cfg, (err, stats) => {
    if (err) return console.error(err);
    del('release')
    .then(paths => {
      if (shouldBuildAll) {
        // build for all platforms
        const archs = ['ia32', 'x64'];
        const platforms = ['linux', 'win32', 'darwin'];

        platforms.forEach(plat => {
          archs.forEach(arch => {
            pack(plat, arch, log(plat, arch));
          });
        });
      } else {
        // build for current platform only
        pack(os.platform(), os.arch(), log(os.platform(), os.arch()));
      }
    })
    .catch(err => {
      console.error(err);
    });
  });
}

function pack(plat, arch, cb) {
  // there is no darwin ia32 electron
  if (plat === 'darwin' && arch === 'ia32') return;

  const opts = Object.assign({}, DEFAULT_OPTS, {
    platform: plat,
    arch,
    prune: true,
    out: `release/${plat}-${arch}`
  });

  packager(opts, cb);
}

function log(plat, arch) {
  return (err, filepath) => {
    if (err) return console.error(err);
    console.log(`${plat}-${arch} finished!`);
  };
}
<|endoftext|>


<commit_before>Package.describe({
  name: 'dispatch:time-tracker',
  summary: 'Time-based reactivity.',
  version: '1.0.0',
  git: 'https://github.com/DispatchMe/meteor-time-tracker.git'
});

Package.onUse(function (api) {
  api.versionsFrom('1.0');

  api.use([
    'tracker',
    'reactive-var',
    'dispatch:kernel@0.0.2'
  ], 'web');

  api.addFiles('time_tracker.js', 'web');

  api.export('TimeTracker', 'web');
});

Package.onTest(function (api) {
  api.use(['tinytest', 'tracker', 'dispatch:time-tracker'], 'web');

  api.addFiles('time_tracker_tests.js', 'web');
});
<commit_msg>Bump version 1.0.1<commit_after>Package.describe({
  name: 'dispatch:time-tracker',
  summary: 'Time-based reactivity.',
  version: '1.0.1',
  git: 'https://github.com/DispatchMe/meteor-time-tracker.git'
});

Package.onUse(function (api) {
  api.versionsFrom('1.0');

  api.use([
    'tracker',
    'reactive-var',
    'dispatch:kernel@0.0.2'
  ], 'web');

  api.addFiles('time_tracker.js', 'web');

  api.export('TimeTracker', 'web');
});

Package.onTest(function (api) {
  api.use(['tinytest', 'tracker', 'dispatch:time-tracker'], 'web');

  api.addFiles('time_tracker_tests.js', 'web');
});
<|endoftext|>


<commit_before>Package.describe({
  summary: 'Routing specifically designed for Meteor'
});

Package.on_use(function (api) {
  api.use('reactive-dict', ['client', 'server']);
  api.use('deps', ['client', 'server']);
  api.use('underscore', ['client', 'server']);
  api.use('ejson', ['client', 'server']);
  api.use('jquery', 'client');

  // default ui manager
  // use unordered: true becuase of circular dependency

  // for helpers
  api.use('ui', 'client', {weak: true});

  // default ui manager
  // unordered: true because blaze-layout package weakly
  // depends on iron-router so it can register itself with
  // the router. But we still want to pull in the blaze-layout
  // package automatically when users add iron-router.
  api.use('blaze-layout', 'client', {unordered: true});

  api.add_files('lib/utils.js', ['client', 'server']);
  api.add_files('lib/route.js', ['client', 'server']);
  api.add_files('lib/route_controller.js', ['client', 'server']);
  api.add_files('lib/router.js', ['client', 'server']);

  api.add_files('lib/client/location.js', 'client');
  api.add_files('lib/client/router.js', 'client');
  api.add_files('lib/client/wait_list.js', 'client');
  api.add_files('lib/client/hooks.js', 'client');
  api.add_files('lib/client/route_controller.js', 'client');
  api.add_files('lib/client/ui/helpers.js', 'client');

  api.add_files('lib/server/route_controller.js', 'server');
  api.add_files('lib/server/router.js', 'server');

  api.use('webapp', 'server');
  Npm.depends({connect: '2.9.0'});

  api.export('RouteController', ['client', 'server']);
  api.export('Route', ['client', 'server']);
  api.export('Router', ['client', 'server']);
  api.export('IronLocation', 'client');

  api.export('Utils', ['client', 'server'], {testOnly: true});
  api.export('IronRouter', ['client', 'server'], {testOnly: true});
  api.export('WaitList', 'client', {testOnly: true});
});

Package.on_test(function (api) {
  api.use('iron-router', ['client', 'server']);
  api.use('tinytest', ['client', 'server']);
  api.use('test-helpers', ['client', 'server']);
  api.use('reactive-dict', ['client', 'server']);

  api.add_files('test/test_helpers.js', ['client', 'server']);

  // client and server
  api.add_files('test/both/route.js', ['client', 'server']);
  api.add_files('test/both/route_controller.js', ['client', 'server']);
  api.add_files('test/both/router.js', ['client', 'server']);
  api.add_files('test/both/utils.js', ['client', 'server']);

  // server only
  api.add_files('test/server/router.js', 'server');

  // client only
  api.add_files('test/client/mocks.js', 'client');
  api.add_files('test/client/router.js', 'client');
  api.add_files('test/client/route_controller.js', 'client');
  api.add_files('test/client/wait_list.js', 'client');
});
<commit_msg>Make ui dependency required, not weak.<commit_after>Package.describe({
  summary: 'Routing specifically designed for Meteor'
});

Package.on_use(function (api) {
  api.use('reactive-dict', ['client', 'server']);
  api.use('deps', ['client', 'server']);
  api.use('underscore', ['client', 'server']);
  api.use('ejson', ['client', 'server']);
  api.use('jquery', 'client');

  // default ui manager
  // use unordered: true becuase of circular dependency

  // for helpers
  api.use('ui', 'client');

  // default ui manager
  // unordered: true because blaze-layout package weakly
  // depends on iron-router so it can register itself with
  // the router. But we still want to pull in the blaze-layout
  // package automatically when users add iron-router.
  api.use('blaze-layout', 'client', {unordered: true});

  api.add_files('lib/utils.js', ['client', 'server']);
  api.add_files('lib/route.js', ['client', 'server']);
  api.add_files('lib/route_controller.js', ['client', 'server']);
  api.add_files('lib/router.js', ['client', 'server']);

  api.add_files('lib/client/location.js', 'client');
  api.add_files('lib/client/router.js', 'client');
  api.add_files('lib/client/wait_list.js', 'client');
  api.add_files('lib/client/hooks.js', 'client');
  api.add_files('lib/client/route_controller.js', 'client');
  api.add_files('lib/client/ui/helpers.js', 'client');

  api.add_files('lib/server/route_controller.js', 'server');
  api.add_files('lib/server/router.js', 'server');

  api.use('webapp', 'server');
  Npm.depends({connect: '2.9.0'});

  api.export('RouteController', ['client', 'server']);
  api.export('Route', ['client', 'server']);
  api.export('Router', ['client', 'server']);
  api.export('IronLocation', 'client');

  api.export('Utils', ['client', 'server'], {testOnly: true});
  api.export('IronRouter', ['client', 'server'], {testOnly: true});
  api.export('WaitList', 'client', {testOnly: true});
});

Package.on_test(function (api) {
  api.use('iron-router', ['client', 'server']);
  api.use('tinytest', ['client', 'server']);
  api.use('test-helpers', ['client', 'server']);
  api.use('reactive-dict', ['client', 'server']);

  api.add_files('test/test_helpers.js', ['client', 'server']);

  // client and server
  api.add_files('test/both/route.js', ['client', 'server']);
  api.add_files('test/both/route_controller.js', ['client', 'server']);
  api.add_files('test/both/router.js', ['client', 'server']);
  api.add_files('test/both/utils.js', ['client', 'server']);

  // server only
  api.add_files('test/server/router.js', 'server');

  // client only
  api.add_files('test/client/mocks.js', 'client');
  api.add_files('test/client/router.js', 'client');
  api.add_files('test/client/route_controller.js', 'client');
  api.add_files('test/client/wait_list.js', 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'jagi:astronomy-softremove-behavior',
  version: '2.0.5',
  summary: 'Soft remove behavior for Meteor Astronomy',
  git: 'https://github.com/jagi/meteor-astronomy-softremove-behavior.git'
});

Npm.depends({
  lodash: '4.16.6'
});

Package.onUse(function(api) {
  api.versionsFrom('1.3');

  api.use([
    'ecmascript',
    'es5-shim',
    'jagi:astronomy@2.2.4'
  ], ['client', 'server']);

  api.mainModule('lib/main.js', ['client', 'server']);
});<commit_msg>Bump version to 2.0.6<commit_after>Package.describe({
  name: 'jagi:astronomy-softremove-behavior',
  version: '2.0.6',
  summary: 'Soft remove behavior for Meteor Astronomy',
  git: 'https://github.com/jagi/meteor-astronomy-softremove-behavior.git'
});

Npm.depends({
  lodash: '4.17.2'
});

Package.onUse(function(api) {
  api.versionsFrom('1.3');

  api.use([
    'ecmascript',
    'es5-shim',
    'jagi:astronomy@2.3.4'
  ], ['client', 'server']);

  api.mainModule('lib/main.js', ['client', 'server']);
});<|endoftext|>


<commit_before>var Config = require('./src/utils/Config');
var Logging = require('./src/utils/Logging');

var cfg = new Config().load('config.json');
cfg.log = Logging.console;
Logging.config = cfg;

var starttime = new Date();
var BuildShow = require('./src/package/BuildShow.js');
var showbuilder = new BuildShow(cfg);

var show = process.argv[2] || 'SAShow';
var duration = parseInt(process.argv[3]) || 5400;

showbuilder.on(BuildShow.prototype.COMPLETE, function(stats) {
    cfg.log("SharkAttack", "Show " + show + " created" );
    Logging.recordTaskRun( { start: starttime, end: new Date(), name: 'packaging', details: 'Show ' + show + ' created' } );
});
showbuilder.run(show, duration, cfg.libLocation);<commit_msg>added compression<commit_after>var Config = require('./src/utils/Config');
var Logging = require('./src/utils/Logging');
var zipdir = require('zip-dir');
var path = require('path');

var cfg = new Config().load('config.json');
cfg.log = Logging.console;
Logging.config = cfg;

var starttime = new Date();
var BuildShow = require('./src/package/BuildShow.js');
var showbuilder = new BuildShow(cfg);

var show = process.argv[2] || 'SAShow';
var duration = parseInt(process.argv[3]) || 5400;

showbuilder.on(BuildShow.prototype.COMPLETE, function(stats) {
    cfg.log("SharkAttack", "Show " + show + " created" );
    Logging.recordTaskRun( { start: starttime, end: new Date(), name: 'packaging', details: 'Show ' + show + ' created' } );

    if (cfg.packaging.compress === true) {
        zipdir( cfg.packaging.showLocation + path.sep + show, { saveTo: cfg.packaging.showLocation + path.sep + show + '.zip' }, function (err, buffer) {
            cfg.log("SharkAttack", "Show " + show + " zipped" );
            Logging.recordTaskRun( { start: starttime, end: new Date(), name: 'packaging', details: 'Show ' + show + ' zipped' } );
        });
    }
});
showbuilder.run(show, duration, cfg.libLocation);<|endoftext|>


<commit_before>Package.describe({
  name: "brylie:api-umbrella",
  summary: "Wrapper for API Umbrella Admin API.",
  version: "0.1.9",
  git: "https://github.com/brylie/meteor-api-umbrella"
});

Package.onUse(function(api) {
  api.versionsFrom("1.0.1");
  api.use(["meteor", "http", "underscore"]);

  api.addFiles("server/web-admin-api.js", ["server"]);

  api.export("apiUmbrellaWeb", ["server"]);
});

Package.onTest(function (api) {
  api.use(["tinytest", "underscore"]);
  api.use("brylie:api-umbrella");

  api.addFiles("tests/server/web-admin-api.js", ["server"]);
  api.export("apiUmbrellaWeb", ["server"]);
});
<commit_msg>Bump version. Made breaking changes.<commit_after>Package.describe({
  name: "brylie:api-umbrella",
  summary: "Wrapper for API Umbrella Admin API.",
  version: "0.2.0",
  git: "https://github.com/brylie/meteor-api-umbrella"
});

Package.onUse(function(api) {
  api.versionsFrom("1.0.1");
  api.use(["meteor", "http", "underscore"]);

  api.addFiles("server/web-admin-api.js", ["server"]);

  api.export("apiUmbrellaWeb", ["server"]);
});

Package.onTest(function (api) {
  api.use(["tinytest", "underscore"]);
  api.use("brylie:api-umbrella");

  api.addFiles("tests/server/web-admin-api.js", ["server"]);
  api.export("apiUmbrellaWeb", ["server"]);
});
<|endoftext|>