Read the following instructions carefully before getting started.
Install all packages:
npm install
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:
npm test
Run test for one or more packages:
npm run test:ts-node -- <package1> [<package2> ...]
This section explains how packages are created and updated
-
Create a new folder in the
packages
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": "@hestiaai/<NAME>",
"version": "0.0.0",
"main": "dist/index",
"type": "module",
"files": ["dist"],
"repository": {
"type": "git",
"url": "https://github.com/hestiaai/hestialabs",
"directory": "packages/<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 to the
hestialabs-experiences
repo:
npm link --workspaces
cd ../hestialabs-experiences
npm install
Follow these instructions to authenticate to GitHub Packages with a personal access token (PAT).
-
Create a PAT. Select the scopes (permissions)
write:packages
anddelete:packages
. Never share your PAT with anybody. You may also use the shared PAT for the organization. -
Authenticate. The simplest recommended way is to add your PAT to your
~/.npmrc
file in your home directory. Your.npmrc
should look like this:
//npm.pkg.github.com/:_authToken=TOKEN
@hestiaai:registry=https://npm.pkg.github.com
IMPORTANT SECURITY NOTE
Your personal token is a secret that must not be shared with others. The shared organization token may be shared internally with relevant personnel. Never add the token to the .npmrc
file in the repository. Tokens must never be pushed to GitHub.
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 -- --force-publish=*
npm run lerna:publish
Documentation of lerna’s publish
command
- 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