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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tsas-cdk

v0.0.21

Published

Parameter manager for AWS CDK TypeScript.

Downloads

39

Readme

This is beta. Please use at your own risk.

TSAS CDK - TypeScript Application for Serverless and AWS CDK

A command line tool, supports AWS serverless application development.

  • Manage file-based multiple parameters.
  • Manage hand-based single parameter.
  • Calculate parameter key using application name, environment name, division name.

TypeScript package, supports use Parameter Store Value.

  • Use Parameter Store value via TypeScript.

Installation

npm i -g tsas-cdk # Cli tool

cd <your cdk project>
npm i -s tsas-cdk # TypeScript package.

Usage

CLI

tsas -h
---
Usage: tsas-cdk [options] [command]

Options:
  -V, --version  output the version number
  -v --verbose   verbose logging mode
  -h, --help     output usage information

Commands:
  init           Init filles
  param          Manage application parameters, [push-all|push-single|list]
  help [cmd]     display help for [cmd]


Usage: tsas-cdk param [options] [command]

Options:
  -V, --version                       output the version number
  -s, --stage <stage>                 parameter stage name
  -d, --division <division>           parameter division, such as "app", "e2e" (default: "app")
  -h, --help                          output usage information

Commands:
  list
  put-all
  put-single [options] <key> <value>
  *

TypeScript


// in cdk stack
import * as cdk from '@aws-cdk/core';
import * as ssm from '@aws-cdk/aws-ssm';
import { TsasParameters, TsasParameterManager } from 'tsas-cdk';
 import { RestApi } from 'aws-sdk/clients/apigateway';
import * as tsasCdk from 'tsas-cdk';

export async function cdkStackHelloWorldServer(
    scope: cdk.Construct,
    id: string,
): Promise<void> {
    const stack = new cdk.Stack(scope, id, {
        stackName: 'HelloWorldStack'
    });

    // load ssm parameters
    const pm: TsasParameterManager = new tsasCdk.TsasParameterManager(stage, division);
    const params: TsasParameters = await pm.load();
    const apiVersion = params.ApiVersion.Value;
    
    const apiGateway: RestApi = createApiGateway(apiVersion);

    // register to ssm        
    new ssm.StringParameter(stack, 'HelloWorldApiUrl', {
          parameterName: pm.fullKeyOf('HelloWorldApiUrl', 'e2e'),
          stringValue: apiGateway.url,
    })

}


// in e2e test
import * as tsasCdk from 'tsas-cdk';

describe('Call api', (): void => {
        test('success', async (): Promise<void> => {
    const pm = new tsasCdk.TsasParameterManager('dev', 'e2e'); // env:dev division:e2e
    const params = await pm.load();
    const url = params.HelloWorldApiUrl.Value;
     
    // you can use ssm stored `url`
    console.log(url);
    });
});

Examples

Requirements

If you need to switch role, you can use these helpful tools.

Create settings

First, cdk init.

tsas-cdk init

What your serverless application name? [hello-service-sls]hellosls
What your default region? [ap-northeast-1]
✅ All done!

Push dev stage parameters using file

tsas-cdk param put-all --stage dev

putting parameters...
done.

Push individual parameter, such as SaaS token.

tsas-cdk param put-single -s dev GitHubToken XXXXXXXXXXYYYYYYYYYYYY --secure

List app, e2e division parameters

tsas-cdk param list --stage dev
tsas-cdk param list --stage dev --division e2e