Remove bower

All JS dependencies management moved to NPM

Change-Id: I444b9d06477737cc1e8c19fea202cfb1d693b658
This commit is contained in:
Vitaly Kramskikh 2015-08-29 16:48:52 -05:00 committed by Artem Silenkov
parent 3aec11eb57
commit 2e82b1933f
12 changed files with 2362 additions and 3920 deletions

View File

@ -1,64 +0,0 @@
{
"name": "fuel-web",
"dependencies": {
"jquery": "1.11.3",
"js-cookie": "1.5.1",
"classnames": "1.1.4",
"react": "0.13.1",
"requirejs": "2.1.16",
"requirejs-plugins": "1.0.3",
"requirejs-text": "2.0.12",
"require-css": "0.1.0",
"jsx-requirejs-plugin": "0.5.1",
"routefilter": "0.2.1",
"lodash": "3.9.3",
"backbone": "1.2.1",
"backbone.stickit": "0.9.2",
"i18next": "1.7.1",
"less": "2.4.0",
"bootstrap": "3.3.4",
"open-sans-fontface": "1.4.0",
"react-dnd": "1.1.3"
},
"devDependencies": {
"es5-shim": "4.1.0",
"sinon": "1.15.3"
},
"overrides": {
"react": {
"main": [
"JSXTransformer.js",
"react-with-addons.js",
"react-with-addons.min.js"
]
},
"requirejs-plugins": {
"main": "src/json.js"
},
"i18next": {
"main": "release/i18next-1.7.1.js"
},
"bootstrap": {
"main": [
"dist/js/bootstrap.js",
"dist/css/bootstrap.css",
"dist/css/bootstrap.css.map",
"dist/fonts/*"
]
},
"sinon": {
"main": [
"lib/sinon.js",
"lib/sinon/*",
"lib/sinon/util/*"
]
}
},
"ignore": [
"**/.*",
"node_modules",
"test",
"tests"
],
"private": true
}

View File

@ -2,7 +2,7 @@
var fs = require('fs');
var gutil = require('gulp-util');
var _ = require('lodash-node');
var _ = require('lodash');
function validate(translations, locales) {
var processedTranslations = {};

View File

@ -24,16 +24,13 @@ var glob = require('glob');
var spawn = require('child_process').spawn;
var rimraf = require('rimraf');
var es = require('event-stream');
var _ = require('lodash-node');
var _ = require('lodash');
var gulp = require('gulp');
var gutil = require('gulp-util');
var shell = require('gulp-shell');
var runSequence = require('run-sequence');
var bower = require('gulp-bower');
var mainBowerFiles = require('main-bower-files');
var filter = require('gulp-filter');
var react = require('gulp-react');
var less = require('gulp-less');
@ -64,7 +61,7 @@ var rjsConfig = _.merge(rjs('static/config.js'), {
}
},
paths: {
react: 'vendor/bower/react/react-with-addons.min'
react: 'vendor/npm/react/dist/react-with-addons.min'
},
stubModules: ['jsx'],
modules: [
@ -87,8 +84,8 @@ var buildResultFilter = filter([
'index.html',
'main.js',
'main.js.map',
'vendor/bower/requirejs/require.js',
'vendor/bower/requirejs/require.js.map',
'vendor/npm/requirejs/require.js',
'vendor/npm/requirejs/require.js.map',
'styles/*.css',
'favicon.ico',
'img/**',
@ -103,23 +100,18 @@ gulp.task('i18n:validate', function() {
validateTranslations(tranlations, locales);
});
gulp.task('bower:fetch', bower);
gulp.task('bower:copy-main', function() {
var dirs = [
{dirName: 'static/vendor/bower', includeDev: false},
{dirName: 'static/tests/bower', includeDev: 'exclusive'}
];
var streams = dirs.map(function(dir) {
rimraf.sync(dir.dirName);
return gulp.src(mainBowerFiles({checkExistence: true, includeDev: dir.includeDev}), {base: 'bower_components'})
.pipe(gulp.dest(dir.dirName));
gulp.task('copy-main', function() {
var config = JSON.parse(fs.readFileSync('package.json'));
var streams = _.map(config.mainFiles, function(files, package) {
if (!(package in config.dependencies) && !(package in config.devDependencies)) {
throw new Error(package + ' is not a dependency');
}
return _.map(_.isArray(files) ? files : [files], function(file) {
return gulp.src('node_modules/' + package + '/' + file, {base: 'node_modules'})
.pipe(gulp.dest('static/vendor/npm/'));
});
});
return es.merge(streams);
});
gulp.task('bower', function(cb) {
runSequence('bower:fetch', 'bower:copy-main', cb);
return es.merge(_.flatten(streams));
});
var selenium = require('selenium-standalone');
@ -211,8 +203,7 @@ var jsFiles = [
'static/**/*.jsx',
'!static/vendor/**',
'!static/expression/parser.js',
'static/tests/**/*.js',
'!static/tests/bower/**/*.js'
'static/tests/**/*.js'
];
var styleFiles = [
'static/**/*.less',
@ -313,7 +304,7 @@ gulp.task('rjs', function() {
});
gulp.task('build', function(cb) {
runSequence('bower', 'rjs', cb);
runSequence('copy-main', 'rjs', cb);
});
gulp.task('default', ['build']);

5852
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,16 +5,35 @@
"type": "git",
"url": "https://github.com/stackforge/fuel-web.git"
},
"scripts": {
"install": "./node_modules/.bin/gulp copy-main"
},
"dependencies": {
"backbone": "1.2.1",
"backbone.stickit": "0.9.2",
"bootstrap": "3.3.4",
"classnames": "1.1.4",
"i18next": "1.7.1",
"jquery": "1.11.3",
"js-cookie": "1.5.1",
"less": "2.4.0",
"lodash": "3.9.3",
"open-sans-fontface": "1.4.0",
"react": "0.13.3",
"react-dnd": "1.1.3",
"require-css": "0.1.8",
"requirejs": "2.1.20",
"requirejs-plugins": "1.0.2"
},
"devDependencies": {
"bower": "~1.3.12",
"casperjs": "~1.1.0-beta3",
"es5-shim": "~4.1.11",
"eslint-plugin-react": "~3.1.0",
"esprima-fb": "13001.1001.0-dev-harmony-fb",
"event-stream": "~3.3.1",
"glob": "~5.0.5",
"gulp": "~3.8.11",
"gulp-autoprefixer": "~2.1.0",
"gulp-bower": "~0.0.10",
"gulp-eslint": "~1.0.0",
"gulp-filter": "~2.0.1",
"gulp-intermediate": "~3.0.1",
@ -27,14 +46,54 @@
"gulp-shell": "~0.4.1",
"gulp-util": "~3.0.4",
"intern": "~2.2.2",
"lodash-node": "~3.9.3",
"main-bower-files": "~2.6.2",
"minimist": "~1.1.1",
"phantomjs": "~1.9.16",
"requirejs": "~2.1.16",
"rimraf": "~2.2.8",
"run-sequence": "~1.0.2",
"selenium-standalone": "~4.4.0",
"sinon": "~1.15.3",
"uglify-js": "~2.4.21"
},
"mainFiles": {
"backbone": "backbone.js",
"backbone.stickit": "backbone.stickit.js",
"bootstrap": [
"dist/js/bootstrap.js",
"dist/css/bootstrap.css",
"dist/css/bootstrap.css.map",
"dist/fonts/*"
],
"classnames": "index.js",
"es5-shim": "es5-shim.js",
"i18next": "lib/dep/i18next-1.7.1.js",
"jquery": "dist/jquery.js",
"js-cookie": "src/js.cookie.js",
"less": "dist/less.js",
"lodash": "index.js",
"open-sans-fontface": [
"./open-sans.css",
"./fonts/**/*"
],
"react": [
"dist/JSXTransformer.js",
"dist/react-with-addons.js",
"dist/react-with-addons.min.js"
],
"react-dnd": "dist/ReactDnD.min.js",
"require-css": [
"css.js",
"css-builder.js",
"normalize.js"
],
"requirejs": "require.js",
"requirejs-plugins": [
"lib/text.js",
"src/json.js"
],
"sinon": [
"lib/sinon.js",
"lib/sinon/*",
"lib/sinon/util/*"
]
}
}

View File

@ -20,27 +20,27 @@ define(function() {
baseUrl: 'static',
waitSeconds: 60,
paths: {
jquery: 'vendor/bower/jquery/dist/jquery',
'js-cookie': 'vendor/bower/js-cookie/src/js.cookie',
lodash: 'vendor/bower/lodash/lodash',
underscore: 'vendor/bower/lodash/lodash',
backbone: 'vendor/bower/backbone/backbone',
classnames: 'vendor/bower/classnames/index',
react: 'vendor/bower/react/react-with-addons',
JSXTransformer: 'vendor/bower/react/JSXTransformer',
jsx: 'vendor/bower/jsx-requirejs-plugin/js/jsx',
jquery: 'vendor/npm/jquery/dist/jquery',
'js-cookie': 'vendor/npm/js-cookie/src/js.cookie',
lodash: 'vendor/npm/lodash/index',
underscore: 'vendor/npm/lodash/index',
backbone: 'vendor/npm/backbone/backbone',
classnames: 'vendor/npm/classnames/index',
react: 'vendor/npm/react/dist/react-with-addons',
JSXTransformer: 'vendor/npm/react/dist/JSXTransformer',
jsx: 'vendor/custom/jsx',
'react.backbone': 'vendor/custom/react.backbone',
'react-dnd': 'vendor/bower/react-dnd/dist/ReactDnD.min',
stickit: 'vendor/bower/backbone.stickit/backbone.stickit',
'react-dnd': 'vendor/npm/react-dnd/dist/ReactDnD.min',
stickit: 'vendor/npm/backbone.stickit/backbone.stickit',
coccyx: 'vendor/custom/coccyx',
routefilter: 'vendor/bower/routefilter/dist/backbone.routefilter.min',
bootstrap: 'vendor/bower/bootstrap/dist/js/bootstrap',
text: 'vendor/bower/requirejs-text/text',
json: 'vendor/bower/requirejs-plugins/src/json',
i18next: 'vendor/bower/i18next/release/i18next-1.7.1',
routefilter: 'vendor/custom/backbone.routefilter',
bootstrap: 'vendor/npm/bootstrap/dist/js/bootstrap',
text: 'vendor/npm/requirejs-plugins/lib/text',
json: 'vendor/npm/requirejs-plugins/src/json',
i18next: 'vendor/npm/i18next/lib/dep/i18next-1.7.1',
deepModel: 'vendor/custom/deep-model',
lessLibrary: 'vendor/bower/less/dist/less',
'require-css': 'vendor/bower/require-css'
lessLibrary: 'vendor/npm/less/dist/less',
'require-css': 'vendor/npm/require-css'
},
shim: {
'expression/parser': {

View File

@ -13,7 +13,7 @@
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="/static/styles/layout.css">
<script src="/static/vendor/bower/requirejs/require.js"></script>
<script src="/static/vendor/npm/requirejs/require.js"></script>
<script type="text/javascript">
(function() {
'use strict';

View File

@ -1,4 +1,4 @@
@import "../vendor/bower/bootstrap/dist/css/bootstrap.css";
@import "../vendor/npm/bootstrap/dist/css/bootstrap.css";
// COLOR SETTINGS
@ -100,7 +100,7 @@
@slider-color: @tab-color + 20%;
// Fonts and Weight
@import "../vendor/bower/open-sans-fontface/open-sans.css";
@import "../vendor/npm/open-sans-fontface/open-sans.css";
@open-sans-font: 'Open Sans', helvetica, arial, tahoma, verdana, sans-serif;

View File

@ -21,7 +21,7 @@ define(['./intern'], function(config) {
'phantomjs.binary.path': 'node_modules/phantomjs/lib/phantom/bin/phantomjs'
}];
config.loader.shim.react = {
deps: ['tests/bower/es5-shim/es5-shim']
deps: ['vendor/npm/es5-shim/es5-shim']
};
return config;
});

View File

@ -20,7 +20,7 @@ define(['config'], function(config) {
config.baseUrl = '';
config.waitSeconds = 7;
config.paths.sinon = 'tests/bower/sinon/lib/sinon';
config.paths.sinon = 'vendor/npm/sinon/lib/sinon';
// FIXME(vkramskikh): workaround for https://github.com/theintern/intern/issues/348
delete config.map['*'];
@ -34,7 +34,7 @@ define(['config'], function(config) {
maxConcurrency: 1,
useLoader: {
'host-node': 'requirejs',
'host-browser': '/vendor/bower/requirejs/require.js'
'host-browser': '/vendor/npm/requirejs/require.js'
},
grep: /^/,
excludeInstrumentation: /^/,

View File

@ -0,0 +1,128 @@
/*! backbone.routefilter - v0.2.0 - 2014-05-06
* https://github.com/boazsender/backbone.routefilter
* Copyright (c) 2014 Boaz Sender; Licensed MIT */
(function(factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('backbone'), require('underscore'));
} else {
factory(window.Backbone, window._);
}
})(function(Backbone, _) {
// Save a reference to the original route method to be called
// after we pave it over.
var originalRoute = Backbone.Router.prototype.route;
// Create a reusable no operation func for the case where a before
// or after filter is not set. Backbone or Underscore should have
// a global one of these in my opinion.
var nop = function(){};
// Extend the router prototype with a default before function,
// a default after function, and a pave over of _bindRoutes.
_.extend(Backbone.Router.prototype, {
// Add default before filter.
before: nop,
// Add default after filter.
after: nop,
// Pave over Backbone.Router.prototype.route, the public method used
// for adding routes to a router instance on the fly, and the
// method which backbone uses internally for binding routes to handlers
// on the Backbone.history singleton once it's instantiated.
route: function(route, name, callback) {
// If there is no callback present for this route, then set it to
// be the name that was set in the routes property of the constructor,
// or the name arguement of the route method invocation. This is what
// Backbone.Router.route already does. We need to do it again,
// because we are about to wrap the callback in a function that calls
// the before and after filters as well as the original callback that
// was passed in.
if( !callback ){
callback = this[ name ];
}
// Create a new callback to replace the original callback that calls
// the before and after filters as well as the original callback
// internally.
var wrappedCallback = _.bind( function() {
// Call the before filter and if it returns false, run the
// route's original callback, and after filter. This allows
// the user to return false from within the before filter
// to prevent the original route callback and after
// filter from running.
var callbackArgs = [ route, _.toArray(arguments) ];
var beforeCallback;
if ( _.isFunction(this.before) ) {
// If the before filter is just a single function, then call
// it with the arguments.
beforeCallback = this.before;
} else if ( typeof this.before[route] !== "undefined" ) {
// otherwise, find the appropriate callback for the route name
// and call that.
beforeCallback = this.before[route];
} else {
// otherwise, if we have a hash of routes, but no before callback
// for this route, just use a nop function.
beforeCallback = nop;
}
// If the before callback fails during its execusion (by returning)
// false, then do not proceed with the route triggering.
if ( beforeCallback.apply(this, callbackArgs) === false ) {
return;
}
// If the callback exists, then call it. This means that the before
// and after filters will be called whether or not an actual
// callback function is supplied to handle a given route.
if( callback ) {
callback.apply( this, arguments );
}
var afterCallback;
if ( _.isFunction(this.after) ) {
// If the after filter is a single funciton, then call it with
// the proper arguments.
afterCallback = this.after;
} else if ( typeof this.after[route] !== "undefined" ) {
// otherwise if we have a hash of routes, call the appropriate
// callback based on the route name.
afterCallback = this.after[route];
} else {
// otherwise, if we have a has of routes but no after callback
// for this route, just use the nop function.
afterCallback = nop;
}
// Call the after filter.
afterCallback.apply( this, callbackArgs );
}, this);
// Call our original route, replacing the callback that was originally
// passed in when Backbone.Router.route was invoked with our wrapped
// callback that calls the before and after callbacks as well as the
// original callback.
return originalRoute.call( this, route, name, wrappedCallback );
}
});
});

76
static/vendor/custom/jsx.js vendored Normal file
View File

@ -0,0 +1,76 @@
/**
* @license The MIT License (MIT)
*
* Copyright (c) 2014 Felipe O. Carvalho
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
define(['JSXTransformer', 'text'], function (JSXTransformer, text) {
'use strict';
var buildMap = {};
var jsx = {
version: '0.6.2',
load: function (name, req, onLoadNative, config) {
var jsxOptions = config.jsx || {};
var fileExtension = jsxOptions.fileExtension || '.js';
var transformOptions = {
harmony: !!jsxOptions.harmony,
stripTypes: !!jsxOptions.stripTypes
};
var onLoad = function(content) {
try {
content = JSXTransformer.transform(content, transformOptions).code;
} catch (err) {
onLoadNative.error(err);
}
if (config.isBuild) {
buildMap[name] = content;
} else if (typeof location !== 'undefined') { // Do not create sourcemap when loaded in Node
content += '\n//# sourceURL=' + location.protocol + '//' + location.hostname +
config.baseUrl + name + fileExtension;
}
onLoadNative.fromText(content);
};
onLoad.error = function(err) {
onLoadNative.error(err);
};
text.load(name + fileExtension, req, onLoad, config);
},
write: function (pluginName, moduleName, write) {
if (buildMap.hasOwnProperty(moduleName)) {
var content = buildMap[moduleName];
write.asModule(pluginName + '!' + moduleName, content);
}
}
};
return jsx;
});