Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit fa3991d

Browse files
authored
Merge pull request #185 from thornbill/jellyfin-web-npm
Install jellyfin-web with npm
2 parents e95b731 + 25154ca commit fa3991d

File tree

7 files changed

+880
-1214
lines changed

7 files changed

+880
-1214
lines changed

.gitmodules

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Jellyfin Mobile is an Android app built with Cordova.
1313
```sh
1414
git clone https://github.com/jellyfin/jellyfin-android.git
1515
cd jellyfin-android
16-
git submodule update --init --recursive --remote
1716
```
1817
2. Install Cordova and other build dependencies via npm in the project directory.
1918
```sh
@@ -34,6 +33,8 @@ npx gulp
3433

3534
> If `NODE_ENV=development` is set in the environment, then the source files will be copied without being minified.
3635
36+
> The `JELLYFIN_WEB_DIR` environment variable can be used to override the location of `jellyfin-web`.
37+
3738
### Build APK
3839

3940
You can use the `-d` flag if you want to build a debug version. A release version will need to be signed before it will run.

build

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,10 @@ else
2727
release="production"
2828
fi
2929

30-
# Initialize the submodule jellyfin-web
31-
git submodule update --init --remote
32-
33-
# Check out the proper jellyfin-web branch or update submodule
30+
# Change the jellyfin-web branch in package.json
3431
if [[ ${1} == '--web-branch' || ${1} == '-b' ]]; then
3532
if [[ -n ${2} ]]; then
36-
pushd src/jellyfin-web
37-
git fetch --all
38-
git checkout ${2} || usage
39-
popd
33+
sed -i "s/jellyfin\/jellyfin-web.git#[^\"]*/jellyfin\/jellyfin-web.git#${2}/g" package.json
4034
shift 2
4135
else
4236
usage

gulpfile.js

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var gulp = require('gulp');
22
var gulpif = require('gulp-if');
3-
var cleanCSS = require('gulp-clean-css');
43
var del = require('del');
54
var dom = require('gulp-dom');
65
var uglifyes = require('uglify-es');
@@ -9,6 +8,9 @@ var uglify = composer(uglifyes, console);
98

109
// Check the NODE_ENV environment variable
1110
var isDev = process.env.NODE_ENV === 'development';
11+
// Allow overriding of jellyfin-web directory
12+
var WEB_DIR = process.env.JELLYFIN_WEB_DIR || 'node_modules/jellyfin-web/dist';
13+
console.info('Using jellyfin-web from', WEB_DIR);
1214

1315
// Skip minification for development builds or minified files
1416
var compress = !isDev && [
@@ -25,38 +27,21 @@ var uglifyOptions = {
2527
}
2628
};
2729

28-
var cleanOptions = {
29-
// Do not rebase relative urls
30-
// Otherwise asset urls are rewritten to be relative to the current src
31-
rebase: false
32-
};
33-
3430
var paths = {
3531
assets: {
3632
src: [
37-
'src/jellyfin-web/src/**/*',
38-
'!src/jellyfin-web/src/**/*.{js,css}',
39-
'!src/jellyfin-web/src/index.html'
33+
WEB_DIR + '/**/*',
34+
'!' + WEB_DIR + '/index.html'
4035
],
4136
dest: 'www/'
4237
},
4338
index: {
44-
src: 'src/jellyfin-web/src/index.html',
39+
src: WEB_DIR + '/index.html',
4540
dest: 'www/'
4641
},
4742
scripts: {
48-
cordova: {
49-
src: 'src/cordova/**/*.js',
50-
dest: 'www/cordova/'
51-
},
52-
dashboard: {
53-
src: 'src/jellyfin-web/src/**/*.js',
54-
dest: 'www/'
55-
}
56-
},
57-
styles: {
58-
src: 'src/jellyfin-web/src/**/*.css',
59-
dest: 'www/'
43+
src: 'src/cordova/**/*.js',
44+
dest: 'www/cordova/'
6045
}
6146
};
6247

@@ -107,42 +92,22 @@ function modifyIndex() {
10792
}
10893

10994
// Uglify cordova scripts
110-
function cordovaScripts() {
111-
return gulp.src(paths.scripts.cordova.src)
112-
.pipe(gulpif(compress, uglify(uglifyOptions)))
113-
.pipe(gulp.dest(paths.scripts.cordova.dest));
114-
}
115-
cordovaScripts.displayName = 'scripts:cordova';
116-
117-
// Uglify dashboard-ui scripts
118-
function dashboardScripts() {
119-
return gulp.src(paths.scripts.dashboard.src)
95+
function scripts() {
96+
return gulp.src(paths.scripts.src)
12097
.pipe(gulpif(compress, uglify(uglifyOptions)))
121-
.pipe(gulp.dest(paths.scripts.dashboard.dest));
122-
}
123-
dashboardScripts.displayName = 'scripts:dashboard';
124-
125-
// Uglify scripts
126-
var scripts = gulp.parallel(cordovaScripts, dashboardScripts);
127-
128-
// Uglify stylesheets
129-
function styles() {
130-
return gulp.src(paths.styles.src)
131-
.pipe(gulpif(compress, cleanCSS(cleanOptions)))
132-
.pipe(gulp.dest(paths.styles.dest));
98+
.pipe(gulp.dest(paths.scripts.dest));
13399
}
134100

135101
// Default build task
136102
var build = gulp.series(
137103
clean,
138-
gulp.parallel(copy, modifyIndex, scripts, styles)
104+
gulp.parallel(copy, modifyIndex, scripts)
139105
);
140106

141107
// Export tasks so they can be run individually
142108
exports.clean = clean;
143109
exports.copy = copy;
144110
exports.modifyIndex = modifyIndex;
145111
exports.scripts = scripts;
146-
exports.styles = styles;
147112
// Export default task
148113
exports.default = build;

0 commit comments

Comments
 (0)