Migrated bower dependencies
to NPM Change-Id: I478de5ff7c260bf9164f9e6a0d0e33dfeb561355
This commit is contained in:
parent
7647be9500
commit
3b1f9de37f
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"presets": [
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
],
|
||||
"flow",
|
||||
"react"
|
||||
],
|
||||
"plugins": [
|
||||
"transform-object-rest-spread"
|
||||
]
|
||||
}
|
|
@ -8,8 +8,6 @@ ChangeLog
|
|||
doc/build
|
||||
*.egg
|
||||
*.egg-info
|
||||
public/bower_assets
|
||||
public/bower_assets/*
|
||||
*.log
|
||||
/node_modules
|
||||
/public/storage
|
||||
|
@ -18,3 +16,18 @@ Homestead.json
|
|||
.env
|
||||
.env.testing
|
||||
|
||||
/public/assets/jquery-cookie/
|
||||
/public/assets/crypto-js/
|
||||
/public/assets/bootstrap-tagsinput/
|
||||
/public/assets/fonts/
|
||||
/public/assets/typeahead/
|
||||
/public/assets/__common__.js
|
||||
/public/assets/index.js
|
||||
public/assets/index.js.map
|
||||
public/assets/__common__.js.map
|
||||
public/assets/images/
|
||||
public/assets/svg/
|
||||
public/assets/css/index.css.map
|
||||
public/assets/css/index.css
|
||||
/public/assets/pwstrength-bootstrap/
|
||||
/public/assets/sweetalert2/
|
||||
|
|
|
@ -135,11 +135,10 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
|
|||
public function delete($id)
|
||||
{
|
||||
try {
|
||||
$res = $this->client_service->deleteClientByIdentifier($id);
|
||||
return $res ? $this->deleted() : $this->error404(array('error' => 'operation failed'));
|
||||
$this->client_service->deleteClientByIdentifier($id);
|
||||
return $this->deleted();
|
||||
} catch (Exception $ex) {
|
||||
$this->log_service->error($ex);
|
||||
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ final class ApiScopeGroupService implements IApiScopeGroupService
|
|||
}
|
||||
if($param === 'scopes')
|
||||
{
|
||||
$ids = $group->scopes()->getRelatedIds();
|
||||
$ids = $group->scopes()->getRelatedIds()->all();
|
||||
$group->scopes()->detach($ids);
|
||||
$scopes = explode(',', $params['scopes']);
|
||||
foreach($scopes as $scope_id)
|
||||
|
|
45
bower.json
45
bower.json
|
@ -1,45 +0,0 @@
|
|||
{
|
||||
"name": "OpenStackid",
|
||||
"description": "OpenstackId Idp",
|
||||
"keywords": [
|
||||
"OpenStackid",
|
||||
"OpenStack",
|
||||
"openid",
|
||||
"oauth2",
|
||||
"openid",
|
||||
"connect",
|
||||
"OIDC",
|
||||
"OP",
|
||||
"OIDC"
|
||||
],
|
||||
"license": "MIT",
|
||||
"homepage": "https://git.openstack.org/cgit/openstack-infra/openstackid",
|
||||
"authors": [
|
||||
"Sebastian Marcet <smarcet@gmail.com>"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"public/bower_assets",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery-ui": "~1.11.4",
|
||||
"jquery-validate": "~1.14.0",
|
||||
"jquery": "~2.1.4",
|
||||
"bootstrap": "~3.3.5",
|
||||
"fontawesome": "~4.3.0",
|
||||
"jquery-migrate-official": "~1.2.1",
|
||||
"bootstrap-tagsinput": "0.7.1",
|
||||
"bootstrap-datepicker": "~1.4.0",
|
||||
"pure-templates": "*",
|
||||
"pwstrength-bootstrap": "~1.2.7",
|
||||
"uri.js": "~1.15.2",
|
||||
"crypto-js": "~3.1.5",
|
||||
"jquery-cookie": "~1.4.1",
|
||||
"typeahead.js": "0.11.1",
|
||||
"sweetalert": "~1.1.3"
|
||||
}
|
||||
}
|
49
package.json
49
package.json
|
@ -1,10 +1,53 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "OpenStackId",
|
||||
"version": "1.0.0",
|
||||
"description": "OpenStackId, IDP",
|
||||
"main": "resources/assets/js/index.js",
|
||||
"author": "smarcet@gmail.com",
|
||||
"scripts": {
|
||||
"build-dev": "./node_modules/.bin/webpack --config webpack.config.js",
|
||||
"build": "NODE_ENV=production ./node_modules/.bin/webpack --config webpack.config.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^3.9.1"
|
||||
"webpack": "^3.11.0",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-loader": "^7.1.4",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"babel-preset-flow": "^6.23.0",
|
||||
"css-loader": "^0.28.10",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "^1.1.11",
|
||||
"json-loader": "^0.5.7",
|
||||
"less": "^2.7.3",
|
||||
"less-loader": "^4.1.0",
|
||||
"postcss-loader": "^2.1.3",
|
||||
"sass-loader": "^6.0.7",
|
||||
"style-loader": "^0.19.1",
|
||||
"url-loader": "^0.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "^3.3.7",
|
||||
"bootstrap-datepicker": "^1.8.0",
|
||||
"bootstrap-sass": "^3.0.0",
|
||||
"bootstrap-tagsinput": "^0.7.1",
|
||||
"copy-webpack-plugin": "^4.5.1",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"file-loader": "^1.1.11",
|
||||
"font-awesome": "^4.7.0",
|
||||
"jquery": "~2.1.4",
|
||||
"jquery-migrate": "1.2.1",
|
||||
"jquery-ui-themes": "^1.12.0",
|
||||
"jquery-validation": "^1.17.0",
|
||||
"jquery.cookie": "^1.4.1",
|
||||
"jqueryui": "^1.11.1",
|
||||
"laravel-elixir": "^5.0.0",
|
||||
"bootstrap-sass": "^3.0.0"
|
||||
"popper.js": "^1.14.3",
|
||||
"pure": "^2.85.0",
|
||||
"pwstrength-bootstrap": "^2.2.1",
|
||||
"sweetalert2": "7.3.5",
|
||||
"typeahead.js": "^0.11.1",
|
||||
"uri.js": "^0.1.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,9 @@ $(document).ready(function() {
|
|||
|
||||
var resource_server_validator = resource_server_form.validate({
|
||||
rules: {
|
||||
"host" : {required: true, nowhitespace:true,rangelength: [1, 512]},
|
||||
"friendly_name": {required: true, free_text:true,rangelength: [1, 255]},
|
||||
"ips": { required: true},
|
||||
"host" : {required: true, nowhitespace:true, rangelength: [1, 512]},
|
||||
"friendly_name": {required: true, free_text:true, rangelength: [1, 255]},
|
||||
"ips": {required: true},
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -156,11 +156,11 @@ jQuery(document).ready(function($){
|
|||
|
||||
swal({
|
||||
title: "Your Client Credentials!",
|
||||
text: credentials_txt,
|
||||
html: true,
|
||||
html: credentials_txt,
|
||||
type: "info",
|
||||
customClass: "auto-width"
|
||||
});
|
||||
|
||||
$('#save-application').removeAttr('disabled');
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
|
@ -183,24 +183,25 @@ jQuery(document).ready(function($){
|
|||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, Delete it!",
|
||||
closeOnConfirm: true
|
||||
},
|
||||
function(){
|
||||
$.ajax(
|
||||
{
|
||||
type: "DELETE",
|
||||
url: url,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
timeout:60000,
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
loadClients();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
}).then(
|
||||
function(result){
|
||||
if(!result) return;
|
||||
$.ajax(
|
||||
{
|
||||
type: "DELETE",
|
||||
url: url,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
timeout:60000,
|
||||
success: function (data,textStatus,jqXHR) {
|
||||
loadClients();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
ajaxError(jqXHR, textStatus, errorThrown);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
);
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -94,8 +94,9 @@ jQuery(document).ready(function($){
|
|||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, Regenerate it!",
|
||||
closeOnConfirm: true
|
||||
},
|
||||
function(){
|
||||
}).then(
|
||||
function(result){
|
||||
if(!result) return;
|
||||
$.ajax(
|
||||
{
|
||||
type: "PUT",
|
||||
|
|
|
@ -86,8 +86,9 @@
|
|||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, Delete it!",
|
||||
closeOnConfirm: true
|
||||
},
|
||||
function(){
|
||||
}).thern(
|
||||
function(result){
|
||||
if(!result) return;
|
||||
$.ajax(
|
||||
{
|
||||
type: "DELETE",
|
||||
|
|
|
@ -178,8 +178,9 @@ jQuery(document).ready(function($){
|
|||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, revoke it!",
|
||||
closeOnConfirm: true
|
||||
},
|
||||
function(){
|
||||
}).then(
|
||||
function(result){
|
||||
if(!result) return;
|
||||
$.ajax(
|
||||
{
|
||||
type: "DELETE",
|
||||
|
|
|
@ -166,8 +166,9 @@ jQuery(document).ready(function($){
|
|||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, revoke it!",
|
||||
closeOnConfirm: true
|
||||
},
|
||||
function(){
|
||||
}).then(
|
||||
function(result){
|
||||
if(!result) return;
|
||||
$.ajax(
|
||||
{
|
||||
type: "DELETE",
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
import 'font-awesome/css/font-awesome.min.css';
|
||||
import 'jquery-ui-themes/themes/ui-darkness/jquery-ui.css';
|
||||
import 'sweetalert2/dist/sweetalert2.css';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import 'bootstrap-datepicker/dist/css/bootstrap-datepicker.css'
|
||||
|
||||
import $ from 'jquery';
|
||||
window.jQuery = $;
|
||||
window.$ = $;
|
||||
import 'bootstrap'
|
||||
import 'jqueryui'
|
||||
import 'jquery-validation';
|
||||
import 'jquery-validation/dist/additional-methods.js';
|
||||
import swal from 'sweetalert2';
|
||||
import 'pure';
|
||||
import 'pwstrength-bootstrap/dist/pwstrength-bootstrap.js';
|
||||
import 'bootstrap-datepicker/dist/js/bootstrap-datepicker.js';
|
|
@ -9,11 +9,11 @@
|
|||
<link rel="manifest" href="/favicon/manifest.json">
|
||||
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
||||
@yield('meta')
|
||||
{!! HTML::style('bower_assets/bootstrap/dist/css/bootstrap.min.css') !!}
|
||||
{!! HTML::style('assets/css/index.css') !!}
|
||||
{!! HTML::style('assets/css/main.css') !!}
|
||||
{!! HTML::style('bower_assets/jquery-ui/themes/ui-darkness/jquery-ui.css') !!}
|
||||
{!! HTML::style('bower_assets/fontawesome/css/font-awesome.min.css') !!}
|
||||
{!! HTML::style('bower_assets/sweetalert/dist/sweetalert.css') !!}
|
||||
{!! HTML::style('assets/bootstrap-tagsinput/bootstrap-tagsinput-typeahead.css') !!}
|
||||
{!! HTML::style('assets/bootstrap-tagsinput/bootstrap-tagsinput.css') !!}
|
||||
{!! HTML::style('assets/sweetalert2/sweetalert2.css') !!}
|
||||
@yield('css')
|
||||
</head>
|
||||
<body>
|
||||
|
@ -31,17 +31,15 @@
|
|||
</div>
|
||||
<footer class="row"></footer>
|
||||
</div>
|
||||
{!! HTML::script('bower_assets/jquery/dist/jquery.min.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap/dist/js/bootstrap.min.js')!!}
|
||||
{!! HTML::script('bower_assets/jquery-validate/dist/jquery.validate.min.js')!!}
|
||||
{!! HTML::script('bower_assets/jquery-validate/dist/additional-methods.min.js')!!}
|
||||
{!! HTML::script('bower_assets/pure-templates/libs/pure.min.js')!!}
|
||||
{!! HTML::script('bower_assets/uri.js/src/URI.min.js')!!}
|
||||
{!! HTML::script('bower_assets/sweetalert/dist/sweetalert.min.js')!!}
|
||||
{!! HTML::script('assets/__common__.js')!!}
|
||||
{!! HTML::script('assets/index.js')!!}
|
||||
{!! HTML::script('assets/js/ajax.utils.js')!!}
|
||||
{!! HTML::script('assets/js/jquery.cleanform.js')!!}
|
||||
{!! HTML::script('assets/js/jquery.serialize.js')!!}
|
||||
{!! HTML::script('assets/js/jquery.validate.additional.custom.methods.js')!!}
|
||||
{!! HTML::script('assets/typeahead/typeahead.bundle.js')!!}
|
||||
{!! HTML::script('assets/bootstrap-tagsinput/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('assets/sweetalert2/sweetalert2.js')!!}
|
||||
@yield('scripts')
|
||||
<span class="version hidden">{!! Config::get('app.version') !!}</span>
|
||||
</body>
|
||||
|
|
|
@ -88,12 +88,9 @@
|
|||
@endforeach
|
||||
|
||||
</script>
|
||||
{!! HTML::script('bower_assets/typeahead.js/dist/typeahead.bundle.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('assets/js/oauth2/profile/admin/api-scope-groups.js') !!}
|
||||
@append
|
||||
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css') !!}
|
||||
|
||||
@append
|
|
@ -81,14 +81,5 @@
|
|||
@endforeach
|
||||
|
||||
</script>
|
||||
{!! HTML::script('bower_assets/typeahead.js/dist/typeahead.bundle.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('assets/js/oauth2/profile/admin/edit-api-scope-group.js') !!}
|
||||
|
||||
|
||||
@append
|
||||
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css') !!}
|
||||
@append
|
|
@ -5,7 +5,7 @@
|
|||
@stop
|
||||
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
|
||||
@append
|
||||
|
||||
@section('content')
|
||||
|
@ -154,6 +154,5 @@
|
|||
success : '@lang("messages.global_successfully_save_entity", array("entity" => "Resource Server"))'
|
||||
};
|
||||
</script>
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('assets/js/oauth2/profile/admin/edit-resource-server.js') !!}
|
||||
@append
|
|
@ -5,7 +5,7 @@
|
|||
@stop
|
||||
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
|
||||
@append
|
||||
|
||||
@section('content')
|
||||
|
@ -77,6 +77,6 @@
|
|||
add : '{!!URL::action("Api\ApiResourceServerController@create",null)!!}'
|
||||
};
|
||||
</script>
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
|
||||
{!! HTML::script('assets/js/oauth2/profile/admin/resource-servers.js') !!}
|
||||
@append
|
|
@ -3,12 +3,10 @@
|
|||
<title>Welcome to OpenStackId - Server Admin - Server Private Keys</title>
|
||||
@stop
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') !!}
|
||||
{!! HTML::style('assets/css/private-keys.css') !!}
|
||||
@append
|
||||
@section('scripts')
|
||||
{!! HTML::script('bower_assets/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js')!!}
|
||||
{!! HTML::script('bower_assets/pwstrength-bootstrap/dist/pwstrength-bootstrap-1.2.7.min.js')!!}
|
||||
{!! HTML::script('assets/pwstrength-bootstrap/pwstrength-bootstrap.js') !!}
|
||||
{!! HTML::script('assets/js/oauth2/profile/admin/server-private-keys.js') !!}
|
||||
|
||||
<script type="application/javascript">
|
||||
|
|
|
@ -100,12 +100,5 @@
|
|||
fetchUsers: '{!!URL::action("Api\\UserApiController@fetch")!!}',
|
||||
};
|
||||
</script>
|
||||
{!! HTML::script('bower_assets/typeahead.js/dist/typeahead.bundle.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('assets/js/oauth2/profile/clients.js') !!}
|
||||
@stop
|
||||
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css') !!}
|
||||
@append
|
|
@ -4,15 +4,9 @@
|
|||
<title>Welcome to OpenStackId - OAUTH2 Console - Edit Client</title>
|
||||
@stop
|
||||
@section('css')
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.css') !!}
|
||||
{!! HTML::style('bower_assets/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css') !!}
|
||||
{!! HTML::style('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput-typeahead.css') !!}
|
||||
{!! HTML::style('assets/css/edit-client.css') !!}
|
||||
@append
|
||||
@section('scripts')
|
||||
{!! HTML::script('bower_assets/typeahead.js/dist/typeahead.bundle.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap-tagsinput/dist/bootstrap-tagsinput.js')!!}
|
||||
{!! HTML::script('bower_assets/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js')!!}
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
{!! HTML::script('bower_assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('bower_assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
{!! HTML::script('assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
{!! HTML::script('assets/js/oauth2/session/check.session.js')!!}
|
||||
@append
|
|
@ -10,6 +10,6 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
{!! HTML::script('bower_assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('bower_assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
{!! HTML::script('assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
@append
|
|
@ -33,6 +33,6 @@
|
|||
</div>
|
||||
@stop
|
||||
@section('scripts')
|
||||
{!! HTML::script('bower_assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('bower_assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
{!! HTML::script('assets/crypto-js/crypto-js.js')!!}
|
||||
{!! HTML::script('assets/jquery-cookie/jquery.cookie.js')!!}
|
||||
@append
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||
const _ = require('lodash');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
var PRODUCTION = process.env.NODE_ENV === 'production';
|
||||
console.log(`FLAVOR ${process.env.FLAVOR}`);
|
||||
|
||||
var plugins = [
|
||||
new ExtractTextPlugin({ filename: 'css/[name].css' }),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'common',
|
||||
filename: '__common__.js',
|
||||
//chunks: ["main", "utils"],
|
||||
deepChildren: true
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery'
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{from: './node_modules/bootstrap-tagsinput/dist', to: 'bootstrap-tagsinput'},
|
||||
{from: './node_modules/typeahead.js/dist', to: 'typeahead'},
|
||||
{from: './node_modules/jquery.cookie/jquery.cookie.js', to: 'jquery-cookie/jquery.cookie.js'},
|
||||
{from: './node_modules/crypto-js/crypto-js.js', to: 'crypto-js/crypto-js.js'},
|
||||
{from: './node_modules/pwstrength-bootstrap/dist', to: 'pwstrength-bootstrap'},
|
||||
{from: './node_modules/sweetalert2/dist', to: 'sweetalert2'}
|
||||
],
|
||||
{copyUnmodified: false}
|
||||
),
|
||||
];
|
||||
|
||||
var productionPlugins = [
|
||||
//new UglifyJSPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'NODE_ENV': JSON.stringify('production')
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
var devPlugins = [];
|
||||
|
||||
function styleLoader(loaders) {
|
||||
if (PRODUCTION)
|
||||
return ExtractTextPlugin.extract({ fallback: 'style-loader', use: loaders });
|
||||
return [ 'style-loader', ...loaders ];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {object}
|
||||
*/
|
||||
function postCSSLoader() {
|
||||
return {
|
||||
loader: "postcss-loader",
|
||||
options: {
|
||||
plugins: function () {
|
||||
return [require("autoprefixer")];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
'index': './resources/assets/js/index.js',
|
||||
},
|
||||
devtool: "source-map",
|
||||
devServer: {
|
||||
contentBase: './dist',
|
||||
historyApiFallback: true
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(__dirname, 'public/assets'),
|
||||
publicPath: '/assets/'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: /\.module\.css$/,
|
||||
use: styleLoader(['css-loader', postCSSLoader()])
|
||||
},
|
||||
{
|
||||
test: /\.less/,
|
||||
exclude: /\.module\.less/,
|
||||
use: styleLoader(['css-loader', postCSSLoader(), 'less-loader'])
|
||||
},
|
||||
{
|
||||
test: /\.scss/,
|
||||
exclude: /\.module\.scss/,
|
||||
use: styleLoader(['css-loader', postCSSLoader(), 'sass-loader'])
|
||||
},
|
||||
{
|
||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
use: "url-loader?limit=10000&minetype=application/font-woff&name=fonts/[name].[ext]"
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
use: "file-loader?name=fonts/[name].[ext]"
|
||||
},
|
||||
{
|
||||
test: /\.jpg|\.png|\.gif$/,
|
||||
use: "file-loader?name=images/[name].[ext]"
|
||||
},
|
||||
{
|
||||
test: /\.svg/,
|
||||
use: "file-loader?name=svg/[name].[ext]!svgo-loader"
|
||||
},
|
||||
{
|
||||
test: /\.json/,
|
||||
use: "json-loader"
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: PRODUCTION
|
||||
? plugins.concat(productionPlugins)
|
||||
: plugins.concat(devPlugins),
|
||||
};
|
Loading…
Reference in New Issue