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

new version #13

Merged
merged 2 commits into from
Oct 16, 2023
Merged
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
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