Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit 8af0e37

Browse files
committed
Refactor project to use Rollup for packaging
1 parent 244100c commit 8af0e37

File tree

17 files changed

+790
-305
lines changed

17 files changed

+790
-305
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
dist/*
2-
scripts/*
32
spec/*

.eslintrc.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
extends: 'eslint:recommended'
2+
parserOptions:
3+
sourceType: module
14
env:
25
browser: true
36
es6: true
4-
extends: 'eslint:recommended'
5-
globals:
6-
define: true
7-
module: true
87
rules:
98
indent:
109
- error

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ language: node_js
44
node_js:
55
- 8
66
- 9
7+
- 10
78
cache:
89
directories:
910
- node_modules

CONTRIBUTING.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
I'd love to have your help improving CashCash! If you'd like to pitch in, you can do so in a number of ways:
44

55
1. Look through open [Issues](https://github.com/jgarber623/CashCash/issues).
6-
2. Review any open [Pull Requests](https://github.com/jgarber623/CashCash/pulls).
7-
3. [Fork CashCash](#get-set-up-to-contribute) and fix an open Issue or add your own feature.
8-
4. File new Issues if you have a good idea or see a bug and don't know how to fix it yourself. _Only do this after you've made sure the behavior or problem you're seeing isn't already documented in an open Issue._
6+
1. Review any open [Pull Requests](https://github.com/jgarber623/CashCash/pulls).
7+
1. [Fork CashCash](#get-set-up-to-contribute) and fix an open Issue or add your own feature.
8+
1. File new Issues if you have a good idea or see a bug and don't know how to fix it yourself. _Only do this after you've made sure the behavior or problem you're seeing isn't already documented in an open Issue._
99

1010
I definitely appreciate your interest in (and help improving) CashCash. Thanks!
1111

@@ -24,15 +24,16 @@ If you're using a different operating system, use a different package manager, o
2424
Contributing to CashCash is pretty straightforward:
2525

2626
1. Fork the CashCash repo and clone it.
27-
2. Install development dependencies by running `npm install` from the root of the project.
28-
3. Create a feature branch for the issue or new feature you're looking to tackle: `git checkout -b your-descriptive-branch-name`.
29-
4. _Write some code!_
30-
5. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `npm test`.
31-
6. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`.
32-
7. Push the branch to your fork of CashCash: `git push origin your-descriptive-branch-name`.
33-
8. Create a new Pull Request and I'll give it a look!
34-
35-
## "But what files do I change?!?"
27+
1. Install development dependencies by running `npm install` from the root of the project.
28+
1. Create a feature branch for the issue or new feature you're looking to tackle: `git checkout -b your-descriptive-branch-name`.
29+
1. Run `npm start` which instructs [Rollup](https://rollupjs.org) to watch `src/cashcash.js` for changes and automatically exports built files to the `dist` folder.
30+
1. _Write some code!_
31+
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `npm test`.
32+
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`.
33+
1. Push the branch to your fork of CashCash: `git push origin your-descriptive-branch-name`.
34+
1. Create a new Pull Request and I'll give it a look!
35+
36+
## "But which files do I change?!?"
3637

3738
Excellent question. CashCash's source code is in the file `src/cashcash.js`. Make your changes here!
3839

README.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,11 @@
1616

1717
CashCash is also really tiny:
1818

19-
<table>
20-
<tbody>
21-
<tr>
22-
<th align="left">Uncompressed</th>
23-
<td>1,429 bytes</td>
24-
</tr>
25-
<tr>
26-
<th align="left">Minified</th>
27-
<td>888 bytes</td>
28-
</tr>
29-
<tr>
30-
<th align="left">Minified and gzipped</th>
31-
<td>523 bytes</td>
32-
</tr>
33-
</tbody>
34-
</table>
19+
| Format | File Size | Gzipped Size |
20+
|:-----------------------|:------------|:-------------|
21+
| Uncompressed (module) | 1,072 bytes | 516 bytes |
22+
| Uncompressed (browser) | 1,366 bytes | 613 bytes |
23+
| Minified (browser) | 870 bytes | 516 bytes |
3524

3625
## Getting CashCash
3726

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cashcash",
33
"description": "A very small DOM library inspired by jQuery.",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"main": "dist/cashcash.js",
66
"moduleType": [
77
"globals",

dist/cashcash.es.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*!
2+
* CashCash v1.2.0
3+
*
4+
* A very small DOM library inspired by jQuery.
5+
*
6+
* Source code available at: https://github.com/jgarber623/CashCash
7+
*
8+
* (c) 2016-present Jason Garber (https://sixtwothree.org)
9+
*
10+
* CashCash may be freely distributed under the MIT license.
11+
*/
12+
13+
var Cash = function(selector, context) {
14+
selector = typeof selector === "string" ? selector.trim() : "";
15+
if (selector.length) {
16+
selector = typeof context === "string" && context.trim().length ? context.trim() + " " + selector : selector;
17+
context = context instanceof HTMLElement ? context : document;
18+
var elements = context.querySelectorAll(selector), count = elements.length;
19+
this.length = count;
20+
this.context = context;
21+
this.selector = selector;
22+
while (count--) {
23+
this[count] = elements[count];
24+
}
25+
}
26+
};
27+
28+
var CashCash = function(selector, context) {
29+
return new Cash(selector, context);
30+
};
31+
32+
Cash.prototype = CashCash.prototype = {
33+
length: 0,
34+
toArray: function() {
35+
return Array.prototype.slice.call(this);
36+
}
37+
};
38+
39+
export default CashCash;

dist/cashcash.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* CashCash 1.1.0
2+
* CashCash v1.2.0
33
*
44
* A very small DOM library inspired by jQuery.
55
*
@@ -10,15 +10,9 @@
1010
* CashCash may be freely distributed under the MIT license.
1111
*/
1212

13-
(function(root, factory) {
14-
if (typeof define === "function" && define.amd) {
15-
define([], factory);
16-
} else if (typeof module === "object" && module.exports) {
17-
module.exports = factory();
18-
} else {
19-
root.CashCash = factory();
20-
}
21-
})(typeof self !== "undefined" ? self : this, function() {
13+
(function(global, factory) {
14+
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.CashCash = factory();
15+
})(this, function() {
2216
"use strict";
2317
var Cash = function(selector, context) {
2418
selector = typeof selector === "string" ? selector.trim() : "";
@@ -44,4 +38,4 @@
4438
}
4539
};
4640
return CashCash;
47-
});
41+
});

dist/cashcash.min.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* CashCash 1.1.0
2+
* CashCash v1.2.0
33
*
44
* A very small DOM library inspired by jQuery.
55
*
@@ -10,4 +10,4 @@
1010
* CashCash may be freely distributed under the MIT license.
1111
*/
1212

13-
!function(t,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():t.CashCash=e()}("undefined"!=typeof self?self:this,function(){"use strict";var t=function(t,e){if(t="string"==typeof t?t.trim():"",t.length){t="string"==typeof e&&e.trim().length?e.trim()+" "+t:t,e=e instanceof HTMLElement?e:document;var n=e.querySelectorAll(t),o=n.length;for(this.length=o,this.context=e,this.selector=t;o--;)this[o]=n[o]}},e=function(e,n){return new t(e,n)};return t.prototype=e.prototype={length:0,toArray:function(){return Array.prototype.slice.call(this)}},e});
13+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.CashCash=e()}(this,function(){"use strict";var t=function(t,e){if((t="string"==typeof t?t.trim():"").length){t="string"==typeof e&&e.trim().length?e.trim()+" "+t:t;var n=(e=e instanceof HTMLElement?e:document).querySelectorAll(t),o=n.length;for(this.length=o,this.context=e,this.selector=t;o--;)this[o]=n[o]}},e=function(e,n){return new t(e,n)};return t.prototype=e.prototype={length:0,toArray:function(){return Array.prototype.slice.call(this)}},e});

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h1>CashCash: Example</h1>
3030
<p id="paragraph-4">Morbi lacinia et dui a convallis. Donec vel leo vel tortor ultricies suscipit sit amet in neque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam euismod lectus aliquam, cursus massa eget, luctus enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis mollis, velit at varius cursus, leo quam porta justo, nec ornare sapien nulla nec eros. Praesent ligula ligula, condimentum a nulla ac, ultricies accumsan sapien. Aenean condimentum tortor et nulla gravida, ut efficitur enim placerat. Sed fermentum tempus pellentesque. Morbi porttitor orci a enim ornare, a sodales mi congue. Proin a consectetur ipsum.</p>
3131
</main>
3232

33-
<script src="../src/cashcash.js"></script>
33+
<script src="../dist/cashcash.js"></script>
3434
<script>
3535
var $main = CashCash('main'),
3636
$h1 = CashCash('h1', $main[0]),

0 commit comments

Comments
 (0)