mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
Replace YAML package definitions with standard package.json, fix dependencies
This commit is contained in:
parent
dfdcaa893e
commit
6301c3f169
11 changed files with 1148 additions and 433 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
||||||
/package.json
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
sinopia-*.tgz
|
sinopia-*.tgz
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
package.json
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
sinopia-*.tgz
|
sinopia-*.tgz
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg: grunt.file.readYAML('package.yaml'),
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
browserify: {
|
browserify: {
|
||||||
dist: {
|
dist: {
|
||||||
files: {
|
files: {
|
||||||
|
|
|
@ -28,13 +28,12 @@ var Path = require('path')
|
||||||
var URL = require('url')
|
var URL = require('url')
|
||||||
var server = require('./index')
|
var server = require('./index')
|
||||||
var Utils = require('./utils')
|
var Utils = require('./utils')
|
||||||
var pkg_file = '../package.yaml'
|
var pkginfo = require('pkginfo')(module); // eslint-disable-line no-unused-vars
|
||||||
var pkg = YAML.safeLoad(fs.readFileSync(__dirname+'/'+ pkg_file, 'utf8'))
|
|
||||||
|
|
||||||
commander
|
commander
|
||||||
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)')
|
.option('-l, --listen <[host:]port>', 'host:port number to listen on (default: localhost:4873)')
|
||||||
.option('-c, --config <config.yaml>', 'use this configuration file (default: ./config.yaml)')
|
.option('-c, --config <config.yaml>', 'use this configuration file (default: ./config.yaml)')
|
||||||
.version(pkg.version)
|
.version(module.exports.version)
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
||||||
if (commander.args.length == 1 && !commander.config) {
|
if (commander.args.length == 1 && !commander.config) {
|
||||||
|
@ -161,7 +160,7 @@ function afterConfigLoad() {
|
||||||
pathname: '/',
|
pathname: '/',
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
version: 'Sinopia/'+pkg.version,
|
version: 'Sinopia/'+module.exports.version,
|
||||||
}, 'http address - @{addr}')
|
}, 'http address - @{addr}')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var Crypto = require('crypto')
|
var Crypto = require('crypto')
|
||||||
var fs = require('fs')
|
|
||||||
var YAML = require('js-yaml')
|
|
||||||
var Error = require('http-errors')
|
var Error = require('http-errors')
|
||||||
var minimatch = require('minimatch')
|
var minimatch = require('minimatch')
|
||||||
var Path = require('path')
|
var Path = require('path')
|
||||||
var LocalData = require('./local-data')
|
var LocalData = require('./local-data')
|
||||||
var Utils = require('./utils')
|
var Utils = require('./utils')
|
||||||
var pkg_file = '../package.yaml'
|
var Utils = require('./utils')
|
||||||
var pkg = YAML.safeLoad(fs.readFileSync(__dirname+'/'+pkg_file, 'utf8'))
|
var pkginfo = require('pkginfo')(module); // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// [[a, [b, c]], d] -> [a, b, c, d]
|
// [[a, [b, c]], d] -> [a, b, c, d]
|
||||||
function flatten(array) {
|
function flatten(array) {
|
||||||
|
@ -28,7 +26,7 @@ function Config(config) {
|
||||||
for (var i in config) {
|
for (var i in config) {
|
||||||
if (self[i] == null) self[i] = config[i]
|
if (self[i] == null) self[i] = config[i]
|
||||||
}
|
}
|
||||||
if (!self.user_agent) self.user_agent = 'Sinopia/'+pkg.version
|
if (!self.user_agent) self.user_agent = 'Sinopia/'+module.exports.version
|
||||||
|
|
||||||
// some weird shell scripts are valid yaml files parsed as string
|
// some weird shell scripts are valid yaml files parsed as string
|
||||||
assert.equal(typeof(config), 'object', 'CONFIG: it doesn\'t look like a valid config file')
|
assert.equal(typeof(config), 'object', 'CONFIG: it doesn\'t look like a valid config file')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var Cookies = require('cookies')
|
var Cookies = require('cookies')
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var expressJson5 = require('express-json5')
|
var bodyParser = require('body-parser')
|
||||||
var Error = require('http-errors')
|
var Error = require('http-errors')
|
||||||
var Path = require('path')
|
var Path = require('path')
|
||||||
var Middleware = require('./middleware')
|
var Middleware = require('./middleware')
|
||||||
|
@ -30,7 +30,7 @@ module.exports = function(config, auth, storage) {
|
||||||
|
|
||||||
app.use(auth.basic_middleware())
|
app.use(auth.basic_middleware())
|
||||||
//app.use(auth.bearer_middleware())
|
//app.use(auth.bearer_middleware())
|
||||||
app.use(expressJson5({ strict: false, limit: config.max_body_size || '10mb' }))
|
app.use(bodyParser.json({ strict: false, limit: config.max_body_size || '10mb' }))
|
||||||
app.use(Middleware.anti_loop(config))
|
app.use(Middleware.anti_loop(config))
|
||||||
|
|
||||||
// encode / in a scoped package name to be matched as a single parameter in routes
|
// encode / in a scoped package name to be matched as a single parameter in routes
|
||||||
|
|
|
@ -51,10 +51,11 @@ module.exports = function(config, auth, storage) {
|
||||||
async.filterSeries(packages, function(package, cb) {
|
async.filterSeries(packages, function(package, cb) {
|
||||||
auth.allow_access(package.name, req.remote_user, function(err, allowed) {
|
auth.allow_access(package.name, req.remote_user, function(err, allowed) {
|
||||||
setImmediate(function () {
|
setImmediate(function () {
|
||||||
cb(!err && allowed)
|
cb(err, allowed)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, function(packages) {
|
}, function(err, packages) {
|
||||||
|
if (err) throw err
|
||||||
packages.sort(function(p1, p2) {
|
packages.sort(function(p1, p2) {
|
||||||
if (p1.name < p2.name) {
|
if (p1.name < p2.name) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
1327
npm-shrinkwrap.json
generated
1327
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
86
package.json
Normal file
86
package.json
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{
|
||||||
|
"name": "verdaccio",
|
||||||
|
"version": "1.4.0",
|
||||||
|
"description": "Private npm repository server",
|
||||||
|
"author": {
|
||||||
|
"name": "Alex Kocharin",
|
||||||
|
"email": "alex@kocharin.ru"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/verdaccio/verdaccio"
|
||||||
|
},
|
||||||
|
"main": "index.js",
|
||||||
|
"bin": {
|
||||||
|
"sinopia": "./bin/sinopia"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"JSONStream": "^1.1.1",
|
||||||
|
"async": "^2.0.0-rc.3",
|
||||||
|
"body-parser": "^1.15.0",
|
||||||
|
"bunyan": "^1.8.0",
|
||||||
|
"commander": "^2.9.0",
|
||||||
|
"compression": "^1.6.1",
|
||||||
|
"cookies": "^0.6.1",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"express": "^4.13.4",
|
||||||
|
"handlebars": "^4.0.5",
|
||||||
|
"highlight.js": "^9.3.0",
|
||||||
|
"http-errors": "^1.4.0",
|
||||||
|
"jju": "^1.3.0",
|
||||||
|
"js-yaml": "^3.6.0",
|
||||||
|
"lunr": "^0.7.0",
|
||||||
|
"minimatch": "^3.0.0",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"pkginfo": "^0.4.0",
|
||||||
|
"readable-stream": "^2.1.0",
|
||||||
|
"render-readme": "^1.3.1",
|
||||||
|
"request": "^2.72.0",
|
||||||
|
"semver": "^5.1.0",
|
||||||
|
"sinopia-htpasswd": "^0.4.5",
|
||||||
|
"symbol": "^0.2.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fs-ext": "^0.5.0",
|
||||||
|
"crypt3": "^0.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"rimraf": "^2.5.2",
|
||||||
|
"bluebird": "^3.3.5",
|
||||||
|
"mocha": "^2.4.5",
|
||||||
|
"eslint": "^2.8.0",
|
||||||
|
"browserify": "^13.0.0",
|
||||||
|
"browserify-handlebars": "^1.0.0",
|
||||||
|
"grunt": "^1.0.1",
|
||||||
|
"grunt-cli": "^1.2.0",
|
||||||
|
"grunt-browserify": "^5.0.0",
|
||||||
|
"grunt-contrib-less": "^1.3.0",
|
||||||
|
"grunt-contrib-watch": "^1.0.0",
|
||||||
|
"unopinionate": "^0.0.4",
|
||||||
|
"onclick": "^0.1.0",
|
||||||
|
"transition-complete": "^0.0.2"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"private",
|
||||||
|
"package",
|
||||||
|
"repository",
|
||||||
|
"registry",
|
||||||
|
"modules",
|
||||||
|
"proxy",
|
||||||
|
"server"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "eslint . && mocha ./test/functional ./test/unit",
|
||||||
|
"test-travis": "eslint . && mocha -R spec ./test/functional ./test/unit",
|
||||||
|
"test-only": "mocha ./test/functional ./test/unit",
|
||||||
|
"lint": "eslint ."
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
},
|
||||||
|
"preferGlobal": true,
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://registry.npmjs.org/"
|
||||||
|
},
|
||||||
|
"license": "WTFPL"
|
||||||
|
}
|
135
package.yaml
135
package.yaml
|
@ -1,135 +0,0 @@
|
||||||
# use "yapm install ." if you're installing this from git repository
|
|
||||||
|
|
||||||
name: sinopia
|
|
||||||
version: 1.4.0
|
|
||||||
description: Private npm repository server
|
|
||||||
|
|
||||||
author:
|
|
||||||
name: Alex Kocharin
|
|
||||||
email: alex@kocharin.ru
|
|
||||||
|
|
||||||
repository:
|
|
||||||
type: git
|
|
||||||
url: git://github.com/rlidwka/sinopia
|
|
||||||
|
|
||||||
main: index.js
|
|
||||||
|
|
||||||
bin:
|
|
||||||
sinopia: ./bin/sinopia
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
express: '>=5.0.0-0 <6.0.0-0'
|
|
||||||
|
|
||||||
# express middlewares
|
|
||||||
express-json5: '>=0.1.0 <1.0.0-0'
|
|
||||||
body-parser: '>=1.9.2 <2.0.0-0'
|
|
||||||
compression: '>=1.2.0 <2.0.0-0'
|
|
||||||
|
|
||||||
commander: '>=2.3.0 <3.0.0-0'
|
|
||||||
js-yaml: '>=3.0.1 <4.0.0-0'
|
|
||||||
cookies: '>=0.5.0 <1.0.0-0'
|
|
||||||
request: '>=2.31.0 <3.0.0-0'
|
|
||||||
async: '>=0.9.0 <1.0.0-0'
|
|
||||||
es6-shim: '0.21.x'
|
|
||||||
semver: '>=2.2.1 <5.0.0-0'
|
|
||||||
minimatch: '>=0.2.14 <2.0.0-0'
|
|
||||||
bunyan: '>=0.22.1 <2.0.0-0'
|
|
||||||
handlebars: '2.x'
|
|
||||||
highlight.js: '8.x'
|
|
||||||
lunr: '>=0.5.2 <1.0.0-0'
|
|
||||||
render-readme: '>=0.2.1'
|
|
||||||
jju: '1.x'
|
|
||||||
JSONStream: '1.x'
|
|
||||||
|
|
||||||
mkdirp: '>=0.3.5 <1.0.0-0'
|
|
||||||
sinopia-htpasswd: '>= 0.4.3'
|
|
||||||
http-errors: '>=1.2.0'
|
|
||||||
|
|
||||||
# node 0.10 compatibility, should go away soon
|
|
||||||
readable-stream: '~1.1.0'
|
|
||||||
|
|
||||||
optionalDependencies:
|
|
||||||
# those are native modules that could fail to compile
|
|
||||||
# and unavailable on windows
|
|
||||||
fs-ext: '>=0.4.1 <1.0.0-0'
|
|
||||||
crypt3: '>=0.1.6 <1.0.0-0' # for sinopia-htpasswd
|
|
||||||
|
|
||||||
devDependencies:
|
|
||||||
#
|
|
||||||
# Tools required for testing
|
|
||||||
#
|
|
||||||
rimraf: '>=2.2.5 <3.0.0-0'
|
|
||||||
bluebird: '2 >=2.9'
|
|
||||||
|
|
||||||
mocha: '2 >=2.2.3'
|
|
||||||
|
|
||||||
#
|
|
||||||
# Linting tools
|
|
||||||
#
|
|
||||||
eslint: '1 >=1.1.0'
|
|
||||||
|
|
||||||
# for debugging memory leaks, it'll be require()'d if
|
|
||||||
# installed, but I don't want it to be installed everytime
|
|
||||||
#heapdump: '*'
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tools required to build static files
|
|
||||||
#
|
|
||||||
browserify: '7.x'
|
|
||||||
browserify-handlebars: '1.x'
|
|
||||||
grunt: '>=0.4.4 <1.0.0-0'
|
|
||||||
grunt-cli: '*'
|
|
||||||
grunt-browserify: '>=2.0.8 <3.0.0-0'
|
|
||||||
grunt-contrib-less: '>=0.11.0 <1.0.0-0'
|
|
||||||
grunt-contrib-watch: '>=0.6.1 <1.0.0-0'
|
|
||||||
|
|
||||||
# for building static/main.js,
|
|
||||||
# not required in runtime
|
|
||||||
unopinionate: '>=0.0.4 <1.0.0-0'
|
|
||||||
onclick: '>=0.1.0 <1.0.0-0'
|
|
||||||
transition-complete: '>=0.0.2 <1.0.0-0'
|
|
||||||
|
|
||||||
keywords:
|
|
||||||
- private
|
|
||||||
- package
|
|
||||||
- repository
|
|
||||||
- registry
|
|
||||||
- modules
|
|
||||||
- proxy
|
|
||||||
- server
|
|
||||||
|
|
||||||
scripts:
|
|
||||||
test: eslint . && mocha ./test/functional ./test/unit
|
|
||||||
test-travis: eslint . && mocha -R spec ./test/functional ./test/unit
|
|
||||||
test-only: mocha ./test/functional ./test/unit
|
|
||||||
lint: eslint .
|
|
||||||
prepublish: js-yaml package.yaml > package.json
|
|
||||||
clean-shrinkwrap: |
|
|
||||||
node -e '
|
|
||||||
function clean(j) {
|
|
||||||
if (!j) return
|
|
||||||
for (var k in j) {
|
|
||||||
delete j[k].from
|
|
||||||
delete j[k].resolved
|
|
||||||
if (j[k].dependencies) clean(j[k].dependencies)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x = JSON.parse(require("fs").readFileSync("./npm-shrinkwrap.json"))
|
|
||||||
clean(x.dependencies)
|
|
||||||
x = JSON.stringify(x, null, " ")
|
|
||||||
require("fs").writeFileSync("./npm-shrinkwrap.json", x + "\n")
|
|
||||||
'
|
|
||||||
|
|
||||||
# we depend on streams2 stuff
|
|
||||||
# it can be replaced with isaacs/readable-stream, ask if you need to use 0.8
|
|
||||||
engines:
|
|
||||||
node: '>=0.10'
|
|
||||||
|
|
||||||
preferGlobal: true
|
|
||||||
|
|
||||||
publishConfig:
|
|
||||||
registry: https://registry.npmjs.org/
|
|
||||||
|
|
||||||
license:
|
|
||||||
type: WTFPL
|
|
||||||
url: http://www.wtfpl.net/txt/copying/
|
|
|
@ -2,9 +2,8 @@
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var request = require('request')
|
var request = require('request')
|
||||||
var Promise = require('bluebird')
|
var Promise = require('bluebird')
|
||||||
var sym = typeof Symbol !== 'undefined'
|
var Symbol = require('symbol')
|
||||||
? Symbol('smart_request_data')
|
var sym = Symbol('smart_request_data')
|
||||||
: '__why_does_node_0.10_support_suck_so_much'
|
|
||||||
|
|
||||||
function smart_request(options) {
|
function smart_request(options) {
|
||||||
var self = {}
|
var self = {}
|
||||||
|
|
Loading…
Reference in a new issue