Skip to content

Build Process

Vladimir Mandic edited this page Sep 18, 2023 · 24 revisions

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 --dev # installs all project dependencies
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 TypeDoc API specification
  5. Compile TS type definitions
  6. Create TS type definitions rollup

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

2022-07-18 08:21:08 DATA:  Build { name: '@vladmandic/human', version: '2.9.0' }
2022-07-18 08:21:08 INFO:  Analyze: { modelsDir: '../human-models/models', modelsOut: 'models/models.json' }
2022-07-18 08:21:08 STATE: Models: { count: 42, totalSize: 173272189 }
2022-07-18 08:21:08 INFO:  Application: { name: '@vladmandic/human', version: '2.9.0' }
2022-07-18 08:21:08 INFO:  Environment: { profile: 'production', config: '.build.json', package: 'package.json', tsconfig: true, eslintrc: true, git: true }
2022-07-18 08:21:08 INFO:  Toolchain: { build: '0.7.7', esbuild: '0.14.49', typescript: '4.7.4', typedoc: '0.23.8', eslint: '8.20.0' }
2022-07-18 08:21:08 INFO:  Build: { profile: 'production', steps: [ 'clean', 'compile', 'typings', 'typedoc', 'lint', 'changelog' ] }
2022-07-18 08:21:08 STATE: Clean: { locations: [ 'dist/*', 'types/lib/*', 'typedoc/*' ] }
2022-07-18 08:21:08 STATE: Compile: { name: 'tfjs/nodejs/cpu', format: 'cjs', platform: 'node', input: 'tfjs/tf-node.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 102, outputBytes: 608 }
2022-07-18 08:21:08 STATE: Compile: { name: 'human/nodejs/cpu', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node.js', files: 74, inputBytes: 647848, outputBytes: 304014 }
2022-07-18 08:21:08 STATE: Compile: { name: 'tfjs/nodejs/gpu', format: 'cjs', platform: 'node', input: 'tfjs/tf-node-gpu.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 110, outputBytes: 612 }
2022-07-18 08:21:08 STATE: Compile: { name: 'human/nodejs/gpu', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node-gpu.js', files: 74, inputBytes: 647852, outputBytes: 304018 }
2022-07-18 08:21:08 STATE: Compile: { name: 'tfjs/nodejs/wasm', format: 'cjs', platform: 'node', input: 'tfjs/tf-node-wasm.ts', output: 'dist/tfjs.esm.js', files: 1, inputBytes: 149, outputBytes: 664 }
2022-07-18 08:21:08 STATE: Compile: { name: 'human/nodejs/wasm', format: 'cjs', platform: 'node', input: 'src/human.ts', output: 'dist/human.node-wasm.js', files: 74, inputBytes: 647904, outputBytes: 304068 }
2022-07-18 08:21:09 STATE: Compile: { name: 'tfjs/browser/version', format: 'esm', platform: 'browser', input: 'tfjs/tf-version.ts', output: 'dist/tfjs.version.js', files: 1, inputBytes: 1069, outputBytes: 358 }
2022-07-18 08:21:09 STATE: Compile: { name: 'tfjs/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'tfjs/tf-browser.ts', output: 'dist/tfjs.esm.js', files: 2, inputBytes: 1032, outputBytes: 583 }
2022-07-18 08:21:09 STATE: Compile: { name: 'human/browser/esm/nobundle', format: 'esm', platform: 'browser', input: 'src/human.ts', output: 'dist/human.esm-nobundle.js', files: 74, inputBytes: 647823, outputBytes: 302893 }
2022-07-18 08:21:09 STATE: Compile: { name: 'tfjs/browser/esm/custom', format: 'esm', platform: 'browser', input: 'tfjs/tf-custom.ts', output: 'dist/tfjs.esm.js', files: 11, inputBytes: 1140, outputBytes: 2799617 }
2022-07-18 08:21:09 STATE: Compile: { name: 'human/browser/iife/bundle', format: 'iife', platform: 'browser', input: 'src/human.ts', output: 'dist/human.js', files: 74, inputBytes: 3446857, outputBytes: 1678594 }
2022-07-18 08:21:09 STATE: Compile: { name: 'human/browser/esm/bundle', format: 'esm', platform: 'browser', input: 'src/human.ts', output: 'dist/human.esm.js', files: 74, inputBytes: 3446857, outputBytes: 3078417 }
2022-07-18 08:21:16 STATE: Typings: { input: 'src/human.ts', output: 'types/lib', files: 30 }
2022-07-18 08:21:18 STATE: TypeDoc: { input: 'src/human.ts', output: 'typedoc', objects: 76, generated: true }
2022-07-18 08:21:18 STATE: Compile: { name: 'demo/typescript', format: 'esm', platform: 'browser', input: 'demo/typescript/index.ts', output: 'demo/typescript/index.js', files: 1, inputBytes: 6371, outputBytes: 3094 }
2022-07-18 08:21:18 STATE: Compile: { name: 'demo/faceid', format: 'esm', platform: 'browser', input: 'demo/faceid/index.ts', output: 'demo/faceid/index.js', files: 2, inputBytes: 15174, outputBytes: 7820 }
2022-07-18 08:21:28 STATE: Lint: { locations: [ '*.json', 'src/**/*.ts', 'test/**/*.js', 'demo/**/*.js' ], files: 107, errors: 0, warnings: 0 }
2022-07-18 08:21:28 STATE: ChangeLog: { repository: 'https://github.com/vladmandic/human', branch: 'main', output: 'CHANGELOG.md' }
2022-07-18 08:21:28 INFO:  Done...
2022-07-18 08:21:28 STATE: Copy: { input: 'tfjs/tfjs.esm.d.ts' }
2022-07-18 08:21:29 STATE: API-Extractor: { succeeeded: true, errors: 0, warnings: 197 }
2022-07-18 08:21:29 STATE: Copy: { input: 'types/human.d.ts' }
2022-07-18 08:21:29 INFO:  Human Build complete...

Dependencies

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

  • esbuild used to compile TS sources and generate dist bundles
  • eslint used for code linting
  • typescript used to generate typings
  • typedoc used to generate API specifications

Development build is started by running npm run dev

Clone this wiki locally