Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve tinyfunk.js as browser-friendly script through unpkg #10

Merged
merged 2 commits into from
Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
<p align="center">
<a href="https://www.npmjs.com/package/tinyfunk"><img src="https://img.shields.io/npm/v/tinyfunk.svg" alt="npm version" style="max-width:100%;"></a>
<a href="https://www.npmjs.com/package/tinyfunk"><img src="https://img.shields.io/npm/dm/tinyfunk.svg" alt="npm downloads" style="max-width:100%;"></a>
<a href="#"><img src="https://img.shields.io/badge/gzip--size-1.29%20kB-blue.svg" alt="gzip-size" style="max-width:100%;"></a>
<a href="#"><img src="https://img.shields.io/badge/gzip--size-1.31%20kB-blue.svg" alt="gzip-size" style="max-width:100%;"></a>
<br />
<a href="https://travis-ci.org/flintinatux/tinyfunk"><img src="https://travis-ci.org/flintinatux/tinyfunk.svg?branch=master" alt="Build Status" style="max-width:100%;"></a>
<a href="https://coveralls.io/github/flintinatux/tinyfunk?branch=master"><img src="https://coveralls.io/repos/github/flintinatux/tinyfunk/badge.svg?branch=master" alt="Coverage Status" style="max-width:100%;"></a>
<a href="https://nodesecurity.io/orgs/flintinatux/projects/d5f96f7c-898a-4244-a9d2-4f3c429d5f3d"><img src="https://nodesecurity.io/orgs/flintinatux/projects/d5f96f7c-898a-4244-a9d2-4f3c429d5f3d/badge" alt="NSP Status" style="max-width:100%;"></a>
</p>

## Documentation

- [Motivation](#motivation)
- [Caveat Emptor](#caveat-emptor)
- [API](#api)
- [Dependents](#dependents)

## Motivation

Most popular functional libraries, like [Ramda](https://www.npmjs.com/package/ramda), are quite large. To use them in a frontend project, it's common to import only the bits you need (to keep the bundle size down) like this:
Expand Down Expand Up @@ -124,3 +131,9 @@ If you've lived with FP long enough, you are likely familiar with most of the fu
| `values` | `{ k: v } -> [v]` |
| `when` | `(a -> Boolean) -> (a -> a) -> a -> a` |
| `zipObj` | `[k] -> [v] -> { k: v }` |

## Dependents

I use `tinyfunk` everyday to make cool things. Maybe you do, too. If so, let me know with a PR, and we can add your cool things to this list.

- [`puddles`](https://github.com/flintinatux/puddles) - _Tiny vdom app framework. Pure Redux. No boilerplate._ - Built with ❤️ on `tinyfunk`.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ramda"
],
"main": "src.js",
"unpkg": "tinyfunk.js",
"author": "flintinatux",
"license": "MIT",
"nyc": {
Expand All @@ -23,7 +24,7 @@
"branches": 100
},
"scripts": {
"build": "./node_modules/uglify-es/bin/uglifyjs src.js -cm --toplevel > tinyfunk.js",
"build": "./node_modules/uglify-es/bin/uglifyjs src.js -cm --toplevel --wrap tinyfunk > tinyfunk.js",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a tip, npm is smart enough to have node_modules on its path, so if you'd like, you could reduce this to

"build": "uglifyjs src.js -cm --toplevel --wrap tinyfunk > tinyfunk.js",

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I originally included that relative path because at one point I was also building an es5 bundle, and had both uglify-js and uglify-es as deps. Sadly, they share the same executable name, so it always called the wrong one. The relative path fixed that by calling the one I wanted explicitly.

I removed the es5 build at some point, but forgot to change this command. Good find.

"clean": "rm -f tinyfunk.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint src.js test",
Expand All @@ -44,6 +45,6 @@
"mocha": "^3.5.3",
"nyc": "^11.2.1",
"prop-factory": "^1.0.0",
"uglify-es": "^3.1.1"
"uglify-es": "^3.3.9"
}
}
4 changes: 2 additions & 2 deletions src.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const keys = reduceObj(_appendKey, [])
// values :: { k: v } -> [v]
const values = converge(props, [ keys, identity ])

module.exports = {
_assign(exports, {
add,
append,
apply,
Expand Down Expand Up @@ -408,4 +408,4 @@ module.exports = {
values,
when,
zipObj
}
})
2 changes: 1 addition & 1 deletion tinyfunk.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 14 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,14 @@ commander@2.9.0:
dependencies:
graceful-readlink ">= 1.0.0"

commander@^2.9.0, commander@~2.11.0:
commander@^2.9.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"

commander@~2.13.0:
version "2.13.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"

commondir@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
Expand Down Expand Up @@ -2092,6 +2096,10 @@ source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

spawn-wrap@^1.3.8:
version "1.3.8"
resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.3.8.tgz#fa2a79b990cbb0bb0018dca6748d88367b19ec31"
Expand Down Expand Up @@ -2297,12 +2305,12 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

uglify-es@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.1.tgz#27615a1203cd0b351d8b5bda743ac92ed482b826"
uglify-es@^3.3.9:
version "3.3.9"
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
dependencies:
commander "~2.11.0"
source-map "~0.5.1"
commander "~2.13.0"
source-map "~0.6.1"

uglify-js@^2.6:
version "2.8.29"
Expand Down