npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2021 – Pkg Stats / Ryan Hefner

@guardian/cdk

v27.2.1

Published

Generic Guardian flavoured AWS CDK components

Downloads

933

Readme

Guardian CDK Library

npm CD

Welcome to the Guardian CDK library! This library contains a number of reusable patterns and constructs which can be used to build up your AWS Cloudformation stacks.

📖 View the available components in the API documentation.

💬 Come and chat to us in Discussions

Wait, what is CDK?

The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework to define cloud infrastructure in code and provision it through AWS CloudFormation.

You can read more about it in the AWS CDK repository.

Architecture

Patterns

Patterns are high level classes which compose a number of constructs to produce standard architectures. For example, you should be able to get all the resources you need to deploy a new lambda function from one GuLambdaStack class.

We're still working on these right now but hope to start bringing you some of the most common Guardian stacks soon!

Patterns should be your default entry point to this library.

Constructs

Constructs are lower level classes which will create one or more resources to produce one element of a stack. For example, the GuDatabaseInstance will create an RDS instance as well as a parameter group, if required. This library defines a number of constructs which are combined to create the higher level patterns.

If there is a pattern available for your use case, prefer to use that over composing constructs yourself. We welcome feedback and/or PRs to extend the functionality of patterns. Where you need to do something outside the currently available patterns, you can use the constructs to provide some level of abstraction. In this case, consider whether it's worth defining a pattern.

Decision Records

Architecture Decisions Records are files where we can document the decisions we make around any form of structure, architecture or approach. By documenting them in this way, we can preserve the thought process behind all the decisions whilst also laying out formally the preferences for all developers working on the library.

The docs/architecture-decision-records directory contains the records for @guardian/cdk.

Useful commands

We follow the script/task pattern, find useful scripts within the script directory for common tasks.

  • ./script/setup to install dependencies
  • ./script/start to run the Jest unit tests in watch mode
  • ./script/start-docs to generate documentation and view in the browser
  • ./script/lint to lint the code using ESLint
  • ./script/test to run the Jest unit tests
  • ./script/build to compile TypeScript to JS

There are also some other commands defined in package.json:

  • npm run lint --fix attempt to autofix any linter errors
  • npm run format format the code using Prettier
  • npm run watch watch for changes and compile

However, it's advised you configure your IDE to format on save to avoid horrible "correct linting" commits.

Usage

This library can be installed from npm.

npm install --save @guardian/cdk

or

yarn add @guardian/cdk

Patterns can be imported from the top level of the library:

import { GuScheduledLambda } from "@guardian/cdk";

We encourage you to use patterns rather than constructs whenever possible.

If you need to use a construct directly, they must be imported from their construct directory:

import { GuAutoScalingGroup } from "@guardian/cdk/lib/constructs/autoscaling";

This is intentional as the patterns ideally solve the majority of use-cases. If they don't, please let us know about your use-case so that we can consider supporting it via a pattern.

Alternatively, PRs are always welcome!

There are more details on using the CDK library in docs

Releasing

✨ TL;DR We release new versions of the library to NPM automagically ✨

We use semantic-release and guardian/actions-merge-release-changes-to-protected-branch to automate releases.

To release a new version:

  1. Raise a PR. The PR title must follow the Angular / Karma format. Don't worry, CI checks this!
  2. Once reviewed and approved, merge your PR.
  3. Wait for the robots to:
    • Use your structured commit to automatically determine the next version number (following semantic versioning).
    • Release a new version to npm and update package.json.
  4. Enjoy a comment on your PR to inform you that your change has been released.

For more information, see the docs on testing.