Skip to content

Commit

Permalink
adds new build chain
Browse files Browse the repository at this point in the history
* move eslint to package.json
* adds coverage script
* adds build and release scripts
* remove gulp
* update build instructions
* create and push a tag
* update eslintignore
* publish to npm last
* fixes npmcdn links
* omit version tag to always use the latest.
  • Loading branch information
stoeffel committed Feb 22, 2016
1 parent 74f3e96 commit df0903a
Show file tree
Hide file tree
Showing 37 changed files with 333 additions and 411 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.eslintrc.js
gulpfile.js
meteor-*.js
package.js
dist/**
scripts/**
coverage/**
node_modules/**
6 changes: 3 additions & 3 deletions .eslintrc.js → .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
{
"rules": {
"indent": [
2,
4
2
],
"quotes": [
2,
Expand All @@ -23,4 +23,4 @@ module.exports = {
"browser": true
},
"extends": "eslint:recommended"
};
}
9 changes: 2 additions & 7 deletions CONTRIBUTING.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ is out of scope.

(for maintainers)

- Upgrade version number `gulp bump --semver <version>`
- Build the library `gulp build`
- Commit build artifacts in `dist`
- Write a changelog entry to `CHANGELOG.markdown`
- Use Github compare to see what has changed from previous tag. Ex https://github.com/epeli/underscore.string/compare/3.0.0...master
- Add git tag
- `git tag -a 3.2.1 -m "3.2.1" && git push origin --tags`
- [Draft][d] a new Github release for the tag
- Push new release to npm
- Update the version in the `package.json`
- Publish a new version of _.string `npm run release`
- Update the [gh-pages][ghp] branch `gulp bump --semver <version> && gulp site`
- You need global installation of bower for this to work
- Local workaround:
Expand Down
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ filter(S.startsWith('.'), [
```

## Download

* [Development version](https://raw.github.com/epeli/underscore.string/master/dist/underscore.string.js) *Uncompressed with Comments*
* [Production version](https://github.com/epeli/underscore.string/raw/master/dist/underscore.string.min.js) *Minified*
* [Development version](https://npmcdn.com/underscore.string/dist/underscore.string.js) *Uncompressed with Comments*
* [Production version](https://npmcdn.com/underscore.string/dist/underscore.string.min.js) *Minified*

## API

Expand Down
2 changes: 1 addition & 1 deletion bench/endsWith.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var endsWith = require('../endsWith');

module.exports = function() {
endsWith("foobar", "xx");
endsWith('foobar', 'xx');
};
8 changes: 4 additions & 4 deletions bench/levenshtein.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var levenshtein = require('../levenshtein');

module.exports = function() {
levenshtein('pineapple', 'potato');
levenshtein('seven', 'eight');
levenshtein('the very same string', 'the very same string');
levenshtein('very very very long string', 'something completely different');
levenshtein('pineapple', 'potato');
levenshtein('seven', 'eight');
levenshtein('the very same string', 'the very same string');
levenshtein('very very very long string', 'something completely different');
};
2 changes: 1 addition & 1 deletion bench/slugify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var slugify = require('../slugify');

module.exports = function() {
slugify("Un éléphant à l'orée du bois");
slugify('Un éléphant à l\'orée du bois');
};
2 changes: 1 addition & 1 deletion bench/startsWith.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var startsWith = require('../startsWith');

module.exports = function() {
startsWith("foobar", "foo");
startsWith('foobar', 'foo');
};
4 changes: 2 additions & 2 deletions bench/succ.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = function() {
var letter = 'a', alphabet = [];

for (var i=0; i < 26; i++) {
alphabet.push(letter);
letter = succ(letter);
alphabet.push(letter);
letter = succ(letter);
}

return alphabet;
Expand Down
2 changes: 1 addition & 1 deletion bench/toNumber.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var toNumber = require('../toNumber');

module.exports = function() {
toNumber('10.232323', 2);
toNumber('10.232323', 2);
};
6 changes: 3 additions & 3 deletions bench/trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ var s = require('../');
var tests = {};

tests['trimNoNative'] = function() {
return s.trim(" foobar ", " ");
return s.trim(' foobar ', ' ');
};

tests['trim'] = function() {
return s.trim(" foobar ");
return s.trim(' foobar ');
};

tests['trim object-oriented'] = function() {
return s(" foobar ").trim().value();
return s(' foobar ').trim().value();
};

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion camelize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var decap = require('./decapitalize');

module.exports = function camelize(str, decapitalize) {
str = trim(str).replace(/[-_\s]+(.)?/g, function(match, c) {
return c ? c.toUpperCase() : "";
return c ? c.toUpperCase() : '';
});

if (decapitalize === true) {
Expand Down
14 changes: 7 additions & 7 deletions cleanDiacritics.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

var makeString = require('./helper/makeString');

var from = "ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž",
to = "aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz";
var from = 'ąàáäâãåæăćčĉęèéëêĝĥìíïîĵłľńňòóöőôõðøśșşšŝťțţŭùúüűûñÿýçżźž',
to = 'aaaaaaaaaccceeeeeghiiiijllnnoooooooossssstttuuuuuunyyczzz';

from += from.toUpperCase();
to += to.toUpperCase();

to = to.split("");
to = to.split('');

// for tokens requireing multitoken output
from += "ß";
from += 'ß';
to.push('ss');


module.exports = function cleanDiacritics(str) {
return makeString(str).replace(/.{1}/g, function(c){
var index = from.indexOf(c);
return index === -1 ? c : to[index];
return makeString(str).replace(/.{1}/g, function(c){
var index = from.indexOf(c);
return index === -1 ? c : to[index];
});
};
4 changes: 2 additions & 2 deletions escapeHTML.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var makeString = require('./helper/makeString');
var escapeChars = require('./helper/escapeChars');

var regexString = "[";
var regexString = '[';
for(var key in escapeChars) {
regexString += key;
}
regexString += "]";
regexString += ']';

var regex = new RegExp( regexString, 'g');

Expand Down
112 changes: 0 additions & 112 deletions gulpfile.js

This file was deleted.

22 changes: 11 additions & 11 deletions helper/escapeChars.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ nbsp is an HTML entity, but we don't want to escape all space characters in a st
*/
var escapeChars = {
'¢' : 'cent',
'£' : 'pound',
'¥' : 'yen',
'€': 'euro',
'©' :'copy',
'®' : 'reg',
'<' : 'lt',
'>' : 'gt',
'"' : 'quot',
'&' : 'amp',
"'" : '#39'
'¢' : 'cent',
'£' : 'pound',
'¥' : 'yen',
'€': 'euro',
'©' :'copy',
'®' : 'reg',
'<' : 'lt',
'>' : 'gt',
'"' : 'quot',
'&' : 'amp',
'\'' : '#39'
};

module.exports = escapeChars;
2 changes: 1 addition & 1 deletion helper/htmlEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var htmlEntities = {
gt: '>',
quot: '"',
amp: '&',
apos: "'"
apos: '\''
};

module.exports = htmlEntities;
35 changes: 19 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Underscore.string
// (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org>
// Underscore.string is freely distributable under the terms of the MIT license.
// Documentation: https://github.com/epeli/underscore.string
// Some code is borrowed from MooTools and Alexandru Marasteanu.
// Version '3.2.3'
/*
* Underscore.string
* (c) 2010 Esa-Matti Suuronen <esa-matti aet suuronen dot org>
* Underscore.string is freely distributable under the terms of the MIT license.
* Documentation: https://github.com/epeli/underscore.string
* Some code is borrowed from MooTools and Alexandru Marasteanu.
* Version '3.2.3'
* @preserve
*/

'use strict';

Expand Down Expand Up @@ -100,7 +103,7 @@ s.prototype = {
};

function fn2method(key, fn) {
if (typeof fn !== "function") return;
if (typeof fn !== 'function') return;
s.prototype[key] = function() {
var args = [this._wrapped].concat(Array.prototype.slice.call(arguments));
var res = fn.apply(null, args);
Expand All @@ -112,7 +115,7 @@ function fn2method(key, fn) {
// Copy functions to instance methods for chaining
for (var key in s) fn2method(key, s[key]);

fn2method("tap", function tap(string, fn) {
fn2method('tap', function tap(string, fn) {
return fn(string);
});

Expand All @@ -124,14 +127,14 @@ function prototype2method(methodName) {
}

var prototypeMethods = [
"toUpperCase",
"toLowerCase",
"split",
"replace",
"slice",
"substring",
"substr",
"concat"
'toUpperCase',
'toLowerCase',
'split',
'replace',
'slice',
'substring',
'substr',
'concat'
];

for (var method in prototypeMethods) prototype2method(prototypeMethods[method]);
Expand Down

0 comments on commit df0903a

Please sign in to comment.