New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

abstract-buildspec

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-buildspec

Helper class to hierarchically generate buildspec.yml files.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

AbstractBuildspec

Helps you create buildspec.yml files that inherit from each other.

Usage

Create a buildspec.js file like this:

const AbstractBuildspec = require('abstract-buildspec');

class Buildspec extends AbstractBuildspec {
  static version() {
    return '0.2';
  }

  static env() {
    return {
      variables: {
        AAA: 'a',
      },
      'parameter-store': {
        BBB: '/a/b',
        CCC: '/c/d',
      },
    };
  }

  static phases() {
    return {
      install: {
        commands: ['echo Installing dependencies...'],
        'runtime-versions': {
          nodejs: '10',
        },
      },
      pre_build: {
        commands: [
          'echo Setting something up...',
        ],
      },
      build: {
        commands: [
          'echo Building files...',
        ],
      },
      post_build: {
        commands: [
          'echo Cleaning up...',
        ],
      },
    };
  }

  static cache() {
    return {
      paths: ['folder'],
    };
  }

  static artifacts() {
    return {
      files: [
        "'item1'",
        "'item2'",
      ],
      'base-directory': "'.'",
      'discard-paths': 'no',
    };
  }
}

Then you can reuse it to generate a slightly different buildspec like this:

class CustomBuildspec extends Buildspec {
  static phases() {
    const base = super.phases();
    const extraCommands = ['echo Migrating the database...'];
    base.post_build.commands = extraCommands.concat(base.post_build.commands);
    return base;
  }
}

Finally, you can emit the buildspecs to the filesystem by doing:

Buildspec.emit('buildspec.yml');
CustomBuildspec.emit('buildspec-custom.yml');

License

MIT License

Keywords

aws

FAQs

Package last updated on 22 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts