Once you created a new (cloud) project on forest admin, you can use this package to add code customizations to it.
The workflow to add code customizations is the following:
- Bootstrap the code customization template to be able to write your customizations.
- Write your customizations
- Publish your customizations to your project
- Update typings to update typings in your IDE
npx @forestadmin/cloud-toolkit bootstrap
then go to the generated folder
cd cloud-customizer
and install the dependencies
yarn install
or npm install
then build the project
yarn build
or npm run build
You can found in your package.json
some scripts to help you to develop customizations.
You can replace them with your own scripts, by using directly the forest-cloud
command.
Read the developer guide to learn how to write customizations.
To publish your customizations, you need to build, package and publish your customizations. The build command will compile your customizations, the package command will create a package and the publish command will publish your package to your project.
npx forest-cloud build
npx forest-cloud package
npx forest-cloud publish
You can also use yarn
or npm
and run forestadmin:build:package:publish
script.
build
and build:watch
scripts will update typings automatically.
But if you want to update typings manually, you can run:
npx forest-cloud update-typings
You can also use yarn
or npm
and run forestadmin:update-typings
script.
This command will update typings according to the structure of your database and your current code customizations. The typings are here to provide autocompletion in your IDE to help you write faster and avoid errors in your code.
You should execute this command on a regular basis, to keep your IDE updated with your database structure and customizations.
npx forest-cloud login
You can also use yarn
or npm
and run forestadmin:login
script.
This command triggers an authentication workflow and refresh the authentication token.
An alternative, is to add the FOREST_AUTH_TOKEN
token in your .env
file.
You can create one by going to your account settings.
Then add the following line in your .env
file:
FOREST_AUTH_TOKEN=your-token