Skip to content

Developer Guide

Pablo Mayrgundter edited this page Aug 31, 2022 · 5 revisions

Workspaces

ifctool has 2 workspaces, lib and tool. Workspaces are a feature of npm, that allows multiple sub-packages to be maintained and sync'd with each other. In our case, tool depends on lib.

Tool

tool is the wrapper around lib to make a command-line tool that parses flags, reads a local file, prints results to stdout and stderr, and yields a return code for success or error

Lib

lib is the core functionality of ifctool. It's based on web-ifc and adds functionality we find missing in web-ifc.

Exports

lib exports are defined in lib/src/index.js, which simply re-exports all top-level exports from lib/src/Ifc.js. Maybe this should change to explicitly name exports for a more stable API.

NPM, Build & Test & Publish

There are currently 4 locations where version is harcoded. These are kept in sync manually See issue. Each should be updated to the new version you're building:

tool/package.json
lib/package.json
lib/src/version.js

From within the lib directory:

npm pack --pack-destination ~

This will drop an archive file in your home directory, e.g.: ~/bldrs-ai-ifclib-5.2.4.tgz. This can be used in your package.json with:

"@bldrs-ai/ifclib": "file:/Users/pablo/pm/Share/bldrs-ai-ifclib-5.2.3.tgz",

Note that npm allows a ~ path, while yarn requires more explicit paths; the example above is safe for me for both.

Once the NPM is built and validated

npm publish --access public --tag beta

Then go to your client project, and switch the import to test the new version from its network host:

"@bldrs-ai/ifclib": "^5.2.3",

And finally tag as default latest and commit the changes:

npm dist-tag add @bldrs-ai/ifclib@5.2.3 latest
git add . ; git ci -m 'v5.2.3'
Clone this wiki locally