Browse Source

Move files_sharing to webpack

Signed-off-by: Julius Härtl <jus@bitgrid.net>
tags/v16.0.0alpha1
Julius Härtl 5 years ago
parent
commit
d6aae4317d
No account linked to committer's email address

+ 13
- 0
apps/files_sharing/.babelrc.js View File

@@ -0,0 +1,13 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['last 2 versions', 'ie >= 11']
}
}
]
],
plugins: ['@babel/plugin-syntax-dynamic-import']
}

+ 1
- 2
apps/files_sharing/list.php View File

@@ -32,7 +32,6 @@ $tmpl = new OCP\Template('files_sharing', 'list', '');
// gridview not available for ie
$tmpl->assign('showgridview', $showgridview && !$isIE);

OCP\Util::addScript('files_sharing', 'app');
OCP\Util::addScript('files_sharing', 'sharedfilelist');
OCP\Util::addScript('files_sharing', 'dist/files_sharing');

$tmpl->printPage();

+ 35
- 0
apps/files_sharing/package.json View File

@@ -0,0 +1,35 @@
{
"name": "files_sharing",
"version": "1.0.0",
"description": "File sharing in Nextcloud",
"main": "files_sharing.js",
"directories": {
"lib": "lib",
"test": "tests"
},
"scripts": {
"build": "webpack --progress --hide-modules --config webpack.prod.js",
"dev": "webpack --progress --watch --config webpack.dev.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "AGPL-3.0-or-later",
"dependencies": {
"nextcloud-axios": "^0.1.3",
"nextcloud-vue": "^0.5.0",
"vue": "^2.5.17"
},
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"babel-loader": "^8.0.2",
"css-loader": "^2.1.0",
"node-sass": "^4.11.0",
"sass-loader": "^7.1.0",
"vue-loader": "^15.4.2",
"vue-template-compiler": "^2.5.17",
"webpack": "^4.20.0",
"webpack-cli": "^3.1.1",
"webpack-merge": "^4.1.4"
}
}

+ 16
- 0
apps/files_sharing/src/files_sharing.js View File

@@ -0,0 +1,16 @@
// CSP config for webpack dynamic chunk loading
// eslint-disable-next-line
__webpack_nonce__ = btoa(OC.requestToken)

// Correct the root of the app for chunk loading
// OC.linkTo matches the apps folders
// eslint-disable-next-line
__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/')

import '../js/app'
import '../js/sharedfilelist'
import '../js/sharetabview'
import '../js/share'
import '../js/sharebreadcrumbview'

window.OCA.Sharing = OCA.Sharing

+ 2
- 0
apps/files_sharing/src/sharetabview.js View File

@@ -14,6 +14,7 @@
var TEMPLATE =
'<div>' +
'<div class="dialogContainer"></div>' +
'<div id="collaborationResources"></div>' +
'</div>';

/**
@@ -81,6 +82,7 @@
this._dialog.model.on('change', function() {
self.trigger('sharesChanged', shareModel);
});

} else {
this.$el.empty();
// TODO: render placeholder text?

+ 47
- 0
apps/files_sharing/webpack.common.js View File

@@ -0,0 +1,47 @@
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');

module.exports = {
entry: path.join(__dirname, 'src', 'files_sharing.js'),
output: {
path: path.resolve(__dirname, 'js/dist'),
publicPath: '/js/dist/',
filename: 'files_sharing.js',
chunkFilename: 'files_sharing.[name].js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
alias: {
vue$: 'vue/dist/vue.runtime.esm.js',
},
extensions: ['*', '.js', '.vue', '.json']
}
};

+ 12
- 0
apps/files_sharing/webpack.dev.js View File

@@ -0,0 +1,12 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'development',
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
devtool: '#source-map',
})

+ 7
- 0
apps/files_sharing/webpack.prod.js View File

@@ -0,0 +1,7 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')

module.exports = merge(common, {
mode: 'production',
devtool: '#source-map'
})

Loading…
Cancel
Save