0.4.19 • Published 5 days ago

@tryghost/mg-ghost-api v0.4.19

Weekly downloads
4
License
MIT
Repository
github
Last release
5 days ago

Migrate Ghost API

Export content from an existing Ghost installation using the Admin API, and generate a zip file you can import into a Ghost installation.

Install

To install the CLI, which is required for the Usage commands below:

npm install --global @tryghost/migrate

To use this package in your own project:

npm install @tryghost/mg-ghost-api --save

or

yarn add @tryghost/mg-ghost-api

Usage

To run a Ghost API migration, the required command is:

migrate ghost --url https://example.com --apikey 1234abcd

It's possible to pass more options, in order to achieve a better migration file for Ghost:

  • --url (required)
    • Ghost API URL
    • string - default: null
  • --apikey (required)
    • Ghost API key
    • string - default: null
  • -V --verbose
    • bool - default: false
    • Show verbose output
  • --zip
    • bool - default: true
    • Create a zip file
  • -s --scrape
    • Configure scraping tasks
    • string - default: all
    • Choices: all, img, web, media, files, none
  • --sizeLimit
    • number - default: false
    • Media files larger than this size (defined in MB i.e. 5) will be flagged as oversize
  • -I --info
    • bool - default: false
    • Show initalisation info only
  • -b --batch
    • number - default: 0
    • Batch number to run (defaults to running all)
  • -l --limit
    • number - default: 15
    • Number of items fetched in a batch i.e. batch size
  • --posts
    • bool - default: true
    • Import posts (set to false to skip)
  • --postFilter
    • string - default: null
    • A string of post filters, as defined in the Ghost Admin API
  • --pages
    • bool - default: true
    • Import pages (set to false to skip)
  • --pageFilter
    • string - default: null
    • A string of page filters, as defined in the Ghost Admin API
  • --cache
    • Persist local cache after migration is complete (Only if --zip is true)
    • bool - default: true

A more complex migration command could look like this:

migrate ghost --url https://example.com --apikey 1234abcd --batch 5 --limit 10 --postFilter 'tag:[news, press]' --pages false --verbose

This will get the first 50 posts with the tag news or press, in 5 batches of 10 posts, exclude pages, and show all available output in the console.

See the Filter documentation for more info.

Develop

This is a mono repository, managed with lerna.

Follow the instructions for the top-level repo. 1. git clone this repo & cd into it as usual 2. Run yarn to install top-level dependencies.

Run

To run a local development copy, cd into this directory, and replace migrate with yarn dev, like so:

yarn dev ghost --url https://example.com --apikey 1234abcd

Test

  • yarn lint run just eslint
  • yarn test run lint and tests

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.

0.4.19

5 days ago

0.4.18

2 months ago

0.4.17

4 months ago

0.4.16

5 months ago

0.4.15

5 months ago

0.4.9

10 months ago

0.4.10

9 months ago

0.4.13

7 months ago

0.4.14

7 months ago

0.4.11

9 months ago

0.4.12

7 months ago

0.4.8

11 months ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.7

1 year ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.11

2 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago