Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Commit

Permalink
Merge c3309df into 83673db
Browse files Browse the repository at this point in the history
  • Loading branch information
k88hudson committed Jan 7, 2016
2 parents 83673db + c3309df commit 4732e56
Show file tree
Hide file tree
Showing 47 changed files with 429 additions and 462 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"rules": {
"indent": 0,
"quotes": [2, "single"],
"quotes": [2, "double"],
"semi": [2, "always"],
"func-names": 0,
"comma-dangle": [2, "never"],
Expand Down
4 changes: 2 additions & 2 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"preset": "google",
"fileExtensions": [".js"],
"esnext": true,
"validateQuoteMarks": true,
"maximumLineLength": 120,
"excludeFiles": [
"node_modules/**"
"node_modules/**",
"src/lib/platform-placeholder.js"
]
}
2 changes: 0 additions & 2 deletions .jshintignore

This file was deleted.

69 changes: 0 additions & 69 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ before_script:
- firefox -v

after_script:
#- ./node_modules/.bin/codeclimate-test-reporter < ./logs/reports/coverage/lcov/lcov.info
# - npm run test:codeclimate
2 changes: 1 addition & 1 deletion bin/fetchl10nstrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function assureResponse(response) {
}
/**
* Validate the data against the canonical default object.
* Invalid properties are console.log()'ed.
* Invalid properties are console.log()ed.
*
* @param {Map} results results to be validated.
* @param {String} locale The corresponding locale.
Expand Down
4 changes: 2 additions & 2 deletions bin/movesrcfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 4. Copies the localized HTML to the appropriate version/channel locale
* directory.
*
* Files that don't need to be localized are just placed at the
* Files that don"t need to be localized are just placed at the
* "channel" level, so to avoid duplication. For example, there sw.js:
* ./build/v2/nightly/sw.js
*
Expand All @@ -46,7 +46,7 @@ const version = "v2";
*/
const Tasks = {
/**
* Downloads the list of shipping locales from Aurora's repo.
* Downloads the list of shipping locales from Aurora"s repo.
*
* @return {Promise<String[]>} Resolves with the locales.
*/
Expand Down
18 changes: 9 additions & 9 deletions bin/new-component.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");
const args = process.argv.slice(2);
const COMPONENTS_DIR = './src/components';
const MAIN_CSS_PATH = './src/main.scss';
const COMPONENTS_DIR = "./src/components";
const MAIN_CSS_PATH = "./src/main.scss";
const name = args[0];
const dirPath = path.join(COMPONENTS_DIR, name);

function camelToHyphenated(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
}

function jsTemplate(name) {
return (
`const React = require('react');
`const React = require("react");
const ${name} = React.createClass({
render: function () {
Expand All @@ -36,6 +36,6 @@ function cssTemplate(name) {
if (fs.existsSync(dirPath)) throw new Error(`Component "${name}" already exists`);

fs.mkdirSync(dirPath);
fs.writeFileSync(path.join(dirPath, name + '.js'), jsTemplate(name));
fs.writeFileSync(path.join(dirPath, name + '.scss'), cssTemplate(name));
fs.appendFileSync(MAIN_CSS_PATH, `@import './components/${name}/${name}';\n`);
fs.writeFileSync(path.join(dirPath, name + ".js"), jsTemplate(name));
fs.writeFileSync(path.join(dirPath, name + ".scss"), cssTemplate(name));
fs.appendFileSync(MAIN_CSS_PATH, `@import "./components/${name}/${name}";\n`);
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ test:
- PATH=/tmp/firefox/firefox:$PATH npm test
post:
- cd ~/$CIRCLE_PROJECT_REPONAME
- ./node_modules/.bin/codeclimate-test-reporter < ./logs/reports/coverage/lcov/lcov.info
- npm run test:codeclimate
44 changes: 35 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
const webpack = require('./webpack.config');
const webpack = require("./webpack.config");
const path = require("path");

module.exports = function (config) {
config.set({
singleRun: true,
browsers: ['FirefoxNightly'],
frameworks: ['mocha'],
reporters: ['mocha'],
browsers: ["FirefoxNightly"],
frameworks: ["mocha"],
reporters: ["mocha", "coverage", "coveralls"],
coverageReporter: {
dir: "logs/reports/coverage",
reporters: [{
type: "lcov",
subdir: "lcov"
}, {
type: "html",
subdir: "html"
}, {
type: "text",
subdir: ".",
file: "text.txt"
}, {
type: "text-summary",
subdir: ".",
file: "text-summary.txt"
}]
},

files: [
'tests/index.js'
"tests/index.js"
],
preprocessors: {
'tests/**/*.js': ['webpack', 'sourcemap']
"tests/**/*.js": ["webpack", "sourcemap"]
},
webpack: {
devtool: 'inline-source-map',
devtool: "inline-source-map",
resolve: webpack.resolve,
module: {
loaders: webpack.module.loaders
}
loaders: webpack.module.loaders,
postLoaders: [{
test: /\.js$/,
loader: 'istanbul-instrumenter',
include: [path.join(__dirname, '/src')]
}]
},
plugins: webpack.plugins
},
webpackMiddleware: {
noInfo: true
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"build:js": "NODE_ENV=production webpack -p --optimize-dedupe",
"build:css": "node-sass src/main.scss -o www",
"watch:css": "npm run build:css && npm run build:css -- --source-map www/main.css.map -w -r",
"watch:js": "webpack-dev-server --hot --port=1944 --output-public-path www",
"watch:js": "webpack-dev-server --hot --port=1944 --content-base www",
"test:watch": "karma start --no-single-run --browsers ChromeCanary",
"test": "karma start",

"test:codeclimate": "codeclimate-test-reporter < ./logs/reports/coverage/lcov/lcov.info",
"posttest": "awk 'FNR==1{print \"\"}1' ./logs/reports/coverage/text-summary.txt ./logs/reports/coverage/text.txt",
"jshint": "jshint src bin",
"jscs": "jscs --esnext src",
"jscs:fix": "jscs --esnext --fix bin/ src/locale/ src/js/ src/js/lib/ src/test/ src/test/lib"
Expand All @@ -39,7 +40,6 @@
"chai-as-promised": "^5.1.0",
"cli-color": "^1.1.0",
"codeclimate-test-reporter": "^0.1.0",
"codeclimate-test-reporter": "^0.1.0",
"eslint": "^1.10.2",
"eslint-config-airbnb": "^1.0.2",
"eslint-loader": "^1.1.1",
Expand All @@ -48,14 +48,15 @@
"handlebars": "^4.0.4",
"html2js": "^0.2.0",
"inject-loader": "^2.0.1",
"jscs": "^2.1.0",
"istanbul-instrumenter-loader": "^0.1.3",
"jscs": "^2.8.0",
"jshint": "^2.8.0",
"karma": "^0.13.15",
"karma-chai": "^0.1.0",
"karma-chai-as-promised": "^0.1.2",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^0.5.0",
"karma-coveralls": "^1.1.2",
"karma-chrome-launcher": "^0.2.2",
"karma-express-http-server": "0.0.1",
"karma-firefox-launcher": "^0.1.7",
"karma-html2js-preprocessor": "^0.1.0",
Expand Down
16 changes: 8 additions & 8 deletions src/actions/CommActions.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const c = require('lib/constants');
const Comm = require('lib/comm');
const {request, receive} = require('lib/utils');
const c = require("lib/constants");
const Comm = require("lib/comm");
const {request, receive} = require("lib/utils");
const relayEvents = new Map([
'NewTab:ContentSearchService'
"NewTab:ContentSearchService"
].map(event => [event, event]));

// This triggers actions received from comm
// NOTE: All case statements MUST be in relayEvents
function commRelay(dispatch) {
return function onMessage(event, data) {
switch (event) {
case relayEvents.get('NewTab:ContentSearchService'):
case relayEvents.get("NewTab:ContentSearchService"):
switch (data.name) {
case 'Suggestions':
case "Suggestions":
return dispatch(receive(c.RECEIVE_SEARCH_SUGGESTIONS, {suggestions: data.suggestion.remote}));
default:
return null;
Expand Down Expand Up @@ -43,8 +43,8 @@ module.exports = {
getSearchSuggestions(searchString) {
return function next(dispatch) {
dispatch(request(c.REQUEST_SEARCH_SUGGESTIONS));
Comm.dispatch('NewTab:GetSuggestions', {
engineName: 'Google',
Comm.dispatch("NewTab:GetSuggestions", {
engineName: "Google",
searchString,
remoteTimeout: undefined
});
Expand Down
6 changes: 3 additions & 3 deletions src/actions/PrefsActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = require('lib/constants');
const {receive} = require('lib/utils');
const Platform = require('lib/platform');
const c = require("lib/constants");
const {receive} = require("lib/utils");
const Platform = require("lib/platform");

module.exports = {
getPrefs() {
Expand Down
8 changes: 4 additions & 4 deletions src/actions/SearchActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const c = require('lib/constants');
const {request, receive} = require('lib/utils');
const Platform = require('lib/platform');
const async = require('lib/async');
const c = require("lib/constants");
const {request, receive} = require("lib/utils");
const Platform = require("lib/platform");
const async = require("lib/async");

module.exports = {
getSuggestions(engineName, searchString) {
Expand Down
8 changes: 4 additions & 4 deletions src/actions/SitesActions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const c = require('lib/constants');
const {request, receive} = require('lib/utils');
const Platform = require('lib/platform');
const async = require('lib/async');
const c = require("lib/constants");
const {request, receive} = require("lib/utils");
const Platform = require("lib/platform");
const async = require("lib/async");

module.exports = {
getSiteThumbnail(url) {
Expand Down
12 changes: 6 additions & 6 deletions src/actions/SyncActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const c = require('lib/constants');
const {receive} = require('lib/utils');
const Platform = require('lib/platform');
const c = require("lib/constants");
const {receive} = require("lib/utils");
const Platform = require("lib/platform");

module.exports = {
/**
Expand All @@ -9,11 +9,11 @@ module.exports = {
*/
addListeners() {
return dispatch => {
Platform.prefs.addEventListener('message', prefs => dispatch(receive(c.RECEIVE_PREFS, prefs)));
Platform.search.addEventListener('enginechange', event => {
Platform.prefs.addEventListener("message", prefs => dispatch(receive(c.RECEIVE_PREFS, prefs)));
Platform.search.addEventListener("enginechange", event => {
dispatch(receive(c.RECEIVE_CURRENT_SEARCH_ENGINE, {body: event.engine}));
});
Platform.search.addEventListener('visibleenginechange', event => {
Platform.search.addEventListener("visibleenginechange", event => {
dispatch(receive(c.RECEIVE_VISIBLE_SEARCH_ENGINES, {body: event.engines}));
});
};
Expand Down
2 changes: 1 addition & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const req = require.context('.', false, /Actions.js$/);
const req = require.context(".", false, /Actions.js$/);
const files = req.keys();

// Looks for all actions in this folder
Expand Down
16 changes: 8 additions & 8 deletions src/components/Base/Base.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const React = require('react');
const {connect} = require('react-redux');
const React = require("react");
const {connect} = require("react-redux");

const Platform = require('lib/platform');
const TileUtils = require('lib/TileUtils');
const actions = require('actions/index');
const Platform = require("lib/platform");
const TileUtils = require("lib/TileUtils");
const actions = require("actions/index");

const Tile = require('components/Tile/Tile');
const Search = require('components/Search/Search');
const Settings = require('components/Settings/Settings');
const Tile = require("components/Tile/Tile");
const Search = require("components/Search/Search");
const Settings = require("components/Settings/Settings");

const Base = React.createClass({
componentWillMount: function () {
Expand Down

0 comments on commit 4732e56

Please sign in to comment.