Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*~
.*.swp
*.js
/.history/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
18
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
.PHONY: build test tag

TESTS=$(shell cd test && ls *.coffee | sed s/\.coffee$$//)
ESMTESTS=$(shell cd test/ESM && ls *.coffee | sed s/\.coffee$$//)

build: underscore.deep.js

underscore.deep.js: underscore.deep.coffee
node_modules/coffee-script/bin/coffee --bare -c underscore.deep.coffee
# compile coffeescript files to ./dist/esm
coffeescript-compile-to-esm:
node_modules/.bin/coffee --bare -o dist/esm -c src/*.coffee

test: $(TESTS) README.coffee.md
# transpile ESM to CJS using mkdist
mkdist: coffeescript-compile-to-esm
node_modules/.bin/mkdist . --src=dist/esm --dist=dist/cjs --format=cjs --pattern='*.js'

underscore.deep.js: mkdist

test: $(TESTS) README.coffee.md $(ESMTESTS)

README.coffee.md: build
node_modules/mocha/bin/mocha --reporter spec --compilers coffee:coffee-script README.coffee.md
node_modules/.bin/mocha --reporter spec --require coffeescript/register README.coffee.md

$(TESTS): build
@echo $(LIBS)
node_modules/mocha/bin/mocha --bail --timeout 60000 --compilers coffee:coffee-script test/$@.coffee
node_modules/.bin/mocha --bail --timeout 60000 --require coffeescript/register test/$@.coffee

$(ESMTESTS): build
@echo $(ESMLIBS)
node_modules/.bin/coffee --bare -c test/ESM/$@.coffee
node_modules/.bin/mocha --bail --timeout 60000 --input-type=module test/ESM/$@.js

tag:
$(eval VERSION := $(shell grep version package.json | sed -ne 's/^[ ]*"version":[ ]*"\([0-9\.]*\)",/\1/p';))
Expand Down
20 changes: 19 additions & 1 deletion README.coffee.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ npm install underscore.deep

## Usage

Javascript (EcmaScript module):

```js
import _ from 'underscore';
import underscoreDeep from 'underscore.deep';
_.mixin(underscoreDeep);
```

Javascript (CommonJS module):

```js
const _ = require('underscore');
const underscoreDeep = require('underscore.deep');
_.mixin(underscoreDeep);
```

CoffeeScript:

```
_ = require 'underscore'
_.mixin require 'underscore.deep'
Expand All @@ -32,7 +50,7 @@ _.mixin require 'underscore.deep'
describe 'underscore.deep', ->
assert = require 'assert'
_ = require 'underscore'
_.mixin require './underscore.deep'
_.mixin require 'underscore.deep'

### _.deepToFlat(obj)

Expand Down
Loading