Skip to content

Commit

Permalink
new version: removes explicit browser support. separates getters/sett…
Browse files Browse the repository at this point in the history
…ers for stronger typing. uses typescript & jest. uses WHATWG classes and drops node.js imports and 3rd-party deps.
  • Loading branch information
cainus committed Aug 1, 2022
1 parent e0479d2 commit 3a41522
Show file tree
Hide file tree
Showing 16 changed files with 3,097 additions and 15,187 deletions.
39 changes: 2 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,8 @@
REPORTER = spec

lint:
./node_modules/.bin/jshint ./test ./index.js ./util.js

browser-test:
$(MAKE) browser-build
gnome-open test.html

browser-build-min:
@rm -f urlgrey.min.js
@./node_modules/.bin/browserify index.js \
-s urlgrey | \
./node_modules/.bin/uglifyjs > urlgrey.min.js

browser-build:
@rm -f urlgrey.js
@./node_modules/.bin/browserify index.js \
-s urlgrey > urlgrey.js

precommit:
$(MAKE) test
$(MAKE) browser-build
$(MAKE) browser-build-min
echo "Artifacts built!"
npx eslint .

test:
$(MAKE) lint
@NODE_ENV=test ./node_modules/.bin/mocha --bail --reporter $(REPORTER)

test-cov:
$(MAKE) lint
@NODE_ENV=test ./node_modules/.bin/istanbul cover \
./node_modules/mocha/bin/_mocha -- -R spec

test-coveralls:
echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
$(MAKE) test
@NODE_ENV=test ./node_modules/.bin/istanbul cover \
./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && \
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true
@NODE_ENV=test ./node_modules/.bin/jest

.PHONY: test
23 changes: 0 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,33 +189,10 @@ Setter/getter for the username portion of the url.
`npm install urlgrey --save`

Also! If you're using urlgrey in an http application, see [urlgrey-connect](https://github.com/cainus/urlgrey-connect). It gives you an urlgrey object already instantiated with the request url as req.uri in all your request handlers.
### in the browser:
Lots of options:
* grab urlgrey.js from the root of this repo for [browserify](http://browserify.org/)-built, unminified version.
* grab urlgrey.min.js from the root of this repo for a [browserify](http://browserify.org/)-built, minified version.
* use [browserify](http://browserify.org/) and include this like any other node package.


## Contributing:
### Testing:
#### Run the node tests:
* `make test`

#### Run the browser file:// tests:
* `make browser-build`
* ...then open test.html in a browser

#### Run the browser tests on a real server:
* `make browser-build`
* `python -m SimpleHTTPServer 9999`
* ...then open http://localhost://9999/test.html in a browser

### Building before committing
* `make precommit`

### Running node tests with a coverage report
* `make test-cov`




Loading

0 comments on commit 3a41522

Please sign in to comment.