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

segment-cdp-functions

v1.0.35

Published

This library is a framework which allows one to create Segment CDP function and manager their DevOps

Downloads

5

Readme

Segment CDP Functions (Beta)

Introduction

Welcome to the segment-cdp-functions NPM package. This tool is designed to bolster developers' capabilities, streamlining the creation, building, and deployment processes for Segment CDP Functions. With robust integration capabilities for Typescript, CI/CD patterns, and testing environments, our goal is to enhance the development lifecycle and ensure flawless compatibility with the Segment function environment.

Highlighted Features

  • Quick Setup: Instantly set up projects and pipelines for Segment CDP Functions.
  • Typescript Integration: Natively write and compile functions using Typescript.
  • RollupJS Bundling: Leverage rollupJS for efficient code bundling.
  • Segment Deployment Assistance: Hassle-free deployment of your bundled code to the Segment environment.
  • CI/CD & Testing: Easily integrate continuous integration and continuous delivery patterns, and test your functions seamlessly.

Precautions

  • Limited Functionality: Currently, only support for destination functions is available.
  • Library Limitations: To ensure function compatibility, please refrain from adding external libraries to your project. The Segment function environment might not recognize them, risking potential functional disruptions.
  • Accessible Methods: The code environment grants access to specific methods, including fetch(), atob(), and btoa().

Best Practices

  • Situate all your classes within the ./src directory.
  • For optimal functionality, incorporate and employ these classes within ./src/index.ts.

Workflow

Understanding the expectations of the Segment function environment is crucial. Typically, it anticipates a single NodeJS (NodeNext) compatible code. Traditional practices might not fit these parameters. That's where our package steps in:

  1. Setup: Embark on your journey by initializing a fresh project and integrating all essential dependencies.
  2. Development: Dive into a developer-centric environment with full-fledged Typescript support.
  3. Compilation: Rely on rollupJS combined with Typescript to curate a code bundle that's a perfect fit for the Segment environment.
  4. Deployment: Transfer the resulting bundle to the Segment environment, ensuring it integrates smoothly.

Quick Start Guide

Embark on your Segment CDP Functions journey with these simple steps:

  1. Launch your terminal.
  2. Install the package using npm i -g segment-cdp-functions.
  3. Create a project directory: mkdir <project-name>.
  4. Navigate to it: cd <project-name>.
  5. Initialize your project within the directory using: segment-cdp-functions init.
  6. Explore the available Segment API functions in ./src/index.ts.
  7. Check out the sample ./src/slack.ts which demonstrates sending Slack messages.
  8. Bundle your code using: npm run build. This produces a deployment-ready code bundle (./<build>/index.js) and a JSON file (./<build>/to_deploy.json).
  9. To deploy, acquire a segment token and save it in the .env file. Obtain this token from your Segment workspace by navigating: Settings > Workspace Settings > Access Management Tab > Tokens Tab > Create Token. Assign it a name and grant access as Workspace Member > Function Admin. Use this token in your .env as SEGMENT_TOKEN=<Token>.
  10. Deploy your function with: npm run deploy.

We wish you an effortless development journey with the segment-cdp-functions package. Should you have any questions or feedback, please reach out.