Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle using Webpack #4692

Merged
merged 50 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e372d42
try webpack
OmgImAlexis Jul 18, 2018
0db1368
ignore dist
OmgImAlexis Jul 19, 2018
e07cd20
remove dist files
OmgImAlexis Jul 19, 2018
4cac4ae
fix type checking
OmgImAlexis Jul 19, 2018
ea6a194
lint
OmgImAlexis Jul 19, 2018
5e3abbe
add webpack to gulp
OmgImAlexis Jul 19, 2018
8db6030
sync themes
OmgImAlexis Jul 19, 2018
f46f5e5
try and fix pages loading via .vue files
OmgImAlexis Jul 19, 2018
97d001c
Merge branch 'develop' into feature/webpack
sharkykh Jul 26, 2018
85474f8
Fix assets
sharkykh Jul 26, 2018
cc828b0
Fix x-template components
sharkykh Jul 26, 2018
dc3b0a8
Fix toggle button
sharkykh Jul 26, 2018
a500a3d
Fix AsyncComputed
sharkykh Jul 26, 2018
130b075
Enable Vue-DevTools
sharkykh Jul 26, 2018
e3a2065
Spread operator in object literals is experimental
sharkykh Jul 26, 2018
3eba342
Ignore non-browser files in gulp tasks
sharkykh Jul 26, 2018
9966f30
Merge branch 'develop' into feature/webpack
sharkykh Jul 27, 2018
c33f77f
Pin dependencies + update webpack-cli
sharkykh Jul 27, 2018
d29bb92
Remove unused libraries
sharkykh Jul 27, 2018
ab96922
Move Snotify to webpack
sharkykh Jul 27, 2018
84605c7
Remove unused vendors files
sharkykh Jul 27, 2018
653c1d4
Fix VueMeta
sharkykh Jul 27, 2018
227d94a
Fix apibuilder
sharkykh Jul 27, 2018
0f98e3d
Update gulpfile
sharkykh Jul 27, 2018
e866a8c
Webpack optimization
sharkykh Jul 27, 2018
f3a8bd1
Fix notification from store
sharkykh Jul 27, 2018
049a833
Add `?${sbPID}`
sharkykh Jul 27, 2018
4fa70c3
Update changelog
sharkykh Jul 27, 2018
7dd9f76
Merge branch 'develop' into feature/webpack
sharkykh Jul 27, 2018
22c2490
Update script
sharkykh Jul 27, 2018
5597b76
fix cp not running
OmgImAlexis Jul 27, 2018
3fe8057
Fix optimization
sharkykh Jul 27, 2018
2a10205
Merge branch 'develop' into feature/webpack
sharkykh Jul 27, 2018
6ee5539
add cp to webpack
OmgImAlexis Jul 28, 2018
b7cb19b
add vue-loader
OmgImAlexis Jul 28, 2018
b8fa67c
pin deps
OmgImAlexis Jul 28, 2018
e144fc3
Merge branch 'develop' into feature/webpack
sharkykh Jul 28, 2018
d1913fb
Merge branch 'develop' into feature/webpack
sharkykh Jul 28, 2018
ef251b7
Merge branch 'develop' into feature/webpack
sharkykh Aug 1, 2018
d6c7b0b
Better components registration
sharkykh Jul 28, 2018
c709c0b
Read themes from `package.json`
sharkykh Jul 29, 2018
2344421
Clear ./dist/js before build
sharkykh Jul 29, 2018
cbb82b8
Remove webpack-stream
sharkykh Aug 1, 2018
6bc2deb
Make sure webpack is built in production mode for the time being
sharkykh Aug 1, 2018
eff86d6
Re-enable `webpack.config.js` linting
sharkykh Aug 1, 2018
bccf95c
eslint-plugin-unicorn is part of XO
sharkykh Aug 1, 2018
d2c14d5
remove globby (unused)
sharkykh Aug 1, 2018
fab69f4
upgrade webpack
sharkykh Aug 1, 2018
56f6676
Fix vue-loader production mode
sharkykh Aug 1, 2018
99a464b
Disable webpack build for now
sharkykh Aug 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/build-themes-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ run_verbose () {
}

cd themes-default/slim/
# run_verbose "yarn webpack-build"
run_verbose "yarn gulp sync"
cd ../../
status="$(git status --porcelain -- themes/)";
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#### Improvements
- Converted /config/postProcessing to a Vue component ([#4259](https://github.com/pymedusa/Medusa/pull/4259))
- Bundled the web application using Webpack ([#4692](https://github.com/pymedusa/Medusa/pull/4692))

-----

Expand Down
1 change: 1 addition & 0 deletions themes-default/slim/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.nyc_output
coverage
coverage.lcov
dist
21 changes: 18 additions & 3 deletions themes-default/slim/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const pngquant = require('imagemin-pngquant');
const { argv } = require('yargs');
const rename = require('gulp-rename');
const changed = require('gulp-changed');

const xo = require('xo');

const xoReporter = xo.getFormatter('eslint-formatter-pretty');
Expand Down Expand Up @@ -53,12 +52,25 @@ if (PROD) {
}
*/

// List JS files handled by Webpack
// These files will be ignored by the gulp tasks
const webpackedJsFiles = [
'static/js/app.js',
'static/js/index.js',
'static/js/api.js',
'static/js/router.js',
'static/js/store.js'
];

const staticAssets = [
'static/browserconfig.xml',
'static/favicon.ico',
'static/fonts/**/*',
'static/js/**/*',
'static/css/**/*'
'static/css/**/*',

// Webpacked files
...webpackedJsFiles.map(file => '!' + file)
];

/**
Expand Down Expand Up @@ -155,7 +167,10 @@ const bundleJs = done => {
ignore: [
'js/lib/**',
'js/*.min.js',
'js/vender.js'
'js/vender.js',

// Webpacked JS files
...webpackedJsFiles.map(file => file.replace('static/', ''))
]
}, (err, files) => {
if (err) {
Expand Down
16 changes: 15 additions & 1 deletion themes-default/slim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"name": "slim",
"author": "p0psicles",
"scripts": {
"gulp": "gulp",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this as yarn gulp is the same even if you don't have this.

"lint": "xo",
"dev": "webpack --mode development",
"webpack-build": "webpack --mode production",
"build": "cross-env NODE_ENV=production gulp build",
"install": "yarn run lint",
"test": "cross-env NODE_ENV=test nyc ava",
Expand All @@ -31,6 +32,7 @@
"ansi-colors": "2.0.5",
"ava": "0.25.0",
"axios": "0.18.0",
"babel-loader": "7.1.5",
"babel-plugin-istanbul": "4.1.6",
"babel-polyfill": "6.26.0",
"babel-preset-env": "1.7.0",
Expand All @@ -40,11 +42,13 @@
"browserify": "16.2.2",
"codecov": "3.0.4",
"cross-env": "5.2.0",
"css-loader": "1.0.0",
"eslint": "5.2.0",
"eslint-config-xo": "0.23.0",
"eslint-plugin-vue": "4.7.1",
"event-stream": "3.3.4",
"fancy-log": "1.3.2",
"filemanager-webpack-plugin": "1.0.28",
"glob": "7.1.2",
"gulp": "3.9.1",
"gulp-changed": "3.2.0",
Expand All @@ -55,6 +59,7 @@
"gulp-rename": "1.4.0",
"gulp-sourcemaps": "2.6.4",
"gulp-uglify-es": "1.0.4",
"http-vue-loader": "1.3.5",
"imagemin-pngquant": "6.0.0",
"jquery": "3.3.1",
"nyc": "12.0.2",
Expand All @@ -69,9 +74,18 @@
"vinyl-buffer": "1.0.1",
"vinyl-source-stream": "2.0.0",
"vue": "2.5.16",
"vue-async-computed": "3.3.1",
"vue-in-viewport-mixin": "1.0.4",
"vue-js-toggle-button": "1.2.3",
"vue-loader": "15.2.6",
"vue-meta": "1.5.2",
"vue-native-websocket": "2.0.8",
"vue-router": "3.0.1",
"vue-snotify": "3.2.0",
"vue-template-compiler": "2.5.16",
"vuex": "3.0.1",
"webpack": "4.16.3",
"webpack-cli": "3.1.0",
"xo": "0.21.1",
"yargs": "12.0.1"
},
Expand Down
8 changes: 8 additions & 0 deletions themes-default/slim/static/js/api.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import axios from 'axios';

const baseUrl = document.body.getAttribute('web-root');
const idToken = document.body.getAttribute('api-key');

Expand Down Expand Up @@ -37,3 +39,9 @@ const api = axios.create({ // eslint-disable-line no-unused-vars
'X-Api-Key': idToken
}
});

export {
apiRoute,
apiv1,
api
};
2 changes: 1 addition & 1 deletion themes-default/slim/static/js/apibuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ $(document).ready(() => {

if (command) {
const commandId = command.replace('.', '-');
$('[href=#command-' + commandId + ']').click();
$('[href="#command-' + commandId + '"]').click();
}
});
});
76 changes: 76 additions & 0 deletions themes-default/slim/static/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import Vue from 'vue';
import Vuex, { mapState } from 'vuex';
import VueRouter from 'vue-router';
import AsyncComputed from 'vue-async-computed';
import ToggleButton from 'vue-js-toggle-button';
import Snotify from 'vue-snotify';
import store from './store';
import router from './router';
import AppHeader from './templates/app-header.vue';
import ScrollButtons from './templates/scroll-buttons.vue';
import AppLink from './templates/app-link.vue';
import Asset from './templates/asset.vue';
import FileBrowser from './templates/file-browser.vue';
import PlotInfo from './templates/plot-info.vue';
import NamePattern from './templates/name-pattern.vue';
import SelectList from './templates/select-list.vue';
import LanguageSelect from './templates/language-select.vue';
import RootDirs from './templates/root-dirs.vue';
import Backstretch from './templates/backstretch.vue';

Vue.config.devtools = true;
Vue.config.performance = true;

Vue.use(Vuex);
Vue.use(VueRouter);
Vue.use(AsyncComputed);
Vue.use(ToggleButton);
Vue.use(Snotify);

// Load x-template components
window.components.forEach(component => {
console.debug(`Registering ${component.name}`);
Vue.component(component.name, component);
});

// Global components
const globalComponents = [
AppHeader,
ScrollButtons,
AppLink,
Asset,
FileBrowser,
PlotInfo,
NamePattern,
SelectList,
LanguageSelect,
RootDirs,
Backstretch
];

globalComponents.forEach(component => {
Vue.component(component.name, component);
});

const app = new Vue({
name: 'App',
store,
router,
data() {
return {
globalLoading: false
};
},
computed: Object.assign(mapState(['auth', 'config']), {}),
mounted() {
console.log('App Mounted!');

const { $store } = this;
$store.dispatch('login', { username: window.username });
$store.dispatch('getConfig');

console.log('App Loaded!');
}
}).$mount('#vue-wrap');

export default app;
34 changes: 34 additions & 0 deletions themes-default/slim/static/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Vue from 'vue';
import Vuex from 'vuex';
import VueMeta from 'vue-meta';
import VueRouter from 'vue-router';
import VueNativeSock from 'vue-native-websocket';
import VueInViewportMixin from 'vue-in-viewport-mixin';
import AsyncComputed from 'vue-async-computed';
import ToggleButton from 'vue-js-toggle-button';
import Snotify from 'vue-snotify';
import axios from 'axios';
import httpVueLoader from 'http-vue-loader';
import store from './store';
import router from './router';
import { apiRoute, apiv1, api } from './api';

if (window) {
// Adding libs to window so mako files can use them
window.Vue = Vue;
window.Vuex = Vuex;
window.VueMeta = VueMeta;
window.VueRouter = VueRouter;
window.VueNativeSock = VueNativeSock;
window.VueInViewportMixin = VueInViewportMixin;
window.AsyncComputed = AsyncComputed;
window.ToggleButton = ToggleButton;
window.Snotify = Snotify;
window.axios = axios;
window.httpVueLoader = httpVueLoader;
window.store = store;
window.router = router;
window.apiRoute = apiRoute;
window.apiv1 = apiv1;
window.api = api;
}
8 changes: 0 additions & 8 deletions themes-default/slim/static/js/lib/axios.min.js

This file was deleted.

Loading