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

camplify

v2.83.0

Published

Camplify is a collection of CDK constructs that make it easy to use Amplify Libraries in your CDK projects.

Downloads

1

Readme

Camplify - CDK Constructs for Amplify Libraries

Camplify is a collection of CDK constructs that make it easy to use Amplify Libraries in your CDK projects.

Each construct has a 'vals' property that can be used with other constructs (Ex. In order to use Storage with Auth) If these vals are used with the hosting construct then the variables that the Amplify UI libraries require are automatically passed to your deployed front end via the sample buildspec for React.

Pull Requests are Welcome!

Example

These examples are also in the node_modules folder after installation (npm i camplify)

The sampleUsage.ts file shows how to setup your amplify project:

import { Stack, StackProps, RemovalPolicy, Duration, CfnOutput } from 'aws-cdk-lib';
import { Construct } from 'constructs';
// @ts-ignore
import { Auth, Storage, Hosting } from 'camplify'

export class YourStack extends Stack {
    constructor(scope: Construct, id: string, props?: StackProps) {
        super(scope, id, props);
        const appName = "Test"
        const Authentication = new Auth(this, "Authentication", { appName })
        const AppStorage = new Storage(this, "AppStorage", { appName, auth: Authentication.vals })
        //Other Camplify stacks as necessary

        // Your business logic infrastructure //

        const FrontEnd = new Hosting(this, "Hosting", {
            appName, repo: "Camplify", branch: "demo", gitOwner: "master-harvey",
            URL: "yoururl.com",
            buildEnvironment: { //Custom Env Vars passed to frontend
                key1: { value: "value" },
                key2: { value: "value" }
            },
            camplifyVals: {
                AuthVals: Authentication.vals,
                StorageVals: AppStorage.vals
            }
        })
        new CfnOutput(this, "CDK-Exports", { value: FrontEnd.CDK_EXPORTS })
    }
}

If you use the Hosting construct you can configure Amplify like this using the cdk-exports.json file generated during the build:

import { Amplify } from 'aws-amplify';
import awsExports from './cdk-exports.json';

Amplify.configure({
  aws_project_region: awsExports.REGION,
  Auth: {
    identityPoolId: awsExports.IDPID,
    region: awsExports.REGION,
    userPoolId: awsExports.UPID,
    userPoolWebClientId: awsExports.WCID,
    authenticationFlowType: 'USER_PASSWORD_AUTH',
    oauth: {
      domain: 'your_cognito_domain',
      scope: [
        'phone',
        'email',
        'profile',
        'openid',
        'aws.cognito.signin.user.admin'
      ],
      clientId: awsExports.WCID,
      responseType: 'code'
    }
  },
  Storage: {
    AWSS3: {
      bucket: awsExports.STORAGEBUCKET,
      region: awsExports.REGION
    }
  }
});

Input Interfaces

Auth

export interface AuthProps extends NestedStackProps {
  appName: string,
  allowUnauth?: boolean,
  selfSignUpEnabled?: boolean,
  mfa?: cognito.Mfa,
  preventUserExistenceErrors?: boolean,
  mfaSecondFactor?: { sms: boolean, otp: boolean },
  accountRecovery?: cognito.AccountRecovery,
  standardAttributes?: { [key: string]: cognito.StandardAttribute },
  customAttributes?: { [key: string]: cognito.ICustomAttribute },
}

Storage

export interface StorageProps extends NestedStackProps {
  appName: string,
  auth: AuthVals,
  cors?: [s3.CorsRule],
  allowedOrigins?: [string],
  removalPolicy?: RemovalPolicy
}

Hosting (Built only for React at the moment)

export interface HostingProps extends NestedStackProps {
    appName: string,
    repo: string,
    branch: string,
    gitOwner: string,
    URL?: string,
    customBuildSpec?: cbd.BuildSpec,
    buildEnvironment?: { [key: string]: cbd.BuildEnvironmentVariable },
    camplifyVals?: {
        AuthVals?: AuthVals,
        StorageVals?: StorageVals,
    }
}