Upgrading webpack; Basic build tasks for better support (#185); Load progress

This commit is contained in:
James Barnsley
2017-09-07 16:21:35 +12:00
parent aa0505802d
commit bbad09d47b
6 changed files with 34 additions and 20 deletions

2
.gitignore vendored
View File

@ -8,4 +8,4 @@ public_html
Thumbs.db
*.pyc
package-lock.json
npm-debug.log

View File

@ -2,15 +2,15 @@
# copy assets
echo -e Copying assets $SERVER
rsync -avrs src/assets/ mopidy_iris/static/assets/ 2>&1 >/dev/null
rsync -avr src/assets/ mopidy_iris/static/assets/ 2>&1 >/dev/null
# create HTML files
echo -e Copying index.html
cp src/index.html mopidy_iris/static/index.html
# process production html
BUILD_VERSION=$(date | md5sum | cut -f1 -d' ')
echo -e "Injecting build version to js/css URLs ($BUILD_VERSION)"
sed -i 's/BUILD_VERSION_HERE/'$BUILD_VERSION'/g' mopidy_iris/static/index.html
BUILD_NAME=$(date +%s)
echo -e "Injecting build name to js/css URLs ($BUILD_NAME)"
sed -i 's/BUILD_NAME_HERE/'$BUILD_NAME'/g' mopidy_iris/static/index.html
echo -e "\x1b[32;01m"Done!"\x1b[39;49;00m"

View File

@ -36,7 +36,7 @@
"sass-loader": "^6.0.2",
"style-loader": "^0.13.2",
"url-loader": "^0.5.8",
"webpack": "^3.3.0",
"webpack": "^3.5.1",
"webpack-strip": "0.1.0",
"react-lazyload": "2.2.7"
},

View File

@ -35,7 +35,7 @@
<script type="text/javascript">
var build_version = "BUILD_VERSION_HERE";
var build_name = "BUILD_NAME_HERE";
var js = document.createElement("script");
js.type = "application/javascript";
@ -46,11 +46,11 @@
// Identify whether we're in test mode, and need to fetch non-minified assets
var ui = JSON.parse( localStorage.getItem('ui') );
if (typeof(ui) === 'undefined' || typeof(ui.test_mode) === 'undefined' || !ui.test_mode){
js.src = '/iris/app.min.js?v='+build_version;
css.href = '/iris/app.min.css?v='+build_version;
js.src = '/iris/app.min.js?v='+build_name;
css.href = '/iris/app.min.css?v='+build_name;
} else {
js.src = '/iris/app.js?v='+build_version;
css.href = '/iris/app.css?v='+build_version;
js.src = '/iris/app.js?v='+build_name;
css.href = '/iris/app.css?v='+build_name;
}
document.body.appendChild(js);

View File

@ -11,6 +11,7 @@ import ReactGA from 'react-ga'
import store from './bootstrap.js'
require('../scss/app.scss');
require('../index.html');
import App from './App'
import Album from './views/Album'

View File

@ -534,7 +534,7 @@ const MopidyMiddleware = (function(){
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':',''),
{
remaining: next_uri_schemes.length,
remaining: action.data.uri_schemes.length
}
))
@ -728,11 +728,13 @@ const MopidyMiddleware = (function(){
// Albums
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' albums'
'Searching '+action.data.uri_scheme.replace(':','')+' albums',
{
remaining: (action.data.uri_schemes.length) + 1
}
))
instruct( socket, store, 'library.search', {query: {album: [action.data.query]}, uris: [action.data.uri_scheme]})
.then( response => {
if (response.length > 0){
// collate all our different sources into one array
@ -762,10 +764,13 @@ const MopidyMiddleware = (function(){
})
}
// Then, artists
// Then, artists
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' artists'
'Searching '+action.data.uri_scheme.replace(':','')+' artists',
{
remaining: (action.data.uri_schemes.length) + 0.75
}
))
instruct( socket, store, 'library.search', {query: {artist: [action.data.query]}, uris: [action.data.uri_scheme]})
.then( response => {
@ -804,7 +809,10 @@ const MopidyMiddleware = (function(){
// Then, tracks
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' tracks'
'Searching '+action.data.uri_scheme.replace(':','')+' tracks',
{
remaining: (action.data.uri_schemes.length) + 0.5
}
))
instruct( socket, store, 'library.search', {query: {any: [action.data.query]}, uris: [action.data.uri_scheme]})
.then( response => {
@ -825,7 +833,10 @@ const MopidyMiddleware = (function(){
if (action.data.uri_scheme == 'm3u:'){
store.dispatch(uiActions.updateProcess(
'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR',
'Searching '+action.data.uri_scheme.replace(':','')+' playlists'
'Searching '+action.data.uri_scheme.replace(':','')+' playlists',
{
remaining: (action.data.uri_schemes.length) + 0.25
}
))
instruct( socket, store, 'playlists.asList')
.then( response => {
@ -863,7 +874,8 @@ const MopidyMiddleware = (function(){
query: action.data.query,
limit: action.data.limit,
uri_scheme: next_uri_scheme,
uri_schemes: next_uri_schemes
uri_schemes: next_uri_schemes,
remaining: action.data.uri_schemes.length
}
))
})
@ -877,7 +889,8 @@ const MopidyMiddleware = (function(){
query: action.data.query,
limit: action.data.limit,
uri_scheme: next_uri_scheme,
uri_schemes: next_uri_schemes
uri_schemes: next_uri_schemes,
remaining: action.data.uri_schemes.length
}
))
}