Skip to content
Permalink
Browse files

Upgrade gulp and set background (fixes #452) (fixes #454)

  • Loading branch information...
Crecket committed Dec 7, 2018
1 parent 9cee238 commit 429b611b710b9b19b10aec7b8ce510439a2848df
@@ -1,3 +1,2 @@
require('./tasks/build_app');
require('./tasks/build_tests');
require('./tasks/start');
@@ -137,7 +137,7 @@
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/core": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
@@ -160,7 +160,7 @@
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@bunq-community/bunq-js-client": "^0.33.0",
"@bunq-community/bunq-js-client": "^0.35.2",
"@bunq-community/bunqdesktop-templates": "^1.2.0",
"@fortawesome/fontawesome-free": "^5.2.0",
"@material-ui/core": "^3.5.1",
@@ -174,7 +174,6 @@
"animate.css": "^3.6.1",
"awaiting": "^2.0.1",
"axios": "^0.18.0",
"babel-core": "^7.0.0-bridge.0",
"babel-loader": "^8.0.0",
"babel-plugin-dynamic-import-node": "^2.0.0",
"babel-plugin-react-html-attrs": "^2.1.0",
@@ -193,25 +192,23 @@
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"file-loader": "^2.0.0",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"gulp-batch": "^1.0.5",
"gulp-less": "^3.5.0",
"gulp-plumber": "^1.2.0",
"gulp-util": "^3.0.8",
"gulp-watch": "^5.0.0",
"gulp-watch": "^5.0.1",
"hard-source-webpack-plugin": "^0.12.0",
"html-webpack-plugin": "^3.2.0",
"iban": "^0.0.10",
"increase-memory-limit": "^1.0.6",
"jest": "^23.2.0",
"jest": "^23.6.0",
"libphonenumber-js": "^1.6.4",
"localforage": "^1.7.2",
"loglevel": "^1.6.1",
"material-ui-pickers": "^1.0.0",
"mini-css-extract-plugin": "^0.4.0",
"minimist": "^1.2.0",
"mocha": "^5.2.0",
"natives": "^1.1.4",
"natives": "1.1.6",
"node-forge": "^0.7.5",
"node-sass": "^4.9.0",
"prettier": "^1.14.2",
@@ -234,7 +231,7 @@
"react-spring": "^3.1.0",
"react-sticky-box": "^0.6.1",
"react-test-renderer": "^16.3.1",
"react-visibility-sensor": "^3.11.0",
"react-visibility-sensor": "^5.0.2",
"react-windowed-list": "^2.0.0",
"redux": "^3.7.2",
"redux-form": "^7.4.2",
@@ -11,15 +11,21 @@ class LazyAttachmentImage extends React.PureComponent {
}

onVisibilityChange = visible => {
this.setState({ visible: visible });
if (!this.state.visible) {
this.setState({ visible: visible });
}
};

render() {
return (
<VisibilitySensor onChange={this.onVisibilityChange}>
<VisibilitySensor onChange={this.onVisibilityChange} active={this.state.visible === false}>
{state => {
// if currently visible or previously visible render the image
return state.isVisible || this.state.visible ? <AttachmentImage {...this.props} /> : <div />;
return state.isVisible || this.state.visible ? (
<AttachmentImage {...this.props} />
) : (
<div style={{ position: "relative", width: 1, height: 1 }} />
);
}}
</VisibilitySensor>
);
@@ -143,6 +143,16 @@ class Layout extends React.Component {
// make sure language is up-to-date
this.checkLanguageChange(nextProps);

if (nextProps.theme === "DefaultTheme") {
if (document.documentElement.style.backgroundColor !== "#ffffff") {
document.documentElement.style.backgroundColor = "#ffffff";
}
} else {
if (document.documentElement.style.backgroundColor !== "#303030") {
document.documentElement.style.backgroundColor = "#303030";
}
}

if (nextProps.apiKey !== this.props.apiKey || nextProps.environment !== this.props.environment) {
if (this.props.apiKey !== false) {
// clear our old data associated with the previous session
@@ -343,7 +353,7 @@ const mapDispatchToProps = (dispatch, ownProps) => {
// functions to clear user data
registrationClearUserInfo: () => dispatch(registrationClearUserInfo()),

registrationLoadBunqDesktopClient: () => dispatch(registrationSetBunqDesktopClientData()),
registrationLoadBunqDesktopClient: () => dispatch(registrationSetBunqDesktopClientData())
};
};

@@ -11,7 +11,6 @@ body {
min-height: 100%;
width: 100%;
display: flex;
background-color: rgb(48, 48, 48);
}

input,
@@ -1,8 +1,6 @@
const gulp = require("gulp");
const less = require("gulp-less");
const watch = require("gulp-watch");
const batch = require("gulp-batch");
const plumber = require("gulp-plumber");
const gulpWatch = require("gulp-watch");
const gulpBatch = require("gulp-batch");
const jetpack = require("fs-jetpack");
const bundle = require("./bundle");
const utils = require("./utils");
@@ -18,27 +16,35 @@ gulp.task("bundle", () => {
]);
});

gulp.task("environment", () => {
const configFile = `config/env_${utils.getEnvName()}.json`;
projectDir.copy(configFile, destDir.path("env.json"), { overwrite: true });
});
gulp.task(
"environment",
gulp.series(done => {
const configFile = `config/env_${utils.getEnvName()}.json`;
projectDir.copy(configFile, destDir.path("env.json"), { overwrite: true });
done();
})
);

gulp.task("watch", () => {
const beepOnError = done => {
return err => {
if (err) {
utils.beepSound();
}
done(err);
gulp.task(
"watch",
gulp.series(done => {
const beepOnError = done => {
return err => {
if (err) {
utils.beepSound();
}
done(err);
};
};
};

watch(
"src/**/*.js",
batch((events, done) => {
gulp.start("bundle", beepOnError(done));
})
);
});
gulpWatch(
"src/**/*.js",
gulpBatch((events, done) => {
gulp.start("bundle", beepOnError(done));
})
);
done();
})
);

gulp.task("build", ["bundle", "environment"]);
gulp.task("build", gulp.series("bundle", "environment"));

This file was deleted.

@@ -1,60 +1,92 @@
const path = require('path');
const jetpack = require('fs-jetpack');
const rollup = require('rollup').rollup;
const path = require("path");
const jetpack = require("fs-jetpack");
const rollup = require("rollup").rollup;

const nodeBuiltInModules = ['assert', 'buffer', 'child_process', 'cluster',
'console', 'constants', 'crypto', 'dgram', 'dns', 'domain', 'events',
'fs', 'http', 'https', 'module', 'net', 'os', 'path', 'process', 'punycode',
'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'timers',
'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'];
const nodeBuiltInModules = [
"assert",
"buffer",
"child_process",
"cluster",
"console",
"constants",
"crypto",
"dgram",
"dns",
"domain",
"events",
"fs",
"http",
"https",
"module",
"net",
"os",
"path",
"process",
"punycode",
"querystring",
"readline",
"repl",
"stream",
"string_decoder",
"timers",
"tls",
"tty",
"url",
"util",
"v8",
"vm",
"zlib"
];

const electronBuiltInModules = ['electron'];
const electronBuiltInModules = ["electron"];

const generateExternalModulesList = () => {
const appManifest = jetpack.read('./package.json', 'json');
return [].concat(
nodeBuiltInModules,
electronBuiltInModules,
Object.keys(appManifest.dependencies),
Object.keys(appManifest.devDependencies)
);
const appManifest = jetpack.read("./package.json", "json");
return [].concat(
nodeBuiltInModules,
electronBuiltInModules,
Object.keys(appManifest.dependencies),
Object.keys(appManifest.devDependencies)
);
};

const cached = {};

module.exports = (src, dest, opts) => {
const options = opts || {};

const plugins = [
// Add rollup plugins here
];

return rollup({
entry: src,
external: generateExternalModulesList(),
cache: cached[src],
plugins: plugins.concat(options.rollupPlugins || []),
})
.then((bundle) => {
cached[src] = bundle;

const jsFile = path.basename(dest);
return bundle.generate({
format: 'cjs',
sourceMap: true,
sourceMapFile: jsFile,
}).then(result => {
// Wrap code in self invoking function so the constiables don't
// pollute the global namespace.
const isolatedCode = `(function () {${result.code}\n}());`;
return Promise.all([
jetpack.writeAsync(dest, `${isolatedCode}\n//# sourceMappingURL=${jsFile}.map`),
jetpack.writeAsync(`${dest}.map`, result.map.toString()),
]);
const options = opts || {};

const plugins = [
// Add rollup plugins here
];

return rollup({
entry: src,
external: generateExternalModulesList(),
cache: cached[src],
plugins: plugins.concat(options.rollupPlugins || [])
})
})
.catch(e => {
console.error(e);
throw e;
});
.then(bundle => {
cached[src] = bundle;

const jsFile = path.basename(dest);
return bundle
.generate({
format: "cjs",
sourceMap: true,
sourceMapFile: jsFile
})
.then(result => {
// Wrap code in self invoking function so the constiables don't
// pollute the global namespace.
const isolatedCode = `(function () {${result.code}\n}());`;
return Promise.all([
jetpack.writeAsync(dest, `${isolatedCode}\n//# sourceMappingURL=${jsFile}.map`),
jetpack.writeAsync(`${dest}.map`, result.map.toString())
]);
});
})
.catch(e => {
console.error(e);
throw e;
});
};

0 comments on commit 429b611

Please sign in to comment.
You can’t perform that action at this time.