Skip to content

Commit 27c7cac

Browse files
⚡️ Using Parcel for bundling
1 parent ff6374e commit 27c7cac

18 files changed

+15579
-3267
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
node_modules
1+
node_modules
2+
dist
3+
.cache
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

public/index.html index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ <h5 class="text-center mt-3" id="doneIn"></h5>
115115
crossorigin="anonymous"
116116
SameSite
117117
></script>
118-
<script src="./bundle.js"></script>
118+
<script src="./ts/app.ts"></script>
119119
</body>
120120
</html>

package-lock.json

+15,564
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "I built a simple battery info app in vanilla JavaScript using the battery web api in the navigator and Bootstrap.",
55
"main": "app.js",
66
"scripts": {
7-
"serve": "webpack-dev-server",
8-
"build": "webpack"
7+
"serve": "parcel index.html",
8+
"build": "parcel build index.html"
99
},
1010
"repository": {
1111
"type": "git",
@@ -19,10 +19,7 @@
1919
},
2020
"homepage": "https://github.com/max-programming/battery-info-javascript#readme",
2121
"devDependencies": {
22-
"ts-loader": "^8.0.12",
23-
"typescript": "^4.1.3",
24-
"webpack": "^5.11.0",
25-
"webpack-cli": "^3.3.11",
26-
"webpack-dev-server": "^3.11.0"
22+
"parcel-bundler": "1.12.4",
23+
"typescript": "^4.1.3"
2724
}
2825
}

public/bundle.js

-1
This file was deleted.

public/styles.css styles.css

File renamed without changes.

src/app.ts ts/app.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "regenerator-runtime/runtime";
12
import { BatteryType } from "./types";
23
import {
34
changeLevel,

src/functions.ts ts/functions.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ export const changeChargingAnimation = (isCharging: boolean) => {
6666
export const changeDoneIn = (ch: number, disch: number) => {
6767
const doneIn = document.getElementById("doneIn") as HTMLHeadingElement;
6868
if (ch !== Infinity) {
69-
doneIn.innerText = `Your battery will be fully charged in ${ch > 3599 ? `${ch / 3600 | 0} hours ` : ''}${
70-
((ch / 60) % 60 | 0)
71-
} mins`;
69+
doneIn.innerText = `Your battery will be fully charged in ${
70+
ch > 3599 ? `${(ch / 3600) | 0} hours ` : ""
71+
}${(ch / 60) % 60 | 0} mins`;
7272
} else if (disch !== Infinity) {
73-
doneIn.innerText = `Your battery will be dead in ${disch > 3599 ? `${disch / 3600 | 0} hours ` : ''}${(disch / 60) % 60 | 0} mins`;
73+
doneIn.innerText = `Your battery will be dead in ${
74+
disch > 3599 ? `${(disch / 3600) | 0} hours ` : ""
75+
}${(disch / 60) % 60 | 0} mins`;
7476
} else {
7577
doneIn.innerText = "";
7678
}

src/types.d.ts ts/types.d.ts

File renamed without changes.

webpack.config.js

-23
This file was deleted.

0 commit comments

Comments
 (0)