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

Commit

Permalink
Merge pull request #185 from thornbill/jellyfin-web-npm
Browse files Browse the repository at this point in the history
Install jellyfin-web with npm
  • Loading branch information
dkanada authored Sep 5, 2019
2 parents e95b731 + 25154ca commit fa3991d
Show file tree
Hide file tree
Showing 7 changed files with 880 additions and 1,214 deletions.
5 changes: 0 additions & 5 deletions .gitmodules

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Jellyfin Mobile is an Android app built with Cordova.
```sh
git clone https://github.com/jellyfin/jellyfin-android.git
cd jellyfin-android
git submodule update --init --recursive --remote
```
2. Install Cordova and other build dependencies via npm in the project directory.
```sh
Expand All @@ -34,6 +33,8 @@ npx gulp

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

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.
Expand Down
10 changes: 2 additions & 8 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ else
release="production"
fi

# Initialize the submodule jellyfin-web
git submodule update --init --remote

# Check out the proper jellyfin-web branch or update submodule
# Change the jellyfin-web branch in package.json
if [[ ${1} == '--web-branch' || ${1} == '-b' ]]; then
if [[ -n ${2} ]]; then
pushd src/jellyfin-web
git fetch --all
git checkout ${2} || usage
popd
sed -i "s/jellyfin\/jellyfin-web.git#[^\"]*/jellyfin\/jellyfin-web.git#${2}/g" package.json
shift 2
else
usage
Expand Down
59 changes: 12 additions & 47 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var gulp = require('gulp');
var gulpif = require('gulp-if');
var cleanCSS = require('gulp-clean-css');
var del = require('del');
var dom = require('gulp-dom');
var uglifyes = require('uglify-es');
Expand All @@ -9,6 +8,9 @@ var uglify = composer(uglifyes, console);

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

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

var cleanOptions = {
// Do not rebase relative urls
// Otherwise asset urls are rewritten to be relative to the current src
rebase: false
};

var paths = {
assets: {
src: [
'src/jellyfin-web/src/**/*',
'!src/jellyfin-web/src/**/*.{js,css}',
'!src/jellyfin-web/src/index.html'
WEB_DIR + '/**/*',
'!' + WEB_DIR + '/index.html'
],
dest: 'www/'
},
index: {
src: 'src/jellyfin-web/src/index.html',
src: WEB_DIR + '/index.html',
dest: 'www/'
},
scripts: {
cordova: {
src: 'src/cordova/**/*.js',
dest: 'www/cordova/'
},
dashboard: {
src: 'src/jellyfin-web/src/**/*.js',
dest: 'www/'
}
},
styles: {
src: 'src/jellyfin-web/src/**/*.css',
dest: 'www/'
src: 'src/cordova/**/*.js',
dest: 'www/cordova/'
}
};

Expand Down Expand Up @@ -107,42 +92,22 @@ function modifyIndex() {
}

// Uglify cordova scripts
function cordovaScripts() {
return gulp.src(paths.scripts.cordova.src)
.pipe(gulpif(compress, uglify(uglifyOptions)))
.pipe(gulp.dest(paths.scripts.cordova.dest));
}
cordovaScripts.displayName = 'scripts:cordova';

// Uglify dashboard-ui scripts
function dashboardScripts() {
return gulp.src(paths.scripts.dashboard.src)
function scripts() {
return gulp.src(paths.scripts.src)
.pipe(gulpif(compress, uglify(uglifyOptions)))
.pipe(gulp.dest(paths.scripts.dashboard.dest));
}
dashboardScripts.displayName = 'scripts:dashboard';

// Uglify scripts
var scripts = gulp.parallel(cordovaScripts, dashboardScripts);

// Uglify stylesheets
function styles() {
return gulp.src(paths.styles.src)
.pipe(gulpif(compress, cleanCSS(cleanOptions)))
.pipe(gulp.dest(paths.styles.dest));
.pipe(gulp.dest(paths.scripts.dest));
}

// Default build task
var build = gulp.series(
clean,
gulp.parallel(copy, modifyIndex, scripts, styles)
gulp.parallel(copy, modifyIndex, scripts)
);

// Export tasks so they can be run individually
exports.clean = clean;
exports.copy = copy;
exports.modifyIndex = modifyIndex;
exports.scripts = scripts;
exports.styles = styles;
// Export default task
exports.default = build;
Loading

0 comments on commit fa3991d

Please sign in to comment.