updated build targets and tfjs to 2.7.0

pull/293/head
Vladimir Mandic 2020-10-28 15:02:59 -04:00
parent 14503e9eea
commit e5a9113721
2 changed files with 13 additions and 11 deletions

View File

@ -41,15 +41,16 @@ There are multiple ways to use `Human` library, pick one that suits you:
- `dist/human.js`: IIFE format bundle with TFJS for Browsers - `dist/human.js`: IIFE format bundle with TFJS for Browsers
- `dist/human.esm.js`: ESM format bundle with TFJS for Browsers - `dist/human.esm.js`: ESM format bundle with TFJS for Browsers
- `dist/human.esm-nobundle.js`: ESM format bundle without TFJS for Browsers - `dist/human.esm-nobundle.js`: ESM format bundle without TFJS for Browsers
- `dist/human.cjs`: CommonJS format bundle without TFJS for NodeJS - `dist/human.node.js`: CommonJS format bundle with TFJS for NodeJS
- `dist/human.node-nobundle.js`: CommonJS format bundle without TFJS for NodeJS
All versions include `sourcemap` and build `manifest` All versions include `sourcemap` *(.map)* and build `manifest` *(.json)*
While `Human` is in pre-release mode, all bundles are non-minified While `Human` is in pre-release mode, all bundles are non-minified
Defaults: Defaults:
```json ```json
{ {
"main": "dist/human.cjs", "main": "dist/human.node.js",
"module": "dist/human.esm.js", "module": "dist/human.esm.js",
"browser": "dist/human.esm.js", "browser": "dist/human.esm.js",
} }
@ -103,7 +104,7 @@ Install with:
```js ```js
import Human from '@vladmandic/human'; // points to @vladmandic/human/dist/human.esm.js import Human from '@vladmandic/human'; // points to @vladmandic/human/dist/human.esm.js
// you can also force-load specific version // you can also force-load specific version
// for example: `@vladmandic/human/dist/human.esm.js` // for example: `@vladmandic/human/dist/human.esm-nobundle.js`
const human = new Human(); const human = new Human();
``` ```
@ -123,7 +124,7 @@ Install with:
*Recommended for `NodeJS` projects that will execute in the backend* *Recommended for `NodeJS` projects that will execute in the backend*
Entry point is bundle in CJS format `dist/human.node.js` Entry point is bundle in CommonJS format `dist/human.node.js`
You also need to install and include `tfjs-node` or `tfjs-node-gpu` in your project so it can register an optimized backend You also need to install and include `tfjs-node` or `tfjs-node-gpu` in your project so it can register an optimized backend
Install with: Install with:
@ -133,7 +134,7 @@ Install with:
And then use with: And then use with:
```js ```js
const tf = require('@tensorflow/tfjs-node'); // can also use '@tensorflow/tfjs-node-gpu' if you have environment with CUDA extensions const tf = require('@tensorflow/tfjs-node'); // can also use '@tensorflow/tfjs-node-gpu' if you have environment with CUDA extensions
const Human = require('@vladmandic/human').default; // points to @vladmandic/human/dist/human.cjs const Human = require('@vladmandic/human').default; // points to @vladmandic/human/dist/human.node.js
const human = new Human(); const human = new Human();
``` ```
@ -162,7 +163,7 @@ Browser:
- `index.html`, `browser.js`, `worker.js`: Full demo using Browser with ESM module, includes selectable backends and webworkers - `index.html`, `browser.js`, `worker.js`: Full demo using Browser with ESM module, includes selectable backends and webworkers
NodeJS: NodeJS:
- `node.js`: Demo using NodeJS with CJS module - `node.js`: Demo using NodeJS with CommonJS module
This is a very simple demo as althought `Human` library is compatible with NodeJS execution This is a very simple demo as althought `Human` library is compatible with NodeJS execution
and is able to load images and models from local filesystem, and is able to load images and models from local filesystem,

View File

@ -26,7 +26,7 @@
"@tensorflow/tfjs-node": "^2.7.0", "@tensorflow/tfjs-node": "^2.7.0",
"@vladmandic/pilogger": "^0.2.6", "@vladmandic/pilogger": "^0.2.6",
"dayjs": "^1.9.4", "dayjs": "^1.9.4",
"esbuild": "^0.7.21", "esbuild": "^0.7.22",
"eslint": "^7.12.1", "eslint": "^7.12.1",
"eslint-config-airbnb-base": "^14.2.0", "eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
@ -42,9 +42,10 @@
"build-iife": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=iife --external:fs --global-name=Human --metafile=dist/human.json --outfile=dist/human.js src/human.js", "build-iife": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=iife --external:fs --global-name=Human --metafile=dist/human.json --outfile=dist/human.js src/human.js",
"build-esm-bundle": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=esm --external:fs --metafile=dist/human.esm.json --outfile=dist/human.esm.js src/human.js", "build-esm-bundle": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=esm --external:fs --metafile=dist/human.esm.json --outfile=dist/human.esm.js src/human.js",
"build-esm-nobundle": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=esm --external:@tensorflow --external:fs --metafile=dist/human.esm-nobundle.json --outfile=dist/human.esm-nobundle.js src/human.js", "build-esm-nobundle": "esbuild --bundle --platform=browser --sourcemap --target=esnext --format=esm --external:@tensorflow --external:fs --metafile=dist/human.esm-nobundle.json --outfile=dist/human.esm-nobundle.js src/human.js",
"build-node": "esbuild --bundle --platform=node --sourcemap --target=esnext --format=cjs --external:@tensorflow --metafile=dist/human.node.json --outfile=dist/human.node.js src/human.js", "build-node": "esbuild --bundle --platform=node --sourcemap --target=esnext --format=cjs --metafile=dist/human.node.json --outfile=dist/human.node.js src/human.js",
"build": "rimraf dist/* && npm run build-iife && npm run build-esm-bundle && npm run build-esm-nobundle && npm run build-node && ls -l dist/", "build-node-nobundle": "esbuild --bundle --platform=node --sourcemap --target=esnext --format=cjs --external:@tensorflow --metafile=dist/human.node.json --outfile=dist/human.node-nobundle.js src/human.js",
"update": "npm update --depth 20 && npm dedupe && npm prune && npm audit", "build": "rimraf dist/* && npm run build-iife && npm run build-esm-bundle && npm run build-esm-nobundle && npm run build-node && npm run build-node-nobundle && ls -l dist/",
"update": "npm update --depth 20 --force && npm dedupe && npm prune && npm audit",
"changelog": "node changelog.js" "changelog": "node changelog.js"
}, },
"keywords": [ "keywords": [