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

@netlify/build

Package Overview
Dependencies
Maintainers
13
Versions
1244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/build

Netlify build module

  • 0.0.24
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126K
decreased by-6.13%
Maintainers
13
Weekly downloads
 
Created

What is @netlify/build?

@netlify/build is a Node.js library that allows you to programmatically run Netlify Build plugins. It provides a way to automate and customize the build process for Netlify sites, enabling you to extend and modify the default behavior of Netlify's build system.

What are @netlify/build's main functionalities?

Running Build Plugins

This feature allows you to run Netlify Build plugins programmatically. The code sample demonstrates how to configure and run a build with a specific plugin and environment settings.

const { build } = require('@netlify/build');

(async () => {
  const result = await build({
    config: {
      build: {
        publish: 'dist',
        environment: {
          NODE_ENV: 'production'
        }
      },
      plugins: [
        {
          package: '@netlify/plugin-example',
          inputs: {
            exampleInput: 'value'
          }
        }
      ]
    }
  });
  console.log(result);
})();

Custom Build Configuration

This feature allows you to customize the build configuration, such as specifying the publish directory and build command. The code sample shows how to set a custom build command and publish directory.

const { build } = require('@netlify/build');

(async () => {
  const result = await build({
    config: {
      build: {
        publish: 'public',
        command: 'npm run build'
      }
    }
  });
  console.log(result);
})();

Handling Build Events

This feature allows you to handle build events such as success and error. The code sample demonstrates how to log messages based on the build outcome.

const { build } = require('@netlify/build');

(async () => {
  const result = await build({
    config: {
      build: {
        publish: 'dist'
      }
    },
    events: {
      onSuccess: () => {
        console.log('Build succeeded!');
      },
      onError: (error) => {
        console.error('Build failed:', error);
      }
    }
  });
})();

Other packages similar to @netlify/build

FAQs

Package last updated on 22 Oct 2019

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