Skip to content

Latest commit

 

History

History
204 lines (139 loc) · 5.35 KB

README.md

File metadata and controls

204 lines (139 loc) · 5.35 KB

HestiaLabs


Lerna TypeScript webpack ESLint Prettier Babel

Instructions

Read the following instructions carefully before getting started.

# All commands are run in the same folder as this readme
$ cd packages

Setup

Install all packages:

npm install

Build all packages:

npm run build

Set up pre-commit hooks:

npm run prepare

Develop

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

Build all packages:

npm run build

Test

Run tests for all packages in packages/experiences/:

npm test

Run test for one or more packages:

npm run test:ts-node -- <package1> [<package2> ...]

Usage

Refer to packages/experiences/README.md

Package management

This section explains how packages for experiences are created and updated. Similar principles apply to other packages.

Create a new package

  1. Create a new folder in the packages/experiences directory. By convention, the folder name is also the package name.

  2. Add a src folder with the required index.ts entry file.

  3. 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.

  1. Add the package name to the experiences Array in dev.json.

  2. Add an export statement for the package in packages.ts. This ensures tests are run for the package.

  3. Re-link the packages workspace:

npm run build
npm link --workspaces
cd ../data-experience
npm i
cd ../experiences
npm i

Login to npm

  1. Get an npm account and ask Paul-Olivier to add you to the hestia.ai organization in npm.

  2. 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/
  1. Run the following command to login to npm:
npm login [email protected] --registry=https://registry.npmjs.org/

Bump version of packages changed since the last release

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.4
  • minor: 1.2.3 -> 1.3.0
  • major: 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

Publish packages

npm run lerna:publish

Documentation of lerna’s publish command NOTE: You cannot version and publish packages on the master branch

Sources

Notes

$ npm run lerna:version "--" --force-publish