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

@fulminate/deploy

v1.2.0

Published

Easy to use CD tool written in Node.js and TypeScript

Downloads

11

Readme

Fulminate Deploy

@fulminate/deploy is an easy to use package that allows your server to listen to hooks incoming from your VCS and execute automated code update for your projects.

REMEMBER You need to set up SSH keys yourself for your server if you use private repositories.

Installation

mkdir deploy

cd deploy

npm init -y

npm i --save @fulminate/deploy

Usage

// ./index.ts
import { deploy, server } from '@fulminate/deploy';

deploy;
console.log(`Server running on port ${server.appOptions.port}`);

When you run this script, you will get an Express application running.

Setting Up

Create a .fulminate directory in the root of your project and inside of it, provide the deployment options in an app.yml file:

# ./.fulminate/app.yml

# Fulminate Framework specific options
# @see https://fulminate-js.github.io/
bcrypt:
  enabled: false
slackOptions:
  enabled: false
  channel: 'general'
  apiKey: 'key'
domain: 'example.com'
port: 3000
viewOptions:
  enabled: false

# Deployment options
deployOptions:
  # If you disable deployment, server will throw AccessDeniedError on attending the hook route
  enabled: true

  # Route that will wait for VCS hook
  # You need to provide your domain plus this route as your VCS hook URL
  route: /deploy/api/v1/hook

  # Projects living on your current server
  projects:
    # Project name. This value is used to provide deployment options correctly
    # You need to provide this exact value at the end of your VCS hook URL
    # @example https://fulminate.js/deploy/api/v1/hook/main
    main:
      # Git branch to checkout
      branch: master

      # Git repository
      repository: [email protected]:fulminate-js/bootstrap.git

      # Path to the project that needs to be redeployed
      projectDir: ~/Documents/testing

      # The name of the folder that contains the build. Defaults to `./` meaning the project itself
      # will be copied to the projectDir folder. It is defined relatively to the cloned project.
      buildFolderName: build

      # List of scripts to be executed before copying cloned files to your project directory
      # NOTE: these scripts are executed inside the temporary directory, i.e. the cloned project
      beforeCopyScripts:
        - npm i
        - npm run build
      # You can put a list of files to be copied to your project directory
      filesToCopy:
          # Location of the file that needs to be copied
        - location: ./app.yml
          # Path where the file should be put
          # $PROJECT_DIR will be replaced with `projectDir` given above
          savingPath: $PROJECT_DIR/.fulminate/
      # List of scripts to be executed after copying the files to the project directory
      # NOTE: these scripts are executed inside the project folder
      scripts:
        - npm i --only=production
        - pm2 reload main

Adding files to copy

In the root folder of the deployer, let's create the file listed in the filesToCopy property of our app.yml.

# ./app.yml

port: 3001

Integration

Open settings of your project, create a hook to the route from the ./.fulminate/app.yml and set it to be executed on pipeline. Fulminate Deploy will only work on successful build (will be an option in a later release).

Example hook URL: https://test.com/deploy/api/v1/hook/main

Workflow

  • You push code to VCS
  • Pipeline is executed and sends a hook to Fulminate Deploy
  • If the pipeline was successful:
  1. FD creates a backup copy of the current state of your project
  2. FD clones the repository to a temporary directory
  3. FD executes all the beforeCopyScripts
  4. FD copies the contents of the temporary directory to your project directory
  5. FD executes all the scripts
  6. FD writes a log to ./history.json file