Skip to content

Commit

Permalink
Merge pull request #160 from infinitered/use_uglify
Browse files Browse the repository at this point in the history
new bundle method for scripts
  • Loading branch information
GantMan authored Sep 4, 2019
2 parents 2424a38 + 30b0189 commit fb56ed9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ example/
_art/
yarn-error.log
bundle.js
.DS_Store
.DS_Store

# Ignore intermediate browserify files
# Mountpoint
dist/nsfwjs.d.ts
dist/nsfwjs.js
# Unminified bundle
dist/bundle.js

8 changes: 4 additions & 4 deletions example/minimal_demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>

<!-- Load the NSFWJS library from AWS -->
<script src="https://s3.amazonaws.com/ir_public/nsfwjscdn/bundle.js"></script>
<!-- <script src="https://s3.amazonaws.com/ir_public/nsfwjscdn/bundle.js"></script> -->

<!-- For testing: Load from local bundle `yarn scriptbundle` -->
<!-- <script src="../../dist/bundle.js"></script> -->
<!-- For testing: Load from local bundle `yarn scriptbundle && yarn minbundle` -->
<script src="../../dist/nsfwjs.min.js"></script>

<script>
const nsfwjs = require('nsfwjs')
// const nsfwjs = require('nsfwjs')
const img = new Image()
img.crossOrigin = 'anonymous'
// some image here
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "nsfwjs",
"version": "2.0.1",
"unpkg": "dist/nsfwjs.min.js",
"description": "Detect NSFW content client side",
"main": "dist/index.js",
"scripts": {
"test": "yarn build && jest",
"lint": "tslint -p . -t verbose",
"shipit": "yarn build && np",
"shipit": "yarn build && yarn scriptbundle && yarn minbundle && np",
"build": "tsc --skipLibCheck",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"prep": "yarn && yarn build && cd example/nsfw_demo/ && yarn add ../../ && cd -",
"scriptbundle": "browserify -r ./dist/index.js:nsfwjs > ./dist/bundle.js"
"scriptbundle": "browserify ./dist/nsfwjs.js --standalone nsfwjs --outfile ./dist/bundle.js",
"minbundle": "uglifyjs dist/bundle.js --compress --output dist/nsfwjs.min.js"
},
"repository": {
"type": "git",
Expand All @@ -38,7 +40,8 @@
"ts-jest": "^24.0.0",
"ts-node": "~8.3.0",
"tslint": "~5.19.0",
"typescript": "3.6.2"
"typescript": "3.6.2",
"uglify-js": "^3.6.0"
},
"keywords": [
"NSFW",
Expand Down
2 changes: 2 additions & 0 deletions src/nsfwjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// I exist to browserify
module.exports = require('./index')
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6360,7 +6360,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.2.tgz#105b0f1934119dde543ac8eb71af3a91009efe54"
integrity sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==

uglify-js@^3.1.4:
uglify-js@^3.1.4, uglify-js@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==
Expand Down

0 comments on commit fb56ed9

Please sign in to comment.