Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-header

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-header

A Esbuild plugin to add a header to file(s) after build

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

esbuild-header esbuild-header

This plugin lets you add a header comment to the top of your build with Esbuild

Installation

$ npm install --save-dev esbuild-header

Getting Started

main.js

const date = new Date();
const currentTime = `${date.getHours()}:${date.getMintues()}:${date.getSeconds()}`;

console.log(currentTimes);

build.js

const headerPlugin = require('esbuild-header');

require('esbuild').build({
  entryPoints: ['main.js'],
  bundle: true,
  outfile: 'out.js',
  plugins: [headerPlugin()],
});

out.js

/*!
 * esbuild-header
 * A Esbuild plugin to add a header to file(s) after build
 * @author Johnie Hjelm <johnie@hjelm.im>
 * @version 1.0.0
 * Copyright 2022 MIT licensed.
 */
const date = new Date();
const currentTime = `${date.getHours()}:${date.getMintues()}:${date.getSeconds()}`;

console.log(currentTimes);

Configuration

An object containing configuration options may be passed into the plugin constructor headerPlugin

headerPlugin({
  template: '// This is my header',
  cwd: '/Users/foo/path/to/package.json',
});

The following options are available:

  • options.template, string: if specified, you can use your own header template with the use of Pupa to use data from package.json.
  • options.cwd, string: the path to a specified package.json to parse data for header. Default is closest found package.json

Keywords

FAQs

Package last updated on 05 Jul 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc