Read the following instructions carefully before getting started.
# All commands are run in the same folder as this readme
$ cd packages
Install all packages:
npm install
Build all packages:
npm run build
Set up pre-commit hooks:
npm run prepare
Start developing:
npm run dev
This runs webpack in watch mode, building the packages once and then watching all files for changes. If one file is updated, the code is recompiled so you don’t have to run the full build manually.
Build all packages:
npm run build
Run tests for all packages in packages/experiences/
:
npm test
Run test for one or more packages:
npm run test:ts-node -- <package1> [<package2> ...]
Refer to packages/experiences/README.md
This section explains how packages for experiences are created and updated. Similar principles apply to other packages.
-
Create a new folder in the
packages/experiences
directory. By convention, the folder name is also the package name. -
Add a
src
folder with the requiredindex.ts
entry file. -
Add a
package.json
that looks like this:
{
"name": "@hestia.ai/<NAME>",
"version": "0.0.0",
"main": "dist/index.mjs",
"type": "module",
"files": ["dist", "src/<NAME>-viewer.json"],
"repository": {
"type": "git",
"url": "https://github.com/hestiaai/hestialabs-experiences",
"directory": "packages/packages/experiences/<NAME>"
},
"publishConfig": {
"access": "public"
},
"author": "",
"license": "UNLICENSED"
}
Replace <NAME>
with the package name.
-
Add the package name to the
experiences
Array in dev.json. -
Add an export statement for the package in
packages.ts
. This ensures tests are run for the package. -
Re-link the packages workspace:
npm run build
npm link --workspaces
cd ../data-experience
npm i
cd ../experiences
npm i
-
Get an npm account and ask Paul-Olivier to add you to the hestia.ai organization in npm.
-
Add the following file to your
~/.npmrc
file in your home directory. Your~/.npmrc
should look like this:
@hestia.ai:registry=https://registry.npmjs.org/
- Run the following command to login to npm:
npm login [email protected] --registry=https://registry.npmjs.org/
Create a new branch and commit your changes:
git checkout -b <name-of-your-new-branch>
git push origin <name-of-your-new-branch>
git commit ...
Update the package version
npm run lerna:version
Documentation of lerna’s version
command
You can pass extra arguments to the npm script:
npm run lerna:version -- --no-push
npm run lerna:version -- minor --force-publish=*
Please update versions with a meaningful semantic versioning (semver) bump depending on the size/importance of the package changes.
patch
: 1.2.3 -> 1.2.4minor
: 1.2.3 -> 1.3.0major
: 1.2.3 -> 2.0.0
You can either input the new version manually or provide a semver bump positional argument.
NOTE: You cannot version and publish packages on the master branch
npm run lerna:publish
Documentation of lerna’s publish
command
NOTE: You cannot version and publish packages on the master branch
- Passing arguments from the command line to npm scripts works in PowerShell if you enclose the
--
in quotation marks. For example,
$ npm run lerna:version "--" --force-publish