🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@jackdbd/hosting-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jackdbd/hosting-utils

Utilities for working with the configuration files of various hosting providers.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@jackdbd/hosting-utils

Utilities for working with the configuration files of various hosting providers.

  • Installation
  • Usage
  • Configuration
  • Troubleshooting
  • Dependencies
  • License

Installation

npm install @jackdbd/hosting-utils

Note: this library was tested on Node.js >=18. It might work on other Node.js versions though.

Usage

Let's say that you are hosting your Eleventy site on Vercel and that you want to programmatically add a Content-Security-Policy header to a bunch of routes. You could do something like this:

import { updateVercelJSON } from '@jackdbd/hosting-utils'

await updateVercelJSON({
  headerKey: 'Content-Security-Policy',
  headerValue: "default-src 'self'; img-src 'self' cdn.example.com;",
  filepath: '_site/vercel.json',
  sources: ['/(404|index).html', '/posts/**/*.html']
})

Configuration

Read these resources to understand how to configure _headers, serve.json, vercel.json.

Troubleshooting

This plugin uses the debug library for logging. You can control what's logged using the DEBUG environment variable.

For example, if you set your environment variables in a .envrc file, you can do:

# print all logging statements
export DEBUG=hosting-utils:*

Dependencies

PackageVersion
netlify-headers-parser^7.1.4
proper-lockfile^4.1.2

⚠️ Peer Dependencies

This package defines 1 peer dependency.

PeerVersion range
debug>=4.0.0

License

© 2022 - 2024 Giacomo Debidda // MIT License

Keywords

cloudflare-pages

FAQs

Package last updated on 29 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts