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

@pnpm/write-project-manifest

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/write-project-manifest

Write a project manifest (called package.json in most cases)

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
426K
decreased by-19.16%
Maintainers
2
Weekly downloads
 
Created

What is @pnpm/write-project-manifest?

@pnpm/write-project-manifest is an npm package that allows you to programmatically write and update the package.json file of a project. This can be useful for automating project setup, dependency management, and other tasks that involve modifying the package.json file.

What are @pnpm/write-project-manifest's main functionalities?

Write a new package.json

This feature allows you to create a new package.json file with the specified content. The code sample demonstrates how to define a new package.json and write it to the current directory.

const { writeProjectManifest } = require('@pnpm/write-project-manifest');

const manifest = {
  name: 'my-new-project',
  version: '1.0.0',
  description: 'A new project',
  main: 'index.js',
  scripts: {
    start: 'node index.js'
  },
  dependencies: {}
};

writeProjectManifest('.', manifest).then(() => {
  console.log('package.json has been written');
});

Update an existing package.json

This feature allows you to update an existing package.json file. The code sample demonstrates how to read the current package.json, modify its content, and write the updated content back to the file.

const { writeProjectManifest } = require('@pnpm/write-project-manifest');
const fs = require('fs');

const manifestPath = './package.json';
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));

manifest.version = '1.0.1';
manifest.scripts.test = 'jest';

writeProjectManifest('.', manifest).then(() => {
  console.log('package.json has been updated');
});

Other packages similar to @pnpm/write-project-manifest

Keywords

FAQs

Package last updated on 19 Mar 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