Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ An Absolute Beginner's Guide to package.json


๐Ÿ“š An Absolute Beginner's Guide to package.json


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

As a general rule, any project that's using Node.js will need to have a package.json file. What is a package.json file?

At its simplest, a package.json file can be described as a manifest of your project that includes the packages and applications it depends on, information about its unique source control, and specific metadata like the project's name, description, and author.

Let's break down the core parts of a typical package.json file:

Specific Metadata: name, version, description, license, and keywords

Inside a package.json, you'll almost always find metadata specific to the project - no matter if it's a web application, Node.js module, or even just a plain JavaScirpt library. This metadata helps identify the project and acts as a baseline for users and contributors to get information about the project.

Here's an example of how these fields would look in a package.jsonfile:

{
  "name": "metaverse", // The name of your project
  "version": "0.92.12", // The version of your project
  "description": "The Metaverse virtual reality. The final outcome of all virtual worlds, augmented reality, and the Internet.", // The description of your project
  "main": "index.js"
  "license": "MIT" // The license of your project
}

A package.json file is always structured in the JSON format, which allows it to be easily read as metadata and parsed by machines.

If needing to format a package.json file manually to get your project up and running seems a bit daunting, there's a handy command that will automatically generate a base package.json file for you - if you'd like to learn how to use it, take a peek at the npm init instructions below!

Understanding and Managing Your Project's Dependencies: dependencies and devDepenendcies in your `package.json`

The other majorly important aspect of a package.json is that it contains a collection of any given project's dependencies. These dependencies are the modules that the project relies on to function properly.

Having dependencies in your project's package.json allows the project to install the versions of the modules it depends on. By running an install command (see the instructions fornpm install below) inside of a project, you can install all of the dependencies that are listed in the project's package.json - meaning they don't have to be (and almost never should be) bundled with the project itself.

Second, it allows the separation of dependencies that are needed for production and dependencies that are needed for development. In production, you're likely not going to need a tool to watch your CSS files for changes and refresh the app when they change. But in both production and development, you'll want to have the modules that enable what you're trying to accomplish with your project - things like your web framework, API tools, and code utilities.

What would a project'spackage.json look like with dependencies and devDependencies? Let's expand on the previous example of a package.json to include some.

`
{
"name": "metaverse",
"version": "0.92.12",
"description": "The Metaverse virtual reality. The final outcome of all virtual worlds, augmented reality, and the Internet.",
"main": "index.js"
"license": "MIT",
"devDependencies": {
"mocha": "~3.1",
"native-hello-world": "^1.0.0",
"should": "~3.3",
"sinon": "~1.9"
},
"dependencies": {
"fill-keys": "^1.0.2",
"module-not-found-error": "^1.0.0",
"resolve": "~1.1.7"
}
}
`

One key difference between the dependencies and the other common parts of a package.json is that they're both objects, with multiple key/value pairs. Every key in both dependencies and devDependencies is a name of a package, and every value is the version range that's acceptable to install.

...



๐Ÿ“Œ An Absolute Beginner's Guide to package.json


๐Ÿ“ˆ 50.15 Punkte

๐Ÿ“Œ Understanding JSON: A Beginner's Guide


๐Ÿ“ˆ 27.14 Punkte

๐Ÿ“Œ Beginner Guide on JSON


๐Ÿ“ˆ 27.14 Punkte

๐Ÿ“Œ JSON Essentials: A Beginner's guide


๐Ÿ“ˆ 27.14 Punkte

๐Ÿ“Œ Docker for the Absolute Beginner


๐Ÿ“ˆ 24.31 Punkte

๐Ÿ“Œ Elementary OS: Questions from absolute beginner


๐Ÿ“ˆ 24.31 Punkte

๐Ÿ“Œ Github as an absolute beginner


๐Ÿ“ˆ 24.31 Punkte

๐Ÿ“Œ Absolute beginner


๐Ÿ“ˆ 24.31 Punkte

๐Ÿ“Œ O11y Guide: Beginner's Guide To Open Source Instrumenting Java


๐Ÿ“ˆ 22.05 Punkte

๐Ÿ“Œ A Beginner's Guide to Radix Sort: Step-by-Step Guide and Python Code


๐Ÿ“ˆ 22.05 Punkte

๐Ÿ“Œ Parity Ethereum Client 1.7.8 JSON-RPC Endpoint JSON Object CORS privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC API JSON Request denial of service


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC miner_stop API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC miner_start API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC miner_setGasPrice API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC miner_setEtherbase API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC admin_peers API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC admin_nodeInfo API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC admin_addPeer API JSON Request privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Nov json-jwt up to 1.9.3 Signature Validation JSON Web Token weak authentication


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ JSON++ up to 2016-06-15 json.y yyparse() memory corruption


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC admin_addPeer API JSON Request erweiterte Rechte


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ webargs up to 5.1.2 JSON Parser JSON Payload race condition privilege escalation


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Silver Peak EdgeConnect SD-WAN up to 8.1.6.x REST API rest/json/banners JSON Data Trace information disclosure


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ json-c up to 0.14 JSON File printbuf_memappend out-of-bounds write


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ wp-courses Plugin up to 2.0.27 on WordPress JSON REST API /wp-json authorization


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Medium CVE-2016-20005: Rest\/json project Rest\/json


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Aleth Ethereum C++ Client up to 1.8.0 JSON File config.json stack-based overflow


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ cpp-ethereum JSON-RPC admin_nodeInfo API JSON Request erweiterte Rechte


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ OWASP json-sanitizer up to 1.2.1 JSON denial of service


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ netplex json-smart-v1/json-smart-v2 unusual condition [CVE-2021-27568]


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Comments Inside JSON โ€“ Commenting in a JSON File


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ Episode-009 - Importing JSON to a MySQL table with JSON column


๐Ÿ“ˆ 21.76 Punkte

๐Ÿ“Œ JSON to PDF Magic: Harnessing LaTeX and JSON for Effortless Customization and Dynamic PDF Generation


๐Ÿ“ˆ 21.76 Punkte











matomo