Neoteric Plumbing Mishap

    @last-rev/contentful-s3-sync
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.2 • Public • Published

    Overview

    This library syncs content from s3 to the local filesystem. Can be called directly from code as a library, or as a CLI.

    Requirements

    This cli requires the AWS CLI to be installed and the binary available on the path of your current environment.

    In a Netlify build, you must make sure to install the AWS CLI prior to running this command using a script such as the one below:

    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip -q awscliv2.zip
    mkdir aws-home
    ./aws/install -i ~/aws-home -b /opt/buildhome/.binrc/bin

    Usage

    CLI

    npm install -g @last-rev/cli
    
    last-rev s3-sync -d graphql/content

    See Docs for details on the parameters.

    Library

    import sync from '@last-rev/contentful-s3-sync'
    
    async function () {
      await sync({
        rootDir: './graphql/content', // Root directory to sync content to
        space: process.env.CONTENTFUL_SPACE_ID, // Contentful space ID
        environment: process.env.CONTENTFUL_ENV || 'master', // Contentful environment
        isPreview: true
      });
    };

    Output

    The library outputs all content to the passed in rootDir location in the following structure:

    • Entries: {space_id}/{environment}/{preview_or_production}/entries/{entry_id}.json
    • Assets: {space_id}/{environment}/{preview_or_production}/assets/{asset_id}.json
    • Content Types: {space_id}/{environment}/{preview_or_production}/content_types/{contentTypeId}.json
    • Entry IDs by Content type lookup: {space_id}/{environment}/{preview_or_production}/entry_ids_by_content_type/{entry_id}

    Keywords

    none

    Install

    npm i @last-rev/contentful-s3-sync

    DownloadsWeekly Downloads

    185

    Version

    0.1.2

    License

    ISC

    Unpacked Size

    10.6 kB

    Total Files

    11

    Last publish

    Collaborators

    • maxtechera.lastrev
    • tharris
    • justinlastrev
    • jaimelastrev
    • bradtaylorsf