Skip to content

Commit d4de352

Browse files
committed
Drop support for legacy environments and package managers
1 parent 5566334 commit d4de352

File tree

8 files changed

+19
-186
lines changed

8 files changed

+19
-186
lines changed

.travis.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,9 @@ node_js:
33
- "0.10"
44
- "0.12"
55
- "4"
6-
- "5"
76
- "6"
8-
before_script:
9-
- "npm install -g grunt-cli"
10-
# Narwhal uses a hardcoded path to openjdk v6, so use that version
11-
- "sudo apt-get update -qq"
12-
- "sudo apt-get install -qq openjdk-6-jre"
13-
- "PACKAGE=rhino1_7R5; wget https://github.com/mozilla/rhino/releases/download/Rhino1_7R5_RELEASE/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
14-
- "PACKAGE=rhino1_7R5; echo -e '#!/bin/sh\\njava -jar /opt/'$PACKAGE'/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino"
15-
- "PACKAGE=ringojs-0.11; wget https://github.com/ringo/ringojs/releases/download/v0.11.0/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
16-
- "PACKAGE=ringojs-0.11; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo"
17-
- "PACKAGE=v0.3.2; wget https://github.com/280north/narwhal/archive/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip"
18-
- "PACKAGE=narwhal-0.3.2; sudo ln -s /opt/$PACKAGE/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal"
19-
# If the enviroment stores rt.jar in a different directory, find it and symlink the directory
20-
- "PREFIX=/usr/lib/jvm; if [ ! -d $PREFIX/java-6-openjdk ]; then for d in $PREFIX/java-6-openjdk-*; do if [ -e $d/jre/lib/rt.jar ]; then sudo ln -s $d $PREFIX/java-6-openjdk; break; fi; done; fi"
21-
- "sudo apt-get install -qq python; python --version"
7+
- "8"
228
script:
23-
- "grunt ci"
9+
- npm run ci
2410
after_script:
25-
- "grunt shell:cover-coveralls"
11+
- npm run cover-coveralls

Gruntfile.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,11 @@ module.exports = function(grunt) {
77
'stderr': true,
88
'failOnError': true
99
},
10-
'generate-test-data': { // Only when needed
11-
'command': 'if [ ! -f data.json ]; then python generate-test-data.py; fi',
12-
'options': {
13-
'execOptions': {
14-
'cwd': 'tests'
15-
}
16-
}
17-
},
1810
'cover-html': {
1911
'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"; istanbul report --root "coverage" --format "html"'
2012
},
2113
'cover-coveralls': {
22-
'command': 'istanbul cover --verbose --dir "coverage" "tests/tests.js" && coveralls < coverage/lcov.info|coveralls < coverage/lcov.info; rm -rf coverage/lcov*'
23-
},
24-
'test-narwhal': {
25-
'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"'
26-
},
27-
'test-phantomjs': {
28-
'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
29-
},
30-
'test-rhino': {
31-
'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
32-
'options': {
33-
'execOptions': {
34-
'cwd': 'tests'
35-
}
36-
}
37-
},
38-
'test-ringo': {
39-
'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"'
14+
'command': 'istanbul cover --verbose --dir "coverage" "tests/tests.js" && coveralls < coverage/lcov.info; rm -rf coverage/lcov*'
4015
},
4116
'test-node': {
4217
'command': 'echo "Testing in Node..."; node "tests/tests.js"'
@@ -55,10 +30,6 @@ module.exports = function(grunt) {
5530
grunt.registerTask('cover', 'shell:cover-html');
5631
grunt.registerTask('ci', [
5732
'shell:generate-test-data',
58-
'shell:test-narwhal',
59-
'shell:test-phantomjs',
60-
'shell:test-rhino',
61-
'shell:test-ringo',
6233
'shell:test-node',
6334
]);
6435
grunt.registerTask('test', [

README.md

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,16 @@ Via [npm](https://www.npmjs.com/):
1212
npm install utf8
1313
```
1414

15-
Via [Bower](http://bower.io/):
16-
17-
```bash
18-
bower install utf8
19-
```
20-
21-
Via [Component](https://github.com/component/component):
22-
23-
```bash
24-
component install mathiasbynens/utf8.js
25-
```
26-
2715
In a browser:
2816

2917
```html
3018
<script src="utf8.js"></script>
3119
```
3220

33-
In [Narwhal](http://narwhaljs.org/), [Node.js](https://nodejs.org/), and [RingoJS ≥ v0.8.0](http://ringojs.org/):
34-
35-
```js
36-
var utf8 = require('utf8');
37-
```
38-
39-
In [Rhino](http://www.mozilla.org/rhino/):
40-
41-
```js
42-
load('utf8.js');
43-
```
44-
45-
Using an AMD loader like [RequireJS](http://requirejs.org/):
21+
In [Node.js](https://nodejs.org/):
4622

4723
```js
48-
require(
49-
{
50-
'paths': {
51-
'utf8': 'path/to/utf8'
52-
}
53-
},
54-
['utf8'],
55-
function(utf8) {
56-
console.log(utf8);
57-
}
58-
);
24+
const utf8 = require('utf8');
5925
```
6026

6127
## API

bower.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

component.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,18 @@
2525
"utf8.js"
2626
],
2727
"scripts": {
28-
"test": "node tests/tests.js"
28+
"test": "node tests/tests.js",
29+
"test-extended": "node tests/tests.js --extended",
30+
"test-browser": "open tests/index.html",
31+
"ci": "npm run build && npm test",
32+
"build": "cd tests; if [ ! -f data.json ]; then python generate-test-data.py; fi",
33+
"cover-html": "istanbul cover --report html --verbose --dir coverage tests/tests.js; istanbul report --root coverage --format html",
34+
"cover-coveralls": "istanbul cover --verbose --dir coverage tests/tests.js && coveralls < coverage/lcov.info; rm -rf coverage/lcov*"
2935
},
3036
"devDependencies": {
3137
"coveralls": "^2.11.14",
32-
"grunt": "^1.0.1",
33-
"grunt-shell": "^1.1.2",
3438
"istanbul": "^0.4.5",
3539
"qunit-extras": "^1.4.2",
36-
"qunitjs": "~1.11.0",
37-
"requirejs": "^2.3.2"
40+
"qunitjs": "~1.11.0"
3841
}
3942
}

tests/index.html

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,6 @@
99
<div id="qunit"></div>
1010
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
1111
<script src="../utf8.js"></script>
12-
<script>
13-
// populate `QUnit.urlParams`
14-
QUnit.urlParams.norequire = /[?&]norequire=true(?:&|$)/.test(location.search);
15-
16-
// load tests.js if not using require.js
17-
document.write(QUnit.urlParams.norequire
18-
? '<script src="tests.js"><\/script>'
19-
: '<script src="../node_modules/requirejs/require.js"><\/script>'
20-
);
21-
</script>
22-
<script>
23-
window.require && require({
24-
'baseUrl': '../node_modules/requirejs/',
25-
'urlArgs': 't=' + (+new Date),
26-
'paths': {
27-
'utf8': '../../utf8'
28-
}
29-
},
30-
['utf8'], function(utf8) {
31-
require(['tests.js']);
32-
});
33-
</script>
12+
<script src="tests.js"></script>
3413
</body>
3514
</html>

utf8.js

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
/*! https://mths.be/utf8js v2.1.2 by @mathias */
22
;(function(root) {
33

4-
// Detect free variables `exports`
5-
var freeExports = typeof exports == 'object' && exports;
6-
7-
// Detect free variable `module`
8-
var freeModule = typeof module == 'object' && module &&
9-
module.exports == freeExports && module;
10-
11-
// Detect free variable `global`, from Node.js or Browserified code,
12-
// and use it as `root`
13-
var freeGlobal = typeof global == 'object' && global;
14-
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
15-
root = freeGlobal;
16-
}
17-
18-
/*--------------------------------------------------------------------------*/
19-
204
var stringFromCharCode = String.fromCharCode;
215

226
// Taken from https://mths.be/punycode
@@ -211,34 +195,8 @@
211195

212196
/*--------------------------------------------------------------------------*/
213197

214-
var utf8 = {
215-
'version': '2.1.2',
216-
'encode': utf8encode,
217-
'decode': utf8decode
218-
};
219-
220-
// Some AMD build optimizers, like r.js, check for specific condition patterns
221-
// like the following:
222-
if (
223-
typeof define == 'function' &&
224-
typeof define.amd == 'object' &&
225-
define.amd
226-
) {
227-
define(function() {
228-
return utf8;
229-
});
230-
} else if (freeExports && !freeExports.nodeType) {
231-
if (freeModule) { // in Node.js or RingoJS v0.8.0+
232-
freeModule.exports = utf8;
233-
} else { // in Narwhal or RingoJS v0.7.0-
234-
var object = {};
235-
var hasOwnProperty = object.hasOwnProperty;
236-
for (var key in utf8) {
237-
hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
238-
}
239-
}
240-
} else { // in Rhino or a web browser
241-
root.utf8 = utf8;
242-
}
198+
root.version = '2.1.2';
199+
root.encode = utf8encode;
200+
root.decode = utf8decode;
243201

244-
}(this));
202+
}(typeof exports === 'undefined' ? this.utf8 = {} : exports));

0 commit comments

Comments
 (0)