0.2.4 • Published 3 years ago

@knowdev/cdk v0.2.4

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
3 years ago

KnowDev CDK 🌩

📋 Usage

npm install --save @knowdev/cdk

📖 Reference

Resources ☁️

CDK Stack

cdk.app.js
const Construct = require("@knowdev/cdk");
const Template = require("./template.cdk");
const packageJson = require("./package.json");

Construct.stack(Template, packageJson, {});

CDK Template

template.cdk.js
const { cdk } = require("@knowdev/cdk");

class Template extends cdk.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);
    // Define resources...
  }
}

module.exports = Template;

Lambda

// Inside Template constructor...
lambda(this, "functionName");
Lambda Properties
lambda(this, "functionName", {
  memorySize: 512,
  runtime: lambda.Runtime.NODEJS_14_X,
  timeout: DURATION.THIRTY_SECONDS,
});

Helpers 📚

Tagger

const { tagger } = require("@knowdev/cdk");

// Manually add tag (does not call addMeta)
tagger.tag(resource, key, value);

// Automatic meta
//   account: process.env.PROJECT_ACCOUNT
//   env: process.env.PROJECT_ENV
//   project: process.env.PROJECT_PROJECT
tagger.addMeta(resource);

// Convenience for role (calls addMeta)
tagger.role.api(resource);

Constants 💬

Duration ⏲

const { DURATION } = require("@knowdev/cdk");

DURATION = {
  THIRTY_SECONDS,
  ONE_MINUTE,
  TWO_MINUTES,
  FIVE_MINUTES,
  TEN_MINUTES,
  FIFTEEN_MINUTES,
}

💻 Developing

Current style is CommonJS (not ES6).

The hygen code templating system should be used for most new code:

  • hygen fabric new for generic top-level JavaScript
  • hygen fabric newsub for generic JavaScript in subfolders
  • hygen fabric test for generic top-level JavaScript tests
  • hygen fabric util for utility functions

📝 Changelog

  • 0.1.0 Template/stack, tagger, constants

🛣 Roadmap

  • ☑️ 0.1.0: Minimum Viable Something
    • Template/Stack
    • Tagger
    • Constants
  • 🔲 0.2.0: Lambda
  • 🔲 0.3.0: Dynamo

Open Questions 🤔

  • 🔲 If the stack is tagged, do those tags trickle to all resources
    • I.e., is it unnecessary to call addMeta() on sub-resources?

Wishlist 🌠

N/A

📜 License

All rights reserved. Safe for use around pets.

0.2.4

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago