1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #2104 from thornbill/cleanup

Remove unused files and dependencies
This commit is contained in:
dkanada 2020-11-23 17:50:33 +09:00 committed by GitHub
commit 16f52c523f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 125 additions and 5066 deletions

View file

@ -1,178 +0,0 @@
const { src, dest, series, parallel, watch } = require('gulp');
const browserSync = require('browser-sync').create();
const del = require('del');
const babel = require('gulp-babel');
const terser = require('gulp-terser');
const htmlmin = require('gulp-htmlmin');
const imagemin = require('gulp-imagemin');
const sourcemaps = require('gulp-sourcemaps');
const mode = require('gulp-mode')({
modes: ['development', 'production'],
default: 'development',
verbose: false
});
const stream = require('webpack-stream');
const inject = require('gulp-inject');
const postcss = require('gulp-postcss');
const sass = require('gulp-sass');
const lazypipe = require('lazypipe');
sass.compiler = require('node-sass');
let config;
if (mode.production()) {
config = require('./webpack.prod.js');
} else {
config = require('./webpack.dev.js');
}
const options = {
javascript: {
query: ['src/**/*.js', '!src/bundle.js']
},
css: {
query: ['src/**/*.css', 'src/**/*.scss']
},
html: {
query: ['src/**/*.html', '!src/index.html']
},
images: {
query: ['src/**/*.png', 'src/**/*.jpg', 'src/**/*.gif', 'src/**/*.svg']
},
copy: {
query: ['src/**/*.json', 'src/**/*.ico', 'src/**/*.mp3']
},
injectBundle: {
query: 'src/index.html'
}
};
function serve() {
browserSync.init({
server: {
baseDir: './dist'
},
port: 8080
});
const events = ['add', 'change'];
watch(options.javascript.query).on('all', function (event, path) {
if (events.includes(event)) {
javascript(path);
}
});
watch('src/bundle.js', webpack);
watch(options.css.query).on('all', function (event, path) {
if (events.includes(event)) {
css(path);
}
});
watch(options.html.query).on('all', function (event, path) {
if (events.includes(event)) {
html(path);
}
});
watch(options.images.query).on('all', function (event, path) {
if (events.includes(event)) {
images(path);
}
});
watch(options.copy.query).on('all', function (event, path) {
if (events.includes(event)) {
copy(path);
}
});
watch(options.injectBundle.query, injectBundle);
}
function clean() {
return del(['dist/']);
}
const pipelineJavascript = lazypipe()
.pipe(function () {
return mode.development(sourcemaps.init({ loadMaps: true }));
})
.pipe(function () {
return babel({
presets: [
['@babel/preset-env']
]
});
})
.pipe(function () {
return terser({
keep_fnames: true,
mangle: false
});
})
.pipe(function () {
return mode.development(sourcemaps.write('.'));
});
function javascript(query) {
return src(typeof query !== 'function' ? query : options.javascript.query, { base: './src/' })
.pipe(pipelineJavascript())
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function webpack() {
return stream(config)
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function css(query) {
return src(typeof query !== 'function' ? query : options.css.query, { base: './src/' })
.pipe(mode.development(sourcemaps.init({ loadMaps: true })))
.pipe(sass().on('error', sass.logError))
.pipe(postcss())
.pipe(mode.development(sourcemaps.write('.')))
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function html(query) {
return src(typeof query !== 'function' ? query : options.html.query, { base: './src/' })
.pipe(mode.production(htmlmin({ collapseWhitespace: true })))
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function images(query) {
return src(typeof query !== 'function' ? query : options.images.query, { base: './src/' })
.pipe(mode.production(imagemin()))
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function copy(query) {
return src(typeof query !== 'function' ? query : options.copy.query, { base: './src/' })
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
function injectBundle() {
return src(options.injectBundle.query, { base: './src/' })
.pipe(inject(
src(['src/scripts/apploader.js'], { read: false }, { base: './src/' }), {
relative: true,
transform: function (filepath) {
return `<script src="${filepath}" defer></script>`;
}
}
))
.pipe(dest('dist/'))
.pipe(browserSync.stream());
}
exports.default = series(clean, parallel(javascript, webpack, css, html, images, copy), injectBundle);
exports.serve = series(exports.default, serve);

View file

@ -13,13 +13,11 @@
"@babel/preset-env": "^7.12.1",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.2.1",
"browser-sync": "^2.26.13",
"clean-webpack-plugin": "^3.0.0",
"confusing-browser-globals": "^1.0.10",
"copy-webpack-plugin": "^6.0.3",
"css-loader": "^5.0.1",
"cssnano": "^4.1.10",
"del": "^6.0.0",
"eslint": "^7.13.0",
"eslint-plugin-compat": "^3.5.1",
"eslint-plugin-eslint-comments": "^3.2.0",
@ -27,25 +25,12 @@
"eslint-plugin-promise": "^4.2.1",
"expose-loader": "^1.0.1",
"file-loader": "^6.2.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-cli": "^2.3.0",
"gulp-concat": "^2.6.1",
"gulp-htmlmin": "^5.0.1",
"gulp-if": "^3.0.0",
"gulp-imagemin": "^7.1.0",
"gulp-inject": "^5.0.5",
"gulp-mode": "^1.0.2",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^3.0.0",
"gulp-terser": "^1.4.1",
"html-loader": "^1.1.0",
"html-webpack-plugin": "^4.5.0",
"lazypipe": "^1.0.2",
"node-sass": "^5.0.0",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
"sass": "^1.29.0",
"sass-loader": "^10.0.5",
"source-map-loader": "^1.1.1",
"style-loader": "^2.0.0",
"stylelint": "^13.7.2",
@ -56,12 +41,10 @@
"webpack-cli": "^4.0.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2",
"webpack-stream": "^6.1.1",
"workbox-webpack-plugin": "^5.1.4",
"worker-plugin": "^5.0.0"
},
"dependencies": {
"alameda": "^1.4.0",
"blurhash": "^1.1.3",
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
"core-js": "^3.7.0",
@ -71,7 +54,6 @@
"flv.js": "^1.5.0",
"headroom.js": "^0.12.0",
"hls.js": "^0.14.16",
"howler": "^2.2.1",
"intersection-observer": "^0.11.0",
"jellyfin-apiclient": "^1.4.2",
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
@ -84,8 +66,6 @@
"page": "^1.11.6",
"pdfjs-dist": "2.5.207",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.29.0",
"sass-loader": "^10.0.5",
"screenfull": "^5.0.2",
"sortablejs": "^1.12.0",
"swiper": "^6.3.5",

View file

@ -155,8 +155,5 @@
<div class="splashLogo"></div>
</div>
<div class="mainDrawerHandle"></div>
<!-- inject:js -->
<!-- endinject -->
</body>
</html>

View file

@ -1,51 +0,0 @@
(function() {
function injectScriptElement(src, onload) {
if (!src) {
return;
}
const script = document.createElement('script');
if (window.dashboardVersion) {
src += `?v=${window.dashboardVersion}`;
}
script.src = src;
script.setAttribute('async', '');
if (onload) {
script.onload = onload;
}
document.head.appendChild(script);
}
function loadSite() {
injectScriptElement(
'./libraries/alameda.js',
function() {
// onload of require library
injectScriptElement('./scripts/site.js');
}
);
}
try {
Promise.resolve();
} catch (ex) {
// this checks for several cases actually, typical is
// Promise() being missing on some legacy browser, and a funky one
// is Promise() present but buggy on WebOS 2
window.Promise = undefined;
/* eslint-disable-next-line no-restricted-globals -- Explicit check on self needed */
self.Promise = undefined;
}
if (!window.Promise) {
// Load Promise polyfill if they are not natively supported
injectScriptElement(
'./libraries/npo.js',
loadSite
);
} else {
loadSite();
}
})();

View file

@ -6,7 +6,6 @@ const WorkboxPlugin = require('workbox-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Assets = [
'alameda/alameda.js',
'native-promise-only/npo.js',
'libarchive.js/dist/worker-bundle.js',
'libass-wasm/dist/js/subtitles-octopus-worker.js',

4934
yarn.lock

File diff suppressed because it is too large Load diff