From e7f441277116efceb3019e2edbdc9e4909c20857 Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 16 Mar 2020 23:49:56 +0900 Subject: [PATCH 01/15] remove tar from published artifacts --- .ci/azure-pipelines.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 7505f9ab5d..1a0f11a644 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -24,10 +24,12 @@ jobs: strategy: matrix: - bundle: - BuildConfiguration: Bundle - standalone: - BuildConfiguration: Standalone + Development: + BuildConfiguration: development + Bundle: + BuildConfiguration: bundle + Standalone: + BuildConfiguration: standalone maxParallel: 2 steps: @@ -40,20 +42,25 @@ jobs: displayName: 'Install Dependencies' - script: 'yarn build' - displayName: 'Build' + displayName: 'Build Bundle' + condition: eq(variables['BuildConfiguration'], 'bundle') + + - script: 'yarn build --standalone' + displayName: 'Build Standalone' + condition: eq(variables['BuildConfiguration'], 'standalone') - script: 'test -d dist' displayName: 'Check Build' - - script: 'yarn pack --filename jellyfin-web.tgz' - displayName: 'Bundle Release' + - script: 'mv dist jellyfin-web' + displayName: 'Rename Directory' - task: PublishPipelineArtifact@1 displayName: 'Publish Release' condition: succeeded() inputs: - targetPath: '$(Build.SourcesDirectory)/jellyfin-web.tgz' - artifactName: 'jellyfin-web' + targetPath: '$(Build.SourcesDirectory)/jellyfin-web' + artifactName: 'jellyfin-web-$(BuildConfiguration)' - job: lint displayName: 'Lint' From 2cb68b9a243f11ca0c7a8aafcb7ce96a938aa4c9 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:04:52 +0900 Subject: [PATCH 02/15] improve build times and modify yarn scripts --- .ci/azure-pipelines.yml | 10 ++++++---- package.json | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 1a0f11a644..7e929f40fc 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -16,9 +16,6 @@ jobs: - job: build displayName: 'Build' - dependsOn: lint - condition: succeeded() - pool: vmImage: 'ubuntu-latest' @@ -30,7 +27,7 @@ jobs: BuildConfiguration: bundle Standalone: BuildConfiguration: standalone - maxParallel: 2 + maxParallel: 3 steps: - task: NodeTool@0 @@ -41,6 +38,10 @@ jobs: - script: 'yarn install' displayName: 'Install Dependencies' + - script: 'yarn build' + displayName: 'Build Development' + condition: eq(variables['BuildConfiguration'], 'development') + - script: 'yarn build' displayName: 'Build Bundle' condition: eq(variables['BuildConfiguration'], 'bundle') @@ -54,6 +55,7 @@ jobs: - script: 'mv dist jellyfin-web' displayName: 'Rename Directory' + condition: succeeded() - task: PublishPipelineArtifact@1 displayName: 'Publish Release' diff --git a/package.json b/package.json index 90d463fb4d..5ad70cacdf 100644 --- a/package.json +++ b/package.json @@ -90,9 +90,10 @@ ], "scripts": { "serve": "gulp serve", - "build": "gulp --bundle", + "build": "gulp", + "build development": "gulp --development", + "build bundle": "gulp --bundle", "build standalone": "gulp --standalone", - "build development": "gulp", "lint": "eslint \"src\"", "stylelint": "stylelint \"src/**/*.css\"" } From 89ba9cf5d76108bbdaa8c5b7efb93dde741df4e8 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:17:46 +0900 Subject: [PATCH 03/15] cache build dependencies on ci --- .ci/azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 7e929f40fc..b606ac4106 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -38,6 +38,12 @@ jobs: - script: 'yarn install' displayName: 'Install Dependencies' + - task: Cache@2 + displayName: 'Cache Dependencies' + inputs: + key: 'yarn | yarn.lock' + path: '$(Pipeline.Workspace)/.yarn' + - script: 'yarn build' displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') From 9767ecb47440e31257c0ad1ee2012e9d240035ad Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:32:46 +0900 Subject: [PATCH 04/15] cache the right folder --- .ci/azure-pipelines.yml | 2 +- README.md | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index b606ac4106..c14717136a 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -42,7 +42,7 @@ jobs: displayName: 'Cache Dependencies' inputs: key: 'yarn | yarn.lock' - path: '$(Pipeline.Workspace)/.yarn' + path: '$(Pipeline.Workspace)/.node_modules' - script: 'yarn build' displayName: 'Build Development' diff --git a/README.md b/README.md index 4ee78ed786..6ad4bfcbb5 100644 --- a/README.md +++ b/README.md @@ -50,25 +50,32 @@ Jellyfin Web is the frontend used for most of the clients available for end user ### Getting Started 1. Clone or download this repository. + ```sh git clone https://github.com/jellyfin/jellyfin-web.git cd jellyfin-web ``` + 2. Install build dependencies in the project directory. + ```sh yarn install ``` 3. Run the web client with webpack for local development. + ```sh yarn serve ``` 4. Build the client with sourcemaps. + '''sh yarn ''' - Or without sourcemaps + + You can build a nginx compatible version as well. + '''sh - yarn --production + yarn --standalone ''' \ No newline at end of file From 2ecba9cd14a712054e7246c5fa4252d1296e492c Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:37:21 +0900 Subject: [PATCH 05/15] more readme changes --- .ci/azure-pipelines.yml | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index c14717136a..f5515e8f69 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -42,7 +42,7 @@ jobs: displayName: 'Cache Dependencies' inputs: key: 'yarn | yarn.lock' - path: '$(Pipeline.Workspace)/.node_modules' + path: '$(Pipeline.Workspace)/node_modules' - script: 'yarn build' displayName: 'Build Development' diff --git a/README.md b/README.md index 6ad4bfcbb5..f1716d0469 100644 --- a/README.md +++ b/README.md @@ -70,12 +70,12 @@ Jellyfin Web is the frontend used for most of the clients available for end user 4. Build the client with sourcemaps. - '''sh + ```sh yarn - ''' + ``` You can build a nginx compatible version as well. - '''sh + ```sh yarn --standalone - ''' \ No newline at end of file + ``` \ No newline at end of file From 62e8d22f660675642ab67b20d07efda9ac29e434 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:43:13 +0900 Subject: [PATCH 06/15] check cache before installing dependencies --- .ci/azure-pipelines.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index f5515e8f69..bb11c83e83 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -35,15 +35,15 @@ jobs: inputs: versionSpec: '10.x' - - script: 'yarn install' - displayName: 'Install Dependencies' - - task: Cache@2 - displayName: 'Cache Dependencies' + displayName: 'Check Cache' inputs: key: 'yarn | yarn.lock' path: '$(Pipeline.Workspace)/node_modules' + - script: 'yarn install' + displayName: 'Install Dependencies' + - script: 'yarn build' displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') From 88309a9cb4c8dbd841d9fffe7cbf0ae345f5ba0c Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 00:49:38 +0900 Subject: [PATCH 07/15] output files for testing --- .ci/azure-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index bb11c83e83..13970939c0 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -44,6 +44,9 @@ jobs: - script: 'yarn install' displayName: 'Install Dependencies' + - script: 'ls -al $(Pipeline.Workspace)' + displayName: 'Output Files' + - script: 'yarn build' displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') From 43d81f5cd954d163e3a1f6be206b3a17936021df Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 01:02:11 +0900 Subject: [PATCH 08/15] update cache and add prepare --- .ci/azure-pipelines.yml | 5 +---- package.json | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 13970939c0..de7780f672 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -39,14 +39,11 @@ jobs: displayName: 'Check Cache' inputs: key: 'yarn | yarn.lock' - path: '$(Pipeline.Workspace)/node_modules' + path: 'node_modules' - script: 'yarn install' displayName: 'Install Dependencies' - - script: 'ls -al $(Pipeline.Workspace)' - displayName: 'Output Files' - - script: 'yarn build' displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') diff --git a/package.json b/package.json index 5ad70cacdf..7ec376e74b 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ ], "scripts": { "serve": "gulp serve", - "build": "gulp", + "prepare": "gulp --bundle", "build development": "gulp --development", "build bundle": "gulp --bundle", "build standalone": "gulp --standalone", From b5a9273a2413b848a8c053615ded10b1a7df52ed Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 01:09:25 +0900 Subject: [PATCH 09/15] change build commands --- .ci/azure-pipelines.yml | 6 +++--- package.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index de7780f672..a3426e0114 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -44,15 +44,15 @@ jobs: - script: 'yarn install' displayName: 'Install Dependencies' - - script: 'yarn build' + - script: 'yarn build:development' displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') - - script: 'yarn build' + - script: 'yarn build:bundle' displayName: 'Build Bundle' condition: eq(variables['BuildConfiguration'], 'bundle') - - script: 'yarn build --standalone' + - script: 'yarn build:standalone' displayName: 'Build Standalone' condition: eq(variables['BuildConfiguration'], 'standalone') diff --git a/package.json b/package.json index 7ec376e74b..c4679e51e6 100644 --- a/package.json +++ b/package.json @@ -91,9 +91,9 @@ "scripts": { "serve": "gulp serve", "prepare": "gulp --bundle", - "build development": "gulp --development", - "build bundle": "gulp --bundle", - "build standalone": "gulp --standalone", + "build:development": "gulp --development", + "build:bundle": "gulp --bundle", + "build:standalone": "gulp --standalone", "lint": "eslint \"src\"", "stylelint": "stylelint \"src/**/*.css\"" } From be65bdad161cceb0c2b3d2bde99088bc8e3d4c1d Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 01:27:14 +0900 Subject: [PATCH 10/15] update build process in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f1716d0469..e2aac6b155 100644 --- a/README.md +++ b/README.md @@ -71,11 +71,11 @@ Jellyfin Web is the frontend used for most of the clients available for end user 4. Build the client with sourcemaps. ```sh - yarn + yarn build:development ``` You can build a nginx compatible version as well. ```sh - yarn --standalone + yarn build:standalone ``` \ No newline at end of file From a0c5920e7178a1d59dfdcb374b03b1557754ad5c Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 01:47:57 +0900 Subject: [PATCH 11/15] run ci without changing the lockfile --- .ci/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index a3426e0114..bbac82efe6 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -41,7 +41,7 @@ jobs: key: 'yarn | yarn.lock' path: 'node_modules' - - script: 'yarn install' + - script: 'yarn install --pure-lockfile' displayName: 'Install Dependencies' - script: 'yarn build:development' From fa5e1feaab8c8a2665af1680c359cfff34146f49 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 01:49:43 +0900 Subject: [PATCH 12/15] skip dependency step when cache exists --- .ci/azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index bbac82efe6..6f3e2f98ed 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -40,9 +40,11 @@ jobs: inputs: key: 'yarn | yarn.lock' path: 'node_modules' + cacheHitVar: CACHE_RESTORED - script: 'yarn install --pure-lockfile' displayName: 'Install Dependencies' + condition: ne(variables.CACHE_RESTORED, 'true') - script: 'yarn build:development' displayName: 'Build Development' From 3958548b1f5f39f3f852fccbfbe53ddf05af7856 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 02:12:05 +0900 Subject: [PATCH 13/15] fix issues with standalone build --- .ci/azure-pipelines.yml | 8 ++++---- gulpfile.js | 12 ++++++------ package.json | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 6f3e2f98ed..28053bf3a1 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -23,8 +23,8 @@ jobs: matrix: Development: BuildConfiguration: development - Bundle: - BuildConfiguration: bundle + Production: + BuildConfiguration: production Standalone: BuildConfiguration: standalone maxParallel: 3 @@ -50,9 +50,9 @@ jobs: displayName: 'Build Development' condition: eq(variables['BuildConfiguration'], 'development') - - script: 'yarn build:bundle' + - script: 'yarn build:production' displayName: 'Build Bundle' - condition: eq(variables['BuildConfiguration'], 'bundle') + condition: eq(variables['BuildConfiguration'], 'production') - script: 'yarn build:standalone' displayName: 'Build Standalone' diff --git a/gulpfile.js b/gulpfile.js index f49805d346..ca6cf36dd2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,7 +10,7 @@ const htmlmin = require('gulp-htmlmin'); const imagemin = require('gulp-imagemin'); const sourcemaps = require('gulp-sourcemaps'); const mode = require('gulp-mode')({ - modes: ["development", "bundle", "standalone"], + modes: ["development", "production"], default: "development", verbose: false }); @@ -22,7 +22,7 @@ const sass = require('gulp-sass'); sass.compiler = require('node-sass') -if (mode.bundle() || mode.standalone()) { +if (mode.production()) { var config = require('./webpack.prod.js'); } else { var config = require('./webpack.dev.js'); @@ -91,15 +91,14 @@ function css() { function html() { return src(['src/**/*.html', '!src/index.html'], { base: './src/' }) - .pipe(mode.bundle(htmlmin({ collapseWhitespace: true }))) - .pipe(mode.standalone(htmlmin({ collapseWhitespace: true }))) + .pipe(mode.production(htmlmin({ collapseWhitespace: true }))) .pipe(dest('dist/')) .pipe(browserSync.stream()); } function images() { return src(['src/**/*.png', 'src/**/*.jpg', 'src/**/*.gif', 'src/**/*.svg'], { base: './src/' }) - .pipe(imagemin()) + .pipe(mode.production(imagemin())) .pipe(dest('dist/')) .pipe(browserSync.stream()); } @@ -120,4 +119,5 @@ function injectBundle() { } exports.default = series(clean, parallel(javascript, webpack, css, html, images, copy), injectBundle) -exports.serve = series(exports.default, standalone, serve) +exports.standalone = series(exports.default, standalone) +exports.serve = series(exports.standalone, serve) diff --git a/package.json b/package.json index c4679e51e6..90cfa954a8 100644 --- a/package.json +++ b/package.json @@ -90,10 +90,10 @@ ], "scripts": { "serve": "gulp serve", - "prepare": "gulp --bundle", + "prepare": "gulp --production", "build:development": "gulp --development", - "build:bundle": "gulp --bundle", - "build:standalone": "gulp --standalone", + "build:production": "gulp --production", + "build:standalone": "gulp standalone --development", "lint": "eslint \"src\"", "stylelint": "stylelint \"src/**/*.css\"" } From 38b7da8f34676beef6b6fa982ae7c90cedc82be8 Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 02:17:12 +0900 Subject: [PATCH 14/15] use cache for linting as well --- .ci/azure-pipelines.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 28053bf3a1..40d9a78155 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -84,8 +84,16 @@ jobs: inputs: versionSpec: '10.x' - - script: 'yarn install' + - task: Cache@2 + displayName: 'Check Cache' + inputs: + key: 'yarn | yarn.lock' + path: 'node_modules' + cacheHitVar: CACHE_RESTORED + + - script: 'yarn install --pure-lockfile' displayName: 'Install Dependencies' + condition: ne(variables.CACHE_RESTORED, 'true') - script: 'yarn run lint' displayName: 'Run ESLint' From 519751649d30b9667ead714c9643702e936577ed Mon Sep 17 00:00:00 2001 From: dkanada Date: Tue, 17 Mar 2020 03:05:18 +0900 Subject: [PATCH 15/15] apply suggestions from code review Co-Authored-By: Julien Machiels --- .ci/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 40d9a78155..48f042d729 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -42,7 +42,7 @@ jobs: path: 'node_modules' cacheHitVar: CACHE_RESTORED - - script: 'yarn install --pure-lockfile' + - script: 'yarn install --frozen-lockfile' displayName: 'Install Dependencies' condition: ne(variables.CACHE_RESTORED, 'true') @@ -91,7 +91,7 @@ jobs: path: 'node_modules' cacheHitVar: CACHE_RESTORED - - script: 'yarn install --pure-lockfile' + - script: 'yarn install --frozen-lockfile' displayName: 'Install Dependencies' condition: ne(variables.CACHE_RESTORED, 'true')