Skip to content

Commit 853191e

Browse files
committed
Changed structure of building folders
1 parent 18870fd commit 853191e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+58
-36
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

bin/node/cli.js bin/cli.js

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "JsBarcode",
3-
"main": "bin/browser/JsBarcode.all.js",
3+
"main": "dist/JsBarcode.all.min.js",
44
"version": "3.3.5",
55
"homepage": "https://github.com/lindell/JsBarcode",
66
"authors": [
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

example/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title></title>
6-
<script src="../bin/browser/JsBarcode.all.js"></script>
6+
<script src="../dist/JsBarcode.all.js"></script>
77
<script>
88
Number.prototype.zeroPadding = function(){
99
var ret = "" + this.valueOf();

example/toBase64.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title></title>
6-
<script src="../JsBarcode.js"></script>
7-
<script src="../barcodes/CODE39.js"></script>
6+
<script src="../dist/JsBarcode.all.js"></script>
87
<script>
98
function textToBase64Barcode(text){
109
var canvas = document.createElement("canvas");

gulpfile.js

+38-15
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ var clean = require('gulp-clean');
1212
var gulpWebpack = require('webpack-stream');
1313
var webpack = require('webpack');
1414
var gzipSize = require('gzip-size');
15+
var request = require('request');
1516

1617
var fs = require('fs');
1718

1819
gulp.task("clean", function(){
19-
return gulp.src("bin/", {read: false})
20+
return gulp.src(["bin/", "dist/"], {read: false})
2021
.pipe(clean());
2122
});
2223

@@ -30,31 +31,31 @@ function babelFunc(){
3031
presets: ['es2015'],
3132
plugins: [["transform-es2015-classes", {loose: true}]]
3233
}))
33-
.pipe(gulp.dest("bin/node/"));
34+
.pipe(gulp.dest("bin/"));
3435
}
3536

3637
gulp.task("webpack", ["babel"], function () {
3738
return webpackFunc();
3839
});
3940

4041
function webpackFunc(){
41-
return gulp.src('bin/node/JsBarcode.js')
42+
return gulp.src('bin/JsBarcode.js')
4243
.pipe(gulpWebpack(
4344
{
4445
output: {
4546
filename: 'JsBarcode.all.js',
4647
}
4748
}
4849
, webpack))
49-
.pipe(gulp.dest("bin/browser/"));
50+
.pipe(gulp.dest("dist/"));
5051
}
5152

5253
gulp.task("webpack-min", ["babel"], function () {
5354
return webpackMin('JsBarcode.all.min.js');
5455
});
5556

5657
function webpackMin(filename){
57-
return gulp.src('bin/node/JsBarcode.js')
58+
return gulp.src('bin/JsBarcode.js')
5859
.pipe(gulpWebpack(
5960
{
6061
output: {
@@ -63,7 +64,7 @@ function webpackMin(filename){
6364
plugins: [new webpack.optimize.UglifyJsPlugin()],
6465
}
6566
, webpack))
66-
.pipe(gulp.dest("bin/browser/"));
67+
.pipe(gulp.dest("dist/"));
6768
}
6869

6970
gulp.task("webpack-all", function (cb) {
@@ -78,8 +79,8 @@ gulp.task("webpack-all", function (cb) {
7879
toFile += "export default {" + barcode.names + "}";
7980

8081
fs.writeFile("src/barcodes/index.js", toFile, function(){
81-
if(fs.existsSync("bin/node/barcodes/index.js")){
82-
fs.unlinkSync("bin/node/barcodes/index.js");
82+
if(fs.existsSync("bin/barcodes/index.js")){
83+
fs.unlinkSync("bin/barcodes/index.js");
8384
}
8485
babelFunc().on('end', function(){
8586
webpackMin("barcodes/" + barcode.filename).on('end', callback);
@@ -126,7 +127,9 @@ gulp.task('git-release', ['compress'], function(cb){
126127
var v = 'v' + pkg.version;
127128
var message = 'Release ' + v;
128129

129-
gulp.src(['./package.json', './bower.json', './bin/'])
130+
updateReadmeFileSizes();
131+
132+
gulp.src(['./package.json', './bower.json', './README.md', './bin/', './dist'])
130133
.pipe(git.add({args: '--all'}))
131134
.pipe(git.commit(message));
132135

@@ -172,16 +175,37 @@ gulp.task('github-release', function(done) {
172175
repo: "JsBarcode",
173176
tag: v,
174177
name: name,
175-
assets: [__dirname + "/bin/browser/JsBarcode.all.min.js", __dirname + "/bin/browser/JsBarcode.all.js"]
178+
assets: [__dirname + "/dist/JsBarcode.all.min.js", __dirname + "/dist/JsBarcode.all.js"]
176179
}, done);
177180
});
178181

179-
gulp.task('update-readme-sizes', function(){
182+
gulp.task('jsdelivr', function(){
183+
request({
184+
url: "https://api.jsdelivr.com/v1/jsdelivr/libraries?name=jsbarcode",
185+
json: true
186+
}, function (error, response, body) {
187+
if (!error && response.statusCode === 200) {
188+
var readme = fs.readFileSync('README.md', "utf-8");
189+
var version = body[0].lastversion;
190+
191+
readme = readme.replace(/https:\/\/cdn\.jsdelivr\.net\/jsbarcode\/[0-9]+\.[0-9]+\.[0-9]+\//g,
192+
"https://cdn.jsdelivr.net/jsbarcode/" + version + "/");
193+
194+
fs.writeFileSync('README.md', readme, 'utf8');
195+
196+
console.log("New version: " + version);
197+
}
198+
})
199+
});
200+
201+
gulp.task("update-readme-sizes", updateReadmeFileSizes);
202+
203+
function updateReadmeFileSizes(){
180204
var files = require('./barcode-building.json');
181205
var readme = fs.readFileSync('README.md', "utf-8");
182206

183207
// Update .all files
184-
var data = fs.readFileSync('bin/browser/JsBarcode.all.min.js');
208+
var data = fs.readFileSync('dist/JsBarcode.all.min.js');
185209
var filesize = gzipSize.sync(data);
186210

187211
var regexp = new RegExp('\\|[^\\|]*\\|([ \\t\\*]*\\[JsBarcode\\.all\\.min\\.js\\])');
@@ -191,7 +215,7 @@ gulp.task('update-readme-sizes', function(){
191215
for(var i in files){
192216
var filename = files[i].filename;
193217

194-
var data = fs.readFileSync('bin/browser/barcodes/' + filename);
218+
var data = fs.readFileSync('dist/barcodes/' + filename);
195219
var filesize = gzipSize.sync(data);
196220

197221
var regexp = new RegExp('\\|[^\\|]*\\|([ \\t]*\\[' + RegExp.escape(filename) + '\\])');
@@ -200,7 +224,7 @@ gulp.task('update-readme-sizes', function(){
200224
}
201225

202226
fs.writeFileSync('README.md', readme, 'utf8');
203-
});
227+
}
204228

205229
function formatSize(bytes){
206230
var kilobytes = Math.round(bytes/1024*10)/10;
@@ -233,7 +257,6 @@ gulp.task('compile-web', ['webpack'], function(done){
233257

234258
gulp.task('release', function(callback){
235259
runSequence(
236-
'update-readme-sizes',
237260
'git-release',
238261
'wait',
239262
'github-release',

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "jsbarcode",
33
"version": "3.3.5",
44
"description": "JsBarcode is a simple and powerfull way to create different types of 1d barcodes.",
5-
"main": "./bin/node/JsBarcode.js",
5+
"main": "./bin/JsBarcode.js",
66
"directories": {
77
"example": "example",
88
"test": "test",
@@ -35,8 +35,8 @@
3535
"url": "https://github.com/lindell/JsBarcode/issues"
3636
},
3737
"bin": {
38-
"JsBarcode": "./bin/node/cli.js",
39-
"jsbarcode": "./bin/node/cli.js"
38+
"JsBarcode": "./bin/cli.js",
39+
"jsbarcode": "./bin/cli.js"
4040
},
4141
"homepage": "https://github.com/lindell/JsBarcode#readme",
4242
"devDependencies": {

test/browser/canvasTest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Test minified version</title>
6-
<script src="../../bin/browser/JsBarcode.all.js"></script>
6+
<script src="../../dist/JsBarcode.all.js"></script>
77

88
<script src="tests.js"></script>
99
<script src="canvasTest.js"></script>

test/browser/initTest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>Test minified version</title>
66
<script src="help/jquery-2.2.3.js"></script>
7-
<script src="../../bin/browser/JsBarcode.all.js"></script>
7+
<script src="../../dist/JsBarcode.all.js"></script>
88
<style>
99
@font-face {
1010
font-family: "OCRB";

test/browser/jQueryTest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Test minified version</title>
66
<script src="help/jquery-2.2.3.js"></script>
77

8-
<script src="../../bin/browser/JsBarcode.all.js"></script>
8+
<script src="../../dist/JsBarcode.all.js"></script>
99

1010
<script src="tests.js"></script>
1111
<script src="jQueryTest.js"></script>

test/browser/svgTest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Test minified version</title>
6-
<script src="../../bin/browser/JsBarcode.all.js"></script>
6+
<script src="../../dist/JsBarcode.all.js"></script>
77

88
<script src="tests.js"></script>
99
<script src="svgTest.js"></script>

test/browser/tests.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ function createTests(newTest){
22
newTest("This has a \nnewline", {width: 1});
33
newTest("\tHi\nHI", {width: 1});
44
newTest("A little test!", {format: "CODE128", width: 1});
5-
newTest("A LITTLE TEST", {format: "CODE39", width: 1});
5+
newTest("ABCDEFG", {format: "CODE39", width: 1, mod43: true});
66
newTest("A little test", {format: "CODE39", width: 1});
77
newTest("12345", {format: "EAN5", width: 1});
88
newTest("52", {format: "EAN2", width: 1});
99
newTest("423514346455", {format: "UPC", width: 2, textMargin: 0});
10-
newTest("5901234123457", {format: "EAN13", fontSize: 20, textMargin: 0});
10+
newTest("5901234123457", {format: "EAN13", fontSize: 20, textMargin: 0, lastChar: ">"});
1111
newTest("590123412345", {format: "EAN13", width: 2, fontSize: 16});
1212
newTest("590123412345", {format: "EAN13", width: 3});
1313
newTest("96385074", {format: "EAN8", width: 1});

test/node/CODE128.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55

test/node/CODE39.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55

test/node/EAN-UPC.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44
var help = require("./help/help");
55

test/node/ITF-14.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55

test/node/ITF.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55

test/node/JsBarcode.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55
describe('Encoders', function() {

test/node/MSI.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55

test/node/pharmacode.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var assert = require('assert');
2-
var JsBarcode = require('../../bin/node/JsBarcode.js');
2+
var JsBarcode = require('../../bin/JsBarcode.js');
33
var Canvas = require("canvas");
44

55
describe('Pharmacode', function() {

0 commit comments

Comments
 (0)