open-index/open-npm huggingface dataset:
npm package: @kdcio/aws-policy
Description: Generate AWS auth policy for API Gateway lambda authorizer
Author: Ian Dela Cruz
Latest version: 0.3.2

# AWS Policy Generator

This package will generate AWS auth policy for [API Gateway lambda authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html).

[![ver](https://img.shields.io/npm/v/@kdcio/aws-policy)](https://www.npmjs.com/package/@kdcio/aws-policy) [![size](https://badgen.net/bundlephobia/minzip/@kdcio/aws-policy)](https://bundlephobia.com/result?p=@kdcio/aws-policy) [![build](https://img.shields.io/github/workflow/status/kdcio/aws-policy/build)](https://github.com/kdcio/aws-policy/actions?query=workflow%3Abuild) [![Known Vulnerabilities](https://snyk.io/test/github/kdcio/aws-policy/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kdcio/aws-policy?targetFile=package.json) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kdcio_aws-policy&metric=alert_status)](https://sonarcloud.io/dashboard?id=kdcio_aws-policy) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=kdcio_aws-policy&metric=code_smells)](https://sonarcloud.io/dashboard?id=kdcio_aws-policy) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kdcio_aws-policy&metric=coverage)](https://sonarcloud.io/dashboard?id=kdcio_aws-policy) [![license](https://img.shields.io/github/license/kdcio/aws-policy)](https://github.com/kdcio/aws-policy/blob/master/LICENSE)

## Install

```terminal
npm i @kdcio/aws-policy
```

## Usage

```javascript
import generatePolicy from '@kdcio/aws-policy';

export const handler = (event) => {
  const user = {
    name: 'Ian',
    username: 'ian',
    role: 'admin',
  };
  const resources = [
    'GET/users',
    'POST/users',
    'GET/users/*',
    'PUT/users/*',
    'DELETE/users/*',
  ];

  return generatePolicy({
    context: { ...user },
    principalId: user.username,
    effect: 'Allow',
    methodArn: event.methodArn,
    resources,
  });
};
```

## Further Reading

[Output from an Amazon API Gateway Lambda authorizer](https://docs.aws.amazon.com/en_pv/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html)
npm package: @kdcio/create-nodejs
Description: NodeJs boilerplate
Author: Ian Dela Cruz
Latest version: 0.5.0

# Create NodeJs

[![ver](https://img.shields.io/npm/v/@kdcio/create-nodejs?style=for-the-badge)](https://www.npmjs.com/package/@kdcio/create-nodejs)
[![build](https://img.shields.io/github/workflow/status/kdcio/create-nodejs/build?style=for-the-badge)](https://github.com/kdcio/create-nodejs/actions?query=workflow%3Abuild)
[![codecov](https://img.shields.io/codecov/c/github/kdcio/create-nodejs?style=for-the-badge)](https://codecov.io/gh/kdcio/create-nodejs)
[![size](https://img.shields.io/bundlephobia/min/@kdcio/create-nodejs?style=for-the-badge)](https://bundlephobia.com/result?p=@kdcio/create-nodejs)
[![license](https://img.shields.io/github/license/kdcio/create-nodejs?style=for-the-badge)](https://github.com/kdcio/create-nodejs/blob/master/LICENSE)

Start your [NodeJs](https://nodejs.org/) project easily with the right tools and best practices.

## Usage

```terminal
  _  ______   ____ ____         __ _
 | |/ /  _ \ / ___/ ___|  ___  / _| |___      ____ _ _ __ ___
 | ' /| | | | |   \___ \ / _ \| |_| __\ \ /\ / / _` | '__/ _ \
 | . \| |_| | |___ ___) | (_) |  _| |_ \ V  V / (_| | | |  __/
 |_|\_\____/ \____|____/ \___/|_|  \__| \_/\_/ \__,_|_|  \___|

Usage: npx @kdcio/create-nodejs package-name

Options:
  -V, --version                  output the version number
  --no-bundle                    do not bundle the build output
  -g, --git-origin <remote-url>  add git remote url as origin
  -i, --info                     print environment debug info
  -v, --verbose                  verbose output
  -h, --help                     display help for command

Example:
  npx @kdcio/create-nodejs my-awesome-package

```

## What's included

### Packages Installed

- [babel](https://babeljs.io/)
- [eslint](https://eslint.org/)
- [prettier](https://prettier.io/)
- [jest](https://jestjs.io/)
- [husky](https://github.com/typicode/husky)
- [lint-staged](https://github.com/okonet/lint-staged)
- [parcel](https://parceljs.org/)

### Scripts

- Build script
- Bundler script
- Sample test script
- GitHub Actions for merging and publishing
- Initialize git and add remote url
- Add info in package.json
- Debug jest test scripts using VS Code
npm package: @kdcio/gatsby-source-abucms
Description: GatsbyJS source plugin for AbuCMS
Author: Ian Dela Cruz
Latest version: 0.2.2

# gatsby-source-abucms

Source plugin for pulling data from [AbuCMS](https://github.com/kdcio/abu) into [GatsbyJS](https://www.gatsbyjs.com/). It creates links between models and asset so they can be queried in Gatsby using GraphQL.

[![ver](https://img.shields.io/npm/v/@kdcio/gatsby-source-abucms)](https://www.npmjs.com/package/@kdcio/gatsby-source-abucms) [![size](https://badgen.net/bundlephobia/minzip/@kdcio/gatsby-source-abucms)](https://bundlephobia.com/result?p=@kdcio/gatsby-source-abucms) [![build](https://img.shields.io/github/workflow/status/kdcio/gatsby-source-abucms/CI)](https://github.com/kdcio/gatsby-source-abucms/actions?query=workflow%3ACI) [![Known Vulnerabilities](https://snyk.io/test/github/kdcio/gatsby-source-abucms/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kdcio/gatsby-source-abucms?targetFile=package.json) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kdcio_gatsby-source-abucms&metric=alert_status)](https://sonarcloud.io/dashboard?id=kdcio_gatsby-source-abucms) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=kdcio_gatsby-source-abucms&metric=code_smells)](https://sonarcloud.io/dashboard?id=kdcio_gatsby-source-abucms) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kdcio_gatsby-source-abucms&metric=coverage)](https://sonarcloud.io/dashboard?id=kdcio_gatsby-source-abucms) [![license](https://img.shields.io/github/license/kdcio/gatsby-source-abucms)](https://github.com/kdcio/gatsby-source-abucms/blob/master/LICENSE)

:warning: This plugin only works on Gatsby v3+.

## Install

```bash
npm install gatsby-source-abucms
```

## Configuration

```js
// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-abucms`,
      options: {
        baseUrl: "https://xxxxxxxx.execute-api.us-east-1.amazonaws.com",
        apiBase: "prod", // deployment stage
        models: ["blog", "home_page", "about_page", "social_profile"], // modelId
        apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        useCache: false, // default is true. set to false if you want to debug.
      },
    },
  ],
};
```

## Example

[Gatsby's blog starter with AbuCMS](https://github.com/kdcio/gatsby-starter-blog-abucms)
npm package: @kdcio/init
Description: Initialize KDC Projects with npm & git. Security included!
Author: Ian Dela Cruz
Latest version: 0.1.5

# KDC Init

Initialize KDC Projects with npm & git. Security included!

## Features

0. Install [gpg](https://gnupg.org/) - Encrypt files using a public and a secret key identified by your email address.
1. Install [git-secrets](https://github.com/awslabs/git-secrets) - Prevents you from committing passwords and other sensitive information in plain text to a git repository.
2. Install [git-secrets](https://git-secret.io/) - Encrypt files that containt passwords and other sensitive information before comitting to a git repository.
3. Run ```git init``` - Initialize git repository.
4. Run ```npm init``` - Initialize npm project.
5. Install husky and lint-staged - Enable git hooks to make use of [git-secrets](https://github.com/awslabs/git-secrets).

## Prerequisites

Please install the following before using:

- [brew](https://brew.sh/)
- [git](https://formulae.brew.sh/formula/git#default)
- [node, npm & npx](https://formulae.brew.sh/formula/node@12#default)

## Usage

```bash
npx @kdcio/init <project-name>
```
npm package: @kdcio/password
Description: This package will generate hash and salt given a password. It also has a function to validate a password input.
Author: Ian Dela Cruz
Latest version: 0.4.2

# Password Hash and Salt Generator

This package will generate hash and salt given a password. It also has a function to validate a password input.

[![ver](https://img.shields.io/npm/v/@kdcio/password)](https://www.npmjs.com/package/@kdcio/password) [![size](https://badgen.net/bundlephobia/minzip/@kdcio/password)](https://bundlephobia.com/result?p=@kdcio/password) [![build](https://img.shields.io/github/workflow/status/kdcio/password/build)](https://github.com/kdcio/password/actions?query=workflow%3Abuild) [![Known Vulnerabilities](https://snyk.io/test/github/kdcio/password/badge.svg?targetFile=package.json)](https://snyk.io/test/github/kdcio/password?targetFile=package.json) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password&metric=alert_status)](https://sonarcloud.io/dashboard?id=kdcio_password) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password&metric=code_smells)](https://sonarcloud.io/dashboard?id=kdcio_password) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=kdcio_password&metric=coverage)](https://sonarcloud.io/dashboard?id=kdcio_password) [![license](https://img.shields.io/github/license/kdcio/password)](https://github.com/kdcio/password/blob/master/LICENSE)

## Install

```terminal
npm i @kdcio/password
```

## Usage

### On user registration

```javascript
const { getHashSalt } = require('@kdcio/password');

const register = (password) => {
    ...
    const {hash, salt} = getHashSalt(password);
    ...
};
```

Store the hash and salt in your database.

### On user login

```javascript
const { isValidPassword } = require('@kdcio/password');

const login = (username, password) => {
    ...
    const {hash, salt} = getFromDatabase(username);
    if(isValidPassword(password, hash, salt)) {
        console.log("Password is correct");
    } else {
        console.log("Password is wrong");
    }
    ...
};
```

## Configuration

Iterations, keylen and digest can be configured by defining environment variables.

- PW_ITERATIONS
- PW_KEYLEN
- PW_DIGEST

See algorithms in [NodeJs crypto](https://nodejs.org/api/crypto.html#crypto_crypto_createhmac_algorithm_key_options) docs for possible values for digest. More info on the link below.

## Reference

[https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback](https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback)
npm package: @kdcloudjs/auto-inject-css-webpack-plugin
Description: Webpack plugin to inject CSS into head at runtime without extra HTML file
Latest version: 1.0.0

# auto-inject-css-webpack-plugin

Inject CSS into `&lt;head&gt;` at **runtime** without generating extra HTML files.

## Install

```bash
npm i -D auto-inject-css-webpack-plugin

## Usage
```js
// webpack.config.js
const AutoInjectCssWebpackPlugin = require('auto-inject-css-webpack-plugin');

module.exports = {
  plugins: [
    new AutoInjectCssWebpackPlugin({
      files: ['src/reset.css', 'src/theme.css'], // single file also ok
      tagId: 'app',
      insert: 'head' // or 'body'
    })
  ]
};
```

After building, the runtime will insert:
```html
<style data-id="app-0">/* reset.css */</style>
<style data-id="app-1">/* theme.css */</style>
```
If only one file, data-id="app" (no suffix).