The Mov.AI's frontend components library. Here we place all reusable/common components, such as buttons, icons, textfields, etc. Its main use will be to build Mov.AI applications.
You can set up your development environment in two ways:
- In a DevContainer (recommended)
- Locally
Ensure that your ~/.npmrc file is configured with the necessary access tokens. The file should look like this:
//npm.pkg.github.com/mov-ai/:_authToken=GITHUB_TOKEN
@mov-ai:registry=https://npm.pkg.github.com/mov-ai/
always-auth=false
engine-strict=true
//registry.npmjs.org/:_authToken=GITHUB_TOKEN
//npm.pkg.github.com/:_authToken=GITHUB_TOKEN
Replace GITHUB_TOKEN with your actual token.
-
Clone the app and libraries (if needed) to
$HOME/movai/src/feapps
-
Open the project in VS Code and reopen in container:
Open the project directory in VS Code. You should be prompted to reopen the project in a container. Accept this prompt.
To install Node.js using nvm
(Node Version Manager), follow these steps:
-
Install
nvm
:Open your terminal and run the following command to install
nvm
:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
-
Load
nvm
:After installing
nvm
, you need to load it. Close and reopen your terminal, or run:source ~/.nvm/nvm.sh
-
Install the required Node.js version:
With
nvm
installed and loaded, run the following command to use the required Node.js version:nvm install && nvm use # uses the node version specify in the .nvmrc file
-
Set the used Node.js as the default version:
nvm current # prints the node.js version being used nvm alias default xx.xx.x # sets xx.xx.x as default
-
Verify the installation:
node -v
This should output the node version specified in
.nvmrc
file.
To install pnpm
, follow these steps:
-
Using the required pnpm version:
The pnpm version required is specify in the
package.json
file as:{ "packageManager": "[email protected]" }
In order to have Node.js use the specified version, run:
corepack enable
Upon first use, Corepack downloads the latest version from the network and uses it when running pnpm commands.
-
- Install package:
"pnpm install @mov-ai/mov-fe-lib-react"
You might want to work with this library while seeing the changes in an app. In order to do so, you'll have to provide a path to a local directory that contains this library package. Here's how it can be done:
-
In the app, identify this library in the
package.json
:"@mov-ai/mov-fe-lib-react": "^x.x.x-X",
-
Replace the library version with the path of this local library:
"@mov-ai/mov-fe-lib-react": "file:/home/username/path/to/library/frontend-npm-lib-react"
-
Build this local library:
pnpm install # installs dependencies pnpm buildDev # builds the app and watches for changes
-
Install and build the app:
pnpm install # installs dependencies including the local library pnpm start # runs the app
- Install husky git hook:
"pnpm prepare"