0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

Refactor web, relocate files to web folder

This commit is contained in:
Juan Picado @jotadeveloper 2017-06-11 09:01:13 +02:00
parent 4829e5286e
commit b3a82bc294
No known key found for this signature in database
GPG key ID: 18AC54485952D158
34 changed files with 31 additions and 28 deletions

View file

@ -1,5 +1,5 @@
node_modules
lib/static
lib/web/static
lib/web/ui/
coverage/
lib/GUI/
wiki/

View file

@ -4,7 +4,7 @@ module.exports = function(grunt) {
browserify: {
dist: {
files: {
'lib/static/main.js': ['lib/GUI/js/main.js'],
'lib/static/main.js': ['lib/ui/js/main.js'],
},
options: {
debug: true,
@ -15,7 +15,7 @@ module.exports = function(grunt) {
less: {
dist: {
files: {
'lib/static/main.css': ['lib/GUI/css/main.less'],
'lib/static/main.css': ['lib/ui/css/main.less'],
},
options: {
sourceMap: false,
@ -23,7 +23,7 @@ module.exports = function(grunt) {
},
},
watch: {
files: ['lib/GUI/**/*'],
files: ['lib/ui/**/*'],
tasks: ['default'],
},
});

View file

@ -6,7 +6,7 @@ const compression = require('compression');
const Auth = require('./auth');
const Logger = require('./logger');
const Config = require('./config');
const Middleware = require('./middleware');
const Middleware = require('./web/middleware');
const Cats = require('./status-cats');
const Storage = require('./storage');
@ -77,14 +77,14 @@ module.exports = function(config_hash) {
});
}
app.use(require('./index-api')(config, auth, storage));
app.use(require('./web/api/api')(config, auth, storage));
if (config.web && config.web.enable === false) {
app.get('/', function(req, res, next) {
next( Error[404]('web interface is disabled in the config file') );
});
} else {
app.use(require('./index-web')(config, auth, storage));
app.use(require('./web/index')(config, auth, storage));
}
app.get('/*', function(req, res, next) {

View file

@ -5,9 +5,9 @@ let express = require('express');
let bodyParser = require('body-parser');
let Error = require('http-errors');
let Path = require('path');
let Middleware = require('./middleware');
let Notify = require('./notify');
let Utils = require('./utils');
let Middleware = require('../middleware');
let Notify = require('../../notify');
let Utils = require('../../utils');
let expect_json = Middleware.expect_json;
let match = Middleware.match;
let media = Middleware.media;

View file

@ -7,9 +7,9 @@ let express = require('express');
let fs = require('fs');
let Handlebars = require('handlebars');
let renderReadme = require('render-readme');
let Search = require('./search');
let Search = require('../search');
let Middleware = require('./middleware');
let Utils = require('./utils');
let Utils = require('../utils');
let match = Middleware.match;
let validate_name = Middleware.validate_name;
let validate_pkg = Middleware.validate_package;
@ -37,12 +37,12 @@ module.exports = function(config, auth, storage) {
Search.configureStorage(storage);
Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./GUI/entry.hbs'), 'utf8'));
Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./ui/entry.hbs'), 'utf8'));
let template;
if (config.web && config.web.template) {
template = Handlebars.compile(fs.readFileSync(config.web.template, 'utf8'));
} else {
template = Handlebars.compile(fs.readFileSync(require.resolve('./GUI/index.hbs'), 'utf8'));
template = Handlebars.compile(fs.readFileSync(require.resolve('./ui/index.hbs'), 'utf8'));
}
app.get('/', function(req, res, next) {
let base = Utils.combineBaseUrl(Utils.getWebProtocol(req), req.get('host'), config.url_prefix);

View file

@ -4,8 +4,8 @@
const crypto = require('crypto');
const Error = require('http-errors');
const utils = require('./utils');
const Logger = require('./logger');
const utils = require('../utils');
const Logger = require('../logger');
module.exports.match = function match(regexp) {
return function(req, res, next, value, name) {

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 315 B

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -7166,8 +7166,8 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
}
@font-face {
font-family: 'fontello';
src: url('../static/fontello.eot?10872183');
src: url('../static/fontello.eot?10872183#iefix') format('embedded-opentype'), url('../static/fontello.woff?10872183') format('woff'), url('../static/fontello.ttf?10872183') format('truetype'), url('../static/fontello.svg?10872183#fontello') format('svg');
src: url('eot?10872183');
src: url('eot?10872183#iefix') format('embedded-opentype'), url('woff?10872183') format('woff'), url('ttf?10872183') format('truetype'), url('svg?10872183#fontello') format('svg');
font-weight: normal;
font-style: normal;
}

View file

@ -671,7 +671,7 @@ function registerDefaultDecorators(instance) {
exports.__esModule = true;
var _utils = require('../utils');
var _utils = require('../../utils');
exports['default'] = function (instance) {
instance.registerDecorator('inline', function (fn, props, container, options) {
@ -803,7 +803,7 @@ function registerDefaultHelpers(instance) {
exports.__esModule = true;
var _utils = require('../utils');
var _utils = require('../../utils');
exports['default'] = function (instance) {
instance.registerHelper('blockHelperMissing', function (context, options) {
@ -847,7 +847,7 @@ exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = require('../utils');
var _utils = require('../../utils');
var _exception = require('../exception');
@ -967,7 +967,7 @@ module.exports = exports['default'];
exports.__esModule = true;
var _utils = require('../utils');
var _utils = require('../../utils');
exports['default'] = function (instance) {
instance.registerHelper('if', function (conditional, options) {
@ -1040,7 +1040,7 @@ module.exports = exports['default'];
exports.__esModule = true;
var _utils = require('../utils');
var _utils = require('../../utils');
exports['default'] = function (instance) {
instance.registerHelper('with', function (context, options) {

View file

@ -2,15 +2,18 @@
// ensure that all arguments are validated
let assert = require('assert');
const assert = require('assert');
const path = require('path');
describe('index.js app', test('index.js'));
describe('index-api.js app', test('index-api.js'));
describe('index-web.js app', test('index-web.js'));
describe('api.js app', test('api/api.js'));
describe('index.js app', test('index.js'));
function test(file) {
return function() {
let source = require('fs').readFileSync(__dirname + '/../../lib/' + file, 'utf8');
let requirePath = path.normalize(path.join(__dirname + '/../../lib/web/', file));
let source = require('fs').readFileSync(requirePath, 'utf8');
let very_scary_regexp = /\n\s*app\.(\w+)\s*\(\s*(("[^"]*")|('[^']*'))\s*,/g;
let m;