-
Notifications
You must be signed in to change notification settings - Fork 0
Standalone CAMO project using Javascript migration files
Sam Bauers edited this page May 25, 2022
·
2 revisions
Using your favourite package manager:
# Create a new project directory
$ mkdir my-camo-js
$ cd my-camo-js
# npm
$ npm init
# or yarn
$ yarn init
# or ppm
$ pnpm init
Then answer all the package manager setup questions.
# npm
$ npm install --save-dev @sambauers/camo
# or yarn
$ yarn add --dev @sambauers/camo
# or pnpm
$ pnpm add --save-dev @sambauers/camo
In your projects package.json
add a migrate
script in the scripts
definitions:
{
"scripts": {
"migrate": "camo"
}
}
$ mkdir migrations
Create a .env
file in the project root containing (at least):
# Contentful Active Migration Organiser (CAMO)
# The space ID to connect to
CONTENTFUL_MIGRATION_SPACE_ID='<your-contentful-space-id>'
# The access token to connect with
CONTENTFUL_MIGRATION_ACCESS_TOKEN='<your-contentful-access-token>'
Run the migrate --list
command:
# npm
$ npm run migrate --list
# or yarn
$ yarn migrate --list
# or pnpm
$ pnpm migrate --list
You will be asked if you want CAMO create the content type in Contentful.
Create a migration file in the migrations folder with your desired schema.
The file you created above should now be visible with the --list
option
# npm
$ npm run migrate --list
# or yarn
$ yarn migrate --list
# or pnpm
$ pnpm migrate --list
The file you created above should now be applied when running CAMO
# npm
$ npm run migrate
# or yarn
$ yarn migrate
# or pnpm
$ pnpm migrate