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

prepend-header

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prepend-header

Use a JS module to define a header to prepend to one or more files.

  • 1.0.10
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Prepend text to a file / group of files

Example(s):

  • prepend-header src-web/foo.js 'header.config.js' (single file)
  • prepend-header src-web/**/*.js 'header.config.js' (all files matching glob).

Successful Output should look like:

[FILES from src-web/**/*]
Prepended to src-web/after1.js
Prepended to src-web/foo/after2.js
Prepended to src-web/foo/after3.js

Local Project:

  • npm i prepend-header --save-dev
  1. create a header.config.js in your root that looks something like:
const year = new Date().getFullYear();
const text = `/*******************************************************************************
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation ${year}. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
 * Use, duplication or disclosure restricted by GSA ADP Schedule
 * Contract with IBM Corp.
 *******************************************************************************/
`;

const match = 'Reserved'; // avoid double-prepends. if this word exists in a file, that file gets skipped.
module.exports = {
  text,
  match,
};
  1. In package.json do:
"scripts" {
  "prepend-header": "prepend-header src/**/*.js header.config.js",
}
  1. npm run prepend-header

Run once with NPX

  1. create a header.config.js in your current working directory see above for format)
  2. npx prepend-header src/**/*.js header.config.js

Releasing

  • npm version patch
  • npm publish
  • git push --tags
  • create GH release (pptional)

FAQs

Package last updated on 25 Jul 2020

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