Read the following instructions carefully before getting started.
Install all packages:
npm installSet up pre-commit hooks:
npm run prepare
Start developing:
npm run devThis 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 buildRun tests for all packages:
npm testRun 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
packagesdirectory. By convention, the folder name is also the package name. -
Add a
srcfolder with the requiredindex.tsentry file. -
Add a
package.jsonthat 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
experiencesArray 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-experiencesrepo:
npm link --workspaces
cd ../hestialabs-experiences
npm installFollow these instructions to authenticate to GitHub Packages with a personal access token (PAT).
-
Create a PAT. Select the scopes (permissions)
write:packagesanddelete: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
~/.npmrcfile in your home directory. Your.npmrcshould 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:versionDocumentation 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:publishDocumentation 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