Skip to content
Snippets Groups Projects
Commit 3f5322ca authored by Fabrice Salvaire's avatar Fabrice Salvaire
Browse files

webpack and package.json cleanup, removed angular1 test

parent 734a05f3
No related branches found
No related tags found
No related merge requests found
......@@ -5,4 +5,5 @@ BABEL_ENV=latest-browser
export BABEL_ENV
# see --help
npx webpack --watch --debug
# npx webpack --watch --debug
npx webpack-dashboard webpack --watch
......@@ -8,27 +8,27 @@
"repository": "https://github.com/FabriceSalvaire/climbing-asso-portal",
"author": "Fabrice Salvaire",
"scripts": {
"babel": "babel --presets es2015 js/main.js -o build/main.bundle.js",
"webpack": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@angular/cli": "^1.7.3",
"angular": "^1.6.9",
"angular-cookies": "^1.6.9",
"angular-resource": "^1.6.9",
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.0.0",
"bootstrap-slider": "^10.0.0",
"classnames": "^2.2.5",
"es6bindall": "^0.0.9",
"jquery": "^3.3.1",
"leaflet": "^1.3.1",
"openlayers": "^4.6.5",
"perfect-scrollbar": "^1.3.0",
"popper.js": "^1.12.9",
"prop-types": "^15.6.1",
"react": "^16.3.0",
"react-bootstrap-slider": "^2.1.3",
"react-dom": "^16.3.0",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"react-intl": "^2.4.0",
"react-table": "^6.8.0",
"rxjs": "^5.5.8",
"select2": "^4.0.6-rc.1",
"select2-bootstrap4-theme": "^1.0.0"
},
......@@ -37,22 +37,19 @@
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-angularjs-annotate": "^0.8.2",
"babel-plugin-react-intl": "^2.4.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"es6bindall": "0.0.9",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"node-sass": "^4.8.3",
"postcss-loader": "^2.1.3",
"prop-types": "^15.6.1",
"sass-loader": "^6.0.7",
"style-loader": "^0.20.3",
"sugarss": "^1.0.1",
"webpack": "^4.4.1",
"webpack-cli": "^2.0.13",
"webpack-dashboard": "^1.1.1",
"webpack-dev-server": "^3.1.1"
}
}
/***************************************************************************************************
*
* Climbing Asso Portal
* Copyright (C) 2018 Fabrice Salvaire
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**************************************************************************************************/
......@@ -22,8 +22,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import es6BindAll from 'es6bindall';
import ReactBootstrapSlider from 'react-bootstrap-slider';
import es6BindAll from 'es6bindall';
// import ReactBootstrapSlider from '../../externals/react-bootstrap-slider.jsx';
// import '../../tools/set.js';
......
/***************************************************************************************************
*
* Climbing Asso Portal
* Copyright (C) 2018 Fabrice Salvaire
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**************************************************************************************************/
import * as AliceMilliatWall from "./alice-milliat-wall.js";
import * as HoldColour from "./hold-colour.js";
// import * as RouteController from "./route-controller.js";
console.log('HoldColour', HoldColour.hold_colours);
// cf. http://django-angular.readthedocs.io/en/latest/integration.html
// https://docs.djangoproject.com/en/2.0/ref/csrf/
export var application = angular.module('route_index', ['ngCookies', 'ngResource']);
// Ajax requests shall send this HTTP-Header
application.config(/* @ngInject */ $httpProvider => {
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
});
application.factory('Route', /* @ngInject */ $resource => {
// Fixme: angularjs can remove trailing / -> useless redirection
return $resource('/api/routes/?limit=1000', {}, {
query: {
method: 'GET',
// params: {},
isArray: false
}
});
});
application.controller('route_controller', /* @ngInject */ ($scope, Route) => {
$scope.routes = [];
var query = Route.query();
query.$promise.then(
result => {
console.log('result:', result);
angular.forEach(result.results, item => {
$scope.routes.push(item);
});
},
results => {
console.log('error:', result);
}
);
});
/***************************************************************************************************
*
* Climbing Asso Portal
* Copyright (C) 2018 Fabrice Salvaire
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**************************************************************************************************/
/**************************************************************************************************/
// const NODE_ENV = process.env.NODE_ENV || 'production';
......@@ -6,10 +26,19 @@ const NODE_ENV = 'development';
const is_development = NODE_ENV === 'development';
// set default Babel preset
if (!process.env.BABEL_ENV)
process.env.BABEL_ENV = 'latest-browser';
console.log('Babel will use', process.env.BABEL_ENV);
/**************************************************************************************************/
var path = require('path');
// https://github.com/FormidableLabs/webpack-dashboard
// run using : npx webpack-dashboard webpack ...
const DashboardPlugin = require('webpack-dashboard/plugin');
// https://webpack.js.org/plugins/extract-text-webpack-plugin
// https://www.npmjs.com/package/extract-text-webpack-plugin
// for webpack 4: npm i -D extract-text-webpack-plugin@next
......@@ -30,10 +59,7 @@ const babel_config = {
env: {
browser: {
presets: ['es2015', 'react', 'stage-2'],
plugins: [
// https://github.com/schmod/babel-plugin-angularjs-annotate
['angularjs-annotate', { 'explicitOnly' : true}]
]
plugins: []
},
'latest-browser': {
......@@ -47,9 +73,7 @@ const babel_config = {
'react',
'stage-2',
],
plugins: [
['angularjs-annotate', { explicitOnly : true}]
]
plugins: []
},
node: {
......@@ -111,7 +135,7 @@ const postcss_options = {
/**************************************************************************************************/
module.exports = {
let config = {
mode: NODE_ENV,
// entry: ['babel-polyfill', './app/js']
......@@ -120,7 +144,6 @@ module.exports = {
admin: './src/admin/index.js',
member_map: './src/pages/member_map/index.js',
rest_framework: './src/rest_framework/index.js',
route_page: './src/pages/wall/route-page.js',
route_page_react: './src/pages/wall/route-page.jsx',
select2_test: './src/pages/select2_test.js',
test: './src/test.js',
......@@ -149,6 +172,7 @@ module.exports = {
use: ExtractTextPlugin.extract({
use: [
// scss files > sass-loader > postcss-loader > css-loader > ExtractTextPlugin
// { loader: "style-loader" },
{
loader: 'css-loader',
options: css_loader_options
......@@ -171,6 +195,7 @@ module.exports = {
}
},
],
// https://github.com/webpack-contrib/style-loader
// use style-loader in development
// fallback: 'style-loader'
})
......@@ -194,6 +219,7 @@ module.exports = {
},
plugins: [
new DashboardPlugin(),
new ExtractTextPlugin({
filename: 'css/[name].css'
}),
......@@ -296,3 +322,7 @@ module.exports = {
// warningsFilter: 'filter' | /filter/ | ['filter', /filter/] | (warning) => ... return true|false
// }
};
/**************************************************************************************************/
module.exports = config;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment