Skip to content

Commit

Permalink
Merge pull request #13 from cainus/v2
Browse files Browse the repository at this point in the history
new version
  • Loading branch information
cainus committed Oct 16, 2023
2 parents e0479d2 + 80c0f50 commit a752840
Show file tree
Hide file tree
Showing 22 changed files with 13,658 additions and 15,187 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
"env": {
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"never"
]
}
}
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 a752840

Please sign in to comment.