Skip to content

Commit

Permalink
initial rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
llCorvinSll committed Dec 14, 2017
1 parent e39ccaf commit cfba2a6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
"url": "http://github.com/travist/jsencrypt/issues"
},
"devDependencies": {
"expect.js": "^0.3.1",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^2.0.0",
"gulp-insert": "^0.5.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.3",
"gulp-watch": "^4.3.5",
"gulp-wrap": "^0.11.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.3"
"mocha": "^4.0.1",
"rollup": "^0.52.1"
},
"dependencies": {

}
"dependencies": {}
}
24 changes: 24 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use strict";
const path = require('path');
const rollup = require('rollup');


const entries = {
'src/jsencrypt': {file: 'bin/jsencrypt.bundle', name: 'jsencrypt'},
'test/test.rsa': {file: 'test/test.rsa.bundle', name: 'rsaTest'}
};
for (let entry in entries) {
console.log(`processing ${entry}.js`);
rollup.rollup({
input: path.join(__dirname, `${entry}.js`),
}).then(function (bundle) {
console.log(`processing ${entry}.js finished`);
bundle.write({
format: 'umd',
name: entries[entry].name,
file: path.join(__dirname, `${entries[entry].file}.js`)
});
}).catch((e)=>{
console.log(e);
});
}
9 changes: 4 additions & 5 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
title: Testing JSEncrypt
layout: default
---
<link href="test/mocha.css" rel="stylesheet" type="text/css">
<link href="../node_modules/mocha/mocha.css" rel="stylesheet" type="text/css">
<div id="mocha"></div>
<script type="text/javascript" src="test/expect.js"></script>
<script type="text/javascript" src="test/mocha.js"></script>
<script type="text/javascript" src="../node_modules/expect.js/index.js"></script>
<script type="text/javascript" src="../node_modules/mocha/mocha.js"></script>
<script>mocha.setup('bdd')</script>
<script type="text/javascript" src="test/test.rsa.js"></script>
<script type="text/javascript" src="test.rsa.bundle.js"></script>
<script>
mocha.checkLeaks();
mocha.globals(['jQuery']);
mocha.run();
</script>
8 changes: 4 additions & 4 deletions test/test.rsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ahh8P6K19o8ysVAvZEnUECUlIR2Afpq5yabOCIkpbA==\
-----END RSA PRIVATE KEY-----"
];

$.each(keySizes, function(index, keySize){
keySizes.forEach(function(index, keySize){

var jse = new JSEncrypt({default_key_size:keySize});
var openssl_public_key = pbkeys[index];
Expand Down Expand Up @@ -209,7 +209,7 @@ $.each(keySizes, function(index, keySize){
var params = ['n', 'e', 'd', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];
expect(tmp.key).to.be.ok();
expect(tmp.key).to.have.keys(params);
$.each(params, function(index,value){
params.forEach(function(index,value){
expect(tmp.key[value]).to.be.ok();
});

Expand Down Expand Up @@ -238,10 +238,10 @@ $.each(keySizes, function(index, keySize){
var priv_params = ['d', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];
expect(tmp.key).to.be.ok();
expect(tmp.key).to.have.keys(pub_params);
$.each(pub_params, function(index,value){
pub_params.forEach(function(index,value){
expect(tmp.key[value]).to.be.ok();
});
$.each(priv_params, function(index,value){
priv_params.forEach(function(index,value){
expect(tmp.key[value]).to.not.be.ok();
});

Expand Down

0 comments on commit cfba2a6

Please sign in to comment.