Skip to content

Commit

Permalink
migrating to typescript; upgrade bottom-tip; bump 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYong committed Aug 20, 2018
1 parent 6d93c74 commit 41bb44d
Show file tree
Hide file tree
Showing 17 changed files with 1,507 additions and 2,014 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

104 changes: 0 additions & 104 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.target/
lib/
/node_modules/

.awcache
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/index.html
/example
.awcache
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 160,
"trailingComma": "es5",
"arrowParens": "always"
}
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
## Webpack HUD, displaying errors in app

Webpack HUD, displaying errors in app
----

> Contact me if you'd like to maintain this project!
[![](https://pbs.twimg.com/media/CjrPoAWUYAE_77K.png:large)](https://www.youtube.com/watch?v=i-qGt-7nxVg)

Warning message in the demo is genetated
by [eslint-loader](https://github.com/MoOx/eslint-loader)
with [`cooking`](http://cookingjs.github.io/).
![Webpack TypeScript demo](https://pbs.twimg.com/media/DlB9RKGUwAMWvBh.png:large)

### Usage

Expand All @@ -20,23 +12,27 @@ npm i --save-dev webpack-hud
module.exports = {
entry: {
main: [
'webpack-hud', // <-- put package here, before your code
'./src/main.js'
]
"webpack-hud", // <-- put package here, before your code
"./src/main",
],
},
output: {
filename: 'bundle.js',
path: 'build/'
filename: "bundle.js",
path: "build/",
},
module: {
loaders: [
{test: /\.js$/, loader: 'eslint'}
]
rules: [
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
eslint: {
emitWarning: true
}
}
};
```

### How does it work?
Expand Down
2 changes: 0 additions & 2 deletions example/demo.js

This file was deleted.

12 changes: 12 additions & 0 deletions example/demo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export class Fibonacci {
index: number;
fibonacciNumber: number;

public calculateFibonacciNumber() {
this.fibonacciNumber = this.calculate(this.index);
}

private calculate(i: number): number {
return i <= 2 ? 1 : this.calculate(i - 1) + this.calculate(i - 2);
}
}
10 changes: 9 additions & 1 deletion example/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>HUD</title>
<script src="http://localhost:8080/bundle.js"></script>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>

<body>
<p>Edit demo.js to see...</p>
<p>Follow guide and edit demo.ts to try...</p>
</body>

</html>
13 changes: 0 additions & 13 deletions example/main.js

This file was deleted.

14 changes: 14 additions & 0 deletions example/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "../src";
import "./demo";

declare let module: any;

if (module.hot) {
module.hot.accept("./demo", function _() {
console.log("reload");
});

module.hot.accept("../src", function _() {
window.location.reload();
});
}
35 changes: 17 additions & 18 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@

var path = require('path');
var path = require("path");

module.exports = {
mode: "development",
entry: {
main: [
'./main.js'
]
main: ["./main"],
},
performance: {
hints: false
hints: false,
},
output: {
filename: 'bundle.js',
path: '/example'
filename: "bundle.js",
path: "/example",
},
module: {
rules: [
{test: /\.js$/, loader: 'babel-loader'},
{enforce: "pre", test: /demo\.js$/, loader: 'eslint-loader',
query: {
emitWarning: true,
configFile: path.join(__dirname, '../.eslintrc.json')
}
}
]
}
}
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: /node_modules/,
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
};
28 changes: 9 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-hud",
"version": "0.1.1",
"version": "0.1.2",
"main": "lib/index.js",
"description": "Webpack HUD, for showing error messages",
"repository": {
Expand All @@ -12,11 +12,8 @@
},
"homepage": "https://github.com/mvc-works/webpack-hud#readme",
"scripts": {
"lint": "eslint src/ examples/",
"fix": "eslint --fix src/",
"precompile": "rm -rf lib/; mkdir lib; exit 0",
"compile": "babel -d lib/ src",
"prepublish": "npm run lint && npm run compile && exit 0"
"compile": "rm -rf lib/ && tsc --outDir lib",
"prepublish": "yarn compile"
},
"keywords": [
"webpack",
Expand All @@ -27,22 +24,15 @@
"author": "jiyinyiyong",
"license": "MIT",
"dependencies": {
"bottom-tip": "0.0.4",
"bottom-tip": "^0.1.0",
"doc-ready": "^1.0.4",
"sockjs-client": "^1.1.0",
"strip-ansi": "^4.0.0"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-core": "^6.21.0",
"babel-eslint": "^8.0.2",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.9.0",
"eslint": "^4.12.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-babel": "^4.1.2",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.5"
"awesome-typescript-loader": "^5.2.0",
"typescript": "^3.0.1",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
}
}
Loading

0 comments on commit 41bb44d

Please sign in to comment.