Build Process - vladmandic/human Wiki

Original URL: https://github.com/vladmandic/human/wiki/Build-Process

Build Process

If you want to modify the library and perform a full rebuild:

clone repository, install dependencies, check for errors and run full rebuild from which creates bundles from /src into /dist:

git clone https://github.com/vladmandic/human
cd human
npm install # installs all project dependencies
npm run lint
npm run build

This will rebuild library itself (all variations) as well as demo

Build process is written as JavaScript module @vladmandic/build
which uses build.json as configuration file which can be modified to change any build parameters

Build creates a custom tfjs bundle to optimize size and avoid unnecessary polyfills

Production build runs following operations:

  1. Compile TypeScript
  2. Create dist minified bundles
  3. Run Linter
  4. Create TS typings
  5. Create TypeDoc API specification

Dev build runs following operations:

  1. Start HTTP/HTTPS web server
  2. Compile TypeScript
  3. Create dist non-minified bundles
  4. Run in file watch mode

Build

Production build is started by running npm run build

2021-09-10 20:55:41 INFO:  @vladmandic/human version 2.1.5
2021-09-10 20:55:41 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.5.0
2021-09-10 20:55:41 INFO:  Application: { name: '@vladmandic/human', version: '2.1.5' }
2021-09-10 20:55:41 INFO:  Environment: { profile: 'production', config: 'build.json', tsconfig: true, eslintrc: true, git: true }
2021-09-10 20:55:41 INFO:  Toolchain: { build: '0.3.4', esbuild: '0.12.26', typescript: '4.4.3', typedoc: '0.21.9', eslint: '7.32.0' }
2021-09-10 20:55:41 STATE: Clean: { locations: [ 'dist/*', 'types/*', 'typedoc/*', [length]: 3 ] }
2021-09-10 20:55:41 STATE: Build: { name: 'tfjs for nodejs with cpu', type: 'production', format: 'cjs', platform: 'node', input: 'tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 102, outputBytes: 1416 }
2021-09-10 20:55:41 STATE: Build: { name: 'human for nodejs with cpu', type: 'production', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node.js', files: 47, inputBytes: 456844, outputBytes: 396579 }
2021-09-10 20:55:41 STATE: Build: { name: 'tfjs for nodejs with gpu', type: 'production', format: 'cjs', platform: 'node', input: 'tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 110, outputBytes: 1424 }
2021-09-10 20:55:41 STATE: Build: { name: 'human for nodejs with gpu', type: 'production', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node-gpu.js', files: 47, inputBytes: 456852, outputBytes: 396583 }
2021-09-10 20:55:41 STATE: Build: { name: 'tfjs for nodejs with wasm', type: 'production', format: 'cjs', platform: 'node', input: 'tfjs/tf-node-wasm.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 149, outputBytes: 1491 }
2021-09-10 20:55:41 STATE: Build: { name: 'human for nodejs with wasm', type: 'production', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node-wasm.js', files: 47, inputBytes: 456919, outputBytes: 396655 }
2021-09-10 20:55:41 STATE: Build: { name: 'tfjs for browser esm nobundle', type: 'production', format: 'esm', platform: 'browser', input: 'tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 2168, outputBytes: 1590 }
2021-09-10 20:55:41 STATE: Build: { name: 'human for browser esm nobundle', type: 'production', format: 'esm', platform: 'browser', input: 'src/human.ts', output: 'dist/human.esm-nobundle.js', files: 47, inputBytes: 457018, outputBytes: 398559 }
2021-09-10 20:55:42 STATE: Build: { name: 'tfjs for browser esm bundle', type: 'production', format: 'esm', platform: 'browser', input: 'tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 7, inputBytes: 2168, outputBytes: 2343946 }
2021-09-10 20:55:42 STATE: Build: { name: 'human for browser iife bundle', type: 'production', format: 'iife', platform: 'browser', input: 'src/human.ts', output: 'dist/human.js', files: 47, inputBytes: 2799374, outputBytes: 2716138 }
2021-09-10 20:55:42 STATE: Build: { name: 'human for browser esm bundle', type: 'production', format: 'esm', platform: 'browser', input: 'src/human.ts', output: 'dist/human.esm.js', files: 47, inputBytes: 2799374, outputBytes: 2583497 }
2021-09-10 20:55:58 STATE: Typings: { input: 'src/human.ts', output: 'types', files: 47 }
2021-09-10 20:56:04 STATE: TypeDoc: { input: 'src/human.ts', output: 'typedoc', objects: 14, index: true }
2021-09-10 20:56:30 STATE: Lint: { locations: [ 'src/**/*.ts', 'test/*.js', 'demo/**/*.js', [length]: 3 ], files: 75, errors: 0, warnings: 0 }
2021-09-10 20:56:30 STATE: ChangeLog: { repository: 'https://github.com/vladmandic/human', branch: 'main', output: 'CHANGELOG.md' }

Dependencies

Only project depdendency is @tensorflow/tfjs
Development dependencies are:

Development build is started by running npm run dev