Skip to content

Commit 04d082c

Browse files
author
ozelot379
committed
Merge branch 'develop' into 'master'
Develop See merge request minecraft/ConvertJavaTextureToBedrock!26
2 parents 197838e + edc9d60 commit 04d082c

8 files changed

Lines changed: 119 additions & 19 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## [3.2.0]
4+
- Offline usage
5+
36
## [3.1.0]
47
- Possible speed up texture pack loading
58
- First sounds support

‎README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Some experimental conversions are disabled by default, but can be enabled if you
2727
## Web app
2828
Look at https://ozelot379.github.io/ConvertJavaTextureToBedrock
2929

30-
Works directly in your browser - no upload
30+
Works directly in your browser - no upload and offline
3131

3232
## CLI
3333
As an alternative you can also use the cli version on your computer
@@ -98,12 +98,13 @@ yarn build
9898
# How this work
9999
This project uses the follow main features or external libraries:
100100

101-
- [Web Worker](https://developer.mozilla.org/docs/Web/API/Web_Workers_API) for convert it in the background to not freeze the ui
101+
- [Web Worker](https://developer.mozilla.org/docs/Web/API/Web_Workers_API) for convert it in the background to not freeze the browser ui (web app)
102102
- [jszip](https://www.npmjs.com/package/jszip) for read, modify and write zip files
103103
- [jimp](https://www.npmjs.com/package/jimp) for graphic manipulation
104104
- [file-saver](https://www.npmjs.com/package/file-saver) for deliver the converted pack to download
105105
- [webpack](https://www.npmjs.com/package/webpack) for bundle the dist code
106-
- [gh-pages](https://www.npmjs.com/package/gh-pages) for publish a new version to the github static page
106+
- [gh-pages](https://www.npmjs.com/package/gh-pages) for publish a new version to the github static page (web app)
107+
- [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) for offline cache and usage (web app)
107108

108109
# Use it direct in your code
109110
Add it as a dependency to your `package.json`
@@ -112,7 +113,7 @@ Add it as a dependency to your `package.json`
112113
yarn add @ozelot379/convert-minecraft-java-texture-to-bedrock
113114
```
114115

115-
Import it in your code, if you use webpack
116+
Import it in your code
116117
```javascript
117118
import ConvertJavaTextureToBedrock, {ConsoleLog, Input, LocalFileInputEntry, LocalFileOutput} from "@ozelot379/convert-minecraft-java-texture-to-bedrock";
118119
```

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ozelot379/convert-minecraft-java-texture-to-bedrock",
33
"productName": "ConvertJavaTextureToBedrock",
4-
"version": "3.1.0",
4+
"version": "3.2.0",
55
"description": "Convert Minecraft Java texture packs to Bedrock texture packs",
66
"keywords": [
77
"Minecraft",
@@ -37,6 +37,7 @@
3737
"less-loader": "^5.0.0",
3838
"materialize-css": "^1.0.0",
3939
"mini-css-extract-plugin": "^0.8.0",
40+
"offline-plugin": "^5.0.7",
4041
"optimize-css-assets-webpack-plugin": "^5.0.3",
4142
"path-browserify": "^1.0.0",
4243
"readdirp": "^3.1.2",

‎src/webapp/css/style.less‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ html, body {
66
height: 100%;
77
}
88

9+
#toastMessage {
10+
cursor: pointer;
11+
margin: 0;
12+
opacity: 0;
13+
position: fixed;
14+
right: 20px;
15+
top: 50px;
16+
transition-duration: 300ms;
17+
transition-property: opacity, top, visibility;
18+
visibility: hidden;
19+
20+
&[data-show] {
21+
opacity: 1;
22+
top: 20px;
23+
visibility: visible;
24+
}
25+
}
26+
927
main {
1028
.black-text;
1129
align-items: center;

‎src/webapp/html/index.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<div class="container">
3535
<div class="row">
3636
<div class="col l6">
37-
<div>Works directly in your browser - no upload</div>
37+
<div>Works directly in your browser - no upload and offline</div>
3838
<div>More infos in the <a class="green-text"
3939
href="https://github.com/ozelot379/ConvertJavaTextureToBedrock/blob/master/README.md"
4040
target="_blank">Readme</a></div>
@@ -60,5 +60,6 @@
6060
</div>
6161
</div>
6262
</footer>
63+
<div class="toast" id="toastMessage"></div>
6364
</body>
6465
</html>

‎src/webapp/js/index.js‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
import fileSaver from "file-saver";
2+
import OfflinePluginRuntime from "offline-plugin/runtime";
23
import swal from "sweetalert";
34
import Worker from "./worker";
45
import "./../css/style.less";
56

67
document.addEventListener("DOMContentLoaded", () => {
8+
const toastMessage = document.getElementById("toastMessage");
9+
OfflinePluginRuntime.install({
10+
onInstalled: () => {
11+
showToastMessage("Ready for install and use offline", 5000, () => {
12+
13+
});
14+
},
15+
onUpdateReady: () => {
16+
OfflinePluginRuntime.applyUpdate();
17+
},
18+
onUpdated: () => {
19+
showToastMessage("Update installed - Reloading ...", 2000, () => {
20+
location.reload();
21+
});
22+
}
23+
});
24+
725
const selectInputFileButton = document.getElementById("selectInputFileButton");
826
selectInputFileButton.addEventListener("change", startConvert);
927

@@ -26,6 +44,29 @@ document.addEventListener("DOMContentLoaded", () => {
2644
const logs = document.createElement("ul");
2745
logs.classList.add("log");
2846

47+
/**
48+
* @param {string} message
49+
* @param {number} duration
50+
* @param {function} func
51+
*/
52+
function showToastMessage(message, duration, func) {
53+
toastMessage.innerText = message;
54+
55+
toastMessage.dataset.show = "true";
56+
57+
toastMessage.addEventListener("click", hide);
58+
59+
setTimeout(hide, duration);
60+
61+
function hide() {
62+
toastMessage.removeEventListener("click", hide);
63+
64+
delete toastMessage.dataset.show;
65+
66+
func();
67+
}
68+
}
69+
2970
/**
3071
* @returns {boolean}
3172
*/

‎webpack.config.webapp.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const {CleanWebpackPlugin} = require("clean-webpack-plugin");
22
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
33
const HtmlWebpackPlugin = require("html-webpack-plugin");
44
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
5+
const OfflinePlugin = require("offline-plugin");
56
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
67
const PACKAGE = require("./package");
78
const TerserJSPlugin = require("terser-webpack-plugin");
@@ -11,7 +12,7 @@ const isDebug = (process.env.NODE_ENV === "development");
1112
module.exports = {
1213
devServer: {
1314
disableHostCheck: true,
14-
host: "0.0.0.0",
15+
host: "127.0.0.1",
1516
open: true,
1617
port: 8080
1718
},
@@ -92,7 +93,15 @@ module.exports = {
9293
},
9394
prefix: "webapp",
9495
publicPath: "./"
95-
})
96+
}),
97+
...(!isDebug ? [new OfflinePlugin({
98+
ServiceWorker: {
99+
events: true
100+
},
101+
AppCache: {
102+
events: true
103+
}
104+
})] : [])
96105
],
97106
resolve: {
98107
alias: {

‎yarn.lock‎

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,11 @@ deep-equal@^1.0.1:
20212021
object-keys "^1.1.1"
20222022
regexp.prototype.flags "^1.2.0"
20232023

2024+
deep-extend@^0.5.1:
2025+
version "0.5.1"
2026+
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.5.1.tgz#b894a9dd90d3023fbf1c55a394fb858eb2066f1f"
2027+
integrity sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==
2028+
20242029
deep-extend@^0.6.0:
20252030
version "0.6.0"
20262031
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
@@ -2236,6 +2241,11 @@ ee-first@1.1.1:
22362241
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
22372242
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
22382243

2244+
ejs@^2.3.4:
2245+
version "2.7.4"
2246+
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba"
2247+
integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==
2248+
22392249
electron-to-chromium@^1.3.322:
22402250
version "1.3.322"
22412251
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8"
@@ -3893,16 +3903,7 @@ loader-runner@^2.4.0:
38933903
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357"
38943904
integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==
38953905

3896-
loader-utils@1.2.3, loader-utils@^1.0.0, loader-utils@^1.1.0, loader-utils@^1.2.3:
3897-
version "1.2.3"
3898-
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7"
3899-
integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==
3900-
dependencies:
3901-
big.js "^5.2.2"
3902-
emojis-list "^2.0.0"
3903-
json5 "^1.0.1"
3904-
3905-
loader-utils@^0.2.16:
3906+
loader-utils@0.2.x, loader-utils@^0.2.16:
39063907
version "0.2.17"
39073908
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
39083909
integrity sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=
@@ -3912,6 +3913,15 @@ loader-utils@^0.2.16:
39123913
json5 "^0.5.0"
39133914
object-assign "^4.0.1"
39143915

3916+
loader-utils@1.2.3, loader-utils@^1.0.0, loader-utils@^1.1.0, loader-utils@^1.2.3:
3917+
version "1.2.3"
3918+
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7"
3919+
integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==
3920+
dependencies:
3921+
big.js "^5.2.2"
3922+
emojis-list "^2.0.0"
3923+
json5 "^1.0.1"
3924+
39153925
locate-path@^3.0.0:
39163926
version "3.0.0"
39173927
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
@@ -4134,7 +4144,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
41344144
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
41354145
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
41364146

4137-
minimatch@^3.0.4:
4147+
minimatch@^3.0.3, minimatch@^3.0.4:
41384148
version "3.0.4"
41394149
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
41404150
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
@@ -4476,6 +4486,17 @@ obuf@^1.0.0, obuf@^1.1.2:
44764486
resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e"
44774487
integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==
44784488

4489+
offline-plugin@^5.0.7:
4490+
version "5.0.7"
4491+
resolved "https://registry.yarnpkg.com/offline-plugin/-/offline-plugin-5.0.7.tgz#26936ad1a7699f4d67e0a095a258972a4ccf1788"
4492+
integrity sha512-ArMFt4QFjK0wg8B5+R/6tt65u6Dk+Pkx4PAcW5O7mgIF3ywMepaQqFOQgfZD4ybanuGwuJihxUwMRgkzd+YGYw==
4493+
dependencies:
4494+
deep-extend "^0.5.1"
4495+
ejs "^2.3.4"
4496+
loader-utils "0.2.x"
4497+
minimatch "^3.0.3"
4498+
slash "^1.0.0"
4499+
44794500
omggif@^1.0.9:
44804501
version "1.0.10"
44814502
resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.10.tgz#ddaaf90d4a42f532e9e7cb3a95ecdd47f17c7b19"
@@ -5780,6 +5801,11 @@ simple-swizzle@^0.2.2:
57805801
dependencies:
57815802
is-arrayish "^0.3.1"
57825803

5804+
slash@^1.0.0:
5805+
version "1.0.0"
5806+
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
5807+
integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=
5808+
57835809
snapdragon-node@^2.0.1:
57845810
version "2.1.1"
57855811
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"

0 commit comments

Comments
 (0)