Skip to content

Commit

Permalink
Added Babel
Browse files Browse the repository at this point in the history
  • Loading branch information
szwacz committed Nov 1, 2017
1 parent 6158af4 commit 92ed6bf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
14 changes: 14 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"presets": [
[
"@babel/env",
{
"targets": {
"browsers": "last 2 Chrome versions",
"node": "current"
}
}
]
],
"plugins": [["transform-object-rest-spread", { "useBuiltIns": true }]]
}
19 changes: 1 addition & 18 deletions build/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,7 @@ const compiler = webpack(config(env));
let electronStarted = false;

const watching = compiler.watch({}, (err, stats) => {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}

console.log(
stats.toString({
colors: true,
hash: false,
version: false,
timings: false
})
);

if (!stats.hasErrors() && !electronStarted) {
if (!err && !stats.hasErrors() && !electronStarted) {
electronStarted = true;

childProcess
Expand Down
5 changes: 5 additions & 0 deletions build/webpack.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ module.exports = env => {
devtool: "source-map",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"]
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
},
"scripts": {
"postinstall": "install-app-deps",
"preunit": "webpack --config=build/webpack.unit.config.js --env=test --display=errors-only",
"preunit": "webpack --config=build/webpack.unit.config.js --env=test --display=none",
"unit": "electron-mocha temp/specs.js --renderer --require source-map-support/register",
"pree2e": "webpack --config=build/webpack.app.config.js --env=test --display=errors-only && webpack --config=build/webpack.e2e.config.js --env=test --display=errors-only",
"pree2e": "webpack --config=build/webpack.app.config.js --env=test --display=none && webpack --config=build/webpack.e2e.config.js --env=test --display=none",
"e2e": "mocha temp/e2e.js --require source-map-support/register",
"test": "npm run unit && npm run e2e",
"start": "node build/start.js",
Expand All @@ -34,6 +34,10 @@
"fs-jetpack": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.5",
"@babel/preset-env": "^7.0.0-beta.5",
"babel-loader": "^8.0.0-beta.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"chai": "^4.1.0",
"css-loader": "^0.28.7",
"electron": "^1.6.11",
Expand Down
6 changes: 6 additions & 0 deletions src/hello_world/hello_world.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ describe("hello world", () => {
"Add here any environment specific stuff you like."
);
});

it("babel features should work", () => {
const a = { a: 1 };
const b = { ...a, b: 2 };
expect(b).to.eql({ a: 1, b: 2 });
});
});

0 comments on commit 92ed6bf

Please sign in to comment.