Skip to content

Commit

Permalink
# This is a combination of 3 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:
update travis

# The commit message electrode-io#2 will be skipped:

#	add traivs env

# The commit message electrode-io#3 will be skipped:

#	add traivs env
  • Loading branch information
didi0613 committed Jun 20, 2017
1 parent c43afe7 commit 988545c
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 66 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ notifications:
before_install:
- if [[ `npm -v` != 3* ]]; then npm i -g npm@3; npm --version; fi
- npm install -g xclap-cli
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ module.exports = {
},
archetypeOptions.webpack
),
karma: Object.assign({}, {
enableChromeHeadless: process.env.ENABLE_CHROME_HEADLESS
}),
karma: Object.assign(
{},
{ browser: process.env.KARMA_BROWSER === undefined ? "chrome" : process.env.KARMA_BROWSER },
archetypeOptions.karma
),
config: Object.assign(
{},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use strict";

const archetype = require("electrode-archetype-react-app/config/archetype");
const logger = require("electrode-archetype-react-app/lib/logger");

module.exports = function(settings) {
const browser = archetype.karma.browser.toLowerCase();
if (browser === "chrome") {
settings.browsers = ["Chrome", "Chrome_without_security"];
settings.customLaunchers = {
Chrome_without_security: {
base: "Chrome",
flags: ["--disable-web-security"]
},
Chrome_travis_ci: {
base: "Chrome",
flags: ["--no-sandbox"]
}
};
logger.info("Using Chrome Headless to run Karma test");

if (process.env.TRAVIS) {
settings.browsers = ["Chrome_travis_ci"];
}
} else if (browser === "phantomjs") {
settings.frameworks.push("phantomjs-shim");
settings.browser = ["PhantomJS"];
logger.warn(
"Using PhantomJS to run Karma test. It's been deprecated and may be removed in the future."
);
} else {
logger.error(`Unknown browser ${browser} set for Karma test. Failed.`);
return process.exit(1);
}

return settings;
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

const loadUserConfig = require("./util/load-user-config");
const Path = require("path");
const logger = require("electrode-archetype-react-app/lib/logger");
const archetype = require("electrode-archetype-react-app/config/archetype");
const browserSettings = require("./browser-settings");

module.exports = function(config) {
const settings = {
frameworks: ["mocha"],
reporters: ["spec"],
basePath: process.cwd(), // repository root.
files: [
Expand All @@ -31,26 +31,6 @@ module.exports = function(config) {
}
};

if (archetype.karma.enableChromeHeadless) {
Object.assign(settings, {
frameworks: ["mocha"],
browsers: ["Chrome", "Chrome_without_security"],
customLaunchers: {
Chrome_without_security: { // eslint-disable-line camelcase
base: "Chrome",
flags: ["--disable-web-security"]
}
}
});
} else {
Object.assign(settings, {
frameworks: ["mocha", "phantomjs-shim"],
browsers: ["PhantomJS"]
});

// eslint-disable-next-line max-len
logger.warn("PhantomJS has been deprecated, to use chrome headless, please set env 'ENABLE_CHROME_HEADLESS' to true.");
}

browserSettings(settings);
loadUserConfig(Path.basename(__filename), config, settings);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ const PREPROCESSORS = {};

const loadUserConfig = require("./util/load-user-config");

const logger = require("electrode-archetype-react-app/lib/logger");
const archetype = require("electrode-archetype-react-app/config/archetype");
const browserSettings = require("./browser-settings");

PREPROCESSORS[MAIN_PATH] = ["webpack", "sourcemap"];

module.exports = function(config) {
const settings = {
basePath: process.cwd(),
frameworks: ["mocha", "phantomjs-shim", "intl-shim"],
frameworks: ["mocha", "intl-shim"],
files: [MAIN_PATH],
plugins: [
"karma-chrome-launcher",
Expand Down Expand Up @@ -66,26 +65,6 @@ module.exports = function(config) {
singleRun: true
};

if (archetype.karma.enableChromeHeadless) {
Object.assign(settings, {
frameworks: ["mocha", "intl-shim"],
browsers: ["Chrome", "Chrome_without_security"],
customLaunchers: {
Chrome_without_security: { // eslint-disable-line camelcase
base: "Chrome",
flags: ["--disable-web-security"]
}
}
});
} else {
Object.assign(settings, {
frameworks: ["mocha", "phantomjs-shim", "intl-shim"],
browsers: ["PhantomJS"]
});

// eslint-disable-next-line max-len
logger.warn("PhantomJS has been deprecated, to use chrome headless, please set env 'ENABLE_CHROME_HEADLESS' to true.");
}

browserSettings(settings);
loadUserConfig(Path.basename(__filename), config, settings);
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const cssModuleSupport = !stylusExists && cssNextExists;

module.exports = function() {
const cssModuleStylusSupport = archetype.webpack.cssModuleStylusSupport;
const stylusQuery = cssLoader + "?-autoprefixer!" + stylusLoader;
const stylusQuery = `${cssLoader}?-autoprefixer!${stylusLoader}`;
const cssLoaderOptions =
"?modules&localIdentName=[name]__[local]___[hash:base64:5]&-autoprefixer";
const cssQuery = cssLoader + cssLoaderOptions + "!" + postcssLoader;
const cssStylusQuery = cssLoader + cssLoaderOptions + "!" + postcssLoader + "!" + stylusLoader;
const cssQuery = `${cssLoader}${cssLoaderOptions}!${postcssLoader}`;
const cssStylusQuery = `${cssLoader}${cssLoaderOptions}!${postcssLoader}!${stylusLoader}`;

// By default, this archetype assumes you are using CSS-Modules + CSS-Next
const rules = [
Expand Down
36 changes: 23 additions & 13 deletions packages/generator-electrode/generators/app/templates/clap.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
// Tell Electrode app archetype that you want to use ES6 syntax in your server code
/*
* Tell Electrode app archetype that you want to use ES6 syntax in your server code
*/

process.env.SERVER_ES6 = true;

/*
* Enable the following flags for optional features in the Electrode app archetype
* Use PhantomJS to run your Karma Unit tests. Default is "chrome" (Chrome Headless)
*/

// Use Chrome Headless instead of PhantomJS to run your Karma Unit tests
// process.env.ENABLE_CHROME_HEADLESS = true;
// process.env.KARMA_BROWSER = "phantomjs";

// Turn off using electrode-webpack-reporter to show visual report of your webpack
// compile results when running in dev mode with `clap dev`
// process.env.HTML_WEBPACK_REPORTER_OFF = true
/*
* Turn off using electrode-webpack-reporter to show visual report of your webpack
* compile results when running in dev mode with `clap dev`
*/

// Use a custom host name instead of localhost, and a diff port instead of 2992
// for webpack dev server when running in dev mode with `clap dev`
// process.env.WEBPACK_DEV_HOST = "dev.mymachine.net"
// process.env.WEBPACK_DEV_PORT = 8100
// process.env.HTML_WEBPACK_REPORTER_OFF = true;

// Enable HTTPS for webpack dev server when running in dev mode with `clap dev`
// process.env.WEBPACK_DEV_HTTPS = true;
/*
* Use a custom host name instead of localhost, and a diff port instead of 2992
* for webpack dev server when running in dev mode with `clap dev`
*/

// process.env.WEBPACK_DEV_HOST = "dev.mymachine.net";
// process.env.WEBPACK_DEV_PORT = 8100;

/*
* Enable HTTPS for webpack dev server when running in dev mode with `clap dev`
*/

// process.env.WEBPACK_DEV_HTTPS = true;

require("electrode-archetype-react-app")();

0 comments on commit 988545c

Please sign in to comment.