[Pkg-javascript-commits] [node-asn1.js] 04/202: lib: move rfcs to separate npm packages
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Apr 20 19:18:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-asn1.js.
commit aaa8bde46f304b2618d1d10c10f53c14c7d45965
Author: Fedor Indutny <fedor.indutny at gmail.com>
Date: Sun Dec 1 22:43:45 2013 +0400
lib: move rfcs to separate npm packages
---
lib/asn1.js | 1 -
lib/modules/index.js | 2 --
package.json | 2 +-
lib/modules/rfc2560.js => rfc/2560/index.js | 10 +++++++---
package.json => rfc/2560/package.json | 19 ++++++++++---------
test/rfc2560-test.js => rfc/2560/test/basic-test.js | 6 +++---
lib/modules/rfc3280.js => rfc/3280/index.js | 6 +++++-
package.json => rfc/3280/package.json | 16 +++++++---------
test/rfc2560-test.js => rfc/3280/test/basic-test.js | 6 +++---
9 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/lib/asn1.js b/lib/asn1.js
index 7dc4b33..18fed16 100644
--- a/lib/asn1.js
+++ b/lib/asn1.js
@@ -5,4 +5,3 @@ asn1.base = require('./asn1/base');
asn1.constants = require('./asn1/constants');
asn1.decoders = require('./asn1/decoders');
asn1.encoders = require('./asn1/encoders');
-asn1.modules = require('./modules');
diff --git a/lib/modules/index.js b/lib/modules/index.js
deleted file mode 100644
index 7932eae..0000000
--- a/lib/modules/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-exports.rfc3280 = require('./rfc3280');
-exports.rfc2560 = require('./rfc2560');
diff --git a/package.json b/package.json
index 002fa61..de27aaa 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "ASN.1 encoder and decoder",
"main": "lib/asn1.js",
"scripts": {
- "test": "mocha --reporter spec test/*-test.js"
+ "test": "mocha --reporter spec test/*-test.js rfc/2560/test/*-test.js"
},
"repository": {
"type": "git",
diff --git a/lib/modules/rfc2560.js b/rfc/2560/index.js
similarity index 94%
rename from lib/modules/rfc2560.js
rename to rfc/2560/index.js
index 2df3235..df7558c 100644
--- a/lib/modules/rfc2560.js
+++ b/rfc/2560/index.js
@@ -1,7 +1,11 @@
-var asn1 = require('../asn1');
-var rfc3280 = require('./rfc3280');
+try {
+ var asn1 = require('asn1.js');
+ var rfc3280 = require('asn1.js-rfc3280');
+} catch (e) {
+ var asn1 = require('../..');
+ var rfc3280 = require('../3280');
+}
-// Import
var OCSPResponse = asn1.define('OCSPResponse', function() {
this.seq().obj(
this.key('responseStatus').use(ResponseStatus),
diff --git a/package.json b/rfc/2560/package.json
similarity index 58%
copy from package.json
copy to rfc/2560/package.json
index 002fa61..c1e4119 100644
--- a/package.json
+++ b/rfc/2560/package.json
@@ -1,17 +1,15 @@
{
- "name": "asn1.js",
+ "name": "asn1.js-rfc2560",
"version": "0.0.0",
- "description": "ASN.1 encoder and decoder",
- "main": "lib/asn1.js",
- "scripts": {
- "test": "mocha --reporter spec test/*-test.js"
- },
+ "description": "RFC2560 structures for asn1.js",
+ "main": "index.js",
"repository": {
"type": "git",
"url": "git at github.com:indutny/asn1.js"
},
"keywords": [
- "asn.1",
+ "asn1",
+ "rfc2560",
"der"
],
"author": "Fedor Indutny",
@@ -20,7 +18,10 @@
"url": "https://github.com/indutny/asn1.js/issues"
},
"homepage": "https://github.com/indutny/asn1.js",
- "devDependencies": {
- "mocha": "~1.14.0"
+ "dependencies": {
+ "asn1.js-3280": "~0.1.0"
+ },
+ "peerDependencies": {
+ "asn1.js": "~0.1.0"
}
}
diff --git a/test/rfc2560-test.js b/rfc/2560/test/basic-test.js
similarity index 91%
copy from test/rfc2560-test.js
copy to rfc/2560/test/basic-test.js
index 9bea5c1..88d1cb1 100644
--- a/test/rfc2560-test.js
+++ b/rfc/2560/test/basic-test.js
@@ -1,5 +1,5 @@
var assert = require('assert');
-var asn1 = require('..');
+var rfc2560 = require('..');
var Buffer = require('buffer').Buffer;
@@ -22,11 +22,11 @@ describe('asn1.js RFC2560', function() {
'2721ff38c709f3ec580d22ff40818dd17f',
'hex');
- var res = asn1.modules.rfc2560.OCSPResponse.decode(data, 'der');
+ var res = rfc2560.OCSPResponse.decode(data, 'der');
assert.equal(res.responseStatus, 'successful');
assert.equal(res.responseBytes.responseType, 'id-pkix-ocsp-basic');
- var basic = asn1.modules.rfc2560.BasicOCSPResponse.decode(
+ var basic = rfc2560.BasicOCSPResponse.decode(
res.responseBytes.response,
'der'
);
diff --git a/lib/modules/rfc3280.js b/rfc/3280/index.js
similarity index 97%
rename from lib/modules/rfc3280.js
rename to rfc/3280/index.js
index 44038fb..157dd03 100644
--- a/lib/modules/rfc3280.js
+++ b/rfc/3280/index.js
@@ -1,4 +1,8 @@
-var asn1 = require('../asn1');
+try {
+ var asn1 = require('asn1.js');
+} catch (e) {
+ var asn1 = require('../..');
+}
var CRLReason = asn1.define('CRLReason', function() {
this.enum({
diff --git a/package.json b/rfc/3280/package.json
similarity index 59%
copy from package.json
copy to rfc/3280/package.json
index 002fa61..b9d1f63 100644
--- a/package.json
+++ b/rfc/3280/package.json
@@ -1,17 +1,15 @@
{
- "name": "asn1.js",
+ "name": "asn1.js-rfc3280",
"version": "0.0.0",
- "description": "ASN.1 encoder and decoder",
- "main": "lib/asn1.js",
- "scripts": {
- "test": "mocha --reporter spec test/*-test.js"
- },
+ "description": "RFC3280 structures for asn1.js",
+ "main": "index.js",
"repository": {
"type": "git",
"url": "git at github.com:indutny/asn1.js"
},
"keywords": [
- "asn.1",
+ "asn1",
+ "rfc3280",
"der"
],
"author": "Fedor Indutny",
@@ -20,7 +18,7 @@
"url": "https://github.com/indutny/asn1.js/issues"
},
"homepage": "https://github.com/indutny/asn1.js",
- "devDependencies": {
- "mocha": "~1.14.0"
+ "peerDependencies": {
+ "asn1.js": "~0.1.0"
}
}
diff --git a/test/rfc2560-test.js b/rfc/3280/test/basic-test.js
similarity index 91%
rename from test/rfc2560-test.js
rename to rfc/3280/test/basic-test.js
index 9bea5c1..88d1cb1 100644
--- a/test/rfc2560-test.js
+++ b/rfc/3280/test/basic-test.js
@@ -1,5 +1,5 @@
var assert = require('assert');
-var asn1 = require('..');
+var rfc2560 = require('..');
var Buffer = require('buffer').Buffer;
@@ -22,11 +22,11 @@ describe('asn1.js RFC2560', function() {
'2721ff38c709f3ec580d22ff40818dd17f',
'hex');
- var res = asn1.modules.rfc2560.OCSPResponse.decode(data, 'der');
+ var res = rfc2560.OCSPResponse.decode(data, 'der');
assert.equal(res.responseStatus, 'successful');
assert.equal(res.responseBytes.responseType, 'id-pkix-ocsp-basic');
- var basic = asn1.modules.rfc2560.BasicOCSPResponse.decode(
+ var basic = rfc2560.BasicOCSPResponse.decode(
res.responseBytes.response,
'der'
);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-asn1.js.git
More information about the Pkg-javascript-commits
mailing list