0.1.59 • Published 2 years ago

simplify-sdk v0.1.59

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

Simplify Framework - JavaScript SDK

NPM Downloads Package Version

This is a JavaScript SDK that help DevOps easier by integrating deployment process inline to your code. You will never want to be locked into any vendor for a tool. In FaaS architecture, a function can be very small but a project needs some (3-100) functions to orchestrate a workload. One CI/CD tool for all of them is quite vague to deploy your project when you just need to update one line of a function.

By using this SDK, you can breakdown your CI/CD tool as a function. Once again, FaaS concept now being applied for DevOps process. When you are micro focused into a function, a micro CI/CD function is beside of you. You're always feel safe and be efficiency. Simplify CodeGen generates a first code for you. It works well enough until you need to customize for your best fit. Happy OpenSource ₩

To start, choose one of two serverless models: OpenAPI or GraphQL

Simplify - JavaScript SDK

npm install simplify-sdk

Deploy for AWS Lambda Configuration: config.json

{
    "Profile": "${DEPLOYMENT_PROFILE}",
    "Region": "${DEPLOYMENT_REGION}",
    "Bucket": {
        "Name": "${DEPLOYMENT_BUCKET}",
        "Key": "builds/${DATE_TODAY}"
    },
    "Function": {
        "FunctionName": "${FUNCTION_NAME}",
        "Handler": "index.handler",
        "MemorySize": 256,
        "Publish": true,
        "Role": "${FUNCTION_ROLE}",
        "Runtime": "nodejs12.x",
        "Tags": {
            "Group": "Simplify"
        },
        "Timeout": 15,
        "TracingConfig": {
            "Mode": "PassThrough"
        },
        "Environment": {
            "Variables": {
                "ENV": "development"
            }
        }
    }
}

Deoloy AWS Lambda Function example: main.js

'use strict';
const path = require('path')
const fs = require('fs')
const simplify = require('simplify-sdk')
const provider = require('simplify-sdk/provider')

const YOUR_DEPLOYMENT_REGION = "eu-west-1"
const YOUR_DEPLOYMENT_BUCKET = "your-deployment-bucket-2873821"
const YOUR_FUNCTION_NAME = "YourLambdaFunction-1WDRZ5J5OUN5H"
const YOUR_FUNCTION_ROLE = "arn:aws:iam::01234567890:role/YourLambdaExecutionRole"
var YOUR_FUNCTION_SHA256 = "LOAD_FROM_OUTPUT_FILE__data.YOUR_FUNCTION_SHA256"

var config = simplify.getInputConfig(path.join(__dirname, 'config.json'), {
    DEPLOYMENT_BUCKET: YOUR_DEPLOYMENT_BUCKET,
    DEPLOYMENT_REGION: YOUR_DEPLOYMENT_REGION,
    FUNCTION_NAME: YOUR_FUNCTION_NAME,
    FUNCTION_ROLE: YOUR_FUNCTION_ROLE
})

provider.setConfig(config).then(sessionCreds => {
    simplify.uploadDirectoryAsZip({
        adaptor: provider.getStorage(), ...{
            bucketKey: config.Bucket.Key,
            inputDirectory: 'src',
            outputFilePath: 'dist',
            hashInfo: { FileSha256: YOUR_FUNCTION_SHA256 }
        }
    }).then(uploadInfor => {
        simplify.createOrUpdateFunction({
            adaptor: provider.getFunction(),
            ...{
                functionConfig: config.Function,
                bucketName: config.Bucket.Name,
                bucketKey: uploadInfor.Key
            }
        }).then(function (data) {
            // Handle data response: save output to file...
            data.YOUR_FUNCTION_SHA256 = uploadInfor.FileSha256
            console.log(`Update-Function: ${data}`)
        }, function(err) {
            console.error(`Update-ERROR: ${err}`);
        })
    }).catch(err => {
        console.error(`UploadZip-ERROR: ${err}`);
    })
})
0.1.56

2 years ago

0.1.58

2 years ago

0.1.59

2 years ago

0.1.55

3 years ago

0.1.54

3 years ago

0.1.52

3 years ago

0.1.53

3 years ago

0.1.50

3 years ago

0.1.51

3 years ago

0.1.49

4 years ago

0.1.48

4 years ago

0.1.47

4 years ago

0.1.45

4 years ago

0.1.46

4 years ago

0.1.43

4 years ago

0.1.44

4 years ago

0.1.42

4 years ago

0.1.41

4 years ago

0.1.40

4 years ago

0.1.38

4 years ago

0.1.39

4 years ago

0.1.37

4 years ago

0.1.35

4 years ago

0.1.36

4 years ago

0.1.34

4 years ago

0.1.33

4 years ago

0.1.32

4 years ago

0.1.30

4 years ago

0.1.31

4 years ago

0.1.29

4 years ago

0.1.27

4 years ago

0.1.28

4 years ago

0.1.26

4 years ago

0.1.25

4 years ago

0.1.24

4 years ago

0.1.22

4 years ago

0.1.23

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago