Remove bower, install everything using npm (#197)

* Remove bower, install everything using npm

Remove js-url and use a simple function to get the query param.

* Bundle all js scripts in app.min.js

* Move jquery to devDependencies

* Remove es6-shim, most common browsers support es6 natively.
This commit is contained in:
Daniel Schaal 2017-06-18 12:19:38 +02:00 committed by Bernhard Posselt
parent c32d85c119
commit fd630242da
11 changed files with 48 additions and 81 deletions

1
.gitignore vendored
View File

@ -2,7 +2,6 @@
composer.phar
node_modules/
vendor/
js/vendor/
js/build
*.log
/build/

View File

@ -29,13 +29,13 @@
# build tools and additional package managers should be installed locally in
# your project, since this won't pollute people's global namespace.
#
# The following npm scripts in your package.json install and update the bower
# and npm dependencies and use gulp as build system (notice how everything is
# run from the node_modules folder):
# The following npm scripts in your package.json install the npm dependencies
# and use gulp as build system (notice how everything is run from the
# node_modules folder):
#
# "scripts": {
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
# "prebuild": "npm install",
# "build": "node node_modules/gulp-cli/bin/gulp.js"
# },
@ -104,13 +104,12 @@ npm:
clean:
rm -rf ./build
# Same as clean but also removes dependencies installed by composer, bower and
# Same as clean but also removes dependencies installed by composer and
# npm
.PHONY: distclean
distclean: clean
rm -rf vendor
rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules
# Builds the source and appstore package
@ -153,14 +152,6 @@ appstore:
"COPYING" \
"AUTHORS.md" \
"CHANGELOG.md" \
"js/vendor/js-url/url.min.js" \
"js/vendor/es6-shim/es6-shim.min.js" \
"js/vendor/angular/angular.min.js" \
"js/vendor/angular-animate/angular-animate.min.js" \
"js/vendor/angular-route/angular-route.min.js" \
"js/vendor/angular-sanitize/angular-sanitize.min.js" \
"js/vendor/moment/min/moment-with-locales.min.js" \
"js/vendor/masonry/dist/masonry.pkgd.min.js" \
"js/build/app.min.js" \
"js/admin/Admin.js" \
$(appstore_build_directory)

View File

@ -1,4 +0,0 @@
{
"directory": "vendor"
}

View File

@ -1,3 +1,2 @@
build/
node_modules/
vendor/

View File

@ -46,7 +46,6 @@
"enumerate": true,
"News": true,
"t": true,
"url": true,
"navigator": true,
"oc_requesttoken": true,
"_": true

View File

@ -1,36 +0,0 @@
{
"name": "nextcloud-news",
"homepage": "https://github.com/nextcloud/news",
"authors": [
"Bernhard Posselt <dev@bernhard-posselt.com>"
],
"description": "An RSS/Atom feed reader",
"keywords": [
"rss",
"atom",
"nextcloud",
"feed",
"reader",
"app"
],
"license": "AGPL-3.0",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"vendor",
"tests"
],
"dependencies": {
"angular": "~1.6.0",
"angular-route": "~1.6.0",
"angular-mocks": "~1.6.0",
"angular-sanitize": "~1.6.0",
"angular-animate": "~1.6.0",
"jquery": "~2.2.0",
"moment": "~2.18",
"es6-shim": "~0.35.0",
"js-url": "~2.5.0",
"masonry": "~4.2.0"
}
}

View File

@ -12,9 +12,22 @@
* This prefills the add feed section if an external link has ?subsribe_to
* filled out
*/
(function (window, document, navigator, url, $, undefined) {
(function (window, document, navigator, $, undefined) {
'use strict';
function queryParam(param)
{
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i += 1) {
var pair = vars[i].split('=');
if(pair[0] === param) {
return decodeURIComponent(pair[1]);
}
}
return(false);
}
// register reader as feed reader in firefox
var location = window.location;
var storage = window.localStorage;
@ -50,12 +63,13 @@
$(document).ready(function () {
var subscription = url('?subscribe_to');
if (subscription && subscription !== 'undefined') {
var subscribeTo = queryParam('subscribe_to');
if(subscribeTo && subscribeTo !== 'undefined') {
$('#new-feed').show();
var input = $('input[ng-model="Navigation.feed.url"]');
input.val(subscription);
input.val(subscribeTo);
input.trigger('input');
// hacky way to focus because initial loading of a feed
@ -66,4 +80,4 @@
}
});
})(window, document, navigator, url, $);
})(window, document, navigator, $);

View File

@ -26,6 +26,12 @@ const phpunitConfig = __dirname + '/../phpunit.xml';
const karmaConfig = __dirname + '/karma.conf.js';
const destinationFolder = __dirname + '/build/';
const sources = [
'node_modules/angular/angular.min.js',
'node_modules/angular-animate/angular-animate.min.js',
'node_modules/angular-route/angular-route.min.js',
'node_modules/angular-sanitize/angular-sanitize.min.js',
'node_modules/moment/min/moment-with-locales.min.js',
'node_modules/masonry-layout/dist/masonry.pkgd.min.js',
'app/App.js', 'app/Config.js', 'app/Run.js',
'controller/**/*.js',
'filter/**/*.js',

View File

@ -16,14 +16,12 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
files: [
'vendor/js-url/url.min.js',
'vendor/es6-shim/es6-shim.min.js',
'vendor/jquery/dist/jquery.js',
'vendor/moment/min/moment-with-locales.js',
'vendor/angular/angular.js',
'vendor/angular-mocks/angular-mocks.js',
'vendor/angular-route/angular-route.js',
'vendor/angular-sanitize/angular-sanitize.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/moment/min/moment-with-locales.js',
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'node_modules/angular-route/angular-route.js',
'node_modules/angular-sanitize/angular-sanitize.js',
'tests/unit/stubs/App.js',
'tests/unit/stubs/OC.js',
'controller/**/*.js',

View File

@ -4,7 +4,7 @@
"main": "build/app.min.js",
"scripts": {
"test": "node node_modules/gulp-cli/bin/gulp.js karma",
"prebuild": "npm install && npm update && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
"prebuild": "npm install && npm update",
"build": "node node_modules/gulp-cli/bin/gulp.js"
},
"repository": {
@ -30,7 +30,6 @@
"private": true,
"homepage": "https://github.com/nextcloud/news",
"devDependencies": {
"bower": "^1.8.0",
"gulp": "^3.9.1",
"gulp-cli": "^1.2.2",
"gulp-concat": "^2.6.1",
@ -40,6 +39,7 @@
"gulp-sourcemaps": "^1.9.1",
"gulp-uglify": "^2.0.0",
"jasmine-core": "^2.5.2",
"jquery": "^2.2.4",
"jshint": "^2.9.4",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
@ -47,5 +47,14 @@
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.1.0"
},
"dependencies": {}
"dependencies": {
"angular": "^1.6.4",
"angular-animate": "^1.6.4",
"angular-mocks": "^1.6.4",
"angular-route": "^1.6.4",
"angular-sanitize": "^1.6.4",
"debug": "^2.6.8",
"masonry-layout": "^4.2.0",
"moment": "^2.18.1"
}
}

View File

@ -2,14 +2,6 @@
use OCA\News\Plugin\Client\Plugin;
script('news', [
'vendor/js-url/url.min',
'vendor/es6-shim/es6-shim.min',
'vendor/angular/angular.min',
'vendor/angular-animate/angular-animate.min',
'vendor/angular-route/angular-route.min',
'vendor/angular-sanitize/angular-sanitize.min',
'vendor/moment/min/moment-with-locales.min',
'vendor/masonry/dist/masonry.pkgd.min',
'build/app.min',
]);