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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vite-plugin-upload-to-hubspot

v0.0.5

Published

A Vite plugin to upload files to HubSpot

Readme

Vite Plugin: Upload to HubSpot

This Vite plugin uploads files from a specified source directory to a HubSpot account after the build process is complete. It uses the HubSpot Local Development Library to handle the file uploads.

Installation

To install the plugin using Bun, run the following command:

bun add vite-plugin-upload-to-hubspot

Usage

To use the plugin, import it and add it to your Vite configuration file.

Example Configuration

import { defineConfig } from "vite";
import { resolve } from "node:path";
import uploadToHubSpot from "vite-plugin-upload-to-hubspot";

export default defineConfig({
  build: {
    outDir: "dist",
    rollupOptions: {
      input: {
        main: resolve(__dirname, "src/js/main.ts"),
      },
      output: {
        format: "es",
        assetFileNames: ({ name }) =>
          name?.includes(".css")
            ? "build/css/[name][extname]"
            : "build/js/[name]-[hash][extname]",
        entryFileNames: ({ name }) =>
          name?.includes("module") ? "[name].js" : "build/js/[name].js",
        chunkFileNames: "build/js/[name]-[hash].js",
      },
    },
    minify: "esbuild",
    target: "es2020",
  },
  plugins: [
    uploadToHubSpot({
      src: "dist",
      dest: "ThemeName",
      account: "develop",
      assets: {
        src: "assets",
        dest: "ThemeName/assets",
      },
    }),
  ],
  resolve: {
    extensions: [".js", ".ts"],
  },
});

Options

  • src: The source directory containing the files to upload.
  • dest: The destination directory on the HubSpot account.
  • account: The HubSpot account to upload the files to. This should match an account in your hubspot.config.yml file.
  • assets: (Optional) An object specifying additional assets to upload. It contains:
    • src: The source directory for the assets.
    • dest: The destination directory for the assets on the HubSpot account.

Features

  • Recursive Directory Processing: The plugin scans the src directory recursively to find all files to upload, typically a build directory.
  • File Type Handling: The plugin skips unsupported file types and logs a message for skipped files.
  • FieldsJS Processing: Automatically detects and processes convertible FieldsJS files before uploading.
  • File Manager Support: Allows uploading specific files to the HubSpot File Manager if the assets option is configured.
  • Error Handling: Logs detailed error messages for failed uploads, including reasons for failure.
  • Success Logging: Logs success messages for each file uploaded successfully.