Skip to content
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _pkginfo.txt
/bin/
/BundleArtifacts/
/dist/
/dist/node_modules
/archives/*.zim*
/archives/*wikivoyage*.zim
/archives/*medicine*.zim
Expand Down
10 changes: 4 additions & 6 deletions KiwixWebApp-github.jsproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,12 @@
<Content Include="www\-\s\vector.css" />
<Content Include="www\article.html" />
<Content Include="www\css\app.css" />
<Content Include="www\css\bootstrap-theme.min.css" />
<Content Include="www\css\bootstrap.min.css" />
<Content Include="node_modules/@fortawesome/fontawesome-free/css/all.min.css" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.woff2" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" />
<Content Include="www\favicon.ico" />
<Content Include="www\fonts\glyphicons-halflings-regular.eot" />
<Content Include="www\fonts\glyphicons-halflings-regular.svg" />
<Content Include="www\fonts\glyphicons-halflings-regular.ttf" />
<Content Include="www\fonts\glyphicons-halflings-regular.woff" />
<Content Include="www\fonts\glyphicons-halflings-regular.woff2" />
<Content Include="www\img\icons\kiwix-32.png" />
<Content Include="www\img\icons\kiwix-60.png" />
<Content Include="www\img\icons\kiwix-90.png" />
Expand Down
10 changes: 4 additions & 6 deletions KiwixWebApp.jsproj
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,12 @@
<Content Include="www\-\s\vector.css" />
<Content Include="www\article.html" />
<Content Include="www\css\app.css" />
<Content Include="www\css\bootstrap-theme.min.css" />
<Content Include="www\css\bootstrap.min.css" />
<Content Include="node_modules/@fortawesome/fontawesome-free/css/all.min.css" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.woff2" />
<Content Include="node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2" />
<Content Include="www\favicon.ico" />
<Content Include="www\fonts\glyphicons-halflings-regular.eot" />
<Content Include="www\fonts\glyphicons-halflings-regular.svg" />
<Content Include="www\fonts\glyphicons-halflings-regular.ttf" />
<Content Include="www\fonts\glyphicons-halflings-regular.woff" />
<Content Include="www\fonts\glyphicons-halflings-regular.woff2" />
<Content Include="www\img\icons\kiwix-32.png" />
<Content Include="www\img\icons\kiwix-60.png" />
<Content Include="www\img\icons\kiwix-90.png" />
Expand Down
92 changes: 82 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@
"@babel/cli": "^7.21.5",
"@babel/core": "^7.21.5",
"@babel/preset-env": "^7.21.5",
"@fortawesome/fontawesome-free": "^5.15.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"babel-plugin-polyfill-corejs3": "^0.7.1",
"bootstrap": "^4.6.2",
"del-cli": "^5.0.0",
"electron": "38.3.0",
"electron-builder": "^26.0.18",
Expand All @@ -206,7 +208,6 @@
"electron-context-menu": "^3.1.1",
"electron-store": "^8.1.0",
"electron-updater": "^6.6.8",
"express": "^4.21.0",
"jquery": "^3.7.1"
"express": "^4.21.0"
}
}
28 changes: 19 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ const config = {
copy({
targets: [{
src: ['www/js/lib/*dec-wasm.wasm', 'www/js/lib/libzim-asm.js', 'www/js/lib/libzim-wasm.*', 'www/js/lib/darkreader.min.js', 'www/js/lib/webpHeroBundle*',
'node_modules/jquery/dist/jquery.slim.min.*', '!www/js/lib/libzim-wasm.dev*'],
'!www/js/lib/libzim-wasm.dev*'],
dest: 'dist/www/js'
},
{ src: ['node_modules/bootstrap/dist/css/bootstrap.min.css'], dest: 'dist/www/css' },
{ src: ['node_modules/@fortawesome/fontawesome-free/css/all.min.css'], dest: 'dist/www/css' },
{ src: ['node_modules/@fortawesome/fontawesome-free/webfonts/*'], dest: 'dist/www/webfonts' },
{ src: ['archives', 'images', 'index.html', 'manifest.json', 'package.json', 'LICENSE', 'CHANGELOG.md', 'README.md', '*.appxmanifest', '*.pfx', '*.cjs', 'Package.StoreAssociation.xml'], dest: 'dist' }
],
flatten: true
Expand Down Expand Up @@ -75,6 +78,9 @@ if (process.env.BUILD === 'production') {
// Remove all the lib files that will be included in the bundle
.replace(/(?:<Content Include=)?["']www[\\/]js[\\/]lib[\\/]cache[\s\S]+zimfile.js["'](?:\s*\/>|,)\s*/, '')
// Replace any references to node_modules
.replace(/node_modules[\\/]@fortawesome[\\/]fontawesome-free[\\/]((?:css|webfonts)[\\/])?/g, function (m, p1) {
return 'www/' + p1;
})
.replace(/node_modules[\\/].*dist[\\/]((?:js|css)[\\/])?/g, function (m, p1) {
p1 = p1 || 'js/';
return 'www/' + p1;
Expand All @@ -96,6 +102,9 @@ if (process.env.BUILD === 'production') {
// Remove all the lib files that will be included in the bundle
.replace(/(?:<Content Include=)?["']www[\\/]js[\\/]lib[\\/]cache[\s\S]+zimfile.js["'](?:\s*\/>|,)\s*/, '')
// Replace any references to node_modules
.replace(/node_modules[\\/]@fortawesome[\\/]fontawesome-free[\\/]((?:css|webfonts)[\\/])?/g, function (m, p1) {
return 'www/' + p1;
})
.replace(/node_modules[\\/].*dist[\\/]((?:js|css)[\\/])?/g, function (m, p1) {
p1 = p1 || 'js/';
return 'www/' + p1;
Expand Down Expand Up @@ -147,10 +156,9 @@ if (process.env.BUILD === 'production') {
.replace(/bundle\.js/, 'bundle.min.js')
// Comment out the old app.js link
.replace(/(<script type="module.*app.js.*)/, '<!-- $1 -->')
// Redirect jQuery and bootstrap
.replace(/(<script\s.*src=").*jquery.slim.min.js/, '$1js/jquery.slim.min.js')
// .replace(/(<script\s.*src=").*bootstrap.bundle.min.js/, '$1js/bootstrap.bundle.min.js')
// .replace(/(<link\s.*href=").*bootstrap.min.css/, '$1css/bootstrap.min.css')
// Redirect Bootstrap 4 and Font Awesome to dist locations
.replace(/(<link\s.*href=")\.\.\/node_modules\/bootstrap\/dist\/css\/bootstrap.min.css/, '$1css/bootstrap.min.css')
.replace(/(<link\s.*href=")\.\.\/node_modules\/@fortawesome\/fontawesome-free\/css\/all.min.css/, '$1css/all.min.css')
}
],
flatten: false
Expand Down Expand Up @@ -178,6 +186,9 @@ if (process.env.BUILD === 'production') {
// Remove all the lib files that will be included in the bundle
.replace(/(?:<Content Include=)?["']www[\\/]js[\\/]lib[\\/]cache[\s\S]+zimfile.js["'](?:\s*\/>|,)\s*/, '')
// Replace any references to node_modules
.replace(/node_modules[\\/]@fortawesome[\\/]fontawesome-free[\\/]((?:css|webfonts)[\\/])?/g, function (m, p1) {
return 'www/' + p1;
})
.replace(/node_modules[\\/].*dist[\\/]((?:js|css)[\\/])?/g, function (m, p1) {
p1 = p1 || 'js/';
return 'www/' + p1;
Expand All @@ -200,10 +211,9 @@ if (process.env.BUILD === 'production') {
.replace(/<!--\s(<script type="text\/javascript.*bundle.js.*)\s-->/, '$1')
// Comment out the old app.js link
.replace(/(<script type="module.*app.js.*)/, '<!-- $1 -->')
// Redirect jQuery and bootstrap
.replace(/(<script\s.*src=").*jquery.slim.min.js/, '$1js/jquery.slim.min.js')
// .replace(/(<script\s.*src=").*bootstrap.bundle.min.js/, '$1js/bootstrap.bundle.min.js')
// .replace(/(<link\s.*href=").*bootstrap.min.css/, '$1css/bootstrap.min.css')
// Redirect Bootstrap 4 and Font Awesome to dist locations
.replace(/(<link\s.*href=")\.\.\/node_modules\/bootstrap\/dist\/css\/bootstrap.min.css/, '$1css/bootstrap.min.css')
.replace(/(<link\s.*href=")\.\.\/node_modules\/@fortawesome\/fontawesome-free\/css\/all.min.css/, '$1css/all.min.css')
}
],
flatten: false
Expand Down
25 changes: 18 additions & 7 deletions scripts/patch_gitignore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
# Delete gitignore entry for the dist folder
sed -i "/^\/dist\/$/d" .gitignore

# Replace the /node_modules*/ entry in gitignore with the following
sed -i 's|/node_modules\*/|/node_modules/*\
!/node_modules/jquery\
/node_modules/jquery/*\
!/node_modules/jquery/dist\
/node_modules/jquery/dist/*\
!/node_modules/jquery/dist/jquery.slim.min.*|' .gitignore
# Replace the /*node_modules*/ entry in gitignore with the following
sed -i 's|/\*node_modules\*/|/node_modules/*\
!/node_modules/bootstrap\
/node_modules/bootstrap/*\
!/node_modules/bootstrap/dist\
/node_modules/bootstrap/dist/*\
!/node_modules/bootstrap/dist/css\
!/node_modules/bootstrap/dist/css/*\
!/node_modules/bootstrap/dist/js\
!/node_modules/bootstrap/dist/js/*\
!/node_modules/@fortawesome\
/node_modules/@fortawesome/*\
!/node_modules/@fortawesome/fontawesome-free\
/node_modules/@fortawesome/fontawesome-free/*\
!/node_modules/@fortawesome/fontawesome-free/css\
!/node_modules/@fortawesome/fontawesome-free/css/*\
!/node_modules/@fortawesome/fontawesome-free/webfonts\
!/node_modules/@fortawesome/fontawesome-free/webfonts/*|' .gitignore
5 changes: 4 additions & 1 deletion service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ const precacheFiles = [
'www/I/s/Icons-mini-file_acrobat.gif',
'www/css/app.css',
'www/css/bootstrap.min.css',
'www/fonts/glyphicons-halflings-regular.woff2',
'node_modules/@fortawesome/fontawesome-free/css/all.min.css',
'node_modules/@fortawesome/fontawesome-free/webfonts/fa-brands-400.woff2',
'node_modules/@fortawesome/fontawesome-free/webfonts/fa-regular-400.woff2',
'node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2',
'www/img/icons/apple-touch-icon.png',
'www/img/icons/favicon-16x16.png',
'www/img/icons/favicon-32x32.png',
Expand Down
5 changes: 0 additions & 5 deletions www/-/static/bootstrap/css/bootstrap.min.css

This file was deleted.

Loading
Loading