Adds instructions to the readme for setting up node/yarn in a project.
This commit is contained in:
87
README.md
87
README.md
@@ -0,0 +1,87 @@
|
||||
# Project Template
|
||||
|
||||
This repository is a starter template.
|
||||
Replace this README with documentation specific to your project once you begin development.
|
||||
|
||||
The notes below apply only if you choose to build a Node.js project using this template.
|
||||
|
||||
---
|
||||
|
||||
## If your project will use Node.js
|
||||
|
||||
Use Node 22 or newer for development.
|
||||
|
||||
Check your version:
|
||||
|
||||
```
|
||||
node --version
|
||||
```
|
||||
|
||||
If your version is older than 22, update using nvm:
|
||||
|
||||
```
|
||||
nvm install --lts
|
||||
```
|
||||
|
||||
(Optional) Make the new version your default:
|
||||
|
||||
```
|
||||
nvm alias default <version>
|
||||
```
|
||||
|
||||
After running `yarn init`, you may add a minimum Node version requirement to your `package.json`:
|
||||
|
||||
```json
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
```
|
||||
|
||||
This helps ensure you do not accidentally use an outdated Node version.
|
||||
|
||||
---
|
||||
|
||||
## If your project will use Yarn (Berry)
|
||||
|
||||
This template assumes modern Yarn (Yarn 4+), managed by Corepack.
|
||||
|
||||
Enable Corepack:
|
||||
|
||||
```
|
||||
corepack enable
|
||||
```
|
||||
|
||||
Update Yarn to the latest stable version:
|
||||
|
||||
```
|
||||
corepack prepare yarn@stable --activate
|
||||
```
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
If you want Yarn to error (instead of warn) when the Node version does not satisfy the `engines` field, add this to `.yarnrc.yml`:
|
||||
|
||||
```yaml
|
||||
enableStrictEngineChecks: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## If your project will use containers
|
||||
|
||||
If you plan to build or deploy using Docker, choose a base image that matches your development environment.
|
||||
For Node.js projects, a common choice is:
|
||||
|
||||
```
|
||||
FROM node:24
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Replace this README
|
||||
|
||||
Once you know what your project will be (Node, C++, Python, etc.), replace this file with documentation specific to your build, run, and deployment steps.
|
||||
|
||||
Reference in New Issue
Block a user